Merge branch 'master' into settingsui

This commit is contained in:
Marcos Rodriguez 2019-12-11 22:21:04 -05:00
commit 98a80d9798
26 changed files with 1183 additions and 3005 deletions

2
App.js
View File

@ -13,6 +13,7 @@ import { Chain } from './models/bitcoinUnits';
import QuickActions from 'react-native-quick-actions';
import * as Sentry from '@sentry/react-native';
import OnAppLaunch from './class/onAppLaunch';
const A = require('./analytics');
if (process.env.NODE_ENV !== 'development') {
Sentry.init({
@ -110,6 +111,7 @@ export default class App extends React.Component {
_handleAppStateChange = async nextAppState => {
if (BlueApp.getWallets().length > 0) {
if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') {
setTimeout(() => A(A.ENUM.APP_UNSUSPENDED), 2000);
const clipboard = await Clipboard.getString();
const isAddressFromStoredWallet = BlueApp.getWallets().some(wallet =>
wallet.chain === Chain.ONCHAIN ? wallet.weOwnAddress(clipboard) : wallet.isInvoiceGeneratedByWallet(clipboard),

View File

@ -1,5 +1,4 @@
/* eslint react/prop-types: 0 */
/** @type {AppStorage} */
import React, { Component, useEffect, useState } from 'react';
import Ionicons from 'react-native-vector-icons/Ionicons';
import PropTypes from 'prop-types';

1
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1 @@
Do what you wish, that is the law

27
RELEASE.md Normal file
View File

@ -0,0 +1,27 @@
# How to make a release
## Apple
* test the build on real device. its imperative that you run selftest and it gives you OK
* if necessary, up version number in all relevant files (you can use `./edit-version-number.sh`)
* run `./release-notes.sh` - it prints changelog between latest tag and now, put this output under
new version in file `ios/fastlane/metadata/en-US/release_notes.txt` (on top); if file got too big
delete the oldest version from the bottom of the file
* now is a good time to commit ver bump and release notes changes
* create this release version in App Store Connect (iTunes) and attach appropriate build. note
last 4 digits of the build and announce it - this is now a RC. no need to fill release notes yet
* `cd ios/` and then run `DELIVER_USERNAME="my_itunes_email@example.com" DELIVER_PASSWORD="my_itunes_password" fastlane deliver --force --skip_binary_upload --skip_screenshots --ignore_language_directory_validation -a io.bluewallet.bluewallet --app_version "6.6.6"`
but replace `6.6.6` with your version number - this will upload release notes to all locales in itunes
* go back to App Store Connect and press `Submit for Review`. choose Yes, we use identifiers - for installs tracking
* once its approved and released it is safe to cut a release tag: run `git tag -m "REL v6.6.6: 76ed479" v6.6.6`
where `76ed479` is a latest commit in this version. replace the version as well. then run `git push origin --tags`
* you are awesome!
## Android
* do android after ios usually
* test the build on real device. its imperative that you run selftest and it gives you OK. note which build you are testing
* go to appcenter.ms, find this exact build under `master` builds, and press `Distribute` -> `Store` -> `Production`.
in `Release notes` write `Bug fixes and performance improvements`, this field is to small to include actual changelog
* wait till appcenter displays message that it is succesfully distributed
* noice!

View File

@ -1,14 +1,17 @@
import amplitude from 'amplitude-js';
import Analytics from 'appcenter-analytics';
import { getVersion } from 'react-native-device-info';
import { Platform } from 'react-native';
amplitude.getInstance().init('8b7cf19e8eea3cdcf16340f5fbf16330', null, {
useNativeDeviceInfo: true,
platform: Platform.OS,
});
amplitude.getInstance().setVersionName(getVersion());
let A = async event => {
amplitude.getInstance().logEvent(event, {});
console.log('posting analytics...', event);
try {
Analytics.trackEvent(event);
amplitude.getInstance().logEvent(event);
} catch (err) {
console.log(err);
}
@ -17,8 +20,10 @@ let A = async event => {
A.ENUM = {
INIT: 'INIT',
GOT_NONZERO_BALANCE: 'GOT_NONZERO_BALANCE',
GOT_ZERO_BALANCE: 'GOT_ZERO_BALANCE',
CREATED_WALLET: 'CREATED_WALLET',
CREATED_LIGHTNING_WALLET: 'CREATED_LIGHTNING_WALLET',
APP_UNSUSPENDED: 'APP_UNSUSPENDED',
};
module.exports = A;

View File

@ -119,7 +119,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "4.8.1"
versionName "4.8.2"
multiDexEnabled true
missingDimensionStrategy 'react-native-camera', 'general'
}

View File

@ -1,3 +0,0 @@
{
"app_secret": "7a010505-cccc-4e40-aa6b-fbbe0624c8d9"
}

View File

@ -1,5 +1,3 @@
<resources>
<string name="app_name">BlueWallet</string>
<string name="appCenterCrashes_whenToSendCrashes" moduleConfig="true" translatable="false">ASK_JAVASCRIPT</string>
<string name="appCenterAnalytics_whenToEnableAnalytics" moduleConfig="true" translatable="false">ALWAYS_SEND</string>
</resources>

View File

@ -498,7 +498,7 @@ export class AppStorage {
getBalance() {
let finalBalance = 0;
for (let wal of this.wallets) {
finalBalance += wal.balance;
finalBalance += wal.getBalance();
}
return finalBalance;
}

View File

@ -1,6 +1,7 @@
let CryptoJS = require('crypto-js');
module.exports.encrypt = function(data, password) {
if (data.length < 10) throw new Error('data length cant be < 10');
let ciphertext = CryptoJS.AES.encrypt(data, password);
return ciphertext.toString();
};
@ -11,5 +12,11 @@ module.exports.decrypt = function(data, password) {
try {
str = bytes.toString(CryptoJS.enc.Utf8);
} catch (e) {}
// for some reason, sometimes decrypt would succeed with wrong password and return random couple of characters.
// at least in nodejs environment. so with this little hack we are not alowing to encrypt data that is shorter than
// 10 characters, and thus if decrypted data is less than 10 characters we assume that decrypt actually failed.
if (str.length < 10) return false;
return str;
};

View File

@ -9,7 +9,6 @@ import App from './App';
import LottieView from 'lottie-react-native';
import UnlockWith from './UnlockWith.js';
/** @type {AppStorage} */
const A = require('./analytics');
if (!Error.captureStackTrace) {

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppSecret</key>
<string>e83710b1-61c2-497b-b0f7-c3b6ab79f2d8</string>
</dict>
</plist>

View File

@ -20,7 +20,6 @@
2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; };
2DCD954D1E0B4F2C00145EB5 /* BlueWalletTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* BlueWalletTests.m */; };
32002D9D236FAA9F00B93396 /* TodayDataStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32002D9C236FAA9F00B93396 /* TodayDataStore.swift */; };
3208E93922F63279007F5A27 /* AppCenter-Config.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3208E93822F63279007F5A27 /* AppCenter-Config.plist */; };
3271B0AB236E2E0700DA766F /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3271B0AA236E2E0700DA766F /* NotificationCenter.framework */; };
3271B0AE236E2E0700DA766F /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3271B0AD236E2E0700DA766F /* TodayViewController.swift */; };
3271B0B1236E2E0700DA766F /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3271B0AF236E2E0700DA766F /* MainInterface.storyboard */; };
@ -156,7 +155,6 @@
2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
2FCC2CD6FF4448229D0CE0F3 /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialCommunityIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf"; sourceTree = "<group>"; };
32002D9C236FAA9F00B93396 /* TodayDataStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayDataStore.swift; sourceTree = "<group>"; };
3208E93822F63279007F5A27 /* AppCenter-Config.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "AppCenter-Config.plist"; sourceTree = "<group>"; };
32475F792370F6D30070E6CF /* BlueWallet - Bitcoin Price.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "BlueWallet - Bitcoin Price.entitlements"; sourceTree = "<group>"; };
3271B0A9236E2E0700DA766F /* BlueWallet - Bitcoin Price.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "BlueWallet - Bitcoin Price.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
3271B0AA236E2E0700DA766F /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; };
@ -335,7 +333,6 @@
isa = PBXGroup;
children = (
32F0A2502310B0910095C559 /* BlueWallet.entitlements */,
3208E93822F63279007F5A27 /* AppCenter-Config.plist */,
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.m */,
@ -773,7 +770,6 @@
files = (
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
3208E93922F63279007F5A27 /* AppCenter-Config.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -11,19 +11,11 @@
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RNQuickActionManager.h"
#import <AppCenterReactNativeShared/AppCenterReactNativeShared.h>
#import <AppCenterReactNative.h>
#import <AppCenterReactNativeAnalytics.h>
#import <AppCenterReactNativeCrashes.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[AppCenterReactNative register];
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];
[AppCenterReactNativeCrashes registerWithAutomaticProcessing];
{
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

View File

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
@ -17,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>4.8.1</string>
<string>4.8.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>4.8.1</string>
<string>4.8.2</string>
<key>CFBundleVersion</key>
<string>239</string>
<key>CLKComplicationPrincipalClass</key>

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>4.8.1</string>
<string>4.8.2</string>
<key>CFBundleVersion</key>
<string>239</string>
<key>UISupportedInterfaceOrientations</key>

View File

@ -1,22 +1,4 @@
PODS:
- appcenter (2.6.0):
- AppCenterReactNativeShared
- React
- appcenter-analytics (2.6.0):
- AppCenter/Analytics
- AppCenterReactNativeShared
- React
- appcenter-crashes (2.6.0):
- AppCenter/Crashes
- AppCenterReactNativeShared
- React
- AppCenter/Analytics (2.5.1):
- AppCenter/Core
- AppCenter/Core (2.5.1)
- AppCenter/Crashes (2.5.1):
- AppCenter/Core
- AppCenterReactNativeShared (2.6.0):
- AppCenter/Core (= 2.5.1)
- boost-for-react-native (1.63.0)
- BVLinearGradient (2.5.4):
- React
@ -171,9 +153,6 @@ PODS:
- yoga (0.60.5.React)
DEPENDENCIES:
- appcenter (from `../node_modules/appcenter/ios`)
- appcenter-analytics (from `../node_modules/appcenter-analytics/ios`)
- appcenter-crashes (from `../node_modules/appcenter-crashes/ios`)
- BVLinearGradient (from `../node_modules/react-native-linear-gradient`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- EFQRCode (= 5.1.0)
@ -227,8 +206,6 @@ DEPENDENCIES:
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- AppCenter
- AppCenterReactNativeShared
- boost-for-react-native
- EFQRCode
- lottie-ios
@ -236,12 +213,6 @@ SPEC REPOS:
- swift_qrcodejs
EXTERNAL SOURCES:
appcenter:
:path: "../node_modules/appcenter/ios"
appcenter-analytics:
:path: "../node_modules/appcenter-analytics/ios"
appcenter-crashes:
:path: "../node_modules/appcenter-crashes/ios"
BVLinearGradient:
:path: "../node_modules/react-native-linear-gradient"
DoubleConversion:
@ -342,11 +313,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
AppCenter: fddcbac6e4baae3d93a196ceb0bfe0e4ce407dec
appcenter: dc687dcf81280ccab1dc938b0b974d265144a802
appcenter-analytics: fa8dba207d07733dcbda749d262fde3e7161258d
appcenter-crashes: fa97ffec69882486d7183193cc9394473757d1ad
AppCenterReactNativeShared: d5e360f8a4cb5126d29e31ab98051d2f070ba631
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
BVLinearGradient: 8cbc5155c978f2e43098818c91d206d07aae6d30
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>4.8.1</string>
<string>4.8.2</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>

View File

@ -1,3 +1,9 @@
v4.8.1
======
* FIX: Updated biometrics
* FIX: Import QR Code from screenshot not working
v4.8.0
======

4003
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "BlueWallet",
"version": "4.8.1",
"version": "4.8.2",
"devDependencies": {
"@babel/core": "^7.5.0",
"@babel/runtime": "^7.5.1",
@ -54,9 +54,6 @@
"@remobile/react-native-qrcode-local-image": "git+https://github.com/BlueWallet/react-native-qrcode-local-image.git",
"@sentry/react-native": "1.0.9",
"amplitude-js": "5.6.0",
"appcenter": "2.6.0",
"appcenter-analytics": "2.6.0",
"appcenter-crashes": "2.6.0",
"bech32": "1.1.3",
"bignumber.js": "9.0.0",
"bip21": "2.0.2",
@ -110,7 +107,7 @@
"react-native-quick-actions": "0.3.12",
"react-native-randombytes": "3.5.3",
"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#38332f629f577cdd57c69fc8cc971b3cbad193c9",
"react-native-share": "2.0.0",
"react-native-snap-carousel": "3.8.4",
"react-native-sortable-list": "0.0.23",

View File

@ -1,19 +0,0 @@
module.exports = {
dependencies: {
appcenter: {
platforms: {
android: null, // disable Android platform, other platforms will still autolink if provided
},
},
'appcenter-analytics': {
platforms: {
android: null, // disable Android platform, other platforms will still autolink if provided
},
},
'appcenter-crashes': {
platforms: {
android: null, // disable Android platform, other platforms will still autolink if provided
},
},
},
};

View File

@ -202,13 +202,12 @@ export default class Selftest extends Component {
}
//
let crypted = encryption.encrypt('data', 'password');
const data2encrypt = 'really long data string';
let crypted = encryption.encrypt(data2encrypt, 'password');
let decrypted = encryption.decrypt(crypted, 'password');
if (decrypted !== 'data' && crypted && decrypted) {
errorMessage += 'encryption lib is not ok; ';
isOk = false;
if (decrypted !== data2encrypt && crypted && decrypted) {
throw new Error('encryption lib is not ok');
}
//

View File

@ -111,6 +111,8 @@ export default class WalletsList extends Component {
console.log('wallets/list redrawScreen()');
if (BlueApp.getBalance() !== 0) {
A(A.ENUM.GOT_NONZERO_BALANCE);
} else {
A(A.ENUM.GOT_ZERO_BALANCE);
}
this.setState({

View File

@ -5,19 +5,28 @@ let c = require('../../encryption')
describe('unit - encryption', function () {
it('encrypts and decrypts', function () {
let crypted = c.encrypt('data', 'password');
let decrypted = c.decrypt(crypted, 'password');
const data2encrypt = 'really long data string bla bla really long data string bla bla really long data string bla bla';
const crypted = c.encrypt(data2encrypt, 'password');
const decrypted = c.decrypt(crypted, 'password');
assert.ok(crypted);
assert.ok(decrypted);
assert.equal(decrypted, 'data');
assert.ok(crypted !== 'data');
assert.equal(decrypted, data2encrypt);
assert.ok(crypted !== data2encrypt);
let decryptedWithBadPassword
try {
decryptedWithBadPassword = c.decrypt(crypted, 'passwordBad');
} catch (e) {}
assert.ok(!decryptedWithBadPassword)
let exceptionRaised = false;
try {
c.encrypt('yolo', 'password');
} catch (_) {
exceptionRaised = true;
}
assert.ok(exceptionRaised);
})
it('handles ok malformed data', function() {