Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Jun 23, 2024
2 parents 4e45cca + b1d38ed commit 75da155
Show file tree
Hide file tree
Showing 30 changed files with 446 additions and 506 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-release-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Specify node version
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: Use npm caches
uses: actions/cache@v4
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ source "https://rubygems.org"

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby "3.1.6"
gem "cocoapods", ">= 1.13", "< 1.15"
gem 'rubyzip', '2.3.0'
gem "cocoapods", "1.15.2"
gem "activesupport", ">= 6.1.7.3", "< 7.1.0"
gem "fastlane"
17 changes: 9 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ GEM
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.84.0)
aws-sdk-kms (1.85.0)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.152.3)
Expand All @@ -36,10 +36,10 @@ GEM
babosa (1.0.4)
base64 (0.2.0)
claide (1.1.0)
cocoapods (1.14.3)
cocoapods (1.15.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.14.3)
cocoapods-core (= 1.15.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -54,7 +54,7 @@ GEM
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.14.3)
cocoapods-core (1.15.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand Down Expand Up @@ -117,7 +117,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.3.1)
fastlane (2.220.0)
fastlane (2.221.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -206,7 +206,7 @@ GEM
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.7.2)
jwt (2.8.1)
jwt (2.8.2)
base64
mini_magick (4.13.1)
mini_mime (1.1.5)
Expand Down Expand Up @@ -234,7 +234,7 @@ GEM
rouge (2.0.7)
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
rubyzip (2.3.0)
security (0.1.5)
signet (0.19.0)
addressable (~> 2.8)
Expand Down Expand Up @@ -277,8 +277,9 @@ PLATFORMS

DEPENDENCIES
activesupport (>= 6.1.7.3, < 7.1.0)
cocoapods (>= 1.13, < 1.15)
cocoapods (= 1.15.2)
fastlane
rubyzip (= 2.3.0)

RUBY VERSION
ruby 3.1.6p260
Expand Down
32 changes: 0 additions & 32 deletions blue_modules/showPopupMenu.android.ts

This file was deleted.

1 change: 1 addition & 0 deletions class/wallets/watch-only-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class WatchOnlyWallet extends LegacyWallet {
public readonly type = WatchOnlyWallet.type;
// @ts-ignore: override
public readonly typeReadable = WatchOnlyWallet.typeReadable;
public isWatchOnlyWarningVisible = true;

public _hdWalletInstance?: THDWalletForWatchOnly;
use_with_hardware_wallet = false;
Expand Down
119 changes: 61 additions & 58 deletions components/AddressInput.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import { Image, Keyboard, StyleSheet, Text, TextInput, View } from 'react-native';
import React, { useCallback, useMemo } from 'react';
import { Image, Keyboard, Platform, StyleSheet, Text, TextInput, View } from 'react-native';

import { scanQrHelper } from '../helpers/scan-qr';
import loc from '../loc';
import { useTheme } from './themes';
import ToolTipMenu from './TooltipMenu';
import { showFilePickerAndReadFile, showImagePickerAndReadImage } from '../blue_modules/fs';
import Clipboard from '@react-native-clipboard/clipboard';
import presentAlert from './Alert';
import ToolTipMenu from './TooltipMenu';

interface AddressInputProps {
isLoading?: boolean;
Expand Down Expand Up @@ -69,52 +69,63 @@ const AddressInput = ({
Keyboard.dismiss();
};

const onMenuItemPressed = (action: string) => {
if (onBarScanned === undefined) throw new Error('onBarScanned is required');
switch (action) {
case actionKeys.ScanQR:
scanButtonTapped();
if (launchedBy) {
scanQrHelper(launchedBy)
.then(value => onBarScanned({ data: value }))
const toolTipOnPress = useCallback(async () => {
await scanButtonTapped();
Keyboard.dismiss();
if (launchedBy) scanQrHelper(launchedBy).then(value => onBarScanned({ data: value }));
}, [launchedBy, onBarScanned, scanButtonTapped]);

const onMenuItemPressed = useCallback(
(action: string) => {
if (onBarScanned === undefined) throw new Error('onBarScanned is required');
switch (action) {
case actionKeys.ScanQR:
scanButtonTapped();
if (launchedBy) {
scanQrHelper(launchedBy)
.then(value => onBarScanned({ data: value }))
.catch(error => {
presentAlert({ message: error.message });
});
}

break;
case actionKeys.CopyFromClipboard:
Clipboard.getString()
.then(onChangeText)
.catch(error => {
presentAlert({ message: error.message });
});
break;
case actionKeys.ChoosePhoto:
showImagePickerAndReadImage()
.then(value => {
if (value) {
onChangeText(value);
}
})
.catch(error => {
presentAlert({ message: error.message });
});
}
break;
case actionKeys.ImportFile:
showFilePickerAndReadFile()
.then(value => {
if (value.data) {
onChangeText(value.data);
}
})
.catch(error => {
presentAlert({ message: error.message });
});
break;
}
Keyboard.dismiss();
},
[launchedBy, onBarScanned, onChangeText, scanButtonTapped],
);

break;
case actionKeys.CopyFromClipboard:
Clipboard.getString()
.then(onChangeText)
.catch(error => {
presentAlert({ message: error.message });
});
break;
case actionKeys.ChoosePhoto:
showImagePickerAndReadImage()
.then(value => {
if (value) {
onChangeText(value);
}
})
.catch(error => {
presentAlert({ message: error.message });
});
break;
case actionKeys.ImportFile:
showFilePickerAndReadFile()
.then(value => {
if (value.data) {
onChangeText(value.data);
}
})
.catch(error => {
presentAlert({ message: error.message });
});
break;
}
Keyboard.dismiss();
};
const buttonStyle = useMemo(() => [styles.scan, stylesHook.scan], [stylesHook.scan]);

return (
<View style={[styles.root, stylesHook.root]}>
Expand All @@ -141,12 +152,8 @@ const AddressInput = ({
onPressMenuItem={onMenuItemPressed}
testID="BlueAddressInputScanQrButton"
disabled={isLoading}
onPress={async () => {
await scanButtonTapped();
Keyboard.dismiss();
if (launchedBy) scanQrHelper(launchedBy).then(value => onBarScanned({ data: value }));
}}
style={[styles.scan, stylesHook.scan]}
onPress={toolTipOnPress}
buttonStyle={buttonStyle}
accessibilityLabel={loc.send.details_scan}
accessibilityHint={loc.send.details_scan_hint}
>
Expand Down Expand Up @@ -202,20 +209,16 @@ const actionKeys = {

const actionIcons = {
ScanQR: {
iconType: 'SYSTEM',
iconValue: 'qrcode',
iconValue: Platform.OS === 'ios' ? 'qrcode' : 'ic_menu_camera',
},
ImportFile: {
iconType: 'SYSTEM',
iconValue: 'doc',
},
ChoosePhoto: {
iconType: 'SYSTEM',
iconValue: 'photo',
iconValue: Platform.OS === 'ios' ? 'photo' : 'ic_menu_gallery',
},
Clipboard: {
iconType: 'SYSTEM',
iconValue: 'doc.on.doc',
iconValue: Platform.OS === 'ios' ? 'doc' : 'ic_menu_file',
},
};

Expand Down
8 changes: 3 additions & 5 deletions components/QRCodeComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Clipboard from '@react-native-clipboard/clipboard';
import React, { useRef } from 'react';
import React, { useCallback, useRef } from 'react';
import { Platform, StyleSheet, View } from 'react-native';
import QRCode from 'react-native-qrcode-svg';
import Share from 'react-native-share';
Expand All @@ -22,11 +22,9 @@ interface QRCodeComponentProps {

const actionIcons: { [key: string]: ActionIcons } = {
Share: {
iconType: 'SYSTEM',
iconValue: 'square.and.arrow.up',
},
Copy: {
iconType: 'SYSTEM',
iconValue: 'doc.on.doc',
},
};
Expand Down Expand Up @@ -76,13 +74,13 @@ const QRCodeComponent: React.FC<QRCodeComponentProps> = ({
});
};

const onPressMenuItem = (id: string) => {
const onPressMenuItem = useCallback((id: string) => {
if (id === actionKeys.Share) {
handleShareQRCode();
} else if (id === actionKeys.Copy) {
qrCode.current.toDataURL(Clipboard.setImage);
}
};
}, []);

const renderQRCode = (
<QRCode
Expand Down
37 changes: 19 additions & 18 deletions components/SaveFileButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from 'react';
import React, { ReactNode, useCallback } from 'react';
import { StyleProp, ViewStyle } from 'react-native';

import * as fs from '../blue_modules/fs';
Expand Down Expand Up @@ -28,22 +28,25 @@ const SaveFileButton: React.FC<SaveFileButtonProps> = ({
onMenuWillHide,
onMenuWillShow,
}) => {
const handlePressMenuItem = async (actionId: string) => {
if (beforeOnPress) {
await beforeOnPress();
}
const action = actions.find(a => a.id === actionId);
const handlePressMenuItem = useCallback(
async (actionId: string) => {
if (beforeOnPress) {
await beforeOnPress();
}
const action = actions.find(a => a.id === actionId);

if (action?.id === 'save') {
await fs.writeFileAndExport(fileName, fileContent, false).finally(() => {
afterOnPress?.();
});
} else if (action?.id === 'share') {
await fs.writeFileAndExport(fileName, fileContent, true).finally(() => {
afterOnPress?.();
});
}
};
if (action?.id === 'save') {
await fs.writeFileAndExport(fileName, fileContent, false).finally(() => {
afterOnPress?.();
});
} else if (action?.id === 'share') {
await fs.writeFileAndExport(fileName, fileContent, true).finally(() => {
afterOnPress?.();
});
}
},
[afterOnPress, beforeOnPress, fileContent, fileName],
);

return (
<ToolTipMenu
Expand All @@ -64,11 +67,9 @@ export default SaveFileButton;

const actionIcons: { [key: string]: ActionIcons } = {
Share: {
iconType: 'SYSTEM',
iconValue: 'square.and.arrow.up',
},
Save: {
iconType: 'SYSTEM',
iconValue: 'square.and.arrow.down',
},
};
Expand Down
Loading

0 comments on commit 75da155

Please sign in to comment.