Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call.getObject() in the plugin for the "arguments" analytics, properties & shareText all return empty braces {} in both iOS & Android; from the javascript calls generateShortUrl(analytics, properties) & showShareSheet(analytics, properties, message) #191

Open
chiemekailo opened this issue Dec 13, 2024 · 0 comments
Labels
bug Something isn't working needs-triage

Comments

@chiemekailo
Copy link

chiemekailo commented Dec 13, 2024

Describe the bug

When you call generateShortUrl(analytics, properties) or showShareSheet(analytics, properties, message) from the javascript end, you get empty objects for the arguments in the native plugin calls.
Hence user Branch generated link does not include parameters such as custom_string necessary for the deeplink function.

Steps to reproduce

  1. analytics = {

      channel: "twitter",
      feature: "installs",
      campaign: "marked 4 share",
      stage: "new user",
      tags: ["tag_one", "tag_two"]
};
  1. properties = {

    $desktop_url: GlobalVarsService.$desktop_url,
    $android_url: GlobalVarsService.$android_url,
    $ios_url: GlobalVarsService.$ios_url,
    $ipad_url: GlobalVarsService.$ipad_url,
    $match_duration: GlobalVarsService.$match_duration,
    custom_string: querystring,
    custom_integer: Date.now(),
    custom_boolean: true,
  };
BranchDeepLinks
        .generateShortUrl(analytics, properties)
        .then((res: any) => {
          console.log("Branch: (Response) " + JSON.stringify(res.url));
        })
        .catch((err: any) => {
          console.log("Branch: (Error) " + JSON.stringify(err));
        });

Expected behavior

using swift to demonstrate a code line

let analytics = call.getObject("analytics") ?? [:]
print("share::analytics \(analytics as AnyObject)")

should print

share::analytics {
          channel: "twitter",
          feature: "installs",
          campaign: "marked 4 share",
          stage: "new user",
          tags: ["tag_one", "tag_two"]
        }

SDK Version

7.0.0

Make and Model

iPhone 7 & Android 13 emulator

OS

iPhone OS 15.8.2 & iPhone Simulator OS 17.2 & Android 13 Emulator

Additional Information/Context

using swift for example:

@objc func showShareSheet(_ call: CAPPluginCall) {
        let analytics = call.getObject("analytics") ?? [:]
        let properties = call.getObject("properties") ?? [:]
        let shareText = call.getString("shareText", "Share Link")
        let linkProperties = getLinkProperties(analytics: analytics, properties: properties)

        let params = NSMutableDictionary();
        params.addEntries(from: linkProperties.controlParams)

        let buo = BranchUniversalObject.init()
        DispatchQueue.main.async {
            buo.showShareSheet(with: linkProperties, andShareText: shareText, from: self.bridge?.viewController)
        }
        
        //AKM
        print("share::analytics \(analytics as AnyObject)")
        print("share::properties \(properties as AnyObject)")
        print("share::shareText \(shareText as AnyObject)")
        print("share::linkProperties \(linkProperties as AnyObject)")
        //AKM - ENd

        call.resolve()
    }

this prints to console

share::analytics {
}
share::properties {
}
share::shareText Share Link
share::linkProperties BranchLinkProperties | tags: (null) 
 feature: (null) 
 alias: (null) 
 channel: (null) 
 stage: (null) 
 campaign: (null) 
 matchDuration: 0 
 controlParams: {
}

whereas they all have values as shown in the Steps To Reproduce section.

@chiemekailo chiemekailo added bug Something isn't working needs-triage labels Dec 13, 2024
@chiemekailo chiemekailo changed the title call.getObject() in the plugin for "analytics", "properties" & "shareText" all return empty braces {} in both iOS & Android, from the javascript calls generateShortUrl(analytics, properties) & showShareSheet(analytics, properties, message) call.getObject() in the plugin for "analytics", "properties" & "shareText" all return empty braces {} in both iOS & Android; from the javascript calls generateShortUrl(analytics, properties) & showShareSheet(analytics, properties, message) Dec 13, 2024
@chiemekailo chiemekailo changed the title call.getObject() in the plugin for "analytics", "properties" & "shareText" all return empty braces {} in both iOS & Android; from the javascript calls generateShortUrl(analytics, properties) & showShareSheet(analytics, properties, message) call.getObject() in the plugin for "analytics", "properties" & "shareText" all return empty braces {} in both iOS & Android; from the javascript calls generateShortUrl(analytics, properties) & showShareSheet(analytics, properties, message) Dec 13, 2024
@chiemekailo chiemekailo changed the title call.getObject() in the plugin for "analytics", "properties" & "shareText" all return empty braces {} in both iOS & Android; from the javascript calls generateShortUrl(analytics, properties) & showShareSheet(analytics, properties, message) call.getObject() in the plugin for the arguments analytics, properties & shareText all return empty braces {} in both iOS & Android; from the javascript calls generateShortUrl(analytics, properties) & showShareSheet(analytics, properties, message) Dec 13, 2024
@chiemekailo chiemekailo changed the title call.getObject() in the plugin for the arguments analytics, properties & shareText all return empty braces {} in both iOS & Android; from the javascript calls generateShortUrl(analytics, properties) & showShareSheet(analytics, properties, message) call.getObject() in the plugin for the "arguments" analytics, properties & shareText all return empty braces {} in both iOS & Android; from the javascript calls generateShortUrl(analytics, properties) & showShareSheet(analytics, properties, message) Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

1 participant