DEL: Remove outdated code for unsupported macOS

This commit is contained in:
Marcos Rodriguez Velez 2023-02-25 12:20:46 -04:00
parent 0cb6647177
commit 64a5863af8
11 changed files with 72 additions and 143 deletions

View file

@ -83,8 +83,7 @@ npx react-native run-ios
npm run maccatalystpatches
```
Once the patches are applied, open Xcode and select "My Mac" as destination. If you are running macOS Catalina, you may need to remove all iOS 14 Widget targets.
Once the patches are applied, open Xcode and select "My Mac" as destination.
## TESTS

View file

@ -1,8 +1,7 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
import { Platform } from 'react-native';
import { getSystemName, isTablet, getDeviceType } from 'react-native-device-info';
import { isTablet, getDeviceType } from 'react-native-device-info';
const isMacCatalina = getSystemName() === 'Mac OS X';
const isDesktop = getDeviceType() === 'Desktop';
const getIsTorCapable = () => {
let capable = true;
@ -37,4 +36,4 @@ export async function isTorDaemonDisabled() {
export const isHandset = getDeviceType() === 'Handset';
export const isTorCapable = getIsTorCapable();
export { isMacCatalina, isDesktop, isTablet };
export { isDesktop, isTablet };

View file

@ -6,8 +6,6 @@ import DocumentPicker from 'react-native-document-picker';
import { launchCamera, launchImageLibrary } from 'react-native-image-picker';
import { presentCameraNotAuthorizedAlert } from '../class/camera';
import { isDesktop } from '../blue_modules/environment';
import ActionSheet from '../screen/ActionSheet';
import BlueClipboard from './clipboard';
import alert from '../components/Alert';
const LocalQRCode = require('@remobile/react-native-qrcode-local-image');
@ -205,43 +203,8 @@ const showFilePickerAndReadFile = async function () {
}
};
// Intended for macOS Catalina. Not for long press shortcut
const showActionSheet = async props => {
const isClipboardEmpty = (await BlueClipboard.getClipboardContent()).trim().length === 0;
let copyFromClipboardIndex;
const options = [loc._.cancel, loc.wallets.take_photo, loc.wallets.list_long_choose];
if (!isClipboardEmpty) {
options.push(loc.wallets.list_long_clipboard);
copyFromClipboardIndex = options.length - 1;
}
options.push(loc.wallets.import_file);
const importFileButtonIndex = options.length - 1;
return new Promise(resolve =>
ActionSheet.showActionSheetWithOptions({ options, cancelButtonIndex: 0, anchor: props.anchor }, async buttonIndex => {
if (buttonIndex === 1) {
takePhotoWithImagePickerAndReadPhoto().then(resolve);
} else if (buttonIndex === 2) {
showImagePickerAndReadImage()
.then(resolve)
.catch(error => alert(error.message));
} else if (buttonIndex === copyFromClipboardIndex) {
const clipboard = await BlueClipboard.getClipboardContent();
resolve(clipboard);
} else if (importFileButtonIndex) {
const { data } = await showFilePickerAndReadFile();
if (data) {
resolve(data);
}
}
}),
);
};
module.exports.writeFileAndExport = writeFileAndExport;
module.exports.openSignedTransaction = openSignedTransaction;
module.exports.showFilePickerAndReadFile = showFilePickerAndReadFile;
module.exports.showImagePickerAndReadImage = showImagePickerAndReadImage;
module.exports.takePhotoWithImagePickerAndReadPhoto = takePhotoWithImagePickerAndReadPhoto;
module.exports.showActionSheet = showActionSheet;

View file

@ -39,6 +39,21 @@
<key>orderHint</key>
<integer>2</integer>
</dict>
<key>Stickers.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
</dict>
<key>TodayExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>5</integer>
</dict>
<key>WidgetsExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>6</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>

View file

@ -1,13 +1,11 @@
import React, { useState, useContext, useRef } from 'react';
import { useNavigation, useRoute, useTheme } from '@react-navigation/native';
import { StyleSheet, View, KeyboardAvoidingView, Platform, TextInput, Keyboard, findNodeHandle } from 'react-native';
import { StyleSheet, View, KeyboardAvoidingView, Platform, TextInput, Keyboard } from 'react-native';
import loc from '../../loc';
import { BlueButton, BlueButtonLink, BlueCard, BlueSpacing10, BlueSpacing20, BlueText, SafeBlueArea } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import { isMacCatalina } from '../../blue_modules/environment';
const fs = require('../../blue_modules/fs');
const IsItMyAddress = () => {
/** @type {AbstractWallet[]} */
@ -56,18 +54,14 @@ const IsItMyAddress = () => {
};
const importScan = () => {
if (isMacCatalina) {
fs.showActionSheet({ anchor: findNodeHandle(scanButtonRef.current) }).then(onBarScanned);
} else {
navigate('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params: {
launchedBy: name,
onBarScanned,
showFileImportButton: true,
},
});
}
navigate('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params: {
launchedBy: name,
onBarScanned,
showFileImportButton: true,
},
});
};
const clearAddressInput = () => {

View file

@ -1,21 +1,9 @@
import React, { useContext, useEffect, useRef, useState } from 'react';
import {
ActivityIndicator,
TouchableOpacity,
ScrollView,
View,
TextInput,
Linking,
Platform,
Text,
StyleSheet,
findNodeHandle,
} from 'react-native';
import { ActivityIndicator, TouchableOpacity, ScrollView, View, TextInput, Linking, Platform, Text, StyleSheet } from 'react-native';
import Clipboard from '@react-native-clipboard/clipboard';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import DocumentPicker from 'react-native-document-picker';
import { useNavigation, useRoute, useTheme, useIsFocused } from '@react-navigation/native';
import { isMacCatalina } from '../../blue_modules/environment';
import RNFS from 'react-native-fs';
import Biometric from '../../class/biometrics';
@ -220,18 +208,14 @@ const PsbtWithHardwareWallet = () => {
};
const openScanner = () => {
if (isMacCatalina) {
fs.showActionSheet({ anchor: findNodeHandle(openScannerButton.current) }).then(data => onBarScanned({ data }));
} else {
navigation.navigate('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params: {
launchedBy: route.name,
showFileImportButton: false,
onBarScanned,
},
});
}
navigation.navigate('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params: {
launchedBy: route.name,
showFileImportButton: false,
onBarScanned,
},
});
};
if (txHex) return _renderBroadcastHex();

View file

@ -15,9 +15,7 @@ import {
import navigationStyle from '../../components/navigationStyle';
import Privacy from '../../blue_modules/Privacy';
import loc from '../../loc';
import { isMacCatalina } from '../../blue_modules/environment';
import { BlueStorageContext } from '../../blue_modules/storage-context';
const fs = require('../../blue_modules/fs');
const WalletsImport = () => {
const navigation = useNavigation();
@ -94,18 +92,14 @@ const WalletsImport = () => {
};
const importScan = () => {
if (isMacCatalina) {
fs.showActionSheet().then(onBarScanned);
} else {
navigation.navigate('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params: {
launchedBy: route.name,
onBarScanned,
showFileImportButton: true,
},
});
}
navigation.navigate('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params: {
launchedBy: route.name,
onBarScanned,
showFileImportButton: true,
},
});
};
const speedBackdoorTap = () => {

View file

@ -23,7 +23,7 @@ import loc from '../../loc';
import { FContainer, FButton } from '../../components/FloatButtons';
import { useFocusEffect, useIsFocused, useNavigation, useRoute, useTheme } from '@react-navigation/native';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import { isDesktop, isMacCatalina, isTablet } from '../../blue_modules/environment';
import { isDesktop, isTablet } from '../../blue_modules/environment';
import BlueClipboard from '../../blue_modules/clipboard';
import navigationStyle from '../../components/navigationStyle';
import { TransactionListItem } from '../../components/TransactionListItem';
@ -265,7 +265,7 @@ const WalletsList = () => {
<FContainer ref={walletActionButtonsRef}>
<FButton
onPress={onScanButtonPressed}
onLongPress={isMacCatalina ? undefined : sendButtonLongPress}
onLongPress={ sendButtonLongPress}
icon={<Image resizeMode="stretch" source={scanImage} />}
text={loc.send.details_scan}
/>
@ -281,11 +281,8 @@ const WalletsList = () => {
};
const onScanButtonPressed = () => {
if (isMacCatalina) {
fs.showActionSheet({ anchor: findNodeHandle(walletActionButtonsRef.current) }).then(onBarScanned);
} else {
scanqrHelper(navigate, routeName, false).then(onBarScanned);
}
scanqrHelper(navigate, routeName, false).then(onBarScanned);
};
const onBarScanned = value => {
@ -303,9 +300,7 @@ const WalletsList = () => {
const sendButtonLongPress = async () => {
const isClipboardEmpty = (await BlueClipboard.getClipboardContent()).trim().length === 0;
if (Platform.OS === 'ios') {
if (isMacCatalina) {
fs.showActionSheet({ anchor: findNodeHandle(walletActionButtonsRef.current) }).then(onBarScanned);
} else {
const options = [loc._.cancel, loc.wallets.list_long_choose, loc.wallets.list_long_scan];
if (!isClipboardEmpty) {
options.push(loc.wallets.list_long_clipboard);
@ -320,9 +315,9 @@ const WalletsList = () => {
} else if (buttonIndex === 3) {
copyFromClipboard();
}
},
}
);
}
} else if (Platform.OS === 'android') {
const buttons = [
{

View file

@ -27,7 +27,7 @@ import ActionSheet from '../ActionSheet';
import loc from '../../loc';
import { FContainer, FButton } from '../../components/FloatButtons';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import { isDesktop, isMacCatalina } from '../../blue_modules/environment';
import { isDesktop } from '../../blue_modules/environment';
import BlueClipboard from '../../blue_modules/clipboard';
import LNNodeBar from '../../components/LNNodeBar';
import TransactionsNavigationHeader from '../../components/TransactionsNavigationHeader';
@ -371,10 +371,7 @@ const WalletTransactions = () => {
};
const sendButtonLongPress = async () => {
if (isMacCatalina) {
fs.showActionSheet({ anchor: walletActionButtonsRef.current }).then(onBarCodeRead);
} else {
const isClipboardEmpty = (await BlueClipboard.getClipboardContent()).trim().length === 0;
const isClipboardEmpty = (await BlueClipboard.getClipboardContent()).trim().length === 0;
if (Platform.OS === 'ios') {
const options = [loc._.cancel, loc.wallets.list_long_choose, loc.wallets.list_long_scan];
if (!isClipboardEmpty) {
@ -435,7 +432,7 @@ const WalletTransactions = () => {
buttons,
});
}
}
};
const navigateToViewEditCosigners = () => {

View file

@ -13,7 +13,6 @@ import {
Switch,
Text,
View,
findNodeHandle,
} from 'react-native';
import { Icon, Badge } from 'react-native-elements';
import { useFocusEffect, useNavigation, useRoute, useTheme } from '@react-navigation/native';
@ -41,7 +40,6 @@ import MultipleStepsListItem, {
import Privacy from '../../blue_modules/Privacy';
import Biometric from '../../class/biometrics';
import { SquareButton } from '../../components/SquareButton';
import { isMacCatalina } from '../../blue_modules/environment';
import { encodeUR } from '../../blue_modules/ur';
import QRCodeComponent from '../../components/QRCodeComponent';
import alert from '../../components/Alert';
@ -437,33 +435,24 @@ const ViewEditMultisigCosigners = () => {
};
const scanOrOpenFile = () => {
if (isMacCatalina) {
fs.showActionSheet({ anchor: findNodeHandle(openScannerButtonRef.current) }).then(result => {
// Triggers FlatList re-render
setImportText(result);
//
_handleUseMnemonicPhrase(result);
});
} else {
setIsProvideMnemonicsModalVisible(false);
setTimeout(
() =>
navigate('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params: {
launchedBy: route.name,
onBarScanned: result => {
// Triggers FlatList re-render
setImportText(result);
//
_handleUseMnemonicPhrase(result);
},
showFileImportButton: true,
setIsProvideMnemonicsModalVisible(false);
setTimeout(
() =>
navigate('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params: {
launchedBy: route.name,
onBarScanned: result => {
// Triggers FlatList re-render
setImportText(result);
//
_handleUseMnemonicPhrase(result);
},
}),
650,
);
}
showFileImportButton: true,
},
}),
650,
);
};
const hideProvideMnemonicsModal = () => {

View file

@ -18,4 +18,4 @@ echo > blue_modules/torrific.js
echo "Updating Podfile"
cd ios && pod update && cd ..
echo ""
echo "NOTE: react-native-tor is not currently compatible with Mac Catalyst. If you are running macOS Catalina, you will need to remove the iOS 14 Widgets from the project targets."
echo "NOTE: react-native-tor is not currently compatible with Mac Catalyst.