From ead613aed4ca3e6cbe88e506ea8dee42a39334fd Mon Sep 17 00:00:00 2001 From: overtorment Date: Sun, 5 May 2024 18:57:41 +0100 Subject: [PATCH] FIX: is tablet detection --- blue_modules/environment.ts | 35 ------------------- ...ionListItem.js => TransactionListItem.tsx} | 0 hooks/useIsLargeScreen.ts | 2 +- screen/send/Broadcast.tsx | 2 +- 4 files changed, 2 insertions(+), 37 deletions(-) rename components/{TransactionListItem.js => TransactionListItem.tsx} (100%) diff --git a/blue_modules/environment.ts b/blue_modules/environment.ts index f0985a6e2..c6e5db789 100644 --- a/blue_modules/environment.ts +++ b/blue_modules/environment.ts @@ -1,41 +1,6 @@ -import AsyncStorage from '@react-native-async-storage/async-storage'; -import { Platform } from 'react-native'; import { isTablet, getDeviceType } from 'react-native-device-info'; const isDesktop: boolean = getDeviceType() === 'Desktop'; -const getIsTorCapable = (): boolean => { - let capable = true; - if (Platform.OS === 'android' && Platform.Version < 26) { - capable = false; - } else if (isDesktop) { - capable = false; - } - return capable; -}; - -const IS_TOR_DAEMON_DISABLED: string = 'is_tor_daemon_disabled'; - -export async function setIsTorDaemonDisabled(disabled: boolean = true): Promise { - return AsyncStorage.setItem(IS_TOR_DAEMON_DISABLED, disabled ? '1' : ''); -} - -export async function isTorDaemonDisabled(): Promise { - let result: boolean; - try { - const savedValue = await AsyncStorage.getItem(IS_TOR_DAEMON_DISABLED); - if (savedValue === null) { - result = false; - } else { - result = savedValue === '1'; - } - } catch { - result = true; - } - - return result; -} - export const isHandset: boolean = getDeviceType() === 'Handset'; -export const isTorCapable: boolean = getIsTorCapable(); export { isDesktop, isTablet }; diff --git a/components/TransactionListItem.js b/components/TransactionListItem.tsx similarity index 100% rename from components/TransactionListItem.js rename to components/TransactionListItem.tsx diff --git a/hooks/useIsLargeScreen.ts b/hooks/useIsLargeScreen.ts index bf3a2f0c3..8c706cade 100644 --- a/hooks/useIsLargeScreen.ts +++ b/hooks/useIsLargeScreen.ts @@ -32,7 +32,7 @@ export const useIsLargeScreen = () => { const halfScreenWidth = windowWidth >= screenWidth / 2; const condition = (isRunningOnTablet && halfScreenWidth) || isDesktop; console.debug( - `Window width: ${windowWidth}, Screen width: ${screenWidth}, Is tablet: ${isTablet}, Is large screen: ${condition}, isDesktkop: ${isDesktop}`, + `Window width: ${windowWidth}, Screen width: ${screenWidth}, Is tablet: ${isTablet()}, Is large screen: ${condition}, isDesktkop: ${isDesktop}`, ); return condition; }, [windowWidth, screenWidth]); diff --git a/screen/send/Broadcast.tsx b/screen/send/Broadcast.tsx index a33484e79..33d5358f0 100644 --- a/screen/send/Broadcast.tsx +++ b/screen/send/Broadcast.tsx @@ -117,7 +117,7 @@ const Broadcast: React.FC = () => { return ( - + {BROADCAST_RESULT.success !== broadcastResult && (