public void CallbackWithBranchUniversalObject(BranchUniversalObject universalObject, BranchLinkProperties linkProperties, string error) { if (error != null) { Debug.LogError("Branch Error: " + error); } else { Debug.Log("Branch initialization completed: "); Debug.Log("Universal Object: " + universalObject.ToJsonString()); Debug.Log("Link Properties: " + linkProperties.ToJsonString()); BranchEvent e = new BranchEvent("MY_CUSTOM_EVENT"); // BranchEvent e = new BranchEvent (BranchEventType.COMPLETE_REGISTRATION); e.SetAffiliation("my_affilation"); e.SetCoupon("my_coupon"); e.SetCurrency(BranchCurrencyType.USD); e.SetTax(10.0f); e.SetRevenue(100.0f); e.SetShipping(1000.0f); e.SetDescription("my_description"); e.SetSearchQuery("my_search_query"); e.AddCustomData("custom_data_key01", "custom_data_value01"); e.AddContentItem(universalObject); Branch.sendEvent(e); } }
void ShareButton_Click(object sender, EventArgs e) { try { if (universalObject == null) { universalObject = new BranchUniversalObject(); universalObject.canonicalIdentifier = "id12345"; universalObject.title = "id12345 title"; universalObject.contentDescription = "My awesome piece of content!"; universalObject.imageUrl = "https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"; universalObject.metadata.Metadata.Add("foo", "bar"); } if (linkProperties == null) { linkProperties = new BranchLinkProperties(); linkProperties.tags.Add("tag1"); linkProperties.tags.Add("tag2"); linkProperties.feature = "invite"; linkProperties.channel = "Twitter"; linkProperties.stage = "2"; linkProperties.controlParams.Add("$desktop_url", "http://example.com"); } BranchAndroid.GetInstance().ShareLink(this, universalObject, linkProperties, "hello there with short url"); } catch (Exception exc) { LogMessage(exc.ToString()); } }
private void OnShareClicked(object sender, RoutedEventArgs e) { BranchUniversalObject branchUniversalObject = new BranchUniversalObject() .SetCanonicalIdentifier("item/12345") .SetCanonicalUrl("https://branch.io/deepviews") .SetContentIndexingMode(BranchUniversalObject.ContentIndexModes.PRIVATE) .SetLocalIndexMode(BranchUniversalObject.ContentIndexModes.PUBLIC) .SetTitle("My Content Title") .SetContentDescription("my_product_description1") .SetContentImageUrl("https://example.com/mycontent-12345.png") .SetContentImageUrl("https://test_img_url") .AddKeyWord("My_Keyword1") .AddKeyWord("My_Keyword2") .SetContentMetadata( new BranchContentMetadata().AddCustomMetadata("testkey", "testvalue") ); BranchLinkProperties linkProperties = new BranchLinkProperties() .AddTag("Tag1") .SetChannel("Sharing_Channel_name") .SetFeature("my_feature_name") .AddControlParameter("$android_deeplink_path", "custom/path/*") .AddControlParameter("$ios_url", "http://example.com/ios") .SetDuration(100); BranchShareSheetStyle style = new BranchShareSheetStyle("Test share title", "Test share message body"); style.SetDefaultUrl("https://branch.io/"); branchUniversalObject.ShowShareSheet(DataTransferManager.GetForCurrentView(), Dispatcher, linkProperties, style); }
public void OnBtn_CreateBranchLink() { try { universalObject = new BranchUniversalObject(); universalObject.canonicalIdentifier = "id12345"; universalObject.title = "id12345 title"; universalObject.contentDescription = "My awesome piece of content!"; universalObject.imageUrl = "https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"; universalObject.metadata.Add("foo", "bar"); linkProperties = new BranchLinkProperties(); linkProperties.tags.Add("tag1"); linkProperties.tags.Add("tag2"); linkProperties.feature = "sharing"; linkProperties.channel = "facebook"; linkProperties.controlParams.Add("$desktop_url", "http://example.com"); Branch.getShortURL(universalObject, linkProperties, (url, error) => { if (error != null) { Debug.LogError("Branch.getShortURL failed: " + error); } else { Debug.Log("Branch.getShortURL url: " + url); inputShortLink.text = url; } }); } catch (Exception e) { Debug.Log(e); } }
public async void InitSessionComplete(BranchUniversalObject buo, BranchLinkProperties blp) { // Gets the requested sample and design, then navigates to it. this.Log().Debug("Branch initialization completed."); var pageName = string.Empty; if (blp?.controlParams?.TryGetValue("$deeplink_path", out pageName) ?? false) { var sample = App.GetSamples().FirstOrDefault(s => s.ViewType.Name.ToLowerInvariant() == pageName.ToLowerInvariant()); if (sample != null) { if (blp.controlParams.TryGetValue("$design", out var designName) && Enum.TryParse <Design>(designName, out var design)) { SamplePageLayout.SetPreferredDesign(design); } await _isAppReadyTcs.Task; this.Log().Debug($"Navigating to {sample.ViewType.Name} from deeplink."); (Application.Current as App)?.ShellNavigateTo(sample); this.Log().Info($"Navigated to {sample.ViewType.Name} from deeplink."); } } }
/// <summary> /// Creates a branch.io link to the specified sample and design, then shares it. /// </summary> public async Task ShareSample(Sample sample, Design design) { var pageName = sample.ViewType.Name.ToLowerInvariant(); var buo = new BranchUniversalObject() { title = $"{design} {sample.Title}", canonicalIdentifier = Guid.NewGuid().ToString(), }; var blp = new BranchLinkProperties(); blp.feature = "sharing"; blp.controlParams["$deeplink_path"] = pageName; blp.controlParams["$design"] = design.ToString(); _uriTcs = new TaskCompletionSource <string>(); Branch.GetInstance().GetShortURL(this, buo, blp); var uri = await _uriTcs.Task; await Share.RequestAsync(new ShareTextRequest { Title = "Share Link", Text = "Check out this Uno Gallery page!", Uri = uri, }); _uriTcs = null; }
public static IOSNativeBranch.BranchUniversalObject ToNativeUniversalObject(BranchUniversalObject obj) { var res = new IOSNativeBranch.BranchUniversalObject(); if (obj != null) { if (obj.metadata != null) { foreach (String key in obj.metadata.Keys) { res.AddMetadataKey(key, obj.metadata [key]); } } res.Keywords = ToNSObjectArray(obj.keywords); res.CanonicalIdentifier = obj.canonicalIdentifier != null ? obj.canonicalIdentifier : ""; res.Title = obj.title != null ? obj.title : ""; res.ContentDescription = obj.contentDescription != null ? obj.contentDescription : ""; res.ImageUrl = obj.imageUrl != null ? obj.imageUrl : ""; res.Type = obj.type != null ? obj.type : ""; res.ContentIndexMode = (IOSNativeBranch.ContentIndexMode)obj.contentIndexMode; if (obj.expirationDate.HasValue) { res.ExpirationDate = (NSDate)obj.expirationDate.Value; } } return(res); }
private void Awake() { BranchLinkProperties linkProperties = new BranchLinkProperties(); linkProperties.alias = "UnityAndroidAddTest" + System.DateTime.Now; linkProperties.tags.Add("VlaFlip" + System.DateTime.Now); linkProperties.controlParams.Add("PostMoment", System.DateTime.Now.ToString()); // Feature link is associated with. Eg. Sharing linkProperties.feature = "Boodschappen"; // The channel where you plan on sharing the link Eg.Facebook, Twitter, SMS etc linkProperties.channel = "Twitter"; linkProperties.stage = "1"; // Parameters used to control Link behavior linkProperties.controlParams.Add("$desktop_url", "http://roxelane.nl/portfolio-items/a2-racer/?portfolioCats=162"); var universalObject = new BranchUniversalObject(); Branch.getShortURL(universalObject, linkProperties, (p, error) => { if (error != null) { Debug.LogError("Branch.getShortURL failed: " + error); urlDump.text = "Branch.getShortURL failed: " + error; } else if (p != null) { Debug.Log("Branch.getShortURL shared params: " + p); urlDump.text = "Branch.getShortURL shared params: " + p; } }); }
void CreateLinkButton_Click(object sender, EventArgs e) { try { universalObject = new BranchUniversalObject(); universalObject.canonicalIdentifier = "id12345"; universalObject.title = "id12345 title"; universalObject.contentDescription = "My awesome piece of content!"; universalObject.imageUrl = "https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"; universalObject.metadata.Metadata.Add("foo", "bar"); linkProperties = new BranchLinkProperties(); linkProperties.tags.Add("tag1"); linkProperties.tags.Add("tag2"); linkProperties.feature = "sharing"; linkProperties.channel = "facebook"; linkProperties.controlParams.Add("$desktop_url", "http://example.com"); BranchAndroid.GetInstance().GetShortURL(this, universalObject, linkProperties); } catch (Exception exc) { LogMessage(exc.ToString()); } }
public override void ViewDidLoad() { base.ViewDidLoad(); NSNotificationCenter.DefaultCenter.AddObserver((NSString)Constants.Branch_notification, (obj) => { LogMessage("Branch initialization completed: "); BranchUniversalObject buo = null; BranchLinkProperties blp = null; if (obj.UserInfo[(NSString)"+is_first_session"].ToString().Equals("1")) { buo = Branch.GetInstance().GetFirstReferringBranchUniversalObject(); blp = Branch.GetInstance().GetFirstReferringBranchLinkProperties(); } else { buo = Branch.GetInstance().GetLastReferringBranchUniversalObject(); blp = Branch.GetInstance().GetLastReferringBranchLinkProperties(); } LogMessage("\n\nUniversalObject : \n" + buo.ToJsonString()); LogMessage("\n\nLinkProperties : \n" + blp.ToJsonString()); }); inputShortLink.ShouldReturn = delegate { inputShortLink.ResignFirstResponder(); return(true); }; }
public static IO.Branch.Indexing.BranchUniversalObject ToNativeBUO(BranchUniversalObject buo) { IO.Branch.Indexing.BranchUniversalObject resBuo = new IO.Branch.Indexing.BranchUniversalObject(); foreach (string keyword in buo.keywords) { resBuo.AddKeyWord(keyword); } foreach (string key in buo.metadata.Keys) { resBuo.AddContentMetadata(key, buo.metadata[key]); } resBuo.SetCanonicalIdentifier(buo.canonicalIdentifier); resBuo.SetCanonicalUrl(buo.canonicalUrl); resBuo.SetTitle(buo.title); resBuo.SetContentDescription(buo.contentDescription); resBuo.SetContentImageUrl(buo.imageUrl); resBuo.SetContentType(buo.type); if (buo.contentIndexMode == 0) { resBuo.SetContentIndexingMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Public); } else { resBuo.SetContentIndexingMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Private); } Java.Util.Date date = new Java.Util.Date(buo.expirationDate.HasValue ? (buo.expirationDate.Value.Ticks / 10000) : 0); resBuo.SetContentExpiration(date); return(resBuo); }
private void OnGetShortLinkClicked(object sender, RoutedEventArgs e) { BranchUniversalObject branchUniversalObject = new BranchUniversalObject() .SetCanonicalIdentifier("item/12345") .SetCanonicalUrl("https://branch.io/deepviews") .SetContentIndexingMode(BranchUniversalObject.ContentIndexModes.PRIVATE) .SetLocalIndexMode(BranchUniversalObject.ContentIndexModes.PUBLIC) .SetTitle("My Content Title") .SetContentDescription("my_product_description1") .SetContentImageUrl("https://example.com/mycontent-12345.png") .SetContentImageUrl("https://test_img_url") .AddKeyWord("My_Keyword1") .AddKeyWord("My_Keyword2") .SetContentMetadata( new BranchContentMetadata().AddCustomMetadata("testkey", "testvalue") ); BranchLinkProperties linkProperties = new BranchLinkProperties() .AddTag("Tag1") .SetChannel("Sharing_Channel_name") .SetFeature("my_feature_name") .AddControlParameter("$android_deeplink_path", "custom/path/*") .AddControlParameter("$ios_url", "http://example.com/ios") .SetDuration(100); Task.Run(async() => { string url = branchUniversalObject.GetShortURL(linkProperties); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => { List <string> lines = new List <string>(); lines.Add("Short url: " + url); AddLog(lines); }); }); }
public void OnBtn_CreateBranchLink() { try { universalObject = new BranchUniversalObject(); universalObject.canonicalIdentifier = "id12345"; universalObject.canonicalUrl = "https://branch.io"; universalObject.title = "id12345 title"; universalObject.contentDescription = "My awesome piece of content!"; universalObject.imageUrl = "https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"; universalObject.contentIndexMode = 0; universalObject.localIndexMode = 0; universalObject.expirationDate = new DateTime(2020, 12, 30); universalObject.keywords.Add("keyword01"); universalObject.keywords.Add("keyword02"); universalObject.metadata.contentSchema = BranchContentSchema.COMMERCE_BUSINESS; universalObject.metadata.quantity = 100f; universalObject.metadata.price = 1000f; universalObject.metadata.currencyType = BranchCurrencyType.USD; universalObject.metadata.sku = "my_sku"; universalObject.metadata.productName = "my_product_name"; universalObject.metadata.productBrand = "my_product_brand"; universalObject.metadata.productCategory = BranchProductCategory.BUSINESS_AND_INDUSTRIAL; universalObject.metadata.condition = BranchCondition.EXCELLENT; universalObject.metadata.productVariant = "my_product_variant"; universalObject.metadata.setAddress("my_street", "my_city", "my_region", "my_comuntry", "my_postal_code"); universalObject.metadata.setLocation(40.0f, 40.0f); universalObject.metadata.setRating(4.0f, 5.0f, 10); universalObject.metadata.AddImageCaption("https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"); universalObject.metadata.AddCustomMetadata("foo", "bar"); // register a view to add to the index Branch.registerView(universalObject); linkProperties = new BranchLinkProperties(); linkProperties.tags.Add("tag1"); linkProperties.tags.Add("tag2"); linkProperties.feature = "sharing"; linkProperties.channel = "facebook"; linkProperties.controlParams.Add("$desktop_url", "http://example.com"); Branch.getShortURL(universalObject, linkProperties, (url, error) => { if (error != null) { Debug.LogError("Branch.getShortURL failed: " + error); } else { Debug.Log("Branch.getShortURL url: " + url); inputShortLink.text = url; } }); } catch (Exception e) { Debug.Log(e); } }
public static void shareLink(BranchUniversalObject universalObject, BranchLinkProperties linkProperties, string message, BranchCallbackWithParams callback) { var callbackId = _getNextCallbackId(); _branchCallbacks[callbackId] = callback; _shareLinkWithLinkProperties(universalObject.ToJsonString(), linkProperties.ToJsonString(), message, callbackId); }
/** * Get a short url given a BranchUniversalObject, BranchLinkProperties */ public static void getShortURL(BranchUniversalObject universalObject, BranchLinkProperties linkProperties, BranchCallbackWithUrl callback) { var callbackId = _getNextCallbackId(); _branchCallbacks[callbackId] = callback; _getShortURLWithBranchUniversalObjectAndCallback(universalObject.ToJsonString(), linkProperties.ToJsonString(), callbackId); }
void CallbackWithBranchUniversalObject(BranchUniversalObject universalObject, BranchLinkProperties linkProperties, string error) { if (error != null) { } else if (linkProperties.controlParams.Count > 0) { } }
void GetUrlClicked(object sender, EventArgs e) { universalObject = new BranchUniversalObject(); universalObject.canonicalIdentifier = "id12345"; universalObject.canonicalUrl = "https://branch.io"; universalObject.title = "id12345 title"; universalObject.contentDescription = "My awesome piece of content!"; universalObject.imageUrl = "https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"; universalObject.keywords = new List <string>(); universalObject.keywords.Add("key01"); universalObject.keywords.Add("key02"); universalObject.keywords.Add("key03"); // register a view to add to the index Branch.GetInstance().RegisterView(universalObject); var paramStr = ParamsEntry.Text; if (!String.IsNullOrWhiteSpace(paramStr)) { String[] strs = paramStr.Split(','); int count = 1; foreach (String str in strs) { String key = "param" + count; universalObject.metadata.Add(key, str.Trim()); count++; } } linkProperties = new BranchLinkProperties(); linkProperties.feature = feature; linkProperties.channel = ChannelEntry.Text; linkProperties.stage = StageEntry.Text; linkProperties.controlParams.Add("$desktop_url", "http://example.com"); linkProperties.tags = new List <string>(); linkProperties.tags.Add("tag01"); linkProperties.tags.Add("tag02"); linkProperties.tags.Add("tag03"); var tags = TagsEntry.Text; if (!String.IsNullOrWhiteSpace(tags)) { String[] tagStrs = tags.Split(','); foreach (String tag in tagStrs) { linkProperties.tags.Add(tag.Trim()); } } Branch.GetInstance().GetShortURL(this, universalObject, linkProperties); }
void CallbackWithBranchUniversalObject(BranchUniversalObject buo, BranchLinkProperties linkProps, string error) { if (error != null) { System.Console.WriteLine("Error : " + error); } else if (linkProps.controlParams.Count > 0) { System.Console.WriteLine("Deeplink params : " + buo.ToJsonString() + linkProps.ToJsonString()); } }
public void InitSessionComplete(BranchUniversalObject buo, BranchLinkProperties blp) { StatusLabel.Text = "InitBUOSessionComplete"; var first = buo.ToDictionary(); FirstLabel.Text = (first != null) ? buo.ToJsonString() : ""; var latest = blp.ToDictionary(); LatestLabel.Text = (latest != null) ? blp.ToJsonString() : ""; }
public void InitSessionComplete(BranchUniversalObject buo, BranchLinkProperties blp) { bool res = false; if (buo.metadata.GetCustomMetadata().ContainsKey("+clicked_branch_link")) { res = Boolean.Parse(buo.metadata.GetCustomMetadata()["+clicked_branch_link"]); } var dict = Branch.GetInstance().GetLastReferringParams(); testPage.InitSessionComplete(buo, blp); }
public static IO.Branch.Indexing.BranchUniversalObject ToNativeBUO(BranchUniversalObject buo) { IO.Branch.Indexing.BranchUniversalObject resBuo = new IO.Branch.Indexing.BranchUniversalObject(); resBuo.SetCanonicalIdentifier(buo.canonicalIdentifier); resBuo.SetCanonicalUrl(buo.canonicalUrl); resBuo.SetTitle(buo.title); resBuo.SetContentDescription(buo.contentDescription); resBuo.SetContentImageUrl(buo.imageUrl); if (buo.contentIndexMode == 0) { resBuo.SetContentIndexingMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Public); } else { resBuo.SetContentIndexingMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Private); } if (buo.localIndexMode == 0) { resBuo.SetLocalIndexMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Public); } else { resBuo.SetLocalIndexMode(IO.Branch.Indexing.BranchUniversalObject.CONTENT_INDEX_MODE.Private); } Java.Util.Date date = new Java.Util.Date(buo.expirationDate.HasValue ? (buo.expirationDate.Value.Ticks / 10000) : 0); resBuo.SetContentExpiration(date); foreach (string keyword in buo.keywords) { resBuo.AddKeyWord(keyword); } JSONObject dict = new JSONObject(buo.metadata.ToJsonString()); if (dict != null) { IO.Branch.Referral.Util.ContentMetadata cmd = IO.Branch.Referral.Util.ContentMetadata.CreateFromJson(new IO.Branch.Referral.BranchUtil.JsonReader(dict)); if (cmd != null) { resBuo.SetContentMetadata(cmd); } } return(resBuo); }
public void CallbackWithBranchUniversalObject(BranchUniversalObject universalObject, BranchLinkProperties linkProperties, string error) { if (error != null) { Debug.LogError("Branch Error: " + error); } else { Debug.Log("Branch initialization completed: "); Debug.Log("Universal Object: " + universalObject.ToJsonString()); Debug.Log("Link Properties: " + linkProperties.ToJsonString()); } }
/** * Get the BranchUniversalObject from the last open. */ public static BranchUniversalObject getLatestReferringBranchUniversalObject() { string latestReferringParamsString = ""; #if (UNITY_IOS || UNITY_IPHONE) && !UNITY_EDITOR IntPtr ptrResult = _getLatestReferringBranchUniversalObject(); latestReferringParamsString = Marshal.PtrToStringAnsi(ptrResult); #else latestReferringParamsString = _getLatestReferringBranchUniversalObject(); #endif BranchUniversalObject resultObject = new BranchUniversalObject(latestReferringParamsString); return(resultObject); }
private void ShareBranch() { BranchUniversalObject universalObject = new BranchUniversalObject(); universalObject.contentIndexMode = 1; universalObject.canonicalIdentifier = Current.Id; universalObject.title = string.Format(ShareTitle, Current.Name); universalObject.contentDescription = string.Format(ShareDescription, Current.Name); universalObject.imageUrl = Current.BannerImageUrl?.OriginalString; universalObject.metadata.AddCustomMetadata(GameId, Current.Id); var branchLinkProperties = new BranchLinkProperties(); branchLinkProperties.controlParams.Add(GameId, Current.Id); Branch.getShortURL(universalObject, branchLinkProperties, BranchCallbackWithUrl); }
public void InitSessionComplete(BranchUniversalObject buo, BranchLinkProperties blp) { NSObject[] keys = { NSObject.FromObject("+is_first_session") }; NSObject[] values = { NSObject.FromObject(0) }; if (buo.metadata.ContainsKey("+is_first_session")) { values[0] = NSObject.FromObject(buo.metadata["+is_first_session"]); } NSDictionary nsData = NSDictionary.FromObjectsAndKeys(values, keys); NSNotificationCenter.DefaultCenter.PostNotificationName(Constants.Branch_notification, null, nsData); }
public void OnBtn_ShareLink() { try { if (universalObject == null) { universalObject = new BranchUniversalObject(); universalObject.canonicalIdentifier = "id12345"; universalObject.canonicalUrl = "https://branch.io"; universalObject.title = "id12345 title"; universalObject.contentDescription = "My awesome piece of content!"; universalObject.imageUrl = "https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"; universalObject.metadata.Add("foo", "bar"); // register a view to add to the index Branch.registerView(universalObject); } if (linkProperties == null) { linkProperties = new BranchLinkProperties(); linkProperties.tags.Add("tag1"); linkProperties.tags.Add("tag2"); linkProperties.feature = "invite"; linkProperties.channel = "Twitter"; linkProperties.stage = "2"; linkProperties.controlParams.Add("$desktop_url", "http://example.com"); } Branch.shareLink(universalObject, linkProperties, "hello there with short url", (parameters, error) => { if (error != null) { Debug.LogError("Branch.shareLink failed: " + error); } else if (parameters != null) { Debug.Log("Branch.shareLink: " + parameters["sharedLink"].ToString() + " " + parameters["sharedChannel"].ToString()); } }); } catch (Exception e) { Debug.Log(e); } }
public void InitSessionComplete(BranchUniversalObject buo, BranchLinkProperties blp) { }
public static void registerView(BranchUniversalObject universalObject) { _registerView(universalObject.ToJsonString()); }
void GetUrlClicked(object sender, EventArgs e) { universalObject = new BranchUniversalObject(); universalObject.canonicalIdentifier = "id12345"; universalObject.canonicalUrl = "https://branch.io"; universalObject.title = "id12345 title"; universalObject.contentDescription = "My awesome piece of content!"; universalObject.imageUrl = "https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"; universalObject.contentIndexMode = 0; universalObject.localIndexMode = 0; universalObject.expirationDate = new DateTime(2020, 12, 30); universalObject.keywords.Add("keyword01"); universalObject.keywords.Add("keyword02"); universalObject.metadata.contentSchema = BranchContentSchema.COMMERCE_BUSINESS; universalObject.metadata.quantity = 100f; universalObject.metadata.price = 1000f; universalObject.metadata.currencyType = BranchCurrencyType.USD; universalObject.metadata.sku = "my_sku"; universalObject.metadata.productName = "my_product_name"; universalObject.metadata.productBrand = "my_product_brand"; universalObject.metadata.productCategory = BranchProductCategory.BUSINESS_AND_INDUSTRIAL; universalObject.metadata.condition = BranchCondition.EXCELLENT; universalObject.metadata.productVariant = "my_product_variant"; universalObject.metadata.setAddress("my_street", "my_city", "my_region", "my_comuntry", "my_postal_code"); universalObject.metadata.setLocation(40.0f, 40.0f); universalObject.metadata.setRating(4.0f, 5.0f, 10); universalObject.metadata.AddImageCaption("https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"); universalObject.metadata.AddCustomMetadata("foo", "bar"); // register a view to add to the index Branch.GetInstance().RegisterView(universalObject); var paramStr = ParamsEntry.Text; if (!String.IsNullOrWhiteSpace(paramStr)) { String[] strs = paramStr.Split(','); int count = 1; foreach (String str in strs) { String key = "param" + count; universalObject.metadata.AddCustomMetadata(key, str.Trim()); count++; } } linkProperties = new BranchLinkProperties(); linkProperties.feature = feature; linkProperties.channel = ChannelEntry.Text; linkProperties.stage = StageEntry.Text; linkProperties.controlParams.Add("$desktop_url", "http://example.com"); linkProperties.tags = new List <string>(); linkProperties.tags.Add("tag01"); linkProperties.tags.Add("tag02"); linkProperties.tags.Add("tag03"); var tags = TagsEntry.Text; if (!String.IsNullOrWhiteSpace(tags)) { String[] tagStrs = tags.Split(','); foreach (String tag in tagStrs) { linkProperties.tags.Add(tag.Trim()); } } Branch.GetInstance().GetShortURL(this, universalObject, linkProperties); BranchEvent branchEvent = new BranchEvent("MY_CUSTOM_EVENT"); branchEvent.SetAffiliation("my_affilation"); branchEvent.SetCoupon("my_coupon"); branchEvent.SetCurrency(BranchCurrencyType.USD); branchEvent.SetTax(10.0f); branchEvent.SetRevenue(100.0f); branchEvent.SetShipping(1000.0f); branchEvent.SetDescription("my_description"); branchEvent.SetSearchQuery("my_search_query"); branchEvent.AddCustomData("custom_data_key01", "custom_data_value01"); branchEvent.AddContentItem(universalObject); Branch.GetInstance().SendEvent(branchEvent); }
public static void listOnSpotlight(BranchUniversalObject universalObject) { _listOnSpotlight(universalObject.ToJsonString()); }