Skip to content

Commit

Permalink
✨ Add likerland getapp universal link (#382)
Browse files Browse the repository at this point in the history
* ✨ Add likerland getapp universal link

* 🐛 Fix yield is not used on a promise error
  • Loading branch information
williamchong authored Jun 27, 2023
1 parent e638e07 commit 995d0cf
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 14 deletions.
25 changes: 25 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,31 @@
android:host="s.rinkeby.like.co"
android:scheme="https" />
</intent-filter>

<!-- getapp as universal entrance -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="liker.land"
android:scheme="https"
android:pathPrefix="/getapp" />
<data
android:host="liker.land"
android:scheme="https"
android:pathPattern="/.*/getapp" />
<data
android:host="rinkeby.liker.land"
android:scheme="https"
android:pathPrefix="/getapp" />
<data
android:host="rinkeby.liker.land"
android:scheme="https"
android:pathPattern="/.*/getapp" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<activity
Expand Down
12 changes: 8 additions & 4 deletions app/models/deep-link-handle-store/deep-link-handle-store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { flow, Instance, SnapshotOut, types } from "mobx-state-tree"
import { URL } from 'react-native-url-polyfill';

import { SuperLikeMetaResult } from "../../services/api"
import { logAnalyticsEvent } from "../../utils/analytics"
Expand All @@ -14,9 +15,6 @@ import {
} from "../extensions"
import { SuperLikeModel } from "../super-like"

// eslint-disable-next-line no-useless-escape
const URL_REGEX = /^https?:\/\/?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/

const BaseModel = types
.model("DeepLinkHandleStore")
.props({
Expand Down Expand Up @@ -129,13 +127,19 @@ const BaseModel = types
openDeepLink: flow(function*(url: string = deferredDeepLink) {
if (!url) return
if (!self.env.branchIO.getIsClickedBranchLink()) {
if (URL_REGEX.test(url)) {
if (url.startsWith('https://') || url.startsWith('http://')) {
const superLikeBaseURL = `${self.getConfig("SUPERLIKE_BASE_URL")}/`
if (url.startsWith(superLikeBaseURL)) {
const [, superLikeID] = url.split(superLikeBaseURL)
if (superLikeID) {
yield handleSuperLikeID(superLikeID)
}
} else if (url.includes('liker.land') && url.includes('/getapp')) {
const parsed = new URL(url);
if (parsed.searchParams.get('action') === 'wc') {
const walletConnectURI = parsed.searchParams.get('uri')
yield self.walletConnectStore.handleNewSessionRequest(walletConnectURI, { isMobile: true })
}
} else {
self.navigationStore.dispatch({
type: "Navigation/PUSH",
Expand Down
8 changes: 4 additions & 4 deletions app/models/wallet-connect-store/wallet-connect-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ export const WalletConnectStoreModel = types

self.clients.push(newClient)

yield toBeRemovedClients.forEach(async client => {
await client.disconnect()
self.clients.remove(client)
})
yield Promise.all(toBeRemovedClients.map(client => {
client.disconnect().catch()
}))
toBeRemovedClients.map(c => self.clients.remove(c))
} else if (topic && topic.length === 64) {
// valid topic is a sha256 hash of length 64
yield self.v2Client.connect({ uri })
Expand Down
2 changes: 2 additions & 0 deletions ios/LikeCoinApp/LikeCoinApp.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<array>
<string>applinks:s.like.co</string>
<string>applinks:s.rinkeby.like.co</string>
<string>applinks:liker.land</string>
<string>applinks:rinkeby.liker.land</string>
<string>applinks:oice.com</string>
<string>applinks:likecoin.page.link</string>
<string>applinks:likerland.app.link</string>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"react-native-svg": "^12.1.1",
"react-native-swipe-list-view": "^3.2.4",
"react-native-tracking-transparency": "^0.1.2",
"react-native-url-polyfill": "^1.3.0",
"react-native-webview": "^8.1.1",
"react-navigation": "4.4.4",
"react-navigation-stack": "2.10.4",
Expand Down
28 changes: 22 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13563,12 +13563,7 @@ path-key@^3.1.0:
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==

path-parse@^1.0.6:
version "1.0.7"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==

path-parse@^1.0.7:
path-parse@^1.0.6, path-parse@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
Expand Down Expand Up @@ -15016,6 +15011,13 @@ react-native-tracking-transparency@^0.1.2:
resolved "https://registry.yarnpkg.com/react-native-tracking-transparency/-/react-native-tracking-transparency-0.1.2.tgz#78059ffe38079182aaced1326f590b35c7440ae6"
integrity sha512-oe+BFutdq+fnTgyC9pAm/NEz6nuYkEHpFQUU8swj+E5oOOPqGmrNXmseNatKob521Zh7w0ovxXkoQNTV+PKTFA==

react-native-url-polyfill@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/react-native-url-polyfill/-/react-native-url-polyfill-1.3.0.tgz#c1763de0f2a8c22cc3e959b654c8790622b6ef6a"
integrity sha512-w9JfSkvpqqlix9UjDvJjm1EjSt652zVQ6iwCIj1cVVkwXf4jQhQgTNXY6EVTwuAmUjg6BC6k9RHCBynoLFo3IQ==
dependencies:
whatwg-url-without-unicode "8.0.0-3"

react-native-webview@^8.1.1:
version "8.1.2"
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-8.1.2.tgz#c2ddb1e82d1c294f8f68a13be5d0536f7808f377"
Expand Down Expand Up @@ -17876,6 +17878,11 @@ webidl-conversions@^4.0.2:
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==

webidl-conversions@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff"
integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==

webpack-dev-middleware@^3.7.0:
version "3.7.3"
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.7.3.tgz#0639372b143262e2b84ab95d3b91a7597061c2c5"
Expand Down Expand Up @@ -17979,6 +17986,15 @@ whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0:
resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"
integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==

[email protected]:
version "8.0.0-3"
resolved "https://registry.yarnpkg.com/whatwg-url-without-unicode/-/whatwg-url-without-unicode-8.0.0-3.tgz#ab6df4bf6caaa6c85a59f6e82c026151d4bb376b"
integrity sha512-HoKuzZrUlgpz35YO27XgD28uh/WJH4B0+3ttFqRo//lmq+9T/mIOJ6kqmINI9HpUpz1imRC/nR/lxKpJiv0uig==
dependencies:
buffer "^5.4.3"
punycode "^2.1.1"
webidl-conversions "^5.0.0"

whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
Expand Down

0 comments on commit 995d0cf

Please sign in to comment.