Skip to content

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

@chiemekailo

Description

@chiemekailo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions