diff --git a/.ruby-version b/.ruby-version index 49cdd668e1..8a4b2758ef 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.6 +3.1.6 \ No newline at end of file diff --git a/Gemfile b/Gemfile index f233fca005..7e60e03851 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,7 @@ -source 'https://rubygems.org' +source "https://rubygems.org" # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version -ruby '>= 2.6.10' - -gem 'cocoapods', '>= 1.13', '< 1.15' -gem 'activesupport', '>= 6.1.7.3', '< 7.1.0' +ruby "3.1.6" +gem "cocoapods", ">= 1.13", "< 1.15" +gem "activesupport", ">= 6.1.7.3", "< 7.1.0" gem "fastlane" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index f91788e8ee..60e4918247 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,12 +5,11 @@ GEM base64 nkf rexml - activesupport (6.1.7.7) + activesupport (7.0.8.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) algoliasearch (1.27.5) @@ -19,17 +18,17 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.911.0) - aws-sdk-core (3.191.6) + aws-partitions (1.944.0) + aws-sdk-core (3.197.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.78.0) - aws-sdk-core (~> 3, >= 3.191.0) + aws-sdk-kms (1.84.0) + aws-sdk-core (~> 3, >= 3.197.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.146.1) - aws-sdk-core (~> 3, >= 3.191.0) + aws-sdk-s3 (1.152.3) + aws-sdk-core (~> 3, >= 3.197.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.8) aws-sigv4 (1.8.0) @@ -78,18 +77,17 @@ GEM colored2 (3.1.2) commander (4.6.0) highline (~> 2.0.0) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.3) declarative (0.0.20) digest-crc (0.6.5) rake (>= 12.0.0, < 14.0.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) + domain_name (0.6.20240107) dotenv (2.8.1) emoji_regex (3.2.3) escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) - excon (0.109.0) + excon (0.110.0) faraday (1.10.3) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) @@ -160,7 +158,7 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) - ffi (1.16.3) + ffi (1.17.0) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) @@ -178,19 +176,19 @@ GEM google-apis-core (>= 0.11.0, < 2.a) google-apis-playcustomapp_v1 (0.13.0) google-apis-core (>= 0.11.0, < 2.a) - google-apis-storage_v1 (0.29.0) + google-apis-storage_v1 (0.31.0) google-apis-core (>= 0.11.0, < 2.a) - google-cloud-core (1.6.1) + google-cloud-core (1.7.0) google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) google-cloud-env (1.6.0) faraday (>= 0.17.3, < 3.0) - google-cloud-errors (1.3.1) - google-cloud-storage (1.45.0) + google-cloud-errors (1.4.0) + google-cloud-storage (1.47.0) addressable (~> 2.8) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) - google-apis-storage_v1 (~> 0.29.0) + google-apis-storage_v1 (~> 0.31.0) google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) @@ -201,27 +199,27 @@ GEM os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.5) + http-cookie (1.0.6) domain_name (~> 0.5) httpclient (2.8.3) - i18n (1.14.4) + i18n (1.14.5) concurrent-ruby (~> 1.0) jmespath (1.6.2) json (2.7.2) jwt (2.8.1) base64 - mini_magick (4.12.0) + mini_magick (4.13.1) mini_mime (1.1.5) - minitest (5.22.3) + minitest (5.23.1) molinillo (0.8.0) multi_json (1.15.0) - multipart-post (2.4.0) + multipart-post (2.4.1) nanaimo (0.3.0) nap (1.1.0) naturally (2.2.1) netrc (0.11.0) nkf (0.2.0) - optparse (0.4.0) + optparse (0.5.0) os (1.1.4) plist (3.7.1) public_suffix (4.0.7) @@ -231,13 +229,14 @@ GEM trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.2.6) + rexml (3.2.9) + strscan rouge (2.0.7) ruby-macho (2.5.1) ruby2_keywords (0.0.5) rubyzip (2.3.2) security (0.1.5) - signet (0.18.0) + signet (0.19.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) @@ -245,6 +244,7 @@ GEM simctl (1.6.10) CFPropertyList naturally + strscan (3.1.0) terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) @@ -258,9 +258,6 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.9.1) unicode-display_width (2.5.0) word_wrap (1.0.0) xcodeproj (1.24.0) @@ -274,7 +271,6 @@ GEM rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) - zeitwerk (2.6.13) PLATFORMS ruby @@ -285,7 +281,7 @@ DEPENDENCIES fastlane RUBY VERSION - ruby 2.7.4p191 + ruby 3.1.6p260 BUNDLED WITH - 2.4.22 + 2.5.13 diff --git a/class/contact-list.ts b/class/contact-list.ts index e61fcaf723..f06acf3869 100644 --- a/class/contact-list.ts +++ b/class/contact-list.ts @@ -3,6 +3,7 @@ import BIP47Factory from '@spsina/bip47'; import { SilentPayment } from 'silent-payments'; import ecc from '../blue_modules/noble_ecc'; +import * as bitcoin from 'bitcoinjs-lib'; export class ContactList { isBip47PaymentCodeValid(pc: string) { @@ -21,4 +22,21 @@ export class ContactList { isPaymentCodeValid(pc: string): boolean { return this.isBip47PaymentCodeValid(pc) || this.isBip352PaymentCodeValid(pc); } + + isAddressValid(address: string): boolean { + try { + bitcoin.address.toOutputScript(address); // throws, no? + + if (!address.toLowerCase().startsWith('bc1')) return true; + const decoded = bitcoin.address.fromBech32(address); + if (decoded.version === 0) return true; + if (decoded.version === 1 && decoded.data.length !== 32) return false; + if (decoded.version === 1 && !ecc.isPoint(Buffer.concat([Buffer.from([2]), decoded.data]))) return false; + if (decoded.version > 1) return false; + // ^^^ some day, when versions above 1 will be actually utilized, we would need to unhardcode this + return true; + } catch (e) { + return false; + } + } } diff --git a/components/ListItem.tsx b/components/ListItem.tsx index d7051b2190..865fdf8e55 100644 --- a/components/ListItem.tsx +++ b/components/ListItem.tsx @@ -1,5 +1,5 @@ import React, { useMemo } from 'react'; -import { ActivityIndicator, I18nManager, Pressable, PressableProps, StyleSheet, Switch, TouchableOpacity } from 'react-native'; +import { ActivityIndicator, I18nManager, Pressable, PressableProps, StyleSheet, Switch, TouchableOpacity, View } from 'react-native'; import { Avatar, ListItem as RNElementsListItem, Button } from '@rneui/themed'; // Replace with actual import paths import { useTheme } from './themes'; @@ -58,13 +58,6 @@ const DefaultRightContent: React.FC<{ reset: () => void; onDeletePressed?: () => /> ); -const styles = StyleSheet.create({ - rightButton: { - minHeight: '100%', - backgroundColor: 'red', - }, -}); - const ListItem: React.FC = React.memo( ({ swipeable = false, @@ -107,9 +100,7 @@ const ListItem: React.FC = React.memo( fontWeight: '400', fontSize: 14, }, - rightTitleContainer: { - flex: 1, - }, + containerStyle: { backgroundColor: colors.background, }, @@ -121,8 +112,18 @@ const ListItem: React.FC = React.memo( const renderContent = () => ( <> - {leftIcon && } - {leftAvatar && leftAvatar} + {leftIcon && ( + <> + + + + )} + {leftAvatar && ( + <> + {leftAvatar} + + + )} {title} @@ -137,12 +138,13 @@ const ListItem: React.FC = React.memo( )} + {rightTitle && ( - - + + {rightTitle} - + )} {isLoading ? ( @@ -197,3 +199,14 @@ const ListItem: React.FC = React.memo( ); export default ListItem; + +const styles = StyleSheet.create({ + rightButton: { + minHeight: '100%', + backgroundColor: 'red', + }, + margin8: { + margin: 8, + }, + width16: { width: 16 }, +}); diff --git a/components/ReplaceFeeSuggestions.tsx b/components/ReplaceFeeSuggestions.tsx index 838f85157b..9b059f1143 100644 --- a/components/ReplaceFeeSuggestions.tsx +++ b/components/ReplaceFeeSuggestions.tsx @@ -57,11 +57,13 @@ const ReplaceFeeSuggestions: React.FC = ({ onFeeSele setNetworkFees(fees); onFeeSelected(fees.fastestFee); setSelectedFeeType(NetworkTransactionFeeType.FAST); - }, [onFeeSelected]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); useEffect(() => { fetchNetworkFees(); - }, [fetchNetworkFees]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); const handleFeeSelection = (feeType: NetworkTransactionFeeType) => { if (feeType !== NetworkTransactionFeeType.CUSTOM) { diff --git a/components/TransactionListItem.tsx b/components/TransactionListItem.tsx index 1a90f93d66..ca4598c648 100644 --- a/components/TransactionListItem.tsx +++ b/components/TransactionListItem.tsx @@ -42,9 +42,6 @@ export const TransactionListItem: React.FC = React.mem () => ({ backgroundColor: 'transparent', borderBottomColor: colors.lightBorder, - paddingTop: 16, - paddingBottom: 16, - paddingRight: 0, }), [colors.lightBorder], ); @@ -342,22 +339,20 @@ export const TransactionListItem: React.FC = React.mem // eslint-disable-next-line react-hooks/exhaustive-deps }, [item.hash, subtitle, rowTitle, subtitleNumberOfLines, txMetadata]); return ( - - - - - + + + ); }); @@ -395,5 +390,4 @@ const actionIcons = { const styles = StyleSheet.create({ iconWidth: { width: 25 }, - container: { marginHorizontal: 4 }, }); diff --git a/components/WalletsCarousel.js b/components/WalletsCarousel.js index ae08cfc10b..9b334f3e29 100644 --- a/components/WalletsCarousel.js +++ b/components/WalletsCarousel.js @@ -197,7 +197,7 @@ export const WalletCarouselItem = React.memo(({ item, _, onPress, handleLongPres return ( @@ -206,7 +206,9 @@ export const WalletCarouselItem = React.memo(({ item, _, onPress, handleLongPres testID={item.getLabel()} onPressIn={onPressedIn} onPressOut={onPressedOut} - onLongPress={handleLongPress} + onLongPress={() => { + handleLongPress(); + }} onPress={() => { onPressedOut(); setTimeout(() => { diff --git a/components/WatchConnectivity.ios.js b/components/WatchConnectivity.ios.js index f6e251bc6c..e0ccba2623 100644 --- a/components/WatchConnectivity.ios.js +++ b/components/WatchConnectivity.ios.js @@ -232,6 +232,9 @@ function WatchConnectivity() { if (wallet.chain === Chain.ONCHAIN && wallet.type !== MultisigHDWallet.type) { walletInformation.xpub = wallet.getXpub() ? wallet.getXpub() : wallet.getSecret(); } + if (wallet.allowBIP47() && wallet.isBIP47Enabled()) { + walletInformation.paymentCode = wallet.getBIP47PaymentCode(); + } walletsToProcess.push(walletInformation); } return { wallets: walletsToProcess, randomID: Math.floor(Math.random() * 11) }; diff --git a/components/icons/SettingsButton.tsx b/components/icons/SettingsButton.tsx new file mode 100644 index 0000000000..1cb2fdea99 --- /dev/null +++ b/components/icons/SettingsButton.tsx @@ -0,0 +1,38 @@ +import React from 'react'; +import { StyleSheet, TouchableOpacity } from 'react-native'; +import { Icon } from '@rneui/themed'; +import { useTheme } from '../themes'; +import { useExtendedNavigation } from '../../hooks/useExtendedNavigation'; +import loc from '../../loc'; + +const SettingsButton = () => { + const { colors } = useTheme(); + const { navigate } = useExtendedNavigation(); + const onPress = () => { + navigate('Settings'); + }; + + return ( + + + + ); +}; + +export default SettingsButton; + +const style = StyleSheet.create({ + buttonStyle: { + width: 30, + height: 30, + borderRadius: 15, + justifyContent: 'center', + alignContent: 'center', + }, +}); diff --git a/ios/BlueWallet.xcodeproj/project.pbxproj b/ios/BlueWallet.xcodeproj/project.pbxproj index 726ac21b4e..1c61778810 100644 --- a/ios/BlueWallet.xcodeproj/project.pbxproj +++ b/ios/BlueWallet.xcodeproj/project.pbxproj @@ -58,7 +58,6 @@ B40D4E602258425500428FCC /* SpecifyInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B40D4E582258425400428FCC /* SpecifyInterfaceController.swift */; }; B40D4E632258425500428FCC /* ReceiveInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B40D4E5B2258425500428FCC /* ReceiveInterfaceController.swift */; }; B40D4E642258425500428FCC /* WalletDetailsInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B40D4E5C2258425500428FCC /* WalletDetailsInterfaceController.swift */; }; - B40D4E682258426B00428FCC /* KeychainSwiftDistrib.swift in Sources */ = {isa = PBXBuildFile; fileRef = B40D4E672258426B00428FCC /* KeychainSwiftDistrib.swift */; }; B40FC3FA29CCD1D00007EBAC /* SwiftTCPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = B40FC3F829CCD1AC0007EBAC /* SwiftTCPClient.swift */; }; B41B76852B66B2FF002C48D5 /* Bugsnag in Frameworks */ = {isa = PBXBuildFile; productRef = B41B76842B66B2FF002C48D5 /* Bugsnag */; }; B41B76872B66B2FF002C48D5 /* BugsnagNetworkRequestPlugin in Frameworks */ = {isa = PBXBuildFile; productRef = B41B76862B66B2FF002C48D5 /* BugsnagNetworkRequestPlugin */; }; @@ -146,6 +145,7 @@ B461B852299599F800E431AA /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = B461B851299599F800E431AA /* AppDelegate.mm */; }; B47462D02C1538D800100825 /* CustomSegmentedControlManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B45010A52C1507DE00619044 /* CustomSegmentedControlManager.m */; }; B47B21EC2B2128B8001F6690 /* BlueWalletUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B47B21EB2B2128B8001F6690 /* BlueWalletUITests.swift */; }; + B48A6A292C1DF01000030AB9 /* KeychainSwift in Frameworks */ = {isa = PBXBuildFile; productRef = B48A6A282C1DF01000030AB9 /* KeychainSwift */; }; B49038D92B8FBAD300A8164A /* BlueWalletUITest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B49038D82B8FBAD300A8164A /* BlueWalletUITest.swift */; }; B4A29A2C2B55C990002A67DF /* EventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D32C5C52596CE3A008C077C /* EventEmitter.m */; }; B4A29A2D2B55C990002A67DF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; @@ -163,9 +163,13 @@ B4B1A4622BFA73110072E3BB /* WidgetHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4B1A4612BFA73110072E3BB /* WidgetHelper.swift */; }; B4B1A4642BFA73110072E3BB /* WidgetHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4B1A4612BFA73110072E3BB /* WidgetHelper.swift */; }; B4B1A4652BFA73110072E3BB /* WidgetHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4B1A4612BFA73110072E3BB /* WidgetHelper.swift */; }; + B4D0B2622C1DEA11006B6B1B /* ReceivePageInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4D0B2612C1DEA11006B6B1B /* ReceivePageInterfaceController.swift */; }; + B4D0B2642C1DEA99006B6B1B /* ReceiveType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4D0B2632C1DEA99006B6B1B /* ReceiveType.swift */; }; + B4D0B2662C1DEB7F006B6B1B /* ReceiveInterfaceMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4D0B2652C1DEB7F006B6B1B /* ReceiveInterfaceMode.swift */; }; + B4D0B2682C1DED67006B6B1B /* ReceiveMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4D0B2672C1DED67006B6B1B /* ReceiveMethod.swift */; }; B4EE583C226703320003363C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B40D4E35225841ED00428FCC /* Assets.xcassets */; }; C59F90CE0D04D3E4BB39BC5D /* libPods-BlueWalletUITests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F02C2F7CA3591E4E0B06EBA /* libPods-BlueWalletUITests.a */; }; - C978A716948AB7DEC5B6F677 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; + C978A716948AB7DEC5B6F677 /* (null) in Frameworks */ = {isa = PBXBuildFile; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -422,7 +426,6 @@ B40D4E582258425400428FCC /* SpecifyInterfaceController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpecifyInterfaceController.swift; sourceTree = ""; }; B40D4E5B2258425500428FCC /* ReceiveInterfaceController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReceiveInterfaceController.swift; sourceTree = ""; }; B40D4E5C2258425500428FCC /* WalletDetailsInterfaceController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WalletDetailsInterfaceController.swift; sourceTree = ""; }; - B40D4E672258426B00428FCC /* KeychainSwiftDistrib.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainSwiftDistrib.swift; sourceTree = SOURCE_ROOT; }; B40FC3F829CCD1AC0007EBAC /* SwiftTCPClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftTCPClient.swift; sourceTree = ""; }; B41C2E552BB3DCB8000FE097 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; B43B69BA225C46D800925B1E /* libRCTLinking.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libRCTLinking.a; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -458,6 +461,10 @@ B4A29A462B55C990002A67DF /* BlueWallet-NoLDK.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BlueWallet-NoLDK.plist"; sourceTree = ""; }; B4AB225C2B02AD12001F4328 /* XMLParserDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XMLParserDelegate.swift; sourceTree = ""; }; B4B1A4612BFA73110072E3BB /* WidgetHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetHelper.swift; sourceTree = ""; }; + B4D0B2612C1DEA11006B6B1B /* ReceivePageInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceivePageInterfaceController.swift; sourceTree = ""; }; + B4D0B2632C1DEA99006B6B1B /* ReceiveType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiveType.swift; sourceTree = ""; }; + B4D0B2652C1DEB7F006B6B1B /* ReceiveInterfaceMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiveInterfaceMode.swift; sourceTree = ""; }; + B4D0B2672C1DED67006B6B1B /* ReceiveMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiveMethod.swift; sourceTree = ""; }; B4D3235A177F4580BA52F2F9 /* libRNCSlider.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNCSlider.a; sourceTree = ""; }; B642AFB13483418CAB6FF25E /* libRCTQRCodeLocalImage.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTQRCodeLocalImage.a; sourceTree = ""; }; B68F8552DD4428F64B11DCFB /* Pods-BlueWallet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BlueWallet.debug.xcconfig"; path = "Target Support Files/Pods-BlueWallet/Pods-BlueWallet.debug.xcconfig"; sourceTree = ""; }; @@ -484,7 +491,7 @@ files = ( 782F075B5DD048449E2DECE9 /* libz.tbd in Frameworks */, 764B49B1420D4AEB8109BF62 /* libsqlite3.0.tbd in Frameworks */, - C978A716948AB7DEC5B6F677 /* BuildFile in Frameworks */, + C978A716948AB7DEC5B6F677 /* (null) in Frameworks */, 773E382FE62E836172AAB98B /* libPods-BlueWallet.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -518,6 +525,7 @@ files = ( B41B76852B66B2FF002C48D5 /* Bugsnag in Frameworks */, B41B76872B66B2FF002C48D5 /* BugsnagNetworkRequestPlugin in Frameworks */, + B48A6A292C1DF01000030AB9 /* KeychainSwift in Frameworks */, 6DFC807024EA0B6C007B8700 /* EFQRCode in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -771,7 +779,6 @@ children = ( 32F0A24F2310B0700095C559 /* BlueWalletWatch Extension.entitlements */, B43D03242258474500FBAA95 /* Objects */, - B40D4E672258426B00428FCC /* KeychainSwiftDistrib.swift */, 32F0A2992311DBB20095C559 /* ComplicationController.swift */, B40D4E43225841ED00428FCC /* ExtensionDelegate.swift */, B40D4E45225841ED00428FCC /* NotificationController.swift */, @@ -783,6 +790,7 @@ B40D4E5C2258425500428FCC /* WalletDetailsInterfaceController.swift */, B40D4E49225841ED00428FCC /* Info.plist */, B40D4E4A225841ED00428FCC /* PushNotificationPayload.apns */, + B4D0B2612C1DEA11006B6B1B /* ReceivePageInterfaceController.swift */, ); path = "BlueWalletWatch Extension"; sourceTree = ""; @@ -828,6 +836,9 @@ B43D0377225847C500FBAA95 /* WalletInformation.swift */, B43D0373225847C500FBAA95 /* WatchDataSource.swift */, 849047C92702A32A008EE567 /* Handoff.swift */, + B4D0B2632C1DEA99006B6B1B /* ReceiveType.swift */, + B4D0B2652C1DEB7F006B6B1B /* ReceiveInterfaceMode.swift */, + B4D0B2672C1DED67006B6B1B /* ReceiveMethod.swift */, ); path = Objects; sourceTree = ""; @@ -1021,6 +1032,7 @@ 6DFC806F24EA0B6C007B8700 /* EFQRCode */, B41B76842B66B2FF002C48D5 /* Bugsnag */, B41B76862B66B2FF002C48D5 /* BugsnagNetworkRequestPlugin */, + B48A6A282C1DF01000030AB9 /* KeychainSwift */, ); productName = "BlueWalletWatch Extension"; productReference = B40D4E3C225841ED00428FCC /* BlueWalletWatch Extension.appex */; @@ -1157,8 +1169,9 @@ ); mainGroup = 83CBB9F61A601CBA00E9B192; packageReferences = ( - 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode.git" */, + 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode" */, B41B76832B66B2FF002C48D5 /* XCRemoteSwiftPackageReference "bugsnag-cocoa" */, + B48A6A272C1DF01000030AB9 /* XCRemoteSwiftPackageReference "keychain-swift" */, ); productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; projectDirPath = ""; @@ -1616,10 +1629,12 @@ B43D037A225847C500FBAA95 /* Transaction.swift in Sources */, 32F0A29A2311DBB20095C559 /* ComplicationController.swift in Sources */, B40D4E602258425500428FCC /* SpecifyInterfaceController.swift in Sources */, + B4D0B2642C1DEA99006B6B1B /* ReceiveType.swift in Sources */, B43D0379225847C500FBAA95 /* WatchDataSource.swift in Sources */, B450109F2C0FCDA500619044 /* Utilities.swift in Sources */, B44033D42BCC368800162242 /* UserDefaultsGroupKey.swift in Sources */, B44034012BCC37F800162242 /* Bundle+decode.swift in Sources */, + B4D0B2682C1DED67006B6B1B /* ReceiveMethod.swift in Sources */, 849047CA2702A32A008EE567 /* Handoff.swift in Sources */, B44033EA2BCC371A00162242 /* MarketData.swift in Sources */, B44033CB2BCC350A00162242 /* Currency.swift in Sources */, @@ -1628,12 +1643,12 @@ B40D4E5D2258425500428FCC /* InterfaceController.swift in Sources */, B44033FA2BCC379200162242 /* WidgetDataStore.swift in Sources */, B44033DE2BCC36C300162242 /* LatestTransaction.swift in Sources */, + B4D0B2662C1DEB7F006B6B1B /* ReceiveInterfaceMode.swift in Sources */, B43D037B225847C500FBAA95 /* TransactionTableRow.swift in Sources */, B43D037D225847C500FBAA95 /* WalletInformation.swift in Sources */, 6D4AF15925D21172009DD853 /* MarketAPI.swift in Sources */, B40D4E642258425500428FCC /* WalletDetailsInterfaceController.swift in Sources */, B40D4E44225841ED00428FCC /* ExtensionDelegate.swift in Sources */, - B40D4E682258426B00428FCC /* KeychainSwiftDistrib.swift in Sources */, 6D4AF16D25D21192009DD853 /* Placeholders.swift in Sources */, B44033DB2BCC369B00162242 /* Colors.swift in Sources */, B40D4E632258425500428FCC /* ReceiveInterfaceController.swift in Sources */, @@ -1641,6 +1656,7 @@ B44033C02BCC32F800162242 /* BitcoinUnit.swift in Sources */, B44033E52BCC36FF00162242 /* WalletData.swift in Sources */, B44033EF2BCC374500162242 /* Numeric+abbreviated.swift in Sources */, + B4D0B2622C1DEA11006B6B1B /* ReceivePageInterfaceController.swift in Sources */, B44033D02BCC352F00162242 /* UserDefaultsGroup.swift in Sources */, B44033C52BCC332400162242 /* Balance.swift in Sources */, 6D4AF18425D215D1009DD853 /* UserDefaultsExtension.swift in Sources */, @@ -2252,7 +2268,7 @@ SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; - WATCHOS_DEPLOYMENT_TARGET = 6.0; + WATCHOS_DEPLOYMENT_TARGET = 7.0; }; name = Debug; }; @@ -2300,7 +2316,7 @@ SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; - WATCHOS_DEPLOYMENT_TARGET = 6.0; + WATCHOS_DEPLOYMENT_TARGET = 7.0; }; name = Release; }; @@ -2346,7 +2362,7 @@ SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 4; - WATCHOS_DEPLOYMENT_TARGET = 6.0; + WATCHOS_DEPLOYMENT_TARGET = 7.0; }; name = Debug; }; @@ -2392,7 +2408,7 @@ SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 4; - WATCHOS_DEPLOYMENT_TARGET = 6.0; + WATCHOS_DEPLOYMENT_TARGET = 7.0; }; name = Release; }; @@ -2670,7 +2686,7 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode.git" */ = { + 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/EFPrefix/EFQRCode.git"; requirement = { @@ -2686,12 +2702,20 @@ version = 6.28.1; }; }; + B48A6A272C1DF01000030AB9 /* XCRemoteSwiftPackageReference "keychain-swift" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/evgenyneu/keychain-swift.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 24.0.0; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ 6DFC806F24EA0B6C007B8700 /* EFQRCode */ = { isa = XCSwiftPackageProductDependency; - package = 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode.git" */; + package = 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode" */; productName = EFQRCode; }; B41B76842B66B2FF002C48D5 /* Bugsnag */ = { @@ -2704,7 +2728,12 @@ package = B41B76832B66B2FF002C48D5 /* XCRemoteSwiftPackageReference "bugsnag-cocoa" */; productName = BugsnagNetworkRequestPlugin; }; + B48A6A282C1DF01000030AB9 /* KeychainSwift */ = { + isa = XCSwiftPackageProductDependency; + package = B48A6A272C1DF01000030AB9 /* XCRemoteSwiftPackageReference "keychain-swift" */; + productName = KeychainSwift; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} +} \ No newline at end of file diff --git a/ios/BlueWallet.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ios/BlueWallet.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000000..dc603f84c1 --- /dev/null +++ b/ios/BlueWallet.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,42 @@ +{ + "originHash" : "52530e6b1e3a85c8854952ef703a6d1bbe1acd82713be2b3166476b9b277db23", + "pins" : [ + { + "identity" : "bugsnag-cocoa", + "kind" : "remoteSourceControl", + "location" : "https://github.com/bugsnag/bugsnag-cocoa", + "state" : { + "revision" : "16b9145fc66e5296f16e733f6feb5d0e450574e8", + "version" : "6.28.1" + } + }, + { + "identity" : "efqrcode", + "kind" : "remoteSourceControl", + "location" : "https://github.com/EFPrefix/EFQRCode.git", + "state" : { + "revision" : "2991c2f318ad9529d93b2a73a382a3f9c72c64ce", + "version" : "6.2.2" + } + }, + { + "identity" : "keychain-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/evgenyneu/keychain-swift.git", + "state" : { + "revision" : "5e1b02b6a9dac2a759a1d5dbc175c86bd192a608", + "version" : "24.0.0" + } + }, + { + "identity" : "swift_qrcodejs", + "kind" : "remoteSourceControl", + "location" : "https://github.com/ApolloZhu/swift_qrcodejs.git", + "state" : { + "revision" : "374dc7f7b9e76c6aeb393f6a84590c6d387e1ecb", + "version" : "2.2.2" + } + } + ], + "version" : 3 +} diff --git a/ios/BlueWalletWatch Extension/InterfaceController.swift b/ios/BlueWalletWatch Extension/InterfaceController.swift index 1ae3e2f662..d6eedb1643 100644 --- a/ios/BlueWalletWatch Extension/InterfaceController.swift +++ b/ios/BlueWalletWatch Extension/InterfaceController.swift @@ -15,9 +15,7 @@ class InterfaceController: WKInterfaceController, WCSessionDelegate { @IBOutlet weak var noWalletsAvailableLabel: WKInterfaceLabel! override func awake(withContext context: Any?) { - super.awake(withContext: context) setupSession() - processContextData(context) } override func willActivate() { @@ -59,18 +57,20 @@ class InterfaceController: WKInterfaceController, WCSessionDelegate { override func contextForSegue(withIdentifier segueIdentifier: String, in table: WKInterfaceTable, rowIndex: Int) -> Any? { return rowIndex } - + func session(_ session: WCSession, didReceiveApplicationContext applicationContext: [String : Any]) { WatchDataSource.shared.processData(data: applicationContext) } + + func session(_ session: WCSession, didReceiveUserInfo userInfo: [String : Any] = [:]) { WatchDataSource.shared.processData(data: userInfo) } func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { if activationState == .activated { - WatchDataSource.shared.processWalletsData(walletsInfo: WCSession.default.applicationContext) + WatchDataSource.shared.loadKeychainData() } } @@ -78,8 +78,4 @@ class InterfaceController: WKInterfaceController, WCSessionDelegate { WatchDataSource.shared.processData(data: message) } - override func didDeactivate() { - WCSession.default.activate() - } - } diff --git a/ios/BlueWalletWatch Extension/Objects/ReceiveInterfaceMode.swift b/ios/BlueWalletWatch Extension/Objects/ReceiveInterfaceMode.swift new file mode 100644 index 0000000000..3daf911f76 --- /dev/null +++ b/ios/BlueWalletWatch Extension/Objects/ReceiveInterfaceMode.swift @@ -0,0 +1,13 @@ +// +// ReceiveInterfaceMode.swift +// BlueWalletWatch Extension +// +// Created by Marcos Rodriguez on 6/15/24. +// Copyright © 2024 BlueWallet. All rights reserved. +// + +import Foundation + +enum ReceiveInterfaceMode { + case Address, QRCode +} diff --git a/ios/BlueWalletWatch Extension/Objects/ReceiveMethod.swift b/ios/BlueWalletWatch Extension/Objects/ReceiveMethod.swift new file mode 100644 index 0000000000..ea7c29ebe9 --- /dev/null +++ b/ios/BlueWalletWatch Extension/Objects/ReceiveMethod.swift @@ -0,0 +1,13 @@ +// +// ReceiveMethod.swift +// BlueWalletWatch Extension +// +// Created by Marcos Rodriguez on 6/15/24. +// Copyright © 2024 BlueWallet. All rights reserved. +// + +import Foundation + +enum ReceiveMethod { + case Onchain, CreateInvoice +} diff --git a/ios/BlueWalletWatch Extension/Objects/ReceiveType.swift b/ios/BlueWalletWatch Extension/Objects/ReceiveType.swift new file mode 100644 index 0000000000..119bedc2d8 --- /dev/null +++ b/ios/BlueWalletWatch Extension/Objects/ReceiveType.swift @@ -0,0 +1,13 @@ +// +// ReceiveType.swift +// BlueWalletWatch Extension +// +// Created by Marcos Rodriguez on 6/15/24. +// Copyright © 2024 BlueWallet. All rights reserved. +// + +import Foundation + +enum ReceiveType { + case Address, PaymentCode +} diff --git a/ios/BlueWalletWatch Extension/Objects/Transaction.swift b/ios/BlueWalletWatch Extension/Objects/Transaction.swift index 6db26b74e9..e0d0925275 100644 --- a/ios/BlueWalletWatch Extension/Objects/Transaction.swift +++ b/ios/BlueWalletWatch Extension/Objects/Transaction.swift @@ -8,7 +8,9 @@ import Foundation -class Transaction: NSObject, NSCoding { +class Transaction: NSObject, NSSecureCoding { + static var supportsSecureCoding: Bool = true + static let identifier: String = "Transaction" let time: String diff --git a/ios/BlueWalletWatch Extension/Objects/Wallet.swift b/ios/BlueWalletWatch Extension/Objects/Wallet.swift index 62e5418922..7b4f44fc37 100644 --- a/ios/BlueWalletWatch Extension/Objects/Wallet.swift +++ b/ios/BlueWalletWatch Extension/Objects/Wallet.swift @@ -8,11 +8,10 @@ import Foundation -enum InterfaceMode { - case Address, QRCode -} +class Wallet: NSObject, NSSecureCoding { + + static var supportsSecureCoding: Bool = true -class Wallet: NSObject, NSCoding { static let identifier: String = "Wallet" var identifier: Int? @@ -24,8 +23,9 @@ class Wallet: NSObject, NSCoding { let transactions: [Transaction] let xpub: String? let hideBalance: Bool + let paymentCode: String? - init(label: String, balance: String, type: String, preferredBalanceUnit: String, receiveAddress: String, transactions: [Transaction], identifier: Int, xpub: String?, hideBalance: Bool = false) { + init(label: String, balance: String, type: String, preferredBalanceUnit: String, receiveAddress: String, transactions: [Transaction], identifier: Int, xpub: String?, hideBalance: Bool = false, paymentCode: String?) { self.label = label self.balance = balance self.type = type @@ -35,6 +35,7 @@ class Wallet: NSObject, NSCoding { self.identifier = identifier self.xpub = xpub self.hideBalance = hideBalance + self.paymentCode = paymentCode } func encode(with aCoder: NSCoder) { @@ -47,6 +48,7 @@ class Wallet: NSObject, NSCoding { aCoder.encode(identifier, forKey: "identifier") aCoder.encode(xpub, forKey: "xpub") aCoder.encode(hideBalance, forKey: "hideBalance") + aCoder.encode(paymentCode, forKey: "paymentCode") } required init?(coder aDecoder: NSCoder) { @@ -58,6 +60,7 @@ class Wallet: NSObject, NSCoding { transactions = aDecoder.decodeObject(forKey: "transactions") as? [Transaction] ?? [Transaction]() xpub = aDecoder.decodeObject(forKey: "xpub") as? String hideBalance = aDecoder.decodeObject(forKey: "hideBalance") as? Bool ?? false + paymentCode = aDecoder.decodeObject(forKey: "paymentCode") as? String } } diff --git a/ios/BlueWalletWatch Extension/Objects/WatchDataSource.swift b/ios/BlueWalletWatch Extension/Objects/WatchDataSource.swift index 6ddfa10ce0..3a29a7008d 100644 --- a/ios/BlueWalletWatch Extension/Objects/WatchDataSource.swift +++ b/ios/BlueWalletWatch Extension/Objects/WatchDataSource.swift @@ -9,6 +9,7 @@ import Foundation import WatchConnectivity +import KeychainSwift class WatchDataSource: NSObject { struct NotificationName { @@ -27,8 +28,12 @@ class WatchDataSource: NSObject { override init() { super.init() - if let existingData = keychain.getData(Wallet.identifier), let walletData = ((try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(existingData) as? [Wallet]) as [Wallet]??) { - guard let walletData = walletData, walletData != self.wallets else { return } + loadKeychainData() + } + + func loadKeychainData() { + if let existingData = keychain.getData(Wallet.identifier), let walletData = try? NSKeyedUnarchiver.unarchivedArrayOfObjects(ofClass: Wallet.self, from: existingData) { + guard walletData != self.wallets else { return } wallets = walletData WatchDataSource.postDataUpdatedNotification() } @@ -38,7 +43,7 @@ class WatchDataSource: NSObject { if let walletsToProcess = walletsInfo["wallets"] as? [[String: Any]] { wallets.removeAll(); for (index, entry) in walletsToProcess.enumerated() { - guard let label = entry["label"] as? String, let balance = entry["balance"] as? String, let type = entry["type"] as? String, let preferredBalanceUnit = entry["preferredBalanceUnit"] as? String, let transactions = entry["transactions"] as? [[String: Any]] else { + guard let label = entry["label"] as? String, let balance = entry["balance"] as? String, let type = entry["type"] as? String, let preferredBalanceUnit = entry["preferredBalanceUnit"] as? String, let transactions = entry["transactions"] as? [[String: Any]], let paymentCode = entry["paymentCode"] as? String else { continue } @@ -51,7 +56,7 @@ class WatchDataSource: NSObject { let receiveAddress = entry["receiveAddress"] as? String ?? "" let xpub = entry["xpub"] as? String ?? "" let hideBalance = entry["hideBalance"] as? Bool ?? false - let wallet = Wallet(label: label, balance: balance, type: type, preferredBalanceUnit: preferredBalanceUnit, receiveAddress: receiveAddress, transactions: transactionsProcessed, identifier: index, xpub: xpub, hideBalance: hideBalance) + let wallet = Wallet(label: label, balance: balance, type: type, preferredBalanceUnit: preferredBalanceUnit, receiveAddress: receiveAddress, transactions: transactionsProcessed, identifier: index, xpub: xpub, hideBalance: hideBalance, paymentCode: paymentCode) wallets.append(wallet) } diff --git a/ios/BlueWalletWatch Extension/ReceiveInterfaceController.swift b/ios/BlueWalletWatch Extension/ReceiveInterfaceController.swift index f34ea0151e..311a6f91ca 100644 --- a/ios/BlueWalletWatch Extension/ReceiveInterfaceController.swift +++ b/ios/BlueWalletWatch Extension/ReceiveInterfaceController.swift @@ -9,17 +9,13 @@ import WatchConnectivity import Foundation import EFQRCode -import WatchKit -import WatchConnectivity -import Foundation -import EFQRCode - class ReceiveInterfaceController: WKInterfaceController { static let identifier = "ReceiveInterfaceController" private var wallet: Wallet? - private var receiveMethod: String = "receive" - private var interfaceMode: InterfaceMode = .Address + private var receiveMethod: ReceiveMethod = .Onchain + private var interfaceMode: ReceiveInterfaceMode = .Address + var receiveType: ReceiveType = .Address @IBOutlet weak var addressLabel: WKInterfaceLabel! @IBOutlet weak var loadingIndicator: WKInterfaceGroup! @IBOutlet weak var imageInterface: WKInterfaceImage! @@ -35,18 +31,19 @@ class ReceiveInterfaceController: WKInterfaceController { override func awake(withContext context: Any?) { super.awake(withContext: context) - guard let passedContext = context as? (Int, String) else { + guard let passedContext = context as? (Int, ReceiveMethod, ReceiveType) else { pop() return } let wallet = WatchDataSource.shared.wallets[passedContext.0] self.wallet = wallet receiveMethod = passedContext.1 + receiveType = passedContext.2 setupView() } private func setupView() { - if receiveMethod == "createInvoice" && (wallet?.type == WalletGradient.LightningCustodial.rawValue || wallet?.type == WalletGradient.LightningLDK.rawValue) { + if receiveMethod == .CreateInvoice && (wallet?.type == WalletGradient.LightningCustodial.rawValue || wallet?.type == WalletGradient.LightningLDK.rawValue) { presentController(withName: SpecifyInterfaceController.identifier, context: wallet?.identifier) } else { setupQRCode() @@ -55,7 +52,7 @@ class ReceiveInterfaceController: WKInterfaceController { } private func setupQRCode() { - guard let address = wallet?.receiveAddress else { return } + guard let address = receiveType == .Address ? wallet?.receiveAddress : wallet?.paymentCode else { return } addressLabel.setText(address) generateQRCode(from: address) } @@ -95,7 +92,7 @@ class ReceiveInterfaceController: WKInterfaceController { } private func isCreatingInvoice() -> Bool { - return receiveMethod == "createInvoice" && (wallet?.type == WalletGradient.LightningCustodial.rawValue || wallet?.type == WalletGradient.LightningLDK.rawValue) + return receiveMethod == .CreateInvoice && (wallet?.type == WalletGradient.LightningCustodial.rawValue || wallet?.type == WalletGradient.LightningLDK.rawValue) } override func didDeactivate() { diff --git a/ios/BlueWalletWatch Extension/ReceivePageInterfaceController.swift b/ios/BlueWalletWatch Extension/ReceivePageInterfaceController.swift new file mode 100644 index 0000000000..fe55a41437 --- /dev/null +++ b/ios/BlueWalletWatch Extension/ReceivePageInterfaceController.swift @@ -0,0 +1,29 @@ +// +// ReceivePageViewController.swift +// BlueWalletWatch Extension +// +// Created by Marcos Rodriguez on 6/15/24. +// Copyright © 2024 BlueWallet. All rights reserved. +// + +import Foundation +import WatchKit + +class ReceivePageInterfaceController: WKInterfaceController { + static let identifier = "ReceivePageInterfaceController" + var pageNames = ["Address", "Payment Code"] + var pageControllers = ["ReceiveInterfaceController", "ReceiveInterfaceController"] + + override func awake(withContext context: Any?) { + super.awake(withContext: context) + + let wallet = context as? Wallet + + WKInterfaceController.reloadRootPageControllers( + withNames: pageControllers, + contexts: [(wallet,ReceiveMethod.Onchain , ReceiveType.Address), (wallet, ReceiveMethod.Onchain, ReceiveType.PaymentCode)], + orientation: .horizontal, + pageIndex: 0 + ) + } +} diff --git a/ios/BlueWalletWatch Extension/ViewQRCodefaceController.swift b/ios/BlueWalletWatch Extension/ViewQRCodefaceController.swift index f258784771..be326619d4 100644 --- a/ios/BlueWalletWatch Extension/ViewQRCodefaceController.swift +++ b/ios/BlueWalletWatch Extension/ViewQRCodefaceController.swift @@ -19,7 +19,7 @@ class ViewQRCodefaceController: WKInterfaceController { } } - private var interfaceMode = InterfaceMode.Address + private var interfaceMode = ReceiveInterfaceMode.Address private let userActivity: NSUserActivity = NSUserActivity(activityType: HandoffIdentifier.Xpub.rawValue) override func awake(withContext context: Any?) { diff --git a/ios/BlueWalletWatch Extension/WalletDetailsInterfaceController.swift b/ios/BlueWalletWatch Extension/WalletDetailsInterfaceController.swift index 285f467053..1dc2ba8da9 100644 --- a/ios/BlueWalletWatch Extension/WalletDetailsInterfaceController.swift +++ b/ios/BlueWalletWatch Extension/WalletDetailsInterfaceController.swift @@ -111,13 +111,13 @@ class WalletDetailsInterfaceController: WKInterfaceController { @IBAction func receiveMenuItemTapped() { guard let wallet = wallet else { return } - presentController(withName: ReceiveInterfaceController.identifier, context: (wallet, "receive")) + presentController(withName: ReceivePageInterfaceController.identifier, context: (wallet, ReceiveMethod.Onchain)) } @IBAction func createInvoiceTapped() { if WatchDataSource.shared.companionWalletsInitialized { guard let wallet = wallet else { return } - pushController(withName: ReceiveInterfaceController.identifier, context: (wallet.identifier, "createInvoice")) + pushController(withName: ReceiveInterfaceController.identifier, context: (wallet.identifier, ReceiveMethod.CreateInvoice)) } else { WKInterfaceDevice.current().play(.failure) presentAlert(withTitle: "Error", message: "Unable to create invoice. Please open GRS BlueWallet on your iPhone and unlock your wallets.", preferredStyle: .alert, actions: [WKAlertAction(title: "OK", style: .default, handler: { [weak self] in @@ -128,7 +128,7 @@ class WalletDetailsInterfaceController: WKInterfaceController { override func contextForSegue(withIdentifier segueIdentifier: String) -> Any? { guard let wallet = wallet else { return nil } - return (wallet.identifier, "receive") + return (wallet.identifier, ReceiveMethod.Onchain) } } diff --git a/ios/BlueWalletWatch/Base.lproj/Interface.storyboard b/ios/BlueWalletWatch/Base.lproj/Interface.storyboard index fec3f25193..fc02c64343 100644 --- a/ios/BlueWalletWatch/Base.lproj/Interface.storyboard +++ b/ios/BlueWalletWatch/Base.lproj/Interface.storyboard @@ -1,10 +1,9 @@ - + - - + @@ -227,6 +226,13 @@ + + + + + + + diff --git a/ios/KeychainSwiftDistrib.swift b/ios/KeychainSwiftDistrib.swift deleted file mode 100644 index 6287bcf828..0000000000 --- a/ios/KeychainSwiftDistrib.swift +++ /dev/null @@ -1,454 +0,0 @@ -// -// Keychain helper for iOS/Swift. -// -// https://github.com/evgenyneu/keychain-swift -// -// This file was automatically generated by combining multiple Swift source files. -// - - -// ---------------------------- -// -// KeychainSwift.swift -// -// ---------------------------- - -import Security -import Foundation - -/** - -A collection of helper functions for saving text and data in the keychain. - -*/ -open class KeychainSwift { - - var lastQueryParameters: [String: Any]? // Used by the unit tests - - /// Contains result code from the last operation. Value is noErr (0) for a successful result. - open var lastResultCode: OSStatus = noErr - - var keyPrefix = "" // Can be useful in test. - - /** - - Specify an access group that will be used to access keychain items. Access groups can be used to share keychain items between applications. When access group value is nil all application access groups are being accessed. Access group name is used by all functions: set, get, delete and clear. - - */ - open var accessGroup: String? - - - /** - - Specifies whether the items can be synchronized with other devices through iCloud. Setting this property to true will - add the item to other devices with the `set` method and obtain synchronizable items with the `get` command. Deleting synchronizable items will remove them from all devices. In order for keychain synchronization to work the user must enable "Keychain" in iCloud settings. - - Does not work on macOS. - - */ - open var synchronizable: Bool = false - - private let readLock = NSLock() - - /// Instantiate a KeychainSwift object - public init() { } - - /** - - - parameter keyPrefix: a prefix that is added before the key in get/set methods. Note that `clear` method still clears everything from the Keychain. - - */ - public init(keyPrefix: String) { - self.keyPrefix = keyPrefix - } - - /** - - Stores the text value in the keychain item under the given key. - - - parameter key: Key under which the text value is stored in the keychain. - - parameter value: Text string to be written to the keychain. - - parameter withAccess: Value that indicates when your app needs access to the text in the keychain item. By default the .AccessibleWhenUnlocked option is used that permits the data to be accessed only while the device is unlocked by the user. - - - returns: True if the text was successfully written to the keychain. - - */ - @discardableResult - open func set(_ value: String, forKey key: String, - withAccess access: KeychainSwiftAccessOptions? = nil) -> Bool { - - if let value = value.data(using: String.Encoding.utf8) { - return set(value, forKey: key, withAccess: access) - } - - return false - } - - /** - - Stores the data in the keychain item under the given key. - - - parameter key: Key under which the data is stored in the keychain. - - parameter value: Data to be written to the keychain. - - parameter withAccess: Value that indicates when your app needs access to the text in the keychain item. By default the .AccessibleWhenUnlocked option is used that permits the data to be accessed only while the device is unlocked by the user. - - - returns: True if the text was successfully written to the keychain. - - */ - @discardableResult - open func set(_ value: Data, forKey key: String, - withAccess access: KeychainSwiftAccessOptions? = nil) -> Bool { - - delete(key) // Delete any existing key before saving it - - let accessible = access?.value ?? KeychainSwiftAccessOptions.defaultOption.value - - let prefixedKey = keyWithPrefix(key) - - var query: [String : Any] = [ - KeychainSwiftConstants.klass : kSecClassGenericPassword, - KeychainSwiftConstants.attrAccount : prefixedKey, - KeychainSwiftConstants.valueData : value, - KeychainSwiftConstants.accessible : accessible - ] - - query = addAccessGroupWhenPresent(query) - query = addSynchronizableIfRequired(query, addingItems: true) - lastQueryParameters = query - - lastResultCode = SecItemAdd(query as CFDictionary, nil) - - return lastResultCode == noErr - } - - /** - - Stores the boolean value in the keychain item under the given key. - - - parameter key: Key under which the value is stored in the keychain. - - parameter value: Boolean to be written to the keychain. - - parameter withAccess: Value that indicates when your app needs access to the value in the keychain item. By default the .AccessibleWhenUnlocked option is used that permits the data to be accessed only while the device is unlocked by the user. - - - returns: True if the value was successfully written to the keychain. - - */ - @discardableResult - open func set(_ value: Bool, forKey key: String, - withAccess access: KeychainSwiftAccessOptions? = nil) -> Bool { - - let bytes: [UInt8] = value ? [1] : [0] - let data = Data(bytes) - - return set(data, forKey: key, withAccess: access) - } - - /** - - Retrieves the text value from the keychain that corresponds to the given key. - - - parameter key: The key that is used to read the keychain item. - - returns: The text value from the keychain. Returns nil if unable to read the item. - - */ - open func get(_ key: String) -> String? { - if let data = getData(key) { - - if let currentString = String(data: data, encoding: .utf8) { - return currentString - } - - lastResultCode = -67853 // errSecInvalidEncoding - } - - return nil - } - - /** - - Retrieves the data from the keychain that corresponds to the given key. - - - parameter key: The key that is used to read the keychain item. - - returns: The text value from the keychain. Returns nil if unable to read the item. - - */ - open func getData(_ key: String) -> Data? { - // The lock prevents the code to be run simlultaneously - // from multiple threads which may result in crashing - readLock.lock() - defer { readLock.unlock() } - - let prefixedKey = keyWithPrefix(key) - - var query: [String: Any] = [ - KeychainSwiftConstants.klass : kSecClassGenericPassword, - KeychainSwiftConstants.attrAccount : prefixedKey, - KeychainSwiftConstants.returnData : kCFBooleanTrue!, - KeychainSwiftConstants.matchLimit : kSecMatchLimitOne - ] - - query = addAccessGroupWhenPresent(query) - query = addSynchronizableIfRequired(query, addingItems: false) - lastQueryParameters = query - - var result: AnyObject? - - lastResultCode = withUnsafeMutablePointer(to: &result) { - SecItemCopyMatching(query as CFDictionary, UnsafeMutablePointer($0)) - } - - if lastResultCode == noErr { return result as? Data } - - return nil - } - - /** - - Retrieves the boolean value from the keychain that corresponds to the given key. - - - parameter key: The key that is used to read the keychain item. - - returns: The boolean value from the keychain. Returns nil if unable to read the item. - - */ - open func getBool(_ key: String) -> Bool? { - guard let data = getData(key) else { return nil } - guard let firstBit = data.first else { return nil } - return firstBit == 1 - } - - /** - - Deletes the single keychain item specified by the key. - - - parameter key: The key that is used to delete the keychain item. - - returns: True if the item was successfully deleted. - - */ - @discardableResult - open func delete(_ key: String) -> Bool { - let prefixedKey = keyWithPrefix(key) - - var query: [String: Any] = [ - KeychainSwiftConstants.klass : kSecClassGenericPassword, - KeychainSwiftConstants.attrAccount : prefixedKey - ] - - query = addAccessGroupWhenPresent(query) - query = addSynchronizableIfRequired(query, addingItems: false) - lastQueryParameters = query - - lastResultCode = SecItemDelete(query as CFDictionary) - - return lastResultCode == noErr - } - - /** - - Deletes all Keychain items used by the app. Note that this method deletes all items regardless of the prefix settings used for initializing the class. - - - returns: True if the keychain items were successfully deleted. - - */ - @discardableResult - open func clear() -> Bool { - var query: [String: Any] = [ kSecClass as String : kSecClassGenericPassword ] - query = addAccessGroupWhenPresent(query) - query = addSynchronizableIfRequired(query, addingItems: false) - lastQueryParameters = query - - lastResultCode = SecItemDelete(query as CFDictionary) - - return lastResultCode == noErr - } - - /// Returns the key with currently set prefix. - func keyWithPrefix(_ key: String) -> String { - return "\(keyPrefix)\(key)" - } - - func addAccessGroupWhenPresent(_ items: [String: Any]) -> [String: Any] { - guard let accessGroup = accessGroup else { return items } - - var result: [String: Any] = items - result[KeychainSwiftConstants.accessGroup] = accessGroup - return result - } - - /** - - Adds kSecAttrSynchronizable: kSecAttrSynchronizableAny` item to the dictionary when the `synchronizable` property is true. - - - parameter items: The dictionary where the kSecAttrSynchronizable items will be added when requested. - - parameter addingItems: Use `true` when the dictionary will be used with `SecItemAdd` method (adding a keychain item). For getting and deleting items, use `false`. - - - returns: the dictionary with kSecAttrSynchronizable item added if it was requested. Otherwise, it returns the original dictionary. - - */ - func addSynchronizableIfRequired(_ items: [String: Any], addingItems: Bool) -> [String: Any] { - if !synchronizable { return items } - var result: [String: Any] = items - result[KeychainSwiftConstants.attrSynchronizable] = addingItems == true ? true : kSecAttrSynchronizableAny - return result - } -} - - -// ---------------------------- -// -// TegKeychainConstants.swift -// -// ---------------------------- - -import Foundation -import Security - -/// Constants used by the library -public struct KeychainSwiftConstants { - /// Specifies a Keychain access group. Used for sharing Keychain items between apps. - public static var accessGroup: String { return toString(kSecAttrAccessGroup) } - - /** - - A value that indicates when your app needs access to the data in a keychain item. The default value is AccessibleWhenUnlocked. For a list of possible values, see KeychainSwiftAccessOptions. - - */ - public static var accessible: String { return toString(kSecAttrAccessible) } - - /// Used for specifying a String key when setting/getting a Keychain value. - public static var attrAccount: String { return toString(kSecAttrAccount) } - - /// Used for specifying synchronization of keychain items between devices. - public static var attrSynchronizable: String { return toString(kSecAttrSynchronizable) } - - /// An item class key used to construct a Keychain search dictionary. - public static var klass: String { return toString(kSecClass) } - - /// Specifies the number of values returned from the keychain. The library only supports single values. - public static var matchLimit: String { return toString(kSecMatchLimit) } - - /// A return data type used to get the data from the Keychain. - public static var returnData: String { return toString(kSecReturnData) } - - /// Used for specifying a value when setting a Keychain value. - public static var valueData: String { return toString(kSecValueData) } - - static func toString(_ value: CFString) -> String { - return value as String - } -} - - -// ---------------------------- -// -// KeychainSwiftAccessOptions.swift -// -// ---------------------------- - -import Security - -/** - -These options are used to determine when a keychain item should be readable. The default value is AccessibleWhenUnlocked. - -*/ -public enum KeychainSwiftAccessOptions { - - /** - - The data in the keychain item can be accessed only while the device is unlocked by the user. - - This is recommended for items that need to be accessible only while the application is in the foreground. Items with this attribute migrate to a new device when using encrypted backups. - - This is the default value for keychain items added without explicitly setting an accessibility constant. - - */ - case accessibleWhenUnlocked - - /** - - The data in the keychain item can be accessed only while the device is unlocked by the user. - - This is recommended for items that need to be accessible only while the application is in the foreground. Items with this attribute do not migrate to a new device. Thus, after restoring from a backup of a different device, these items will not be present. - - */ - case accessibleWhenUnlockedThisDeviceOnly - - /** - - The data in the keychain item cannot be accessed after a restart until the device has been unlocked once by the user. - - After the first unlock, the data remains accessible until the next restart. This is recommended for items that need to be accessed by background applications. Items with this attribute migrate to a new device when using encrypted backups. - - */ - case accessibleAfterFirstUnlock - - /** - - The data in the keychain item cannot be accessed after a restart until the device has been unlocked once by the user. - - After the first unlock, the data remains accessible until the next restart. This is recommended for items that need to be accessed by background applications. Items with this attribute do not migrate to a new device. Thus, after restoring from a backup of a different device, these items will not be present. - - */ - case accessibleAfterFirstUnlockThisDeviceOnly - - /** - - The data in the keychain item can always be accessed regardless of whether the device is locked. - - This is not recommended for application use. Items with this attribute migrate to a new device when using encrypted backups. - - */ - case accessibleAlways - - /** - - The data in the keychain can only be accessed when the device is unlocked. Only available if a passcode is set on the device. - - This is recommended for items that only need to be accessible while the application is in the foreground. Items with this attribute never migrate to a new device. After a backup is restored to a new device, these items are missing. No items can be stored in this class on devices without a passcode. Disabling the device passcode causes all items in this class to be deleted. - - */ - case accessibleWhenPasscodeSetThisDeviceOnly - - /** - - The data in the keychain item can always be accessed regardless of whether the device is locked. - - This is not recommended for application use. Items with this attribute do not migrate to a new device. Thus, after restoring from a backup of a different device, these items will not be present. - - */ - case accessibleAlwaysThisDeviceOnly - - static var defaultOption: KeychainSwiftAccessOptions { - return .accessibleWhenUnlocked - } - - var value: String { - switch self { - case .accessibleWhenUnlocked: - return toString(kSecAttrAccessibleWhenUnlocked) - - case .accessibleWhenUnlockedThisDeviceOnly: - return toString(kSecAttrAccessibleWhenUnlockedThisDeviceOnly) - - case .accessibleAfterFirstUnlock: - return toString(kSecAttrAccessibleAfterFirstUnlock) - - case .accessibleAfterFirstUnlockThisDeviceOnly: - return toString(kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly) - - case .accessibleAlways: - return toString(kSecAttrAccessibleAlways) - - case .accessibleWhenPasscodeSetThisDeviceOnly: - return toString(kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly) - - case .accessibleAlwaysThisDeviceOnly: - return toString(kSecAttrAccessibleAlwaysThisDeviceOnly) - } - } - - func toString(_ value: CFString) -> String { - return KeychainSwiftConstants.toString(value) - } -} - - diff --git a/ios/Podfile b/ios/Podfile index 7627902a8a..5bbafa5ec8 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -79,7 +79,7 @@ post_install do |installer| ) installer.pods_project.targets.each do |target| target.build_configurations.each do |config| - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.4' if ['React-Core-AccessibilityResources'].include? target.name config.build_settings['CODE_SIGN_STYLE'] = "Manual" config.build_settings['CODE_SIGN_IDENTITY'] = "Apple Distribution: Programio DMCC LLC (CMG3V3T59A)" diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1197984431..b8acce3a80 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -343,7 +343,7 @@ PODS: - React - react-native-randombytes (3.6.1): - React-Core - - react-native-safe-area-context (4.10.4): + - react-native-safe-area-context (4.10.5): - React-Core - react-native-secure-key-store (2.0.10): - React-Core @@ -462,7 +462,7 @@ PODS: - React-perflogger (= 0.72.14) - ReactNativeCameraKit (13.0.0): - React-Core - - RealmJS (12.9.0): + - RealmJS (12.10.0): - React - rn-ldk (0.8.4): - React-Core @@ -803,7 +803,7 @@ SPEC CHECKSUMS: react-native-ios-context-menu: e529171ba760a1af7f2ef0729f5a7f4d226171c5 react-native-qrcode-local-image: 35ccb306e4265bc5545f813e54cc830b5d75bcfc react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846 - react-native-safe-area-context: 399a5859f6acbdf67f671c69b53113f535f3b5b0 + react-native-safe-area-context: a240ad4b683349e48b1d51fed1611138d1bdad97 react-native-secure-key-store: 910e6df6bc33cb790aba6ee24bc7818df1fe5898 react-native-tcp-socket: e724380c910c2e704816ec817ed28f1342246ff7 React-NativeModulesApple: 3107f777453f953906d9ba9dc5f8cbd91a6ef913 @@ -824,7 +824,7 @@ SPEC CHECKSUMS: React-utils: 22a77b05da25ce49c744faa82e73856dcae1734e ReactCommon: ff94462e007c568d8cdebc32e3c97af86ec93bb5 ReactNativeCameraKit: 9d46a5d7dd544ca64aa9c03c150d2348faf437eb - RealmJS: 7aa0e7dcc8959d28cee3ab302415a8893e50ad12 + RealmJS: f86da4f2c5b089d976db335f370449903ddc8fbb rn-ldk: 0d8749d98cc5ce67302a32831818c116b67f7643 RNCAsyncStorage: 826b603ae9c0f88b5ac4e956801f755109fa4d5c RNCClipboard: 0a720adef5ec193aa0e3de24c3977222c7e52a37 @@ -850,6 +850,6 @@ SPEC CHECKSUMS: SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Yoga: c32e0be1a17f8f1f0e633a3122f7666441f52c82 -PODFILE CHECKSUM: d43800c8d806b1d14ba325886c4b71fff2938408 +PODFILE CHECKSUM: f19eea438501edfe85fb2fa51d40ba1b57540758 COCOAPODS: 1.14.3 diff --git a/loc/de_de.json b/loc/de_de.json index 6acc721216..c2ef638cba 100644 --- a/loc/de_de.json +++ b/loc/de_de.json @@ -43,7 +43,8 @@ "entropy": { "save": "Speichern", "title": "Entropie", - "undo": "Zurück" + "undo": "Zurück", + "amountOfEntropy": "{bits} von {limit} Bits" }, "errors": { "broadcast": "Übertragung fehlgeschlagen", @@ -126,7 +127,8 @@ "maxSatsFull": "Der größtmögliche Betrag ist {max} gros oder {currency}", "minSats": "Der kleinstmögliche Betrag ist {min} gros", "minSatsFull": "Der kleinstmögliche Betrag ist {min} gros oder {currency}", - "qrcode_for_the_address": "QR-Code für die Adresse" + "qrcode_for_the_address": "QR-Code für die Adresse", + "bip47_explanation": "Zahlungscodes sind eine universelle Adresse. Sie vermeiden die Offenlegung der Wallet-Adressen, werden aber nicht durch alle Dienste unterstützt." }, "send": { "provided_address_is_invoice": "Diese Adresse ist für eine Lightning-Rechnung. Um diese Rechnung zu zahlen ist ein Lightning Wallet zu verwenden.", @@ -148,6 +150,7 @@ "create_to": "An", "create_tx_size": "Transaktionsgröße", "create_verify": "Verifiziere auf webwallet", + "details_insert_contact": "Kontakt einfügen", "details_add_rec_add": "Empfänger hinzufügen", "details_add_rec_rem": "Empfänger entfernen", "details_address": "Adresse", @@ -385,6 +388,8 @@ "add_bitcoin": "Groestlcoin", "add_bitcoin_explain": "Einfache und leistungsstarke Groestlcoin Wallet", "add_create": "Erstellen", + "add_entropy": "Entropie", + "add_entropy_bytes": "{bytes} Bytes Entropie", "add_entropy_generated": "{gen} Bytes an generierter Entropie ", "add_entropy_provide": "Entropie selbst erzeugen", "add_entropy_remain": "{gen} Bytes an generierter Entropie. Die restlichen {rem} Bytes werden vom Zufallsgenerator des Systems ergänzt.", @@ -398,6 +403,10 @@ "add_title": "Wallet hinzufügen", "add_wallet_name": "Wallet Name", "add_wallet_type": "Typ", + "add_wallet_seed_length": "Seedlänge", + "add_wallet_seed_length_message": "Länge der Seed-Phrase für diese Wallet wählen.", + "add_wallet_seed_length_12": "12 Wörter", + "add_wallet_seed_length_24": "24 Wörter", "clipboard_bitcoin": "Willst Du die Groestlcoin Adresse in der Zwischenablage für eine Transaktion verwenden?", "clipboard_lightning": "Willst Du die Lightning Rechnung in der Zwischenablage für eine Transaktion verwenden?", "details_address": "Adresse", @@ -419,6 +428,7 @@ "details_show_xpub": "Wallet xPub zeigen", "details_show_addresses": "Adressen anzeigen", "details_title": "Wallet", + "wallets": "Wallets", "details_type": "Typ", "details_use_with_hardware_wallet": "Hardware Wallet nutzen", "details_wallet_updated": "Wallet aktualisiert", @@ -620,13 +630,12 @@ }, "bip47": { "payment_code": "Zahlungscode", - "my_payment_code": "Mein Zahlungscode", "contacts": "Kontakte", "purpose": "Wiederverwendbarer und teilbarer Code (BIP47)", "pay_this_contact": "An diesen Kontakt zahlen", "rename_contact": "Kontakt umbenennen", "copy_payment_code": "Zahlungscode kopieren", - "copied": "Kopiert", + "hide_contact": "Kontakt ausblenden", "rename": "Umbenennen", "provide_name": "Neuer Kontaktnahme eingeben", "add_contact": "Kontakt hinzufügen", diff --git a/navigation/DetailViewScreensStack.tsx b/navigation/DetailViewScreensStack.tsx index b4403002e6..c9aab42499 100644 --- a/navigation/DetailViewScreensStack.tsx +++ b/navigation/DetailViewScreensStack.tsx @@ -1,7 +1,6 @@ import React, { useCallback, useMemo } from 'react'; import { NativeStackNavigationOptions } from '@react-navigation/native-stack'; -import { I18nManager, TouchableOpacity, View } from 'react-native'; -import { Icon } from '@rneui/themed'; +import { I18nManager, View } from 'react-native'; import { isDesktop } from '../blue_modules/environment'; import HeaderRightButton from '../components/HeaderRightButton'; import navigationStyle, { CloseButtonPosition } from '../components/navigationStyle'; @@ -66,6 +65,7 @@ import ViewEditMultisigCosignersStackRoot from './ViewEditMultisigCosignersStack import WalletExportStack from './WalletExportStack'; import WalletXpubStackRoot from './WalletXpubStack'; import PlusIcon from '../components/icons/PlusIcon'; +import SettingsButton from '../components/icons/SettingsButton'; const DetailViewStackScreensStack = () => { const theme = useTheme(); @@ -79,18 +79,11 @@ const DetailViewStackScreensStack = () => { }, [navigation]); const useWalletListScreenOptions = useMemo(() => { - const SettingsButton = ( + const RightBarButtons = ( <> - - navigation.navigate('Settings')} - > - - + + ); @@ -102,10 +95,10 @@ const DetailViewStackScreensStack = () => { headerStyle: { backgroundColor: theme.colors.customHeader, }, - headerRight: I18nManager.isRTL ? undefined : () => SettingsButton, - headerLeft: I18nManager.isRTL ? () => SettingsButton : undefined, + headerRight: I18nManager.isRTL ? undefined : () => RightBarButtons, + headerLeft: I18nManager.isRTL ? () => RightBarButtons : undefined, }; - }, [navigateToAddWallet, navigation, theme.colors.customHeader, theme.colors.foregroundColor, theme.colors.navigationBarColor]); + }, [navigateToAddWallet, theme.colors.customHeader, theme.colors.navigationBarColor]); const walletListScreenOptions = useWalletListScreenOptions; return ( @@ -168,6 +161,8 @@ const DetailViewStackScreensStack = () => { backgroundColor: theme.colors.customHeader, }, headerRight: () => DetailButton, + headerBackTitleStyle: { fontSize: 0 }, + headerBackTitleVisible: true, })(theme)} /> @@ -277,6 +272,7 @@ const DetailViewStackScreensStack = () => { headerBackTitleStyle: { fontSize: 0 }, headerBackTitleVisible: true, headerShadowVisible: false, + headerLargeTitle: true, animationTypeForReplace: 'push', })(theme)} /> @@ -350,7 +346,7 @@ const DetailViewStackScreensStack = () => { { export default DetailViewStackScreensStack; const styles = { - width28: { - width: 28, + width24: { + width: 24, }, }; diff --git a/package.json b/package.json index 283a1ae7b9..ae9bcf39d4 100644 --- a/package.json +++ b/package.json @@ -174,7 +174,7 @@ "react-native-randombytes": "3.6.1", "react-native-rate": "1.2.12", "react-native-reanimated": "3.11.0", - "react-native-safe-area-context": "4.10.4", + "react-native-safe-area-context": "4.10.5", "react-native-screens": "3.31.1", "react-native-secure-key-store": "https://github.com/BlueWallet/react-native-secure-key-store#2076b48", "react-native-share": "10.2.1", @@ -183,7 +183,7 @@ "react-native-vector-icons": "10.1.0", "react-native-watch-connectivity": "1.1.0", "readable-stream": "3.6.2", - "realm": "12.9.0", + "realm": "12.10.0", "rn-ldk": "github:BlueWallet/rn-ldk#v0.8.4", "rn-nodeify": "10.3.0", "scryptsy": "2.1.0", diff --git a/screen/send/coinControl.js b/screen/send/coinControl.js index 343ed0820e..f05df843d3 100644 --- a/screen/send/coinControl.js +++ b/screen/send/coinControl.js @@ -84,11 +84,13 @@ const OutputList = ({ return ( - {amount} diff --git a/screen/wallets/PaymentCodesList.tsx b/screen/wallets/PaymentCodesList.tsx index 7bf103cdc5..979bd7e9ff 100644 --- a/screen/wallets/PaymentCodesList.tsx +++ b/screen/wallets/PaymentCodesList.tsx @@ -147,8 +147,8 @@ export default function PaymentCodesList() { } case String(Actions.pay): { const cl = new ContactList(); - // ok its a SilentPayments code, ok to just send - if (cl.isBip352PaymentCodeValid(pc)) { + // ok its a SilentPayments code/regular address, no need to check for notif tx, ok to just send + if (cl.isBip352PaymentCodeValid(pc) || cl.isAddressValid(pc)) { _navigateToSend(pc); return; } @@ -261,6 +261,13 @@ export default function PaymentCodesList() { const cl = new ContactList(); + if (cl.isAddressValid(newPc)) { + // this is not a payment code but a regular onchain address. pretending its a payment code and adding it + foundWallet.addBIP47Receiver(newPc); + setReload(Math.random()); + return; + } + if (!cl.isPaymentCodeValid(newPc)) { presentAlert({ message: loc.bip47.invalid_pc }); return; diff --git a/screen/wallets/ReorderWallets.tsx b/screen/wallets/ReorderWallets.tsx index c08d51e8e1..21bd8c2021 100644 --- a/screen/wallets/ReorderWallets.tsx +++ b/screen/wallets/ReorderWallets.tsx @@ -66,7 +66,7 @@ const ReorderWallets: React.FC = () => { const { colors } = useTheme(); const { wallets, setWalletsWithNewOrder } = useStorage(); const colorScheme = useColorScheme(); - const { navigate, setOptions } = useExtendedNavigation(); + const { navigate, setOptions, goBack } = useExtendedNavigation(); const [state, dispatch] = useReducer(reducer, initialState); const stylesHook = { @@ -109,12 +109,13 @@ const ReorderWallets: React.FC = () => { const navigateToWallet = useCallback( (wallet: any) => { const walletID = wallet.getID(); + goBack(); navigate('WalletTransactions', { walletID, walletType: wallet.type, }); }, - [navigate], + [goBack, navigate], ); const isDraggingDisabled = state.searchQuery.length > 0 || state.isSearchFocused; diff --git a/tests/integration/bip47.test.ts b/tests/integration/bip47.test.ts index a7e847b609..de2f7158a0 100644 --- a/tests/integration/bip47.test.ts +++ b/tests/integration/bip47.test.ts @@ -161,7 +161,7 @@ describe('Bech32 Segwit HD (BIP84) with BIP47', () => { await walletSender.fetchTransactions(); assert.ok(walletSender.getTransactions().length >= 3); - assert.ok(walletSender._receive_payment_codes.length === 1); + assert.ok(walletSender._receive_payment_codes.length >= 2); assert.ok(walletSender.getBIP47NotificationTransaction(bip47instanceReceiver.getSerializedPaymentCode())); // already notified in the past assert.ok( @@ -276,9 +276,11 @@ describe('Bech32 Segwit HD (BIP84) with BIP47', () => { -102308, ); // we paid samurai - assert.deepStrictEqual(w.getBIP47SenderPaymentCodes(), [ - 'PM8TJXuZNUtSibuXKFM6bhCxpNaSye6r4px2GXRV5v86uRdH9Raa8ZtXEkG7S4zLREf4ierjMsxLXSFTbRVUnRmvjw9qnc7zZbyXyBstSmjcb7uVcDYF', - ]); // samurai can pay us + assert.ok( + w + .getBIP47SenderPaymentCodes() + .includes('PM8TJXuZNUtSibuXKFM6bhCxpNaSye6r4px2GXRV5v86uRdH9Raa8ZtXEkG7S4zLREf4ierjMsxLXSFTbRVUnRmvjw9qnc7zZbyXyBstSmjcb7uVcDYF'), + ); // samurai can pay us assert.deepStrictEqual(w.getBIP47ReceiverPaymentCodes(), []); // we can pay no-one diff --git a/tests/unit/contact-list.test.ts b/tests/unit/contact-list.test.ts index c5fcb72a77..f4c9bf335d 100644 --- a/tests/unit/contact-list.test.ts +++ b/tests/unit/contact-list.test.ts @@ -3,6 +3,15 @@ import assert from 'assert'; import { ContactList } from '../../class/contact-list'; describe('ContactList', () => { + it('isAddressValid()', () => { + const cl = new ContactList(); + assert.ok(cl.isAddressValid('3BDsBDxDimYgNZzsqszNZobqQq3yeUoJf2')); + assert.ok(cl.isAddressValid('bc1quuafy8htjjj263cvpj7md84magzmc8svmh8lrm')); + assert.ok(cl.isAddressValid('BC1QH6TF004TY7Z7UN2V5NTU4MKF630545GVHS45U7')); + + assert.ok(!cl.isAddressValid('sfhsdhsdf')); + }); + it('isPaymentCodeValid()', async () => { const cl = new ContactList();