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

feat: make mobile app great again #96

Merged
merged 38 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5d3b798
feat: add react-native walletconnect compatibility layer
gomesalexandre May 14, 2024
9bd08e2
feat: react-native-get-random-values too
gomesalexandre May 14, 2024
7d106b9
feat: honor README
gomesalexandre May 14, 2024
d65d2de
feat: add .git-blame-ignore-revs
gomesalexandre May 14, 2024
9afdf61
feat: onCreate WebView.setWebContentsDebuggingEnabled(true)
gomesalexandre May 14, 2024
6f9627b
feat: what the fuck was that
gomesalexandre May 14, 2024
dabb829
feat: more cleanup
gomesalexandre May 14, 2024
0934d1e
feat: add debugging instructions
gomesalexandre May 14, 2024
c02c20e
feat: setWebContentsDebuggingEnabled(true) in debug builds only
gomesalexandre May 14, 2024
78d0846
feat: add commentary and move out of regular imports for clarity
gomesalexandre May 14, 2024
8f530ac
fix: missing import
gomesalexandre May 14, 2024
d9cfb87
feat: rm compat layer
gomesalexandre May 15, 2024
b8823c9
feat: cleanup package.json
gomesalexandre May 15, 2024
d9915f5
feat: hell
gomesalexandre May 15, 2024
f62aad2
feat: i don't even know what I'm diffing at this point
gomesalexandre May 15, 2024
59f8566
feat: what the fuck?
gomesalexandre May 15, 2024
7b899fa
feat: rm react-native-compat
gomesalexandre May 15, 2024
0e991ce
fix: update every packages needed and patch android style
May 16, 2024
8d476ea
feat: add wc URIs to shouldLoadFilter
gomesalexandre May 20, 2024
27bf1a1
feat: bump minSdkVersion to 33
gomesalexandre May 20, 2024
1d2ba10
feat: regen Podfile
gomesalexandre May 21, 2024
c36f418
fix: restore packages identifiers and fix a few icons and colors
May 21, 2024
a0396f6
fix: icon size
May 21, 2024
84915d3
feat: regen podfile and project.pbxproj after pod install
gomesalexandre May 21, 2024
8fa319c
feat: npx expo prebuild
gomesalexandre May 21, 2024
c7091ee
fix: wrong changes
May 21, 2024
6e1b4c7
feat: bump again (again)
gomesalexandre May 21, 2024
3e4e557
fix: use config without importing
May 22, 2024
c96fbff
fix: proper app name for the ios build
May 22, 2024
2903153
fix: make xcode great again and ios bundle name change
May 22, 2024
c98f118
fix: change prod bundle name
May 22, 2024
89df9aa
fix: reset default component name
May 22, 2024
a3425a1
fix: review
May 23, 2024
17c56fa
feat: update Podfile after nuke and clean rebuild
gomesalexandre May 28, 2024
c7e11a4
Merge pull request #97 from shapeshift/feat_mobile_app_bumps
gomesalexandre May 28, 2024
dd4f5b6
feat: make lint great again
gomesalexandre May 30, 2024
081d4db
feat: make types great again (ish, many ignores for sanity)
gomesalexandre May 30, 2024
10a421d
feat: ffs eslint-disable-next-line on ts-ignore, I know what I'm doing
gomesalexandre May 30, 2024
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
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
File renamed without changes.
Empty file added .git-blame-ignore-revs
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
2 changes: 2 additions & 0 deletions android/app/src/main/java/com/shapeshift/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package com.shapeshift;
import android.webkit.WebView;
import expo.modules.ReactActivityDelegateWrapper;

import com.facebook.react.ReactActivity;
Expand Down Expand Up @@ -59,6 +60,7 @@ protected ReactActivityDelegate createReactActivityDelegate() {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView.setWebContentsDebuggingEnabled(true);
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
// get the root view and activate touch filtering to prevent tap jacking
findViewById(android.R.id.content).setFilterTouchesWhenObscured(true);
}
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@react-native-async-storage/async-storage": "^1.17.10",
"@react-native-clipboard/clipboard": "^1.11.1",
"@seald-io/react-native-scrypt": "^1.2.3",
"@walletconnect/react-native-compat": "^2.13.0",
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
"bip39": "^3.0.4",
"expo": "^46.0.13",
"expo-local-authentication": "^12.3.0",
Expand All @@ -31,6 +32,7 @@
"react-native": "0.70.8",
"react-native-dotenv": "^3.4.0",
"react-native-error-boundary": "^1.1.16",
"react-native-get-random-values": "^1.11.0",
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
"react-native-shake": "^5.1.1",
"react-native-simple-crypto": "^0.2.15",
"react-native-svg": "^13.2.0",
Expand All @@ -47,6 +49,7 @@
"@types/lodash.memoize": "^4.1.7",
"@types/lodash.once": "^4.1.7",
"@types/react-native": "^0.70.4",
"@types/react-native-get-random-values": "^1",
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
Expand Down
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@walletconnect/react-native-compat'
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
import React, { useEffect, useMemo, useRef, useState } from 'react'
import { ActivityIndicator, BackHandler, Linking, View } from 'react-native'
import ErrorBoundary from 'react-native-error-boundary'
Expand Down
18 changes: 0 additions & 18 deletions src/lib/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,6 @@
*/
import type { EventData } from './MessageManager'

export const injectedJavaScript = `
if (!globalThis._console) {
globalThis._console = { ...globalThis.console };
globalThis.console = new Proxy(globalThis.console, {
get(target, property) {
return (...args) => {
globalThis._console[property](...args)
try {
window.ReactNativeWebView.postMessage(JSON.stringify({cmd: 'console', fn: property, data: args.join(' ') }))
} catch (e) {
globalThis._console[property]('[REACT-NATIVE-WEBVIEW] ', e)
}
}
}
});
}
`

gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
export const onConsole = (e: EventData) => {
// console messages have a "fn" and "data" property
if (typeof e.fn === 'string' && typeof e.data === 'string') {
Expand Down
9 changes: 1 addition & 8 deletions src/lib/getMessageManager.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* Register message handlers and injected JavaScript */
import Clipboard from '@react-native-clipboard/clipboard'
import once from 'lodash.once'
import { LOGGING_WEBVIEW } from 'react-native-dotenv'
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
import { injectedJavaScript as injectedJavaScriptClipboard } from './clipboard'

import { injectedJavaScript, onConsole } from './console'
import { onConsole } from './console'
import { makeKey } from './crypto/crypto'
import { getWalletManager } from './getWalletManager'
import { EventData, MessageManager } from './MessageManager'
Expand All @@ -15,12 +14,6 @@ type EncryptedWalletInfo = {

export const getMessageManager = once(() => {
const messageManager = new MessageManager()
const enableLogging = LOGGING_WEBVIEW !== 'false'

if (enableLogging) {
console.log('[App] Injecting console logging JavaScript')
messageManager.registerInjectedJavaScript(injectedJavaScript)
}
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved

console.log('[App] Injecting clipboard JavaScript')
messageManager.registerInjectedJavaScript(injectedJavaScriptClipboard)
Expand Down
1 change: 0 additions & 1 deletion types/react-native-dotenv.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ declare module 'react-native-dotenv' {
* chatwoot support widget
*/
export const CHATWOOT_URI: string
export const LOGGING_WEBVIEW: 'false' | 'true' | undefined
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
}
99 changes: 98 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2902,6 +2902,13 @@ __metadata:
languageName: node
linkType: hard

"@types/react-native-get-random-values@npm:^1":
version: 1.8.2
resolution: "@types/react-native-get-random-values@npm:1.8.2"
checksum: 08f3f82efbb5b6d9acd8f7f55a2dac9f228886323ac3018a1bab46cd1b45f24809d194fd2a3fe02a9ec4196606325e5cfffde0b0057ae785208b658fdc83c821
languageName: node
linkType: hard

"@types/react-native@npm:^0.70.4":
version: 0.70.4
resolution: "@types/react-native@npm:0.70.4"
Expand Down Expand Up @@ -3132,6 +3139,25 @@ __metadata:
languageName: node
linkType: hard

"@walletconnect/react-native-compat@npm:^2.13.0":
version: 2.13.0
resolution: "@walletconnect/react-native-compat@npm:2.13.0"
dependencies:
events: 3.3.0
fast-text-encoding: 1.0.6
react-native-url-polyfill: 2.0.0
peerDependencies:
"@react-native-async-storage/async-storage": "*"
"@react-native-community/netinfo": "*"
expo-application: "*"
react-native-get-random-values: "*"
peerDependenciesMeta:
expo-application:
optional: true
checksum: 884164e1ca81234a6a1591ea9d0d4b91f1ed7fdba51a833991e943fb95749e125e0a64915bfe12faa718b41a905379b8d5d2fda2cea1a54d663ad8a5ed1f6aef
languageName: node
linkType: hard

"@xmldom/xmldom@npm:~0.7.0":
version: 0.7.5
resolution: "@xmldom/xmldom@npm:0.7.5"
Expand Down Expand Up @@ -3961,7 +3987,7 @@ __metadata:
languageName: node
linkType: hard

"buffer@npm:^5.5.0, buffer@npm:^5.6.0":
"buffer@npm:^5.4.3, buffer@npm:^5.5.0, buffer@npm:^5.6.0":
version: 5.7.1
resolution: "buffer@npm:5.7.1"
dependencies:
Expand Down Expand Up @@ -5485,6 +5511,13 @@ __metadata:
languageName: node
linkType: hard

"events@npm:3.3.0":
version: 3.3.0
resolution: "events@npm:3.3.0"
checksum: f6f487ad2198aa41d878fa31452f1a3c00958f46e9019286ff4787c84aac329332ab45c9cdc8c445928fc6d7ded294b9e005a7fce9426488518017831b272780
languageName: node
linkType: hard

"exec-async@npm:^2.2.0":
version: 2.2.0
resolution: "exec-async@npm:2.2.0"
Expand Down Expand Up @@ -5763,6 +5796,13 @@ __metadata:
languageName: node
linkType: hard

"fast-base64-decode@npm:^1.0.0":
version: 1.0.0
resolution: "fast-base64-decode@npm:1.0.0"
checksum: 4c59eb1775a7f132333f296c5082476fdcc8f58d023c42ed6d378d2e2da4c328c7a71562f271181a725dd17cdaa8f2805346cc330cdbad3b8e4b9751508bd0a3
languageName: node
linkType: hard

"fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3":
version: 3.1.3
resolution: "fast-deep-equal@npm:3.1.3"
Expand Down Expand Up @@ -5804,6 +5844,13 @@ __metadata:
languageName: node
linkType: hard

"fast-text-encoding@npm:1.0.6":
version: 1.0.6
resolution: "fast-text-encoding@npm:1.0.6"
checksum: 9d58f694314b3283e785bf61954902536da228607ad246905e30256f9ab8331f780ac987e7222c9f5eafd04168d07e12b8054c85cedb76a2c05af0e82387a903
languageName: node
linkType: hard

"fastq@npm:^1.6.0":
version: 1.13.0
resolution: "fastq@npm:1.13.0"
Expand Down Expand Up @@ -10047,6 +10094,13 @@ __metadata:
languageName: node
linkType: hard

"punycode@npm:^2.1.1":
version: 2.3.1
resolution: "punycode@npm:2.3.1"
checksum: bb0a0ceedca4c3c57a9b981b90601579058903c62be23c5e8e843d2c2d4148a3ecf029d5133486fb0e1822b098ba8bba09e89d6b21742d02fa26bda6441a6fb2
languageName: node
linkType: hard

"qrcode-terminal@npm:0.11.0":
version: 0.11.0
resolution: "qrcode-terminal@npm:0.11.0"
Expand Down Expand Up @@ -10181,6 +10235,17 @@ __metadata:
languageName: node
linkType: hard

"react-native-get-random-values@npm:^1.11.0":
version: 1.11.0
resolution: "react-native-get-random-values@npm:1.11.0"
dependencies:
fast-base64-decode: ^1.0.0
peerDependencies:
react-native: ">=0.56"
checksum: 07729f70a007f7a3b8f98ebf687c1298ba288b87dd71d8ba385be6b5a377718b27b97547bbe1db6b225b83ee109dfce0b01721e6ed535d53892f3ac81e6bf975
languageName: node
linkType: hard

"react-native-gradle-plugin@npm:^0.70.3":
version: 0.70.3
resolution: "react-native-gradle-plugin@npm:0.70.3"
Expand Down Expand Up @@ -10233,6 +10298,17 @@ __metadata:
languageName: node
linkType: hard

"react-native-url-polyfill@npm:2.0.0":
version: 2.0.0
resolution: "react-native-url-polyfill@npm:2.0.0"
dependencies:
whatwg-url-without-unicode: 8.0.0-3
peerDependencies:
react-native: "*"
checksum: 1a2e1030a62fd093764b5330ce0ff34d72246e581dd2892cddc347d8621931aeb2c9ea3e054960484a1259230e8461e569e1890f1ff452d3c5c0adef70190fc3
languageName: node
linkType: hard

"react-native-webview@npm:^11.23.1":
version: 11.23.1
resolution: "react-native-webview@npm:11.23.1"
Expand Down Expand Up @@ -11004,9 +11080,11 @@ __metadata:
"@types/lodash.memoize": ^4.1.7
"@types/lodash.once": ^4.1.7
"@types/react-native": ^0.70.4
"@types/react-native-get-random-values": ^1
"@types/react-test-renderer": ^18.0.0
"@typescript-eslint/eslint-plugin": ^5.38.1
"@typescript-eslint/parser": ^5.38.1
"@walletconnect/react-native-compat": ^2.13.0
babel-jest: ^28.1.3
bip39: ^3.0.4
eslint: ^8.24.0
Expand All @@ -11031,6 +11109,7 @@ __metadata:
react-native: 0.70.8
react-native-dotenv: ^3.4.0
react-native-error-boundary: ^1.1.16
react-native-get-random-values: ^1.11.0
react-native-shake: ^5.1.1
react-native-simple-crypto: ^0.2.15
react-native-svg: ^13.2.0
Expand Down Expand Up @@ -12288,13 +12367,31 @@ __metadata:
languageName: node
linkType: hard

"webidl-conversions@npm:^5.0.0":
version: 5.0.0
resolution: "webidl-conversions@npm:5.0.0"
checksum: ccf1ec2ca7c0b5671e5440ace4a66806ae09c49016ab821481bec0c05b1b82695082dc0a27d1fe9d804d475a408ba0c691e6803fd21be608e710955d4589cd69
languageName: node
linkType: hard

"whatwg-fetch@npm:^3.0.0":
version: 3.6.2
resolution: "whatwg-fetch@npm:3.6.2"
checksum: ee976b7249e7791edb0d0a62cd806b29006ad7ec3a3d89145921ad8c00a3a67e4be8f3fb3ec6bc7b58498724fd568d11aeeeea1f7827e7e1e5eae6c8a275afed
languageName: node
linkType: hard

"whatwg-url-without-unicode@npm:8.0.0-3":
version: 8.0.0-3
resolution: "whatwg-url-without-unicode@npm:8.0.0-3"
dependencies:
buffer: ^5.4.3
punycode: ^2.1.1
webidl-conversions: ^5.0.0
checksum: 1fe266f7161e0bd961087c1254a5a59d1138c3d402064495eed65e7590d9caed5a1d9acfd6e7a1b0bf0431253b0e637ee3e4ffc08387cd60e0b2ddb9d4687a4b
languageName: node
linkType: hard

"whatwg-url@npm:^5.0.0":
version: 5.0.0
resolution: "whatwg-url@npm:5.0.0"
Expand Down
Loading