From ab351f626d00e04fcfcb685e504693b5700865fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Rodriguez=20V=C3=A9lez?= Date: Thu, 3 Oct 2024 19:56:09 -0400 Subject: [PATCH 01/15] Update AndroidManifest.xml --- android/app/src/main/AndroidManifest.xml | 36 +++++++++++++----------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 7f0afb58f..707f695d9 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -23,7 +23,7 @@ - + - - + + @@ -99,19 +99,23 @@ + + - - - - - - - + + + + + + + + + @@ -119,7 +123,7 @@ android:mimeType="application/octet-stream" android:pathPattern=".*\\.psbt" /> - + @@ -142,4 +146,4 @@ - + \ No newline at end of file From fcafb8578b226c2d923054bd279a81af7ee4d5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Rodriguez=20V=C3=A9lez?= Date: Thu, 3 Oct 2024 20:00:30 -0400 Subject: [PATCH 02/15] Update AndroidManifest.xml --- android/app/src/main/AndroidManifest.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 707f695d9..e132e6270 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -95,6 +95,8 @@ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:windowSoftInputMode="adjustResize" android:exported="true"> + + @@ -108,6 +110,20 @@ + + + + + + + + + + + + + + @@ -115,6 +131,7 @@ + From 8d64fe363b73de693046061b1bf23010f6e17231 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Thu, 3 Oct 2024 23:02:59 -0400 Subject: [PATCH 03/15] Update Info.plist --- ios/BlueWallet/Info.plist | 681 ++++++++++++++++++-------------------- 1 file changed, 317 insertions(+), 364 deletions(-) diff --git a/ios/BlueWallet/Info.plist b/ios/BlueWallet/Info.plist index d813525db..53b493a5e 100644 --- a/ios/BlueWallet/Info.plist +++ b/ios/BlueWallet/Info.plist @@ -2,369 +2,322 @@ - LSMinimumSystemVersion - 11 - BGTaskSchedulerPermittedIdentifiers - - io.bluewallet.bluewallet.fetchTxsForWallet - - CADisableMinimumFrameDurationOnPhone - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - BlueWallet - CFBundleDocumentTypes - - - CFBundleTypeIconFiles - - CFBundleTypeName - PSBT - CFBundleTypeRole - Editor - LSHandlerRank - Owner - LSItemContentTypes - - io.bluewallet.psbt - - - - CFBundleTypeIconFiles - - CFBundleTypeName - TXN - CFBundleTypeRole - Editor - LSHandlerRank - Owner - LSItemContentTypes - - io.bluewallet.psbt.txn - - - - CFBundleTypeIconFiles - - CFBundleTypeName - ELECTRUMBACKUP - CFBundleTypeRole - Editor - LSHandlerRank - Owner - LSItemContentTypes - - io.bluewallet.backup - - - - CFBundleTypeIconFiles - - CFBundleTypeName - BW COSIGNER - CFBundleTypeRole - Editor - LSHandlerRank - Owner - LSItemContentTypes - - io.bluewallet.bwcosigner - - - - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - $(MARKETING_VERSION) - CFBundleSignature - ???? - CFBundleURLTypes - - - CFBundleTypeRole - Editor - CFBundleURLSchemes - - bitcoin - lightning - bluewallet - lapp - blue - - - - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - ITSAppUsesNonExemptEncryption - - LSApplicationCategoryType - public.app-category.finance - LSApplicationQueriesSchemes - - https - http - - LSRequiresIPhoneOS - - LSSupportsOpeningDocumentsInPlace - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - NSAllowsLocalNetworking - - NSExceptionDomains - - localhost - - NSExceptionAllowsInsecureHTTPLoads - - - onion - - NSExceptionAllowsInsecureHTTPLoads - - NSIncludesSubdomains - - - tailscale.net - - NSExceptionAllowsInsecureHTTPLoads - - NSIncludesSubdomains - - - ts.net - - NSExceptionAllowsInsecureHTTPLoads - - NSIncludesSubdomains - - - - - NSCameraUsageDescription - In order to quickly scan the recipient's address, we need your permission to use the camera to scan their QR Code. - NSFaceIDUsageDescription - In order to use FaceID please confirm your permission. - NSPhotoLibraryAddUsageDescription - Your authorization is required to save this image. - NSPhotoLibraryUsageDescription - In order to import an image for scanning, we need your permission to access your photo library. - NSUserActivityTypes - - io.bluewallet.bluewallet.receiveonchain - io.bluewallet.bluewallet.xpub - - UIAppFonts - - Entypo.ttf - FontAwesome.ttf - FontAwesome5_Brands.ttf - FontAwesome5_Regular.ttf - FontAwesome5_Solid.ttf - Ionicons.ttf - MaterialIcons.ttf - Octicons.ttf - - UIBackgroundModes - - fetch - processing - remote-notification - - UIFileSharingEnabled - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - arm64 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - UIInterfaceOrientationPortraitUpsideDown - - UIViewControllerBasedStatusBarAppearance - - UTExportedTypeDeclarations - - - UTTypeConformsTo - - public.data - - UTTypeDescription - Partially Signed Bitcoin Transaction - UTTypeIconFiles - - UTTypeIdentifier - io.bluewallet.psbt - UTTypeTagSpecification - - public.filename-extension - - psbt - - - - - UTTypeDescription - BW COSIGNER - UTTypeIconFiles - - UTTypeIdentifier - io.bluewallet.bwcosigner - UTTypeTagSpecification - - public.filename-extension - - bwcosigner - - - - - UTTypeConformsTo - - public.data - - UTTypeDescription - Bitcoin Transaction - UTTypeIconFiles - - UTTypeIdentifier - io.bluewallet.psbt.txn - UTTypeTagSpecification - - public.filename-extension - - txn - - - - - UTImportedTypeDeclarations - - - UTTypeConformsTo - - public.text - - UTTypeDescription - JSON File - UTTypeIconFiles - - UTTypeTagSpecification - - public.filename-extension - - json - - public.mime-type - - application/json - - - - - UTTypeConformsTo - - public.data - - UTTypeDescription - Partially Signed Bitcoin Transaction - UTTypeIconFiles - - UTTypeIdentifier - io.bluewallet.psbt - UTTypeTagSpecification - - public.filename-extension - - psbt - - - - - UTTypeConformsTo - - public.data - - UTTypeDescription - Bitcoin Transaction - UTTypeIconFiles - - UTTypeIdentifier - io.bluewallet.psbt.txn - UTTypeTagSpecification - - public.filename-extension - - txn - - - - - UTTypeConformsTo - - public.data - - UTTypeDescription - Electrum Backup - UTTypeIconFiles - - UTTypeIdentifier - io.bluewallet.backup - UTTypeTagSpecification - - public.filename-extension - - backup - - - - - UTTypeDescription - BW COSIGNER - UTTypeIconFiles - - UTTypeIdentifier - io.bluewallet.bwcosigner - UTTypeTagSpecification - - public.filename-extension - - bwcosigner - - - - - bugsnag - - apiKey - 17ba9059f676f1cc4f45d98182388b01 - - FIREBASE_ANALYTICS_COLLECTION_ENABLED - -FIREBASE_MESSAGING_AUTO_INIT_ENABLED - + LSMinimumSystemVersion + 11 + BGTaskSchedulerPermittedIdentifiers + + io.bluewallet.bluewallet.fetchTxsForWallet + + CADisableMinimumFrameDurationOnPhone + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + BlueWallet + CFBundleDocumentTypes + + + + CFBundleTypeIconFiles + + CFBundleTypeName + PSBT + CFBundleTypeRole + Editor + LSHandlerRank + Owner + LSItemContentTypes + + io.bluewallet.psbt + + + + + CFBundleTypeIconFiles + + CFBundleTypeName + TXN + CFBundleTypeRole + Editor + LSHandlerRank + Owner + LSItemContentTypes + + io.bluewallet.psbt.txn + + + + + CFBundleTypeIconFiles + + CFBundleTypeName + ELECTRUMBACKUP + CFBundleTypeRole + Editor + LSHandlerRank + Owner + LSItemContentTypes + + io.bluewallet.backup + + + + + CFBundleTypeIconFiles + + CFBundleTypeName + BW COSIGNER + CFBundleTypeRole + Editor + LSHandlerRank + Owner + LSItemContentTypes + + io.bluewallet.bwcosigner + + + + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleSignature + ???? + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLSchemes + + bitcoin + lightning + bluewallet + lapp + blue + + + + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + ITSAppUsesNonExemptEncryption + + LSApplicationCategoryType + public.app-category.finance + LSApplicationQueriesSchemes + + https + http + + LSRequiresIPhoneOS + + LSSupportsOpeningDocumentsInPlace + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSAllowsLocalNetworking + + NSExceptionDomains + + localhost + + NSExceptionAllowsInsecureHTTPLoads + + + onion + + NSExceptionAllowsInsecureHTTPLoads + + NSIncludesSubdomains + + + tailscale.net + + NSExceptionAllowsInsecureHTTPLoads + + NSIncludesSubdomains + + + ts.net + + NSExceptionAllowsInsecureHTTPLoads + + NSIncludesSubdomains + + + + + NSCameraUsageDescription + In order to quickly scan the recipient's address, we need your permission to use the camera to scan their QR Code. + NSFaceIDUsageDescription + In order to use FaceID please confirm your permission. + NSPhotoLibraryAddUsageDescription + Your authorization is required to save this image. + NSPhotoLibraryUsageDescription + In order to import an image for scanning, we need your permission to access your photo library. + NSUserActivityTypes + + io.bluewallet.bluewallet.receiveonchain + io.bluewallet.bluewallet.xpub + + UIAppFonts + + Entypo.ttf + FontAwesome.ttf + FontAwesome5_Brands.ttf + FontAwesome5_Regular.ttf + FontAwesome5_Solid.ttf + Ionicons.ttf + MaterialIcons.ttf + Octicons.ttf + + UIBackgroundModes + + fetch + processing + remote-notification + + UIFileSharingEnabled + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortraitUpsideDown + + UIViewControllerBasedStatusBarAppearance + + + + UTExportedTypeDeclarations + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + Partially Signed Bitcoin Transaction + UTTypeIdentifier + io.bluewallet.psbt + UTTypeTagSpecification + + public.filename-extension + + psbt + + + + + + UTTypeDescription + BW COSIGNER + UTTypeIdentifier + io.bluewallet.bwcosigner + UTTypeTagSpecification + + public.filename-extension + + bwcosigner + + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + Bitcoin Transaction + UTTypeIdentifier + io.bluewallet.psbt.txn + UTTypeTagSpecification + + public.filename-extension + + txn + + + + + + UTTypeConformsTo + + public.data + + UTTypeDescription + Electrum Backup + UTTypeIdentifier + io.bluewallet.backup + UTTypeTagSpecification + + public.filename-extension + + backup + + + + + + + UTImportedTypeDeclarations + + + UTTypeConformsTo + + public.text + + UTTypeDescription + JSON File + UTTypeIdentifier + public.json + UTTypeTagSpecification + + public.filename-extension + + json + + public.mime-type + + application/json + + + + + + bugsnag + + apiKey + 17ba9059f676f1cc4f45d98182388b01 + + + FIREBASE_ANALYTICS_COLLECTION_ENABLED + + FIREBASE_MESSAGING_AUTO_INIT_ENABLED + From 12800eaa2114adc59f3fcff3309a7bf495d7bd4c Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Thu, 3 Oct 2024 23:46:35 -0400 Subject: [PATCH 04/15] FIX: When user uses custom electrum server, make him aware that his addresses/txids sre still leaked to a Push Notificatinos serer #4806 --- loc/en.json | 5 +- navigation/LazyLoadSettingsStack.tsx | 2 +- screen/settings/NotificationSettings.tsx | 225 +++++++++++++++++++++++ screen/settings/notificationSettings.js | 198 -------------------- 4 files changed, 229 insertions(+), 201 deletions(-) create mode 100644 screen/settings/NotificationSettings.tsx delete mode 100644 screen/settings/notificationSettings.js diff --git a/loc/en.json b/loc/en.json index 18135d7bb..dee4620b6 100644 --- a/loc/en.json +++ b/loc/en.json @@ -295,9 +295,10 @@ "privacy_clipboard_explanation": "Provide shortcuts if an address or invoice is found in your clipboard.", "privacy_do_not_track": "Disable Analytics", "privacy_do_not_track_explanation": "Performance and reliability information will not be submitted for analysis.", - "push_notifications": "Push Notifications", "rate": "Rate", - "selfTest": "Self-Test", + + "push_notifications_explanation": "By enabling notifications, the addresses for all wallets in the app and transaction IDs from any transactions made with the app after enabling notifications will be sent to our server.\nThis is necessary so that we can notify you of updates such as incoming Bitcoin or transaction confirmations.\n\nOnly wallet addresses and transaction IDs created after enabling notifications are transmitted—nothing prior is gathered.\n\nDisabling notifications will remove all of this information from the server." +, "selfTest": "Self-Test", "save": "Save", "saved": "Saved", "success_transaction_broadcasted": "Your transaction has been successfully broadcasted!", diff --git a/navigation/LazyLoadSettingsStack.tsx b/navigation/LazyLoadSettingsStack.tsx index 654a397b5..f1aa9fcf9 100644 --- a/navigation/LazyLoadSettingsStack.tsx +++ b/navigation/LazyLoadSettingsStack.tsx @@ -13,7 +13,7 @@ const DefaultView = lazy(() => import('../screen/settings/DefaultView')); const ElectrumSettings = lazy(() => import('../screen/settings/electrumSettings')); const EncryptStorage = lazy(() => import('../screen/settings/EncryptStorage')); const LightningSettings = lazy(() => import('../screen/settings/LightningSettings')); -const NotificationSettings = lazy(() => import('../screen/settings/notificationSettings')); +const NotificationSettings = lazy(() => import('../screen/settings/NotificationSettings')); const SelfTest = lazy(() => import('../screen/settings/SelfTest')); const ReleaseNotes = lazy(() => import('../screen/settings/ReleaseNotes')); const Tools = lazy(() => import('../screen/settings/tools')); diff --git a/screen/settings/NotificationSettings.tsx b/screen/settings/NotificationSettings.tsx new file mode 100644 index 000000000..3165560c4 --- /dev/null +++ b/screen/settings/NotificationSettings.tsx @@ -0,0 +1,225 @@ +import React, { useCallback, useEffect, useState } from 'react'; +import { I18nManager, Linking, ScrollView, StyleSheet, TextInput, View, Pressable } from 'react-native'; +import { Button as ButtonRNElements } from '@rneui/themed'; +// @ts-ignore: no declaration file +import Notifications from '../../blue_modules/notifications'; +import { BlueCard, BlueSpacing20, BlueText } from '../../BlueComponents'; +import presentAlert from '../../components/Alert'; +import { Button } from '../../components/Button'; +import CopyToClipboardButton from '../../components/CopyToClipboardButton'; +import ListItem, { PressableWrapper } from '../../components/ListItem'; +import { useTheme } from '../../components/themes'; +import loc from '../../loc'; +import { Divider } from '@rneui/base'; + +const NotificationSettings: React.FC = () => { + const [isLoading, setIsLoading] = useState(true); + const [isNotificationsEnabled, setNotificationsEnabled] = useState(false); + const [tokenInfo, setTokenInfo] = useState(''); + const [URI, setURI] = useState(); + const [tapCount, setTapCount] = useState(0); + const { colors } = useTheme(); + const stylesWithThemeHook = { + root: { + backgroundColor: colors.background, + }, + scroll: { + backgroundColor: colors.background, + }, + scrollBody: { + backgroundColor: colors.background, + }, + uri: { + borderColor: colors.formBorder, + borderBottomColor: colors.formBorder, + backgroundColor: colors.inputBackgroundColor, + }, + }; + + const handleTap = () => { + setTapCount(prevCount => prevCount + 1); + }; + + const onNotificationsSwitch = async (value: boolean) => { + setNotificationsEnabled(value); + if (value) { + // User is enabling notifications + // @ts-ignore: refactor later + await Notifications.cleanUserOptOutFlag(); + // @ts-ignore: refactor later + if (await Notifications.getPushToken()) { + // we already have a token, so we just need to reenable ALL level on groundcontrol: + // @ts-ignore: refactor later + await Notifications.setLevels(true); + } else { + // ok, we dont have a token. we need to try to obtain permissions, configure callbacks and save token locally: + // @ts-ignore: refactor later + await Notifications.tryToObtainPermissions(); + } + } else { + // User is disabling notifications + // @ts-ignore: refactor later + await Notifications.setLevels(false); + } + + // @ts-ignore: refactor later + setNotificationsEnabled(await Notifications.isNotificationsEnabled()); + }; + + useEffect(() => { + (async () => { + try { + // @ts-ignore: refactor later + setNotificationsEnabled(await Notifications.isNotificationsEnabled()); + // @ts-ignore: refactor later + setURI(await Notifications.getSavedUri()); + // @ts-ignore: refactor later + setTokenInfo( + 'token: ' + + // @ts-ignore: refactor later + JSON.stringify(await Notifications.getPushToken()) + + ' permissions: ' + + // @ts-ignore: refactor later + JSON.stringify(await Notifications.checkPermissions()) + + ' stored notifications: ' + + // @ts-ignore: refactor later + JSON.stringify(await Notifications.getStoredNotifications()), + ); + } catch (e: any) { + console.debug(e); + presentAlert({ message: e.message }); + } finally { + setIsLoading(false); + } + })(); + }, []); + + const save = useCallback(async () => { + setIsLoading(true); + try { + if (URI) { + // validating only if its not empty. empty means use default + // @ts-ignore: refactor later + if (await Notifications.isGroundControlUriValid(URI)) { + // @ts-ignore: refactor later + await Notifications.saveUri(URI); + presentAlert({ message: loc.settings.saved }); + } else { + presentAlert({ message: loc.settings.not_a_valid_uri }); + } + } else { + // @ts-ignore: refactor later + await Notifications.saveUri(''); + presentAlert({ message: loc.settings.saved }); + } + } catch (error) { + console.warn(error); + } + setIsLoading(false); + }, [URI]); + + return ( + + + + + + {loc.settings.push_notifications_explanation} + + + + {tapCount >= 10 && ( + <> + + + {loc.settings.groundcontrol_explanation} + + + Linking.openURL('https://github.com/BlueWallet/GroundControl')} + titleStyle={{ color: colors.buttonAlternativeTextColor }} + title="github.com/BlueWallet/GroundControl" + color={colors.buttonTextColor} + buttonStyle={styles.buttonStyle} + /> + + + + + + + + setTapCount(tapCount + 1)}> + ♪ Ground Control to Major Tom ♪ + + setTapCount(tapCount + 1)}> + ♪ Commencing countdown, engines on ♪ + + + + + + + +