Branch NativeLink... is it supported?

I’m currently on Managed SDK 41…waiting for SDK 43 to come out.

Is Branch NativeLink supported so that it will work with iCloud+ customers on iOS 15?

More Details: Branch NativeLink™: An Innovative Solution to the Deferred Deep Linking Challenges Caused by Private Relay in iOS 15 | The Branch Blog

How to make it work:

It requires calling: checkPasteboardOnInstall

Does it work on SDK 42…will it work on 43?

To quote from this article on Tudip

Go to the dashboard to configure your Android and iOS app with Branch. And then create links by following the steps on the branch docs (https://docs.branch.io/links/integrate/). The branch has two environments. You can work “Live” and “Test

@walsh5 I appreciate the link, but I dont need help in setting up branch.

I’m specifically talking about NativeLink which is only supported on newer versions of the branch sdk.

Please read the details.

Maybe @charliecruzan or someone from the Expo team knows?

Hi @tennisbum

With EAS Build it should be possible, in theory. I have never used Branch myself, so not sure exactly what’s entailed normally or with NativeLink. If you can list the specific things that would need to be done to a plain React Native project to integrate NativeLink support then someone should be able to say what would be required of a Config Plugin to do the same in a managed Expo app that can then be built with EAS Build. (There’s a misconception that EAS Build is only available if you pay for the Expo Priority Plan. That is the easiest way to use it, but you can also use eas build --local to build locally on your own machine, in which case you don’t need to pay Expo.)

Also, it might be worth contacting Branch and pointing to the Config Plugin docs in case they’re willing to write one so that their users can use it in a managed Expo app without having to write their own plugin.

@wodin - I’m pretty sure that if Expo Managed projects move the react-native-branch package version up to 5.0.4, then we should be good.

Here is a recent ticket where they had to get it working in a non- Expo project:

https://github.com/BranchMetrics/react-native-branch-deep-linking-attribution/issues/668

====

How can I see what react-native-branch version will be coupled with the SDK 43 release coming up? It seems that the fix was released in July/August so that version probably didn’t make it in the SDK 42 release.

Looks like 5.0.0, unless I’m mistaken.

commit 1fffde73411ee7a642b98f1506a8de921805d52b
Author: Tomasz Sapeta <tsapeta@users.noreply.github.com>
Date:   Tue Sep 28 17:13:29 2021 +0200

    Publish packages

[...]
    expo-branch@5.0.0
[...]

One of the Expo team members (or maybe an interested user) would most likely have to update the config plugin to do the extra things needed to support NativeLink.

Here’s the plugin’s entry point:

and that references the following:

Ticket added here: Branch NativeLink support - Upgrade expo-branch to Aug 17 (5.0.4) release of react-native-branch · Issue #14631 · expo/expo · GitHub

Anybody want to volunteer to fix this for Expo Managed apps? :slight_smile:

I’m not sure just bumping the version number is enough. I think it also requires at least the addition of permission to read the clip board or something like that.

It might be worth talking to one of these companies if you’re looking for help with getting this implemented:

Doesn’t Clipboard - Expo Documentation allow for reading from the clipboard?

I will look at some of those companies.

Do you not think the ticket I added will be addressed by the SDK 44 release or is this something that is low priority?

This issue will make the expo-branch library broken for 25% of smartphone users in the coming months. It also might bring a significant amount of related, hard to debug tickets, into triage I suspect.

Good point. OK, maybe bumping the version will be enough. I’m not sure, though. Isn’t there extra stuff the Branch docs say you need to do for NativeLink support?

I do not have any inside knowledge of what Expo is planning. I don’t work for Expo :slight_smile:
EDIT: I don’t work for an Expo consulting company either.

@wodin Got it :grinning_face_with_smiling_eyes:

Just FYI, I was able to solve this by implementing my own version of NativeLink (I catch the token on the landing page button press which launches Branch and put the token on the clipboard) and then check when the user hits the first screen of the app.

Seems to be working well enough.

If someone wants to see my code just reply here.

1 Like

Hi @tennisbum
I do. Could you please share the code?

Sure here you go:

On your app’s landing page, add this script in and fire it on the onpress event when they are supposed to go to the app store.

<script>
  // https://stackoverflow.com/a/33928558/7180620
  function copyToClipboard(text) {
    if (window.clipboardData && window.clipboardData.setData) {
      // Internet Explorer-specific code path to prevent textarea being shown while dialog is visible.
      return window.clipboardData.setData("Text", text);
    }
    else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
      var textarea = document.createElement("textarea");
      textarea.textContent = text;
      textarea.style.position = "fixed";  // Prevent scrolling to bottom of page in Microsoft Edge.
      document.body.appendChild(textarea);
      textarea.select();
      try {
        return document.execCommand("copy");  // Security exception may be thrown by some browsers.
      }
      catch (ex) {
        console.warn("Copy to clipboard failed.", ex);
        return false;
      }
      finally {
        document.body.removeChild(textarea);
      }
    }
  }
</script>

Then in your app you just read the token from the clipboard when they hit the first screen of the app (or whatever the logic should be).

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.