Skip to content

Commit

Permalink
Merge pull request #1361 from tonwhales/develop
Browse files Browse the repository at this point in the history
Develop sync
  • Loading branch information
vzhovnitsky authored Feb 12, 2025
2 parents e4e4b02 + acadc3f commit 2828a9b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
17 changes: 13 additions & 4 deletions app/fragments/ledger/HardwareWalletFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { useTheme } from "../../engine/hooks";
import { useLedgerTransport } from "./components/TransportContext";
import { StatusBar } from "expo-status-bar";
import { ScrollView } from "react-native-gesture-handler";
import { useParams } from "../../utils/useParams";
import { LedgerDeviceSelectionParams } from "./LedgerDeviceSelectionFragment";

const images = {
ios: {
Expand All @@ -30,6 +32,7 @@ export const HardwareWalletFragment = fragment(() => {
const navigation = useTypedNavigation();
const ledgerContext = useLedgerTransport();
const dimentions = useDimensions();
const { selectedAddress } = useParams<LedgerDeviceSelectionParams>();

const [searching, setSearching] = useState(false);
const [bleLocked, setBleLocked] = useState(false);
Expand All @@ -48,11 +51,11 @@ export const HardwareWalletFragment = fragment(() => {
if (ledgerContext?.bleSearchState?.type === 'ongoing') {
setSearching(true);
if (ledgerContext.bleSearchState.devices.length > 0) {
navigation.navigate('LedgerDeviceSelection');
navigation.navigateLedgerDeviceSelection({ selectedAddress });
setSearching(false);
}
} else if (ledgerContext?.bleSearchState?.type === 'completed' && ledgerContext.bleSearchState.success) {
navigation.navigate('LedgerDeviceSelection');
navigation.navigateLedgerDeviceSelection({ selectedAddress });
setSearching(false);
} else {
setSearching(false);
Expand All @@ -61,9 +64,15 @@ export const HardwareWalletFragment = fragment(() => {

useEffect(() => {
if (ledgerContext?.ledgerConnection?.type === 'hid') {
navigation.navigate('LedgerSelectAccount');
if (!selectedAddress) {
navigation.navigateLedgerSelectAccount({ selectedAddress });
return;
}
navigation.goBack();
} else if (ledgerContext?.ledgerConnection?.type === 'ble') {
navigation.goBack();
}
}, [ledgerContext?.ledgerConnection]);
}, [ledgerContext?.ledgerConnection?.type]);

return (
<View style={{
Expand Down
2 changes: 1 addition & 1 deletion app/fragments/ledger/components/TransportContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export const LedgerTransportProvider = ({ children }: { children: ReactNode }) =
if (Platform.OS === 'ios') {
navigationRef.navigate('LedgerDeviceSelection', { selectedAddress: addr });
} else {
navigationRef.navigate('Ledger');
navigationRef.navigate('Ledger', { selectedAddress: addr });
}
}
},
Expand Down
7 changes: 4 additions & 3 deletions app/fragments/wallet/ReceiveAssetsFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useParams } from "../../utils/useParams";
import { useTypedNavigation } from "../../utils/useTypedNavigation";
import { ScreenHeader } from "../../components/ScreenHeader";
import { useRoute } from "@react-navigation/native";
import { useDisplayableJettons, useHoldersAccounts, useHoldersAccountStatus, useIsConnectAppReady, useNetwork, useSelectedAccount, useTheme } from "../../engine/hooks";
import { useBounceableWalletFormat, useDisplayableJettons, useHoldersAccounts, useHoldersAccountStatus, useIsConnectAppReady, useNetwork, useSelectedAccount, useTheme } from "../../engine/hooks";
import { Address } from "@ton/core";
import { useLedgerTransport } from "../ledger/components/TransportContext";
import { StatusBar } from "expo-status-bar";
Expand Down Expand Up @@ -106,6 +106,7 @@ export const ReceiveAssetsFragment = fragment(() => {
const isLedger = route.name === 'LedgerReceiveAssets';
const { assetCallback, title } = useParams<ReceiveAssetsFragment>();
const ledgerContext = useLedgerTransport();
const [bounceableFormat] = useBounceableWalletFormat();

const ledgerAddress = useMemo(() => {
if (isLedger && !!ledgerContext?.addr) {
Expand All @@ -129,9 +130,9 @@ export const ReceiveAssetsFragment = fragment(() => {
assetCallback(asset);
}, 10);
} else {
navigation.navigateReceive({ addr: owner.toString({ testOnly: isTestnet, bounceable: isLedger ? false : undefined }), asset: asset || undefined }, isLedger);
navigation.navigateReceive({ addr: owner.toString({ testOnly: isTestnet, bounceable: isLedger ? false : bounceableFormat }), asset: asset || undefined }, isLedger);
}
}, [assetCallback, isLedger, owner, isTestnet]);
}, [assetCallback, isLedger, owner, isTestnet, bounceableFormat]);

const onHoldersSelected = useCallback((target: GeneralHoldersAccount) => {
const path = `/account/${target.id}?deposit-open=true`;
Expand Down
6 changes: 4 additions & 2 deletions ios/wallet/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ - (BOOL)concurrentRootEnabled
// Linking API
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
[[AppsFlyerAttribution shared] handleOpenUrl:url options:options];
return YES;
return [RCTLinkingManager application:application openURL:url options:options];
}

// Universal Links
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
[[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:restorationHandler];
return YES;
return [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
}

@end

0 comments on commit 2828a9b

Please sign in to comment.