Browse Source

ADD: Rewrite Settings screen with Hooks. OPS: Update pacakges

Update settings.js

FIX: Removed redundancy

OPS: Lower required deployment target for iOS and watchOS

FIX: Podfile

Pod

Update project.pbxproj

ADD:  Use RN Nav Hooks

Update settings.js

Update settings.js
btcpayserverui
Marcos Rodriguez 5 years ago
committed by Overtorment
parent
commit
43f6304666
  1. 9
      App.js
  2. 4
      MainBottomTabs.js
  3. 1
      android/app/build.gradle
  4. 5
      android/sentry.properties
  5. 6
      index.js
  6. 41
      ios/BlueWallet.xcodeproj/project.pbxproj
  7. 5
      ios/BlueWallet/AppDelegate.m
  8. 11
      ios/Podfile
  9. 30
      ios/Podfile.lock
  10. 2
      ios/sentry.properties
  11. 2125
      package-lock.json
  12. 7
      package.json
  13. 165
      screen/settings/settings.js

9
App.js

@ -10,6 +10,15 @@ import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import url from 'url'; import url from 'url';
import { AppStorage, LightningCustodianWallet } from './class'; import { AppStorage, LightningCustodianWallet } from './class';
import { Chain } from './models/bitcoinUnits'; import { Chain } from './models/bitcoinUnits';
import * as Sentry from '@sentry/react-native';
if (process.env.NODE_ENV !== 'development') {
Sentry.init({
dsn: 'https://23377936131848ca8003448a893cb622@sentry.io/1295736',
});
}
const bitcoin = require('bitcoinjs-lib'); const bitcoin = require('bitcoinjs-lib');
const bitcoinModalString = 'Bitcoin address'; const bitcoinModalString = 'Bitcoin address';
const lightningModalString = 'Lightning Invoice'; const lightningModalString = 'Lightning Invoice';

4
MainBottomTabs.js

@ -1,6 +1,6 @@
import { createStackNavigator, createAppContainer } from 'react-navigation'; import { createStackNavigator, createAppContainer } from 'react-navigation';
import Settings from './screen/settings/settings'; import SettingsContainer from './screen/settings/settings';
import About from './screen/settings/about'; import About from './screen/settings/about';
import ReleaseNotes from './screen/settings/releasenotes'; import ReleaseNotes from './screen/settings/releasenotes';
import Selftest from './screen/selftest'; import Selftest from './screen/selftest';
@ -90,7 +90,7 @@ const WalletsStackNavigator = createStackNavigator(
screen: rbfCancel, screen: rbfCancel,
}, },
Settings: { Settings: {
screen: Settings, screen: SettingsContainer,
path: 'Settings', path: 'Settings',
navigationOptions: { navigationOptions: {
headerStyle: { headerStyle: {

1
android/app/build.gradle

@ -80,6 +80,7 @@ project.ext.react = [
] ]
apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
/** /**
* Set this to true to create two separate APKs instead of one: * Set this to true to create two separate APKs instead of one:

5
android/sentry.properties

@ -0,0 +1,5 @@
defaults.url=https://sentry.io/
defaults.org=bluewallet
defaults.project=bluewallet
auth.token=8020b31b54e94e7b86b4a69f60869f3d5a1320f44efe4f22bb9fa27e0b371448
cli.executable=node_modules/@sentry/cli/bin/sentry-cli

6
index.js

@ -2,7 +2,6 @@ import 'intl';
import 'intl/locale-data/jsonp/en'; import 'intl/locale-data/jsonp/en';
import React from 'react'; import React from 'react';
import './shim.js'; import './shim.js';
import { Sentry } from 'react-native-sentry';
import { AppRegistry } from 'react-native'; import { AppRegistry } from 'react-native';
import WalletMigrate from './screen/wallets/walletMigrate'; import WalletMigrate from './screen/wallets/walletMigrate';
import { name as appName } from './app.json'; import { name as appName } from './app.json';
@ -11,10 +10,7 @@ import LottieView from 'lottie-react-native';
import UnlockWith from './UnlockWith.js'; import UnlockWith from './UnlockWith.js';
/** @type {AppStorage} */ /** @type {AppStorage} */
let A = require('./analytics'); const A = require('./analytics');
if (process.env.NODE_ENV !== 'development') {
Sentry.config('https://23377936131848ca8003448a893cb622@sentry.io/1295736').install();
}
if (!Error.captureStackTrace) { if (!Error.captureStackTrace) {
// captureStackTrace is only available when debugging // captureStackTrace is only available when debugging

41
ios/BlueWallet.xcodeproj/project.pbxproj

@ -507,6 +507,7 @@
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
B40D4E2D225841C300428FCC /* Embed Watch Content */, B40D4E2D225841C300428FCC /* Embed Watch Content */,
791C03B6EF06B63A39F55115 /* [CP] Copy Pods Resources */, 791C03B6EF06B63A39F55115 /* [CP] Copy Pods Resources */,
2130DE983D1D45AC8FC45F7E /* Upload Debug Symbols to Sentry */,
); );
buildRules = ( buildRules = (
); );
@ -609,7 +610,7 @@
13B07F861A680F5B00A75B9A = { 13B07F861A680F5B00A75B9A = {
DevelopmentTeam = A7W54YZ4WU; DevelopmentTeam = A7W54YZ4WU;
LastSwiftMigration = 1030; LastSwiftMigration = 1030;
ProvisioningStyle = Automatic; ProvisioningStyle = Manual;
SystemCapabilities = { SystemCapabilities = {
com.apple.Keychain = { com.apple.Keychain = {
enabled = 0; enabled = 0;
@ -733,7 +734,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport NODE_BINARY=node\n../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh\n";
}; };
0E6D0FA885BDBE9988699506 /* [CP] Check Pods Manifest.lock */ = { 0E6D0FA885BDBE9988699506 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
@ -757,6 +758,20 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
2130DE983D1D45AC8FC45F7E /* Upload Debug Symbols to Sentry */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Upload Debug Symbols to Sentry";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export SENTRY_PROPERTIES=sentry.properties\n../node_modules/@sentry/cli/bin/sentry-cli upload-dsym";
};
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -769,7 +784,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport NODE_BINARY=node\n../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh";
}; };
310D9B5C1860199135C315EC /* [CP] Check Pods Manifest.lock */ = { 310D9B5C1860199135C315EC /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
@ -1096,14 +1111,14 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO; DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = A7W54YZ4WU;
HEADER_SEARCH_PATHS = "$(inherited)"; HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = BlueWallet/Info.plist; INFOPLIST_FILE = BlueWallet/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -1116,7 +1131,7 @@
); );
PRODUCT_BUNDLE_IDENTIFIER = io.bluewallet.bluewallet; PRODUCT_BUNDLE_IDENTIFIER = io.bluewallet.bluewallet;
PRODUCT_NAME = BlueWallet; PRODUCT_NAME = BlueWallet;
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "io.bluewallet.bluewallet AppStore";
SWIFT_OBJC_BRIDGING_HEADER = "BlueWallet-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "BlueWallet-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2; SWIFT_VERSION = 4.2;
@ -1137,7 +1152,7 @@
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
HEADER_SEARCH_PATHS = "$(inherited)"; HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = BlueWallet/Info.plist; INFOPLIST_FILE = BlueWallet/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -1505,7 +1520,7 @@
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2; SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 4; TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 5.1; WATCHOS_DEPLOYMENT_TARGET = 5.0;
}; };
name = Debug; name = Debug;
}; };
@ -1537,7 +1552,7 @@
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2; SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 4; TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 5.1; WATCHOS_DEPLOYMENT_TARGET = 5.0;
}; };
name = Release; name = Release;
}; };
@ -1571,7 +1586,7 @@
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4; TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 5.1; WATCHOS_DEPLOYMENT_TARGET = 5.0;
}; };
name = Debug; name = Debug;
}; };
@ -1604,7 +1619,7 @@
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4; TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 5.1; WATCHOS_DEPLOYMENT_TARGET = 5.0;
}; };
name = Release; name = Release;
}; };

5
ios/BlueWallet/AppDelegate.m

@ -10,11 +10,6 @@
#import <React/RCTLinkingManager.h> #import <React/RCTLinkingManager.h>
#import <React/RCTBundleURLProvider.h> #import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h> #import <React/RCTRootView.h>
#if __has_include(<React/RNSentry.h>)
#import <React/RNSentry.h> // This is used for versions of react >= 0.40
#else
#import "RNSentry.h" // This is used for versions of react < 0.40
#endif
#import <AppCenterReactNativeShared/AppCenterReactNativeShared.h> #import <AppCenterReactNativeShared/AppCenterReactNativeShared.h>
#import <AppCenterReactNative.h> #import <AppCenterReactNative.h>
#import <AppCenterReactNativeAnalytics.h> #import <AppCenterReactNativeAnalytics.h>

11
ios/Podfile

@ -1,13 +1,14 @@
# Uncomment the next line to define a global platform for your project # Uncomment the next line to define a global platform for your project
platform :ios, '10.0' platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
workspace 'BlueWallet' workspace 'BlueWallet'
post_install do |installer| post_install do |installer|
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|
target.build_configurations.each do |config| target.build_configurations.each do |config|
puts "Setting Swift Version setting for #{target.name}..." puts "Setting Swift Version and deployment target setting for #{target.name}..."
config.build_settings['SWIFT_VERSION'] = '4.2' config.build_settings['SWIFT_VERSION'] = '4.2'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end end
end end
end end
@ -43,7 +44,7 @@ target 'BlueWallet' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks! # use_frameworks!
project 'BlueWallet.xcodeproj' project 'BlueWallet.xcodeproj'
platform :ios, '10.0' platform :ios, '9.0'
# Pods for BlueWallet # Pods for BlueWallet
# React Native requirements # React Native requirements
@ -60,13 +61,13 @@ target 'BlueWalletWatch' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
# use_frameworks! # use_frameworks!
# Pods for BlueWalletWatch # Pods for BlueWalletWatch
platform :watchos, '5.1' platform :watchos, '5.0'
end end
target 'BlueWalletWatch Extension' do target 'BlueWalletWatch Extension' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
# use_frameworks! # use_frameworks!
platform :watchos, '5.1' platform :watchos, '5.0'
pod 'EFQRCode', '5.1.0' pod 'EFQRCode', '5.1.0'
# Pods for BlueWalletWatch Extension # Pods for BlueWalletWatch Extension
end end

30
ios/Podfile.lock

@ -133,7 +133,7 @@ PODS:
- React - React
- RemobileReactNativeQrcodeLocalImage (1.0.4): - RemobileReactNativeQrcodeLocalImage (1.0.4):
- React - React
- RNCAsyncStorage (1.5.1): - RNCAsyncStorage (1.6.2):
- React - React
- RNDeviceInfo (4.0.1): - RNDeviceInfo (4.0.1):
- React - React
@ -147,18 +147,18 @@ PODS:
- React - React
- RNSecureKeyStore (1.0.0): - RNSecureKeyStore (1.0.0):
- React - React
- RNSentry (1.0.9):
- React
- Sentry (~> 4.4.0)
- RNShare (2.0.0): - RNShare (2.0.0):
- React - React
- RNSVG (9.5.1): - RNSVG (9.5.1):
- React - React
- RNVectorIcons (6.6.0): - RNVectorIcons (6.6.0):
- React - React
- Sentry (4.1.3): - Sentry (4.4.1):
- Sentry/Core (= 4.1.3) - Sentry/Core (= 4.4.1)
- Sentry/Core (4.1.3) - Sentry/Core (4.4.1)
- SentryReactNative (0.43.2):
- React
- Sentry (~> 4.1.3)
- swift_qrcodejs (1.1.2) - swift_qrcodejs (1.1.2)
- TcpSockets (3.3.2): - TcpSockets (3.3.2):
- React - React
@ -211,10 +211,10 @@ DEPENDENCIES:
- RNHandoff (from `../node_modules/react-native-handoff`) - RNHandoff (from `../node_modules/react-native-handoff`)
- RNRate (from `../node_modules/react-native-rate/ios`) - RNRate (from `../node_modules/react-native-rate/ios`)
- RNSecureKeyStore (from `../node_modules/react-native-secure-key-store/ios`) - RNSecureKeyStore (from `../node_modules/react-native-secure-key-store/ios`)
- "RNSentry (from `../node_modules/@sentry/react-native`)"
- RNShare (from `../node_modules/react-native-share`) - RNShare (from `../node_modules/react-native-share`)
- RNSVG (from `../node_modules/react-native-svg`) - RNSVG (from `../node_modules/react-native-svg`)
- RNVectorIcons (from `../node_modules/react-native-vector-icons`) - RNVectorIcons (from `../node_modules/react-native-vector-icons`)
- SentryReactNative (from `../node_modules/react-native-sentry`)
- TcpSockets (from `../node_modules/react-native-tcp`) - TcpSockets (from `../node_modules/react-native-tcp`)
- ToolTipMenu (from `../node_modules/react-native-tooltip`) - ToolTipMenu (from `../node_modules/react-native-tooltip`)
- yoga (from `../node_modules/react-native/ReactCommon/yoga`) - yoga (from `../node_modules/react-native/ReactCommon/yoga`)
@ -316,14 +316,14 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-rate/ios" :path: "../node_modules/react-native-rate/ios"
RNSecureKeyStore: RNSecureKeyStore:
:path: "../node_modules/react-native-secure-key-store/ios" :path: "../node_modules/react-native-secure-key-store/ios"
RNSentry:
:path: "../node_modules/@sentry/react-native"
RNShare: RNShare:
:path: "../node_modules/react-native-share" :path: "../node_modules/react-native-share"
RNSVG: RNSVG:
:path: "../node_modules/react-native-svg" :path: "../node_modules/react-native-svg"
RNVectorIcons: RNVectorIcons:
:path: "../node_modules/react-native-vector-icons" :path: "../node_modules/react-native-vector-icons"
SentryReactNative:
:path: "../node_modules/react-native-sentry"
TcpSockets: TcpSockets:
:path: "../node_modules/react-native-tcp" :path: "../node_modules/react-native-tcp"
ToolTipMenu: ToolTipMenu:
@ -373,23 +373,23 @@ SPEC CHECKSUMS:
React-RCTWebSocket: cd932a16b7214898b6b7f788c8bddb3637246ac4 React-RCTWebSocket: cd932a16b7214898b6b7f788c8bddb3637246ac4
ReactNativePrivacySnapshot: cc295e45dc22810e9ff2c93380d643de20a77015 ReactNativePrivacySnapshot: cc295e45dc22810e9ff2c93380d643de20a77015
RemobileReactNativeQrcodeLocalImage: 57aadc12896b148fb5e04bc7c6805f3565f5c3fa RemobileReactNativeQrcodeLocalImage: 57aadc12896b148fb5e04bc7c6805f3565f5c3fa
RNCAsyncStorage: 2808c378f6a70f22f66eeb6c11a8d69f326dd795 RNCAsyncStorage: 5ae4d57458804e99f73d427214442a6b10a53856
RNDeviceInfo: 12faae605ba42a1a5041c3c41a77834bc23f049d RNDeviceInfo: 12faae605ba42a1a5041c3c41a77834bc23f049d
RNFS: c9bbde46b0d59619f8e7b735991c60e0f73d22c1 RNFS: c9bbde46b0d59619f8e7b735991c60e0f73d22c1
RNGestureHandler: 5329a942fce3d41c68b84c2c2276ce06a696d8b0 RNGestureHandler: 5329a942fce3d41c68b84c2c2276ce06a696d8b0
RNHandoff: d3b0754cca3a6bcd9b25f544f733f7f033ccf5fa RNHandoff: d3b0754cca3a6bcd9b25f544f733f7f033ccf5fa
RNRate: 29be49c24b314c4e8ec09d848c3965f61cb0be47 RNRate: 29be49c24b314c4e8ec09d848c3965f61cb0be47
RNSecureKeyStore: f1ad870e53806453039f650720d2845c678d89c8 RNSecureKeyStore: f1ad870e53806453039f650720d2845c678d89c8
RNSentry: 2803ba8c8129dcf26b79e9b4d8c80168be6e4390
RNShare: 8b171d4b43c1d886917fdd303bf7a4b87167b05c RNShare: 8b171d4b43c1d886917fdd303bf7a4b87167b05c
RNSVG: 0eb087cfb5d7937be93c45b163b26352a647e681 RNSVG: 0eb087cfb5d7937be93c45b163b26352a647e681
RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4 RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4
Sentry: 4e8a17b61ddd116f89536cc81d567fdee1ebca96 Sentry: 5d312a04e369154aeac616214f4dfc3cbcc8b296
SentryReactNative: 07237139c00366ea2e75ae3e5c566e7a71c27a90
swift_qrcodejs: 4d024fc98b0778b804ec6a5c810880fd092aec9d swift_qrcodejs: 4d024fc98b0778b804ec6a5c810880fd092aec9d
TcpSockets: 8d839b9b14f6f344d98e4642ded13ab3112b462d TcpSockets: 8d839b9b14f6f344d98e4642ded13ab3112b462d
ToolTipMenu: c158702a26154d892bc9e6eaa7d7382f0f1ee16e ToolTipMenu: bdcaa0e888bcf44778a67fe34639b094352e904e
yoga: 312528f5bbbba37b4dcea5ef00e8b4033fdd9411 yoga: 312528f5bbbba37b4dcea5ef00e8b4033fdd9411
PODFILE CHECKSUM: c433da8e416a8df290dce0f6ecf8df544c50a90a PODFILE CHECKSUM: 4ac476f363ad99e4ad854f97a5c1854ea0423bf6
COCOAPODS: 1.7.5 COCOAPODS: 1.7.5

2
ios/sentry.properties

@ -1,5 +1,5 @@
defaults.url=https://sentry.io/ defaults.url=https://sentry.io/
defaults.org=bluewallet defaults.org=bluewallet
defaults.project=bluewallet defaults.project=bluewallet
auth.token=0ee298bd4d3743819f710a5ed555f5429e4ffe64acbb41ac933f2745b0c163da auth.token=8020b31b54e94e7b86b4a69f60869f3d5a1320f44efe4f22bb9fa27e0b371448
cli.executable=node_modules/@sentry/cli/bin/sentry-cli cli.executable=node_modules/@sentry/cli/bin/sentry-cli

2125
package-lock.json

File diff suppressed because it is too large

7
package.json

@ -48,11 +48,12 @@
}, },
"dependencies": { "dependencies": {
"@babel/preset-env": "7.5.0", "@babel/preset-env": "7.5.0",
"@react-native-community/async-storage": "1.5.1", "@react-native-community/async-storage": "1.6.2",
"@react-native-community/blur": "3.3.1", "@react-native-community/blur": "3.3.1",
"@react-native-community/slider": "2.0.0-rc.1", "@react-native-community/slider": "2.0.0-rc.1",
"@remobile/react-native-qrcode-local-image": "git+https://github.com/BlueWallet/react-native-qrcode-local-image.git", "@remobile/react-native-qrcode-local-image": "git+https://github.com/BlueWallet/react-native-qrcode-local-image.git",
"amplitude-js": "4.7.0-react-native", "@sentry/react-native": "1.0.9",
"amplitude-js": "5.6.0",
"appcenter": "2.5.0", "appcenter": "2.5.0",
"appcenter-analytics": "2.5.0", "appcenter-analytics": "2.5.0",
"appcenter-crashes": "2.5.0", "appcenter-crashes": "2.5.0",
@ -108,7 +109,6 @@
"react-native-randombytes": "3.5.3", "react-native-randombytes": "3.5.3",
"react-native-rate": "1.1.7", "react-native-rate": "1.1.7",
"react-native-secure-key-store": "git+https://github.com/marcosrdz/react-native-secure-key-store.git", "react-native-secure-key-store": "git+https://github.com/marcosrdz/react-native-secure-key-store.git",
"react-native-sentry": "0.43.2",
"react-native-share": "2.0.0", "react-native-share": "2.0.0",
"react-native-snap-carousel": "3.8.0", "react-native-snap-carousel": "3.8.0",
"react-native-sortable-list": "0.0.23", "react-native-sortable-list": "0.0.23",
@ -119,6 +119,7 @@
"react-native-watch-connectivity": "0.3.2", "react-native-watch-connectivity": "0.3.2",
"react-native-webview": "6.9.0", "react-native-webview": "6.9.0",
"react-navigation": "3.11.0", "react-navigation": "3.11.0",
"react-navigation-hooks": "1.1.0",
"react-test-render": "1.1.2", "react-test-render": "1.1.2",
"readable-stream": "3.4.0", "readable-stream": "3.4.0",
"secure-random": "1.1.2", "secure-random": "1.1.2",

165
screen/settings/settings.js

@ -1,4 +1,4 @@
import React, { Component } from 'react'; import React, { Component, useEffect, useState } from 'react';
import { ScrollView, View, Switch, TouchableOpacity } from 'react-native'; import { ScrollView, View, Switch, TouchableOpacity } from 'react-native';
import { import {
BlueText, BlueText,
@ -10,116 +10,97 @@ import {
BlueListItem, BlueListItem,
} from '../../BlueComponents'; } from '../../BlueComponents';
import AsyncStorage from '@react-native-community/async-storage'; import AsyncStorage from '@react-native-community/async-storage';
import PropTypes from 'prop-types';
import { AppStorage } from '../../class'; import { AppStorage } from '../../class';
import Biometric from '../../class/biometrics'; import Biometric from '../../class/biometrics';
import { useNavigation } from 'react-navigation-hooks';
const BlueApp = require('../../BlueApp'); const BlueApp = require('../../BlueApp');
let loc = require('../../loc'); const loc = require('../../loc');
export default class Settings extends Component { export const Settings = () => {
static navigationOptions = { const [isLoading, setIsLoading] = useState(true);
...BlueNavigationStyle, const [showAdvancedOptions, setShowAdvancedOptions] = useState(false);
}; const [advancedModeEnabled, setAdvancedModeEnabled] = useState(false);
const [biometrics, setBiometrics] = useState({ isDeviceBiometricCapable: false, isBiometricsEnabled: false, biometricsType: '' });
constructor(props) { const { navigate } = useNavigation();
super(props);
this.state = {
isLoading: true,
language: loc.getLanguage(),
biometrics: { isDeviceBiometricCapable: false, isBiometricsEnabled: false },
};
}
async componentDidMount() { useEffect(() => {
const advancedModeEnabled = !!(await AsyncStorage.getItem(AppStorage.ADVANCED_MODE_ENABLED)); (async () => {
const isBiometricsEnabled = await Biometric.isBiometricUseEnabled(); setAdvancedModeEnabled(!!(await AsyncStorage.getItem(AppStorage.ADVANCED_MODE_ENABLED)));
const isDeviceBiometricCapable = await Biometric.isDeviceBiometricCapable(); const isBiometricsEnabled = await Biometric.isBiometricUseEnabled();
const biometricsType = (await Biometric.biometricType()) || 'biometrics'; const isDeviceBiometricCapable = await Biometric.isDeviceBiometricCapable();
this.setState({ const biometricsType = (await Biometric.biometricType()) || 'biometrics';
isLoading: false, setBiometrics({ isBiometricsEnabled, isDeviceBiometricCapable, biometricsType });
advancedModeEnabled, setIsLoading(false);
biometrics: { isBiometricsEnabled, isDeviceBiometricCapable, biometricsType }, })();
}); });
}
async onAdvancedModeSwitch(value) { const onAdvancedModeSwitch = async value => {
if (value) { if (value) {
await AsyncStorage.setItem(AppStorage.ADVANCED_MODE_ENABLED, '1'); await AsyncStorage.setItem(AppStorage.ADVANCED_MODE_ENABLED, '1');
} else { } else {
await AsyncStorage.removeItem(AppStorage.ADVANCED_MODE_ENABLED); await AsyncStorage.removeItem(AppStorage.ADVANCED_MODE_ENABLED);
} }
this.setState({ advancedModeEnabled: value }); setAdvancedModeEnabled(value);
} };
onUseBiometricSwitch = async value => { const onUseBiometricSwitch = async value => {
let isBiometricsEnabled = this.state.biometrics; let isBiometricsEnabled = biometrics;
if (await Biometric.unlockWithBiometrics()) { if (await Biometric.unlockWithBiometrics()) {
isBiometricsEnabled.isBiometricsEnabled = value; isBiometricsEnabled.isBiometricsEnabled = value;
await Biometric.setBiometricUseEnabled(value); await Biometric.setBiometricUseEnabled(value);
this.setState({ biometrics: isBiometricsEnabled }); setBiometrics(isBiometricsEnabled);
} }
}; };
render() { const onShowAdvancedOptions = () => {
if (this.state.isLoading) { setShowAdvancedOptions(!showAdvancedOptions);
return <BlueLoading />; };
}
return isLoading ? (
<BlueLoading />
) : (
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}>
<BlueHeaderDefaultSub leftText={loc.settings.header} rightComponent={null} />
<ScrollView>
{BlueApp.getWallets().length > 1 && (
<BlueListItem component={TouchableOpacity} onPress={() => navigate('DefaultView')} title="On Launch" />
)}
<BlueListItem title={loc.settings.encrypt_storage} onPress={() => navigate('EncryptStorage')} component={TouchableOpacity} />
{biometrics.isDeviceBiometricCapable && (
<BlueListItem
hideChevron
title={`Use ${biometrics.biometricsType}`}
switchButton
onSwitch={onUseBiometricSwitch}
switched={biometrics.isBiometricsEnabled}
/>
)}
<BlueListItem title={loc.settings.lightning_settings} component={TouchableOpacity} onPress={() => navigate('LightningSettings')} />
<BlueListItem title={loc.settings.language} component={TouchableOpacity} onPress={() => navigate('Language')} />
<BlueListItem title={loc.settings.currency} component={TouchableOpacity} onPress={() => navigate('Currency')} />
<BlueListItem title={'Electrum server'} component={TouchableOpacity} onPress={() => navigate('ElectrumSettings')} />
<BlueListItem title={loc.settings.advanced_options} component={TouchableOpacity} onPress={onShowAdvancedOptions} />
{showAdvancedOptions && (
<BlueCard>
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
<BlueText>{loc.settings.enable_advanced_mode}</BlueText>
<Switch value={advancedModeEnabled} onValueChange={onAdvancedModeSwitch} />
</View>
</BlueCard>
)}
return ( <BlueListItem title={loc.settings.about} component={TouchableOpacity} onPress={() => navigate('About')} />
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}> </ScrollView>
<BlueHeaderDefaultSub leftText={loc.settings.header} rightComponent={null} /> </SafeBlueArea>
<ScrollView> );
{BlueApp.getWallets().length > 1 && ( };
<BlueListItem component={TouchableOpacity} onPress={() => this.props.navigation.navigate('DefaultView')} title="On Launch" />
)} export default class SettingsContainer extends Component {
<TouchableOpacity onPress={() => this.props.navigation.navigate('EncryptStorage')}> static navigationOptions = {
<BlueListItem title={loc.settings.encrypt_storage} /> ...BlueNavigationStyle,
</TouchableOpacity> };
{this.state.biometrics.isDeviceBiometricCapable && (
<BlueListItem
hideChevron
title={`Use ${this.state.biometrics.biometricsType}`}
switchButton
onSwitch={this.onUseBiometricSwitch}
switched={this.state.biometrics.isBiometricsEnabled}
/>
)}
<TouchableOpacity onPress={() => this.props.navigation.navigate('LightningSettings')}>
<BlueListItem title={loc.settings.lightning_settings} />
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Language')}>
<BlueListItem title={loc.settings.language} />
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Currency')}>
<BlueListItem title={loc.settings.currency} />
</TouchableOpacity>
<TouchableOpacity onPress={() => this.props.navigation.navigate('ElectrumSettings')}>
<BlueListItem title={'Electrum server'} />
</TouchableOpacity>
<TouchableOpacity onPress={() => this.setState({ showAdvancedOptions: !this.state.showAdvancedOptions })}>
<BlueListItem title={loc.settings.advanced_options} />
</TouchableOpacity>
{this.state.showAdvancedOptions && (
<BlueCard>
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
<BlueText>{loc.settings.enable_advanced_mode}</BlueText>
<Switch value={this.state.advancedModeEnabled} onValueChange={value => this.onAdvancedModeSwitch(value)} />
</View>
</BlueCard>
)}
<TouchableOpacity onPress={() => this.props.navigation.navigate('About')}> render() {
<BlueListItem title={loc.settings.about} /> return <Settings />;
</TouchableOpacity>
</ScrollView>
</SafeBlueArea>
);
} }
} }
Settings.propTypes = {
navigation: PropTypes.shape({
navigate: PropTypes.func,
goBack: PropTypes.func,
}),
};

Loading…
Cancel
Save