示例#1
0
        public override void GetShortURL(IBranchUrlInterface callback,
                                         BranchUniversalObject universalObject,
                                         BranchLinkProperties linkProperties)
        {
            BranchUrlListener obj = new BranchUrlListener(callback);

            callbacksList.Add(obj as Object);

            IO.Branch.Indexing.BranchUniversalObject resBuo =
                IO.Branch.Indexing.BranchUniversalObject.CreateInstance(BranchAndroidUtils.ToJSONObject(universalObject.ToDictionary()));

            IO.Branch.Referral.Util.LinkProperties resBlp =
                new IO.Branch.Referral.Util.LinkProperties();

            foreach (string tag in linkProperties.tags)
            {
                resBlp.AddTag(tag);
            }

            foreach (string key in linkProperties.controlParams.Keys)
            {
                resBlp.AddControlParameter(key, linkProperties.controlParams[key]);
            }

            resBlp.SetAlias(linkProperties.alias);
            resBlp.SetChannel(linkProperties.channel);
            resBlp.SetDuration(linkProperties.matchDuration);
            resBlp.SetFeature(linkProperties.feature);
            resBlp.SetStage(linkProperties.stage);

            resBuo.GenerateShortUrl(appContext, resBlp, obj);
        }
示例#2
0
        public override void ShareLink(IBranchLinkShareInterface callback,
                                       BranchUniversalObject universalObject,
                                       BranchLinkProperties linkProperties,
                                       string message)
        {
            BranchLinkShareListener obj = new BranchLinkShareListener(callback);

            callbacksList.Add(obj as Object);

            IO.Branch.Indexing.BranchUniversalObject resBuo = BranchAndroidUtils.ToNativeBUO(universalObject);
            IO.Branch.Referral.Util.LinkProperties   resBlp = BranchAndroidUtils.ToNativeBLP(linkProperties);

            IO.Branch.Referral.Util.ShareSheetStyle style =
                new IO.Branch.Referral.Util.ShareSheetStyle(appContext, "", message);

            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.Facebook);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.Twitter);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.Message);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.Email);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.Flickr);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.GoogleDoc);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.WhatsApp);

            resBuo.ShowShareSheet(CurrActivity, resBlp, style, obj);
        }
示例#3
0
        public static Dictionary <string, object> ToDictionary(IO.Branch.Referral.Util.LinkProperties data)
        {
            if (data == null)
            {
                return(new Dictionary <string, object> ());
            }

            var controlParamsDict = new Dictionary <string, object>();

            if (data.ControlParams != null)
            {
                foreach (string key in data.ControlParams.Keys)
                {
                    controlParamsDict.Add(key, data.ControlParams[key]);
                }
            }

            var dict = new Dictionary <string, object>();

            dict.Add("~tags", data.Tags == null ? new List <string>() : data.Tags);
            dict.Add("~feature", data.Feature == null ? "" : data.Feature);
            dict.Add("~alias", data.Alias == null ? "" : data.Alias);
            dict.Add("~channel", data.Channel == null ? "" : data.Channel);
            dict.Add("~stage", data.Stage == null ? "" : data.Stage);
            dict.Add("~duration", data.MatchDuration.ToString());
            dict.Add("control_params", controlParamsDict);

            return(dict);
        }
示例#4
0
        public override void GetShortURL(IBranchUrlInterface callback,
                                         BranchUniversalObject universalObject,
                                         BranchLinkProperties linkProperties)
        {
            BranchUrlListener obj = new BranchUrlListener(callback);

            callbacksList.Add(obj as Object);

            IO.Branch.Indexing.BranchUniversalObject resBuo = BranchAndroidUtils.ToNativeBUO(universalObject);
            IO.Branch.Referral.Util.LinkProperties   resBlp = BranchAndroidUtils.ToNativeBLP(linkProperties);

            resBuo.GenerateShortUrl(appContext, resBlp, obj);
        }
示例#5
0
        public override void ShareLink(IBranchLinkShareInterface callback,
                                       BranchUniversalObject universalObject,
                                       BranchLinkProperties linkProperties,
                                       string message)
        {
            BranchLinkShareListener obj = new BranchLinkShareListener(callback);

            callbacksList.Add(obj as Object);

            IO.Branch.Indexing.BranchUniversalObject resBuo =
                IO.Branch.Indexing.BranchUniversalObject.CreateInstance(BranchAndroidUtils.ToJSONObject(universalObject.ToDictionary()));

            IO.Branch.Referral.Util.LinkProperties resBlp =
                new IO.Branch.Referral.Util.LinkProperties();

            foreach (string tag in linkProperties.tags)
            {
                resBlp.AddTag(tag);
            }

            foreach (string key in linkProperties.controlParams.Keys)
            {
                resBlp.AddControlParameter(key, linkProperties.controlParams[key]);
            }

            resBlp.SetAlias(linkProperties.alias);
            resBlp.SetChannel(linkProperties.channel);
            resBlp.SetDuration(linkProperties.matchDuration);
            resBlp.SetFeature(linkProperties.feature);
            resBlp.SetStage(linkProperties.stage);

            IO.Branch.Referral.Util.ShareSheetStyle style =
                new IO.Branch.Referral.Util.ShareSheetStyle(appContext, "", message);

            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.Facebook);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.Twitter);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.Message);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.Email);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.Flickr);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.GoogleDoc);
            style.AddPreferredSharingOption(IO.Branch.Referral.SharingHelper.SHARE_WITH.WhatsApp);

            resBuo.ShowShareSheet(CurrActivity, resBlp, style, obj);
        }
        public void OnInitFinished(IO.Branch.Indexing.BranchUniversalObject buo,
                                   IO.Branch.Referral.Util.LinkProperties blp,
                                   IO.Branch.Referral.BranchError error)
        {
            if (callback == null)
            {
                return;
            }

            if (error == null)
            {
                callback.InitSessionComplete(new BranchUniversalObject(BranchAndroidUtils.ToDictionary(buo)),
                                             new BranchLinkProperties(BranchAndroidUtils.ToDictionary(blp)));
            }
            else
            {
                BranchError err = new BranchError(error.Message, error.ErrorCode);
                callback.SessionRequestError(err);
            }
        }
示例#7
0
        public static IO.Branch.Referral.Util.LinkProperties ToNativeBLP(BranchLinkProperties blp)
        {
            IO.Branch.Referral.Util.LinkProperties resBlp = new IO.Branch.Referral.Util.LinkProperties();

            foreach (string tag in blp.tags)
            {
                resBlp.AddTag(tag);
            }

            foreach (string key in blp.controlParams.Keys)
            {
                resBlp.AddControlParameter(key, blp.controlParams[key]);
            }

            resBlp.SetAlias(blp.alias);
            resBlp.SetChannel(blp.channel);
            resBlp.SetDuration(blp.matchDuration);
            resBlp.SetFeature(blp.feature);
            resBlp.SetStage(blp.stage);

            return(resBlp);
        }