Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from dev #124

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

9 changes: 0 additions & 9 deletions .buckconfig

This file was deleted.

2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
30 changes: 11 additions & 19 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"react-native" // for no-inline-styles rule
"react-native", // for no-inline-styles rule
],
"extends": [
"standard",
Expand All @@ -11,22 +11,16 @@
"plugin:react-hooks/recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"@react-native",
"plugin:prettier/recommended" // removes all eslint rules that can mess up with prettier
],
"rules": {
"react/jsx-key": "off",
"@typescript-eslint/no-unused-vars": "off",
"react/prop-types": "off",
"react/jsx-handler-names": "off", // activated by standard-react config
"react/display-name": "off",
"react-native/no-inline-styles": "error",
"@typescript-eslint/camelcase": "off",
"camelcase": "off",
"no-var": "off",
"one-var": "off",
"no-void": "off",
"eqeqeq": "off",
"no-redeclare": "off",
"react-native/no-unused-styles": "error",
"react/no-is-mounted": "off",
"react-native/no-single-element-style-arrays": "error",
"prettier/prettier": [
"warn",
{
Expand Down Expand Up @@ -76,12 +70,10 @@
"es6": true,
"jest": true
},
// "parserOptions": {
// "ecmaVersion": 2018,
// "sourceType": "module",
// "ecmaFeatures": {
// "jsx": true
// }
// },
"globals": { "fetch": false }
"globals": { "fetch": false },
"settings": {
"react": { // this is for eslint-plugin-react
"version": "detect" // React version. "detect" automatically picks the version you have installed.
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 16.14.2
node-version: 20.9.0

# ESLint and Prettier must be in `package.json`
- name: Install Node.js dependencies
Expand Down
28 changes: 22 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,27 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

**/.xcode.env.local
*.hprof
.cxx/
*.keystore
!debug.keystore
# Android/IntelliJ
#
release/
build/
.idea
.gradle
local.properties
*.iml

# testing
/coverage

# node.js
#
node_modules/
npm-debug.log
yarn-error.log
yarn.lock

# BUCK
buck-out/
Expand All @@ -54,6 +58,8 @@ buck-out/
*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
**/fastlane/test_output
ios/fastlane

# Bundle artifact
*.jsbundle
Expand All @@ -63,8 +69,13 @@ release-notes.json
release-notes.txt
current-branch.json

ios/Pods/
# Ruby / CocoaPods
**/Pods/
/vendor/bundle/
ios/BlueWallet.xcodeproj/xcuserdata/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*
artifacts/

# Editors
Expand All @@ -74,6 +85,11 @@ artifacts/
*.mx
*.realm
*.realm.lock
android/app/.project
android/app/.classpath
android/app/release
android/.settings/org.eclipse.buildship.core.prefs
android/.project

# ENV File
.env
.env
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node-options="--openssl-legacy-provider"
2 changes: 2 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ module.exports = {
singleQuote: true,
printWidth: 500,
tabWidth: 2,
arrowParens: 'avoid',
bracketSameLine: true,
};
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.6
76 changes: 50 additions & 26 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import 'react-native-gesture-handler'; // should be on top
import React, { useContext, useEffect, useRef } from 'react';
import { AppState, DeviceEventEmitter, NativeModules, NativeEventEmitter, Linking, Platform, StyleSheet, UIManager, useColorScheme, View, StatusBar } from 'react-native';
import {

Check warning on line 3 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Replace `⏎··AppState,⏎··Text,⏎··DeviceEventEmitter,⏎··NativeModules,⏎··NativeEventEmitter,⏎··Linking,⏎··Platform,⏎··StyleSheet,⏎··UIManager,⏎··useColorScheme,⏎··View,⏎··StatusBar,⏎··Alert⏎` with `·AppState,·Text,·DeviceEventEmitter,·NativeModules,·NativeEventEmitter,·Linking,·Platform,·StyleSheet,·UIManager,·useColorScheme,·View,·StatusBar,·Alert·`
AppState,
Text,

Check failure on line 5 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'Text' is defined but never used
DeviceEventEmitter,

Check failure on line 6 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'DeviceEventEmitter' is defined but never used
NativeModules,
NativeEventEmitter,
Linking,
Platform,
StyleSheet,
UIManager,
useColorScheme,
View,
StatusBar,
Alert

Check failure on line 16 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'Alert' is defined but never used
} from 'react-native';
import { NavigationContainer, CommonActions } from '@react-navigation/native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { navigationRef } from './NavigationService';
Expand All @@ -10,7 +24,7 @@
import OnAppLaunch from './class/on-app-launch';
import DeeplinkSchemaMatch from './class/deeplink-schema-match';
import loc from './loc';
import { BlueDefaultTheme, BlueDarkTheme, BlueCurrentTheme } from './components/themes';

Check failure on line 27 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'BlueDarkTheme' is defined but never used
import InitRoot from './Navigation';
import BlueClipboard from './blue_modules/clipboard';
import { isDesktop } from './blue_modules/environment';
Expand All @@ -19,7 +33,6 @@
import DeviceQuickActions from './class/quick-actions';
import Notifications from './blue_modules/notifications';
import Biometric from './class/biometrics';
import WidgetCommunication from './blue_modules/WidgetCommunication';
import changeNavigationBarColor from 'react-native-navigation-bar-color';
import ActionSheet from './screen/ActionSheet';
import HandoffComponent from './components/handoff';
Expand Down Expand Up @@ -47,7 +60,7 @@
const clipboardContent = useRef();
const colorScheme = useColorScheme();

const onNotificationReceived = async (notification) => {

Check warning on line 63 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Replace `(notification)` with `notification`
const payload = Object.assign({}, notification, notification.data);
if (notification.data && notification.data.data) Object.assign(payload, notification.data.data);
payload.foreground = true;
Expand All @@ -66,7 +79,7 @@
);
};

const onUserActivityOpen = (data) => {

Check warning on line 82 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Replace `(data)` with `data`
switch (data.activityType) {
case HandoffComponent.activityTypes.ReceiveOnchain:
NavigationService.navigate('ReceiveDetailsRoot', {
Expand All @@ -90,21 +103,51 @@
};

useEffect(() => {
if (walletsInitialized) {
addListeners();
if (!walletsInitialized) {
return;
}

const initializeListeners = async () => {
try {
const initialAction = await DeviceQuickActions.popInitialAction();
popInitialAction(initialAction);

const userActivity = await EventEmitter?.getMostRecentUserActivity();
onUserActivityOpen(userActivity);
} catch (error) {
console.log('No userActivity object sent', error);
}

handleAppStateChange(undefined);
};

initializeListeners();

const subscriptionLinking = Linking.addListener('url', handleOpenURL);
const subscriptionAppState = AppState.addEventListener('change', handleAppStateChange);

const notificationSubscription = eventEmitter.addListener('onNotificationReceived', onNotificationReceived);
const settingsSubscription = eventEmitter.addListener('openSettings', openSettings);
const userActivitySubscription = eventEmitter.addListener('onUserActivityOpen', onUserActivityOpen);

return () => {
subscriptionLinking.remove();
subscriptionAppState.remove();

notificationSubscription.remove();
settingsSubscription.remove();
userActivitySubscription.remove();
}

Check warning on line 140 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Insert `;`
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [walletsInitialized]);

useEffect(() => {
return () => {
Linking.removeEventListener('url', handleOpenURL);
AppState.removeEventListener('change', handleAppStateChange);
eventEmitter.removeAllListeners('onNotificationReceived');
eventEmitter.removeAllListeners('openSettings');
eventEmitter.removeAllListeners('onUserActivityOpen');
};
// eslint-disable-next-line react-hooks/exhaustive-deps

Check warning on line 150 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'react-hooks/exhaustive-deps' rule is disabled but never reported
}, []);

useEffect(() => {
Expand All @@ -119,27 +162,9 @@
}
}, [colorScheme]);

const addListeners = () => {
Linking.addEventListener('url', handleOpenURL);
AppState.addEventListener('change', handleAppStateChange);
DeviceEventEmitter.addListener('quickActionShortcut', walletQuickActions);
DeviceQuickActions.popInitialAction().then(popInitialAction);
EventEmitter?.getMostRecentUserActivity()
.then(onUserActivityOpen)
.catch(() => console.log('No userActivity object sent'));
handleAppStateChange(undefined);
/*
When a notification on iOS is shown while the app is on foreground;
On willPresent on AppDelegate.m
*/
eventEmitter.addListener('onNotificationReceived', onNotificationReceived);
eventEmitter.addListener('openSettings', openSettings);
eventEmitter.addListener('onUserActivityOpen', onUserActivityOpen);
};

const popInitialAction = async (data) => {

Check warning on line 165 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Replace `(data)` with `data`
if (data) {
const wallet = wallets.find((wallet) => wallet.getID() === data.userInfo.url.split('wallet/')[1]);

Check warning on line 167 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Replace `(wallet)` with `wallet`

Check warning on line 167 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'wallet' is already declared in the upper scope on line 167 column 13
NavigationService.dispatch(
CommonActions.navigate({
name: 'WalletTransactions',
Expand All @@ -160,7 +185,7 @@
const isViewAllWalletsEnabled = await OnAppLaunch.isViewAllWalletsEnabled();
if (!isViewAllWalletsEnabled) {
const selectedDefaultWallet = await OnAppLaunch.getSelectedDefaultWallet();
const wallet = wallets.find((wallet) => wallet.getID() === selectedDefaultWallet.getID());

Check warning on line 188 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Replace `(wallet)` with `wallet`

Check warning on line 188 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'wallet' is already declared in the upper scope on line 188 column 17
if (wallet) {
NavigationService.dispatch(
CommonActions.navigate({
Expand All @@ -178,7 +203,7 @@
}
};

const walletQuickActions = (data) => {

Check failure on line 206 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

'walletQuickActions' is assigned a value but never used
const wallet = wallets.find((wallet) => wallet.getID() === data.userInfo.url.split('wallet/')[1]);
NavigationService.dispatch(
CommonActions.navigate({
Expand Down Expand Up @@ -362,13 +387,12 @@
{/* <NavigationContainer ref={navigationRef} theme={colorScheme === 'dark' ? BlueDarkTheme : BlueDefaultTheme}> */}
<NavigationContainer ref={navigationRef} theme={BlueDefaultTheme}>
<InitRoot />
<Notifications onProcessNotifications={processPushNotifications} />
{/* <Notifications onProcessNotifications={processPushNotifications} />*/}

Check failure on line 390 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Expected space or tab before '*/' in comment
</NavigationContainer>
{walletsInitialized && !isDesktop && <WatchConnectivity />}
</View>
<DeviceQuickActions />
<Biometric />
<WidgetCommunication />
<Privacy />
</SafeAreaProvider>
);
Expand All @@ -378,10 +402,10 @@
root: {
flex: 1,
},
space: {

Check failure on line 405 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Unused style detected: styles.space
marginHorizontal: 8,
},
modalContent: {

Check failure on line 408 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Unused style detected: styles.modalContent
padding: 22,
justifyContent: 'center',
alignItems: 'center',
Expand All @@ -391,7 +415,7 @@
minHeight: 200,
height: 200,
},
modelContentButtonLayout: {

Check failure on line 418 in App.js

View workflow job for this annotation

GitHub Actions / Run linters

Unused style detected: styles.modelContentButtonLayout
flexDirection: 'row',
margin: 16,
justifyContent: 'space-between',
Expand Down
2 changes: 1 addition & 1 deletion BlueApp.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppStorage } from './class';
import Biometric from './class/biometrics';
import { Platform } from 'react-native';
import {Alert, Platform} from 'react-native';

Check failure on line 3 in BlueApp.js

View workflow job for this annotation

GitHub Actions / Run linters

'Alert' is defined but never used
import loc from './loc';
const prompt = require('./blue_modules/prompt');
const currency = require('./blue_modules/currency');
Expand Down
Loading