Skip to content

Commit

Permalink
fix: Merge commit '48ab7d0f53a868e926aacd5cb8be5431e43ead05' into tx_…
Browse files Browse the repository at this point in the history
…detail

* commit '48ab7d0f53a868e926aacd5cb8be5431e43ead05': (39 commits)
  OK-7960, OK-7789: add react-native-fast-image (OneKeyHQ#590)
  feat: error boundary message panel (OneKeyHQ#587)
  style: set Select.Option default background to undefined (OneKeyHQ#588)
  Update readme.md
  fix: splash screen OK-8127 OK-8129 (OneKeyHQ#591)
  OK-8041: improve withEnableAuthentication defaultValue (OneKeyHQ#589)
  OK-7814 `ChangeLogModal` component and `Modal` maxHeight prop (OneKeyHQ#586)
  OK-7527: fix check fee (OneKeyHQ#542)
  Feat discover OK-7805 OK-8054 (OneKeyHQ#584)
  feat: swap beta (OneKeyHQ#581)
  fix: finalize tx status timeout bug. (OneKeyHQ#585)
  feat: EVM Dapp Sign message flow (OneKeyHQ#576)
  OK-8050: fix Qcode bgColor (OneKeyHQ#583)
  Update readme.md
  Update readme.md
  fix: 2 problems related to Toast Component. One is its usage in Modal… (OneKeyHQ#579)
  chore: upgrade blockchain-libs (OneKeyHQ#582)
  fix: rsync app js-sdk missing files (OneKeyHQ#580)
  fix: electron production build issue (OneKeyHQ#578)
  fix: import wallet password bug OK-7755 (OneKeyHQ#568)
  ...
  • Loading branch information
liuzjalex committed Apr 24, 2022
2 parents fa6f18f + 48ab7d0 commit 510bf93
Show file tree
Hide file tree
Showing 211 changed files with 4,642 additions and 3,759 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/build_native_dev_wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ jobs:
always-auth: true
scope: '@onekeyhq'

- name: Setup keys secret
run: |
echo ${{ secrets.IOS_KEYS_ENV }} | base64 -d > packages/app/ios/OneKeyWallet/RNBridge/NFCENV.m
- name: Setup Expo
uses: expo/expo-github-action@v5
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build_native_ios_AppStore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:

- name: Setup keys secret
run: |
echo ${{ secrets.IOS_KEYS_ENV }} | base64 -d > packages/app/ios/OneKeyWallet/RNBridge/NFCENV.m
echo ${{ secrets.ASC_API_KEY }} | base64 -d > packages/app/AscApiKey.p8
- name: Setup Credentials
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/build_native_ios_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ jobs:
always-auth: true
scope: '@onekeyhq'

- name: Setup keys secret
run: |
echo ${{ secrets.IOS_KEYS_ENV }} | base64 -d > packages/app/ios/OneKeyWallet/RNBridge/NFCENV.m
- name: Setup Credentials
run: |
mkdir packages/app/ios/certs
Expand Down
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ yarn-error.log
.yarn
.yarnrc

packages/desktop/public/static/connect
packages/kit/src/public/static/connect
packages/app/src/public/static/connect
/packages/desktop/public/static/connect
/packages/kit/src/public/static/connect
/packages/app/src/public/static/connect

/packages/desktop/public/static/js-sdk
/packages/kit/src/public/static/js-sdk
/packages/app/src/public/static/js-sdk

.env
webpack.config.preview.json
Expand All @@ -35,3 +39,4 @@ webpack.config.preview.devServer.json
*.orig.*
web-build/
/inpage-provider-bak
/packages/shared/src/web/index.html
674 changes: 0 additions & 674 deletions LICENSE

This file was deleted.

22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright ONEKEY LIMITED (Hong Kong) All rights reserved.

You acknowledge and agree that ONEKEY LIMITED (Hong Kong) (“ONEKEY LIMITED (Hong Kong)”) (or ONEKEY LIMITED (Hong Kong)’s licensors) own all legal right, title and interest in and to the work, software, application, source code, documentation and any other documents in this repository (collectively, the “Program”), including any intellectual property rights which subsist in the Program (whether those rights happen to be registered or not, and wherever in the world those rights may exist), whether in source code or any other form.

Subject to the limited license below, you may not (and you may not permit anyone else to) distribute, publish, copy, modify, merge, combine with another program, create derivative works of, reverse engineer, decompile or otherwise attempt to extract the source code of, the Program or any part thereof, except that you may contribute to this repository.

### You are granted a non-exclusive, non-transferable, non-sublicensable license to distribute, publish, copy, modify, merge, combine with another program or create derivative works of the Program (such resulting program, collectively, the “Resulting Program”) solely for Non-Commercial Use as long as you:

1. Give prominent notice (“Notice”) with each copy of the Resulting Program that the Program is used in the Resulting Program and that the Program is the copyright of ONEKEY LIMITED (Hong Kong); and

2. Subject the Resulting Program and any distribution, publication, copy, modification, merger therewith, combination with another program or derivative works thereof to the same Notice requirement and Non-Commercial Use restriction set forth herein.

### “Non-Commercial Use” means each use as described in clauses (1)-(3) below, as reasonably determined by ONEKEY LIMITED (Hong Kong) in its sole discretion:

1. Personal use for research, personal study, private entertainment, hobby projects or amateur pursuits, in each case without any anticipated commercial application;

2. Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization or government institution; or

3. The number of monthly active users of the Resulting Program across all versions thereof and platforms globally do not exceed 10,000 at any time.

### You will not use any trade mark, service mark, trade name, logo of ONEKEY LIMITED (Hong Kong) or any other company or organization in a way that is likely or intended to cause confusion about the owner or authorized user of such marks, names or logos.

If you have any questions, comments or interest in pursuing any other use cases, please reach out to us at hi@onekey.so
23 changes: 22 additions & 1 deletion development/babelTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,35 @@ function normalizeConfig({ platform, config }) {
'react-native-restart': fullPath(
'./module-resolver/react-native-restart-mock',
),
'react-native-fast-image': fullPath(
'./module-resolver/react-native-fast-image-mock',
),
},
};
}
if (platform === developmentConsts.platforms.web) {
moduleResolver = {
alias: {
'react-native-fast-image': fullPath(
'./module-resolver/react-native-fast-image-mock',
),
},
};
}
if (platform === developmentConsts.platforms.desktop) {
moduleResolver = {
alias: {
'react-native-fast-image': fullPath(
'./module-resolver/react-native-fast-image-mock',
),
},
};
}
if (platform === developmentConsts.platforms.app) {
moduleResolver = {
root: ['./'],
alias: {
'@onekeyfe/connect': './src/public/static/connect/index.js',
'@onekeyfe/js-sdk': './src/public/static/js-sdk',
},
};
}
Expand Down
9 changes: 9 additions & 0 deletions development/copy-injected.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ cp ./node_modules/@onekeyfe/cross-inpage-provider-injected/dist/injected/injecte

# copy to Native injectedCode
cp ./node_modules/@onekeyfe/cross-inpage-provider-injected/dist/injected/injectedNative.js ./packages/kit/src/components/WebView/injectedNative.text-js

# copy index html
cp ./packages/shared/src/web/index.html.ejs ./packages/shared/src/web/index.html

# copy hardware js-sdk lib files to app
mkdir -p ./packages/app/src/public/static/js-sdk/lib/
rsync ./node_modules/@onekeyfe/js-sdk/lib/utils/ ./packages/app/src/public/static/js-sdk/lib/utils/ --checksum --recursive --verbose
rsync ./node_modules/@onekeyfe/js-sdk/lib/data/ ./packages/app/src/public/static/js-sdk/lib/data/ --checksum --recursive --verbose
rsync ./node_modules/@onekeyfe/js-sdk/lib/constants/ ./packages/app/src/public/static/js-sdk/lib/constants/ --checksum --recursive --verbose
22 changes: 22 additions & 0 deletions development/indexHtmlParameter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function createEjsParams({ filename = '', platform = '', browser = '' }) {
return {
filename,
platform,
browser,
};
}

function createInterpolateParams({ filename, platform }) {
return {
WEB_PUBLIC_URL: '',
WEB_TITLE: '',
LANG_ISO_CODE: '',
// These are for legacy ejected web/index.html files
NO_SCRIPT: `<form action="" style="background-color:#fff;position:fixed;top:0;left:0;right:0;bottom:0;z-index:9999;"><div style="font-size:18px;font-family:Helvetica,sans-serif;line-height:24px;margin:10%;width:80%;"> <p>Oh no! It looks like JavaScript is not enabled in your browser.</p> <p style="margin:20px 0;"> <button type="submit" style="background-color: #4630EB; border-radius: 100px; border: none; box-shadow: none; color: #fff; cursor: pointer; font-weight: bold; line-height: 20px; padding: 6px 16px;">Reload</button> </p> </div> </form>`,
ROOT_ID: 'root',
};
}
module.exports = {
createEjsParams,
createInterpolateParams,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
Platform: {
OS: 'web',
},
};
31 changes: 30 additions & 1 deletion development/webpackTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ require('./env');
const webpack = require('webpack');
const lodash = require('lodash');
const notifier = require('node-notifier');
const { getPathsAsync } = require('@expo/webpack-config/env');
const path = require('path');
const developmentConsts = require('./developmentConsts');
const indexHtmlParameter = require('./indexHtmlParameter');

class BuildDoneNotifyPlugin {
apply(compiler) {
Expand Down Expand Up @@ -40,7 +43,32 @@ const resolveExtensions = [
'.d.ts',
];

function normalizeConfig({ platform, config }) {
async function modifyExpoEnv({ env, platform }) {
const locations = await getPathsAsync(env.projectRoot);

const indexHtmlFile = path.resolve(
__dirname,
'../packages/shared/src/web/index.html',
);
locations.template.indexHtml = indexHtmlFile;
locations.template.indexHtmlTemplateParameters =
indexHtmlParameter.createEjsParams({
filename: 'index.html',
platform,
});

const newEnv = {
...env,
// https://github.com/expo/expo-cli/issues/1977
locations: {
...locations,
},
};

return newEnv;
}

function normalizeConfig({ platform, config, env }) {
if (platform) {
config.plugins = [
...config.plugins,
Expand All @@ -64,4 +92,5 @@ module.exports = {
developmentConsts,
resolveExtensions,
normalizeConfig,
modifyExpoEnv,
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"copy-webpack-plugin": "^6.0.2",
"css-loader": "^5.2.7",
"cz-lerna-changelog": "2.0.3",
"ejs-loader": "^0.5.0",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-airbnb-typescript": "^14.0.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/* eslint-disable @typescript-eslint/no-unused-vars, import/first, import/order */
import '@formatjs/intl-getcanonicallocales/polyfill';
import '@formatjs/intl-locale/polyfill';
import '@formatjs/intl-pluralrules/polyfill';
import '@formatjs/intl-pluralrules/locale-data/en';
import './shim';

import React, { FC } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.res.Configuration;
import android.util.Log;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.ViewModelStoreOwner;
Expand Down Expand Up @@ -65,6 +66,19 @@ public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}

/**
* 摆脱魅族系统的夜间模式「自动反色」系统
*
* 1. 表示由系统处理(默认)
* 2. 表示禁止针对该view在夜间模式下进行颜色处理
* 3. 表示夜间模式下直接针对该 view 进行反色处理
* 4. 表示夜间模式下直接针对该 view 进行降低亮度
*/
@Keep
public int mzNightModeUseOf() {
return 2;
}

@Override
public void onCreate() {
super.onCreate();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splashscreen_background"/>
<item>
<bitmap android:gravity="center" android:src="@drawable/splashscreen_image"/>
</item>
<item android:drawable="@color/splashscreen_background" />
</layer-list>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources>
<color name="splashscreen_background">#262631</color>
<color name="splashscreen_background">#FFFFFF</color>
</resources>
3 changes: 1 addition & 2 deletions packages/app/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resources>
<string name="app_name">OneKey Wallet</string>
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">true</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
</resources>
2 changes: 2 additions & 0 deletions packages/app/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
</style>
<style name="Theme.App.SplashScreen" parent="AppTheme">
<item name="android:windowBackground">@drawable/splashscreen</item>
<item name="android:statusBarColor">@color/splashscreen_background</item>
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>
4 changes: 0 additions & 4 deletions packages/app/ios/OneKeyWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
A24B8A7B27422F0B00E321A9 /* GPChannelSDKCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A24B8A6F27422EF200E321A9 /* GPChannelSDKCore.framework */; };
A24B8A7C27422F0B00E321A9 /* GPChannelSDKCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A24B8A6F27422EF200E321A9 /* GPChannelSDKCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
A284EFA327C49CDD0070F4EA /* NFCConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = A284EFA227C49CDD0070F4EA /* NFCConfig.m */; };
A284EFAA27C49E9B0070F4EA /* NFCENV.m in Sources */ = {isa = PBXBuildFile; fileRef = A284EFA927C49E9B0070F4EA /* NFCENV.m */; };
A284EFC427CE238D0070F4EA /* OKTools.m in Sources */ = {isa = PBXBuildFile; fileRef = A284EFC327CE238D0070F4EA /* OKTools.m */; };
A2F1BFFB27A2D30900C4EE99 /* RNLiteCallBackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A2F1BFFA27A2D30900C4EE99 /* RNLiteCallBackManager.m */; };
B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */; };
Expand Down Expand Up @@ -72,7 +71,6 @@
A24B8A7327422EF300E321A9 /* OKLiteManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OKLiteManager.h; sourceTree = "<group>"; };
A284EFA127C49CDD0070F4EA /* NFCConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NFCConfig.h; sourceTree = "<group>"; };
A284EFA227C49CDD0070F4EA /* NFCConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NFCConfig.m; sourceTree = "<group>"; };
A284EFA927C49E9B0070F4EA /* NFCENV.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NFCENV.m; sourceTree = "<group>"; };
A284EFC227CE238D0070F4EA /* OKTools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OKTools.h; sourceTree = "<group>"; };
A284EFC327CE238D0070F4EA /* OKTools.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OKTools.m; sourceTree = "<group>"; };
A2F1BFF927A2D30900C4EE99 /* RNLiteCallBackManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNLiteCallBackManager.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -220,7 +218,6 @@
A2F1BFFA27A2D30900C4EE99 /* RNLiteCallBackManager.m */,
A284EFA127C49CDD0070F4EA /* NFCConfig.h */,
A284EFA227C49CDD0070F4EA /* NFCConfig.m */,
A284EFA927C49E9B0070F4EA /* NFCENV.m */,
);
name = RNBridge;
path = OneKeyWallet/RNBridge;
Expand Down Expand Up @@ -432,7 +429,6 @@
1625CE96A62F41B0B52FF2B4 /* noop-file.swift in Sources */,
A284EFC427CE238D0070F4EA /* OKTools.m in Sources */,
A24B8A7A27422EF300E321A9 /* OKLiteManager.m in Sources */,
A284EFAA27C49E9B0070F4EA /* NFCENV.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
11 changes: 0 additions & 11 deletions packages/app/ios/OneKeyWallet/RNBridge/NFCConfig.m
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
#import "NFCConfig.h"
#import "NFCENV.m"

#ifdef DEBUG
#import "ReactNativeConfig.h"
#else
#import "NFCENV.m"
#endif


@implementation NFCConfig

+ (NSDictionary *)env {
#ifdef DEBUG
return ReactNativeConfig.env;
#else
return (NSDictionary *)DOT_ENV;
#endif
}

+ (NSString *)envFor: (NSString *)key {
Expand Down
1 change: 0 additions & 1 deletion packages/app/ios/OneKeyWallet/RNBridge/NFCENV.m

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ - (void)ok_lite:(OKNFCLite *)lite setMnemonicComplete:(OKNFCLiteSetMncStatus)sta
break;
}
self.setMnemonicCallback = nil;
[RNLiteCallBackManager clearLiteInfo];
return;
}

Expand All @@ -125,7 +126,7 @@ - (void)ok_lite:(OKNFCLite *)lite getMnemonic:(NSString *)mnemonic complete:(OKN
}
break;
case OKNFCLiteGetMncStatusError:
if (lite.status == OKNFCLiteStatusNewCard) {
if (lite.status == OKNFCLiteStatusNewCard && lite.SN != nil) {
self.getMnemonicCallback(@[@{@"code":@(NFCLiteExceptionsNotInitialized),@"message":@""},[NSNull null],[NSNull null]]);
} else {
self.getMnemonicCallback(@[@{@"code":@(NFCLiteExceptionsConnectionFail),@"message":@""},[NSNull null],[NSNull null]]);
Expand Down Expand Up @@ -169,7 +170,7 @@ + (void)changePin:(NSString *)oldPwd newPwd:(NSString *)newPwd callBack:(RCTResp
callBack(@[@{@"code":@(NFCLiteExceptionsPasswordWrong),@"message":@""},[NSNull null],cardInfo]);
} break;
case OKNFCLiteChangePinStatusError: {
if (lite.status == OKNFCLiteStatusNewCard) {
if (lite.status == OKNFCLiteStatusNewCard && lite.SN != nil) {
callBack(@[@{@"code":@(NFCLiteExceptionsNotInitialized),@"message":@""},[NSNull null],[NSNull null]]);
} else {
callBack(@[@{@"code":@(NFCLiteExceptionsConnectionFail),@"message":@""},[NSNull null],[NSNull null]]);
Expand Down
Loading

0 comments on commit 510bf93

Please sign in to comment.