Page MenuHomePhabricator

[native] Check install referrer on Android
ClosedPublic

Authored by tomek on May 8 2023, 9:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 13, 9:06 AM
Unknown Object (File)
Wed, Apr 3, 8:22 PM
Unknown Object (File)
Wed, Apr 3, 8:22 PM
Unknown Object (File)
Wed, Apr 3, 8:22 PM
Unknown Object (File)
Wed, Apr 3, 8:22 PM
Unknown Object (File)
Wed, Apr 3, 8:22 PM
Unknown Object (File)
Wed, Apr 3, 8:21 PM
Unknown Object (File)
Wed, Apr 3, 8:14 PM
Subscribers

Details

Summary

When a user clicks an invite link and doesn't have the app installed, we redirect him to Play Store from where the app can be installed. This redirection specifies a referrer parameter which can be used to check from where the app was installed. The, when the app is run, we check if referrer was set and if that's the case, we use it just like an invite link.

Depends on D7751

Test Plan

Open an invite link on an emulator without the app installed. Install the app. Run the app - the invitation modal should appear. Close the app and open it - the invitation shouldn't appear. Log out, close the app, open the app, log in - the invitation shouldn't appear.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.May 8 2023, 9:48 AM
Harbormaster failed remote builds in B19139: Diff 26204!
tomek requested review of this revision.May 9 2023, 2:30 AM

Use onFirstLaunch effect

This revision is now accepted and ready to land.May 9 2023, 4:45 AM
ashoat requested changes to this revision.May 9 2023, 9:43 AM
ashoat added inline comments.
native/navigation/invite-link-handler.react.js
44 ↗(On Diff #26268)

You are redefining the effect function here on every invocation, which means it is very possible that this will get called multiple times if InviteLinkHandler is rerendered before the async logic completes (including the AsyncStorage stuff in useOnFirstLaunchEffect, as well as the function passed here)

45 ↗(On Diff #26268)

Why is this IIFE necessary here?

46 ↗(On Diff #26268)

We should "early exit" to reduce indentation here

This revision now requires changes to proceed.May 9 2023, 9:43 AM
native/navigation/invite-link-handler.react.js
44 ↗(On Diff #26268)

That makes sense - going to fix it.

45 ↗(On Diff #26268)

We have to use an async function, but you're right, the fact that the second parameter of useOnFirstLaunchEffect returns mixed, means that we can simplify.

This revision is now accepted and ready to land.May 15 2023, 9:46 AM
native/utils/crash-utils.js
15 ↗(On Diff #26461)

Unrelated, but I wonder if we should be clearing SQLite here too

native/utils/crash-utils.js
15 ↗(On Diff #26461)
This revision was automatically updated to reflect the committed changes.