Skip to content
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 {
AppState,
Text,
DeviceEventEmitter,
NativeModules,
NativeEventEmitter,
Linking,
Platform,
StyleSheet,
UIManager,
useColorScheme,
View,
StatusBar,
Alert
} from 'react-native';
import { NavigationContainer, CommonActions } from '@react-navigation/native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { navigationRef } from './NavigationService';
Expand All @@ -19,7 +33,6 @@ import WatchConnectivity from './WatchConnectivity';
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 @@ -90,16 +103,46 @@ const App = () => {
};

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();
}
// 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');
Expand All @@ -119,24 +162,6 @@ const App = () => {
}
}, [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) => {
if (data) {
const wallet = wallets.find((wallet) => wallet.getID() === data.userInfo.url.split('wallet/')[1]);
Expand Down Expand Up @@ -362,13 +387,12 @@ const App = () => {
{/* <NavigationContainer ref={navigationRef} theme={colorScheme === 'dark' ? BlueDarkTheme : BlueDefaultTheme}> */}
<NavigationContainer ref={navigationRef} theme={BlueDefaultTheme}>
<InitRoot />
<Notifications onProcessNotifications={processPushNotifications} />
{/* <Notifications onProcessNotifications={processPushNotifications} />*/}
</NavigationContainer>
{walletsInitialized && !isDesktop && <WatchConnectivity />}
</View>
<DeviceQuickActions />
<Biometric />
<WidgetCommunication />
<Privacy />
</SafeAreaProvider>
);
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';
import loc from './loc';
const prompt = require('./blue_modules/prompt');
const currency = require('./blue_modules/currency');
Expand Down
Loading