Skip to content

Commit ca4e825

Browse files
authored
chore: testing deep link startup (#2140)
Signed-off-by: Clécio Varjão <1348549+cvarjao@users.noreply.github.com>
1 parent fffdd76 commit ca4e825

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

app/App.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ import {
1515
initLanguages,
1616
ContainerProvider,
1717
MainContainer,
18+
TOKENS,
1819
} from '@hyperledger/aries-bifold-core'
1920
import { useNavigation } from '@react-navigation/native'
2021
import React, { useEffect, useState, useMemo } from 'react'
2122
import { useTranslation } from 'react-i18next'
22-
import { StatusBar } from 'react-native'
23+
import { Linking, StatusBar } from 'react-native'
2324
import { isTablet } from 'react-native-device-info'
2425
import Orientation from 'react-native-orientation-locker'
2526
import SplashScreen from 'react-native-splash-screen'
@@ -55,6 +56,19 @@ const App = () => {
5556
}
5657

5758
useEffect(() => {
59+
// this block fixes an issue when deep-link doesn't work
60+
// when the app is fully terminated on Android.
61+
// TODO: review and look for a fix
62+
async function getInitialURL() {
63+
const url = await Linking.getInitialURL()
64+
const logger = bcwContainer.resolve(TOKENS.UTIL_LOGGER)
65+
if (url) {
66+
logger.info(`App launched with URL: ${url}`)
67+
} else {
68+
logger.info('App launched without URL')
69+
}
70+
}
71+
getInitialURL()
5872
// Hide the native splash / loading screen so that our
5973
// RN version can be displayed.
6074
SplashScreen.hide()

0 commit comments

Comments
 (0)