Merge branch 'master' into cccc
This commit is contained in:
commit
70dc1e2f5a
@ -62,17 +62,21 @@ export const checkNotificationPermissionStatus = async () => {
|
||||
// Listener to monitor notification permission status changes while app is running
|
||||
let currentPermissionStatus = 'unavailable';
|
||||
const handleAppStateChange = async (nextAppState: AppStateStatus) => {
|
||||
if (nextAppState === 'active') {
|
||||
const isDisabledByUser = (await AsyncStorage.getItem(NOTIFICATIONS_NO_AND_DONT_ASK_FLAG)) === 'true';
|
||||
if (!isDisabledByUser) {
|
||||
const newPermissionStatus = await checkNotificationPermissionStatus();
|
||||
if (newPermissionStatus !== currentPermissionStatus) {
|
||||
currentPermissionStatus = newPermissionStatus;
|
||||
if (newPermissionStatus === 'granted') {
|
||||
await initializeNotifications();
|
||||
try {
|
||||
if (nextAppState === 'active') {
|
||||
const isDisabledByUser = (await AsyncStorage.getItem(NOTIFICATIONS_NO_AND_DONT_ASK_FLAG)) === 'true';
|
||||
if (!isDisabledByUser) {
|
||||
const newPermissionStatus = await checkNotificationPermissionStatus();
|
||||
if (newPermissionStatus !== currentPermissionStatus) {
|
||||
currentPermissionStatus = newPermissionStatus;
|
||||
if (newPermissionStatus === 'granted') {
|
||||
await initializeNotifications();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed handling app state notification refresh:', error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -51,7 +51,11 @@ const useDeviceQuickActions = () => {
|
||||
useEffect(() => {
|
||||
if (walletsInitialized) {
|
||||
DeviceEventEmitter.addListener('quickActionShortcut', walletQuickActions);
|
||||
popInitialShortcutAction().then(popInitialAction);
|
||||
popInitialShortcutAction()
|
||||
.then(popInitialAction)
|
||||
.catch(error => {
|
||||
console.error('Failed to process initial quick action:', error);
|
||||
});
|
||||
return () => DeviceEventEmitter.removeAllListeners('quickActionShortcut');
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@ -74,26 +78,28 @@ const useDeviceQuickActions = () => {
|
||||
};
|
||||
|
||||
const popInitialAction = async (data: any): Promise<void> => {
|
||||
if (data) {
|
||||
const wallet = wallets.find(w => w.getID() === data.userInfo.url.split('wallet/')[1]);
|
||||
if (wallet) {
|
||||
NavigationService.dispatch(
|
||||
CommonActions.navigate({
|
||||
name: 'WalletTransactions',
|
||||
params: {
|
||||
walletID: wallet.getID(),
|
||||
walletType: wallet.type,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
const url = await Linking.getInitialURL();
|
||||
if (url) {
|
||||
if (DeeplinkSchemaMatch.hasSchema(url)) {
|
||||
try {
|
||||
if (data) {
|
||||
const wallet = wallets.find(w => w.getID() === data.userInfo.url.split('wallet/')[1]);
|
||||
if (wallet) {
|
||||
NavigationService.dispatch(
|
||||
CommonActions.navigate({
|
||||
name: 'WalletTransactions',
|
||||
params: {
|
||||
walletID: wallet.getID(),
|
||||
walletType: wallet.type,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
const url = await Linking.getInitialURL();
|
||||
if (url && DeeplinkSchemaMatch.hasSchema(url)) {
|
||||
handleOpenURL({ url });
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to handle initial quick action/deeplink:', error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
4
index.js
4
index.js
@ -23,7 +23,9 @@ LogBox.ignoreLogs([
|
||||
|
||||
const BlueAppComponent = () => {
|
||||
useEffect(() => {
|
||||
restoreSavedPreferredFiatCurrencyAndExchangeFromStorage();
|
||||
restoreSavedPreferredFiatCurrencyAndExchangeFromStorage().catch(error => {
|
||||
console.error('Failed to restore preferred currency and exchange rates on startup:', error);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return <App />;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user