Пример #1
0
        public static NITFeedback GetNative(XCFeedbackNotification xfeed)
        {
            NITFeedback native = new NITFeedback();

            native.TrackingInfo = NITTrackingInfo.TrackingInfoFromRecipeId(xfeed.TrackingInfo.RecipeId,
                                                                           AdapterUtils.From(xfeed.TrackingInfo.extras));

            native.NotificationMessage = xfeed.NotificationMessage;
            native.Question            = xfeed.Question;
            native.ID = xfeed.Id;

            return(native);
        }
Пример #2
0
        public static XCFeedbackNotification GetCommonType(NITFeedback native)
        {
            XCFeedbackNotification xfeed = new XCFeedbackNotification();

            xfeed.TrackingInfo = new XCTrackingInfo();

            xfeed.NotificationMessage = native.NotificationMessage;
            xfeed.Question            = native.Question;
            // xfeed.RecipeId = native.RecipeId;
            xfeed.TrackingInfo.extras   = AdapterUtils.FromNS(native.TrackingInfo.ExtrasDictionary());
            xfeed.TrackingInfo.RecipeId = native.TrackingInfo.RecipeId;
            xfeed.Id = native.ID;

            return(xfeed);
        }
Пример #3
0
        public static XCHistoryItem GetCommonType(NITHistoryItem nativeItem)
        {
            XCHistoryItem item = new XCHistoryItem();

            item.read      = nativeItem.Read;
            item.timestamp = nativeItem.Timestamp;
            XCTrackingInfo trackingInfo = new XCTrackingInfo();

            trackingInfo.RecipeId = nativeItem.TrackingInfo.RecipeId;
            trackingInfo.extras   = AdapterUtils.FromNS(
                nativeItem.TrackingInfo.ExtrasDictionary() as NSDictionary <NSString, NSObject>
                );
            item.trackingInfo = trackingInfo;

            if (nativeItem.ReactionBundle is NITSimpleNotification simple)
            {
                item.reaction = AdapterSimple.GetCommonType(simple);
            }
            else if (nativeItem.ReactionBundle is NITContent content)
            {
                item.reaction = AdapterContent.GetCommonType(content);
            }
            else if (nativeItem.ReactionBundle is NITFeedback feedback)
            {
                item.reaction = AdapterFeedback.GetCommonType(feedback);
            }
            else if (nativeItem.ReactionBundle is NITCoupon coupon)
            {
                item.reaction = AdapterCoupon.GetCommonType(coupon);
            }
            else if (nativeItem.ReactionBundle is NITCustomJSON customJSON)
            {
                item.reaction = AdapterCustom.GetCommonType(customJSON);
            }

            return(item);
        }