Skip to content

Commit 1741189

Browse files
authored
Merge pull request #124 from WalletConnect/feat/w3i-sdk-example
feat: implement notify api to rn sample wallet
2 parents 9770be2 + 21f8628 commit 1741189

File tree

78 files changed

+4866
-2754
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4866
-2754
lines changed

wallets/rn_cli_wallet/.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ DerivedData
2121
*.ipa
2222
*.xcuserstate
2323
ios/.xcode.env.local
24+
ios/GoogleService-Info.plist
2425

2526
# Android/IntelliJ
2627
#
@@ -33,6 +34,7 @@ local.properties
3334
.cxx/
3435
*.keystore
3536
!debug.keystore
37+
android/app/google-services.json
3638

3739
# node.js
3840
#
@@ -71,4 +73,7 @@ yarn-error.log
7173
sentry.properties
7274

7375
# ASDF
74-
.tool-versions
76+
.tool-versions
77+
78+
# Secrets
79+
secrets.properties

wallets/rn_cli_wallet/Gemfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
gem 'cocoapods', '~> 1.13'
7-
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
6+
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7+
# bound in the template on Cocoapods with next React Native release.
8+
gem 'cocoapods', '>= 1.13', '< 1.15'
9+
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'

wallets/rn_cli_wallet/Gemfile.lock

+23-24
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
CFPropertyList (3.0.5)
4+
CFPropertyList (3.0.6)
55
rexml
6-
activesupport (6.1.7)
6+
activesupport (7.0.8)
77
concurrent-ruby (~> 1.0, >= 1.0.2)
88
i18n (>= 1.6, < 2)
99
minitest (>= 5.1)
1010
tzinfo (~> 2.0)
11-
zeitwerk (~> 2.3)
12-
addressable (2.8.1)
11+
addressable (2.8.6)
1312
public_suffix (>= 2.0.2, < 6.0)
1413
algoliasearch (1.27.5)
1514
httpclient (~> 2.8, >= 2.8.3)
1615
json (>= 1.5.1)
1716
atomos (0.1.3)
1817
claide (1.1.0)
19-
cocoapods (1.11.3)
18+
cocoapods (1.15.0)
2019
addressable (~> 2.8)
2120
claide (>= 1.0.2, < 2.0)
22-
cocoapods-core (= 1.11.3)
21+
cocoapods-core (= 1.15.0)
2322
cocoapods-deintegrate (>= 1.0.3, < 2.0)
24-
cocoapods-downloader (>= 1.4.0, < 2.0)
23+
cocoapods-downloader (>= 2.1, < 3.0)
2524
cocoapods-plugins (>= 1.0.0, < 2.0)
2625
cocoapods-search (>= 1.0.0, < 2.0)
27-
cocoapods-trunk (>= 1.4.0, < 2.0)
26+
cocoapods-trunk (>= 1.6.0, < 2.0)
2827
cocoapods-try (>= 1.1.0, < 2.0)
2928
colored2 (~> 3.1)
3029
escape (~> 0.0.4)
3130
fourflusher (>= 2.3.0, < 3.0)
3231
gh_inspector (~> 1.0)
3332
molinillo (~> 0.8.0)
3433
nap (~> 1.0)
35-
ruby-macho (>= 1.0, < 3.0)
36-
xcodeproj (>= 1.21.0, < 2.0)
37-
cocoapods-core (1.11.3)
38-
activesupport (>= 5.0, < 7)
34+
ruby-macho (>= 2.3.0, < 3.0)
35+
xcodeproj (>= 1.23.0, < 2.0)
36+
cocoapods-core (1.15.0)
37+
activesupport (>= 5.0, < 8)
3938
addressable (~> 2.8)
4039
algoliasearch (~> 1.0)
4140
concurrent-ruby (~> 1.1)
@@ -45,7 +44,7 @@ GEM
4544
public_suffix (~> 4.0)
4645
typhoeus (~> 1.0)
4746
cocoapods-deintegrate (1.0.5)
48-
cocoapods-downloader (1.6.3)
47+
cocoapods-downloader (2.1)
4948
cocoapods-plugins (1.0.0)
5049
nap
5150
cocoapods-search (1.0.1)
@@ -54,44 +53,44 @@ GEM
5453
netrc (~> 0.11)
5554
cocoapods-try (1.2.0)
5655
colored2 (3.1.2)
57-
concurrent-ruby (1.1.10)
56+
concurrent-ruby (1.2.3)
5857
escape (0.0.4)
5958
ethon (0.16.0)
6059
ffi (>= 1.15.0)
61-
ffi (1.15.5)
60+
ffi (1.16.3)
6261
fourflusher (2.3.1)
6362
fuzzy_match (2.0.4)
6463
gh_inspector (1.1.3)
6564
httpclient (2.8.3)
66-
i18n (1.12.0)
65+
i18n (1.14.1)
6766
concurrent-ruby (~> 1.0)
68-
json (2.6.2)
69-
minitest (5.16.3)
67+
json (2.7.1)
68+
minitest (5.21.2)
7069
molinillo (0.8.0)
7170
nanaimo (0.3.0)
7271
nap (1.1.0)
7372
netrc (0.11.0)
7473
public_suffix (4.0.7)
75-
rexml (3.2.5)
74+
rexml (3.2.6)
7675
ruby-macho (2.5.1)
77-
typhoeus (1.4.0)
76+
typhoeus (1.4.1)
7877
ethon (>= 0.9.0)
79-
tzinfo (2.0.5)
78+
tzinfo (2.0.6)
8079
concurrent-ruby (~> 1.0)
81-
xcodeproj (1.22.0)
80+
xcodeproj (1.24.0)
8281
CFPropertyList (>= 2.3.3, < 4.0)
8382
atomos (~> 0.1.3)
8483
claide (>= 1.0.2, < 2.0)
8584
colored2 (~> 3.1)
8685
nanaimo (~> 0.3.0)
8786
rexml (~> 3.2.4)
88-
zeitwerk (2.6.6)
8987

9088
PLATFORMS
9189
ruby
9290

9391
DEPENDENCIES
94-
cocoapods (~> 1.11, >= 1.11.2)
92+
activesupport (>= 6.1.7.3, < 7.1.0)
93+
cocoapods (~> 1.13)
9594

9695
RUBY VERSION
9796
ruby 2.7.5p203

wallets/rn_cli_wallet/android/app/build.gradle

+34-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apply plugin: "com.android.application"
22
apply plugin: "org.jetbrains.kotlin.android"
33
apply plugin: "com.facebook.react"
44
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
5+
apply plugin: "com.google.gms.google-services"
56

67
/**
78
* This is the configuration block to customize your React Native Android app.
@@ -78,27 +79,49 @@ android {
7879
applicationId "com.walletconnect.web3wallet.rnsample"
7980
minSdkVersion rootProject.ext.minSdkVersion
8081
targetSdkVersion rootProject.ext.targetSdkVersion
81-
versionCode 9
82+
versionCode 15
8283
versionName "1.0"
8384
}
85+
86+
def secretsProperties = new Properties()
87+
secretsProperties.load(new FileInputStream(rootProject.file("secrets.properties")))
88+
8489
signingConfigs {
8590
debug {
86-
storeFile file('debug.keystore')
87-
storePassword 'android'
88-
keyAlias 'androiddebugkey'
89-
keyPassword 'android'
91+
storeFile file(secretsProperties['WC_FILENAME_DEBUG'])
92+
storePassword secretsProperties['WC_STORE_PASSWORD_DEBUG']
93+
keyAlias secretsProperties['WC_KEYSTORE_ALIAS_DEBUG']
94+
keyPassword secretsProperties['WC_KEY_PASSWORD_DEBUG']
95+
}
96+
internal {
97+
storeFile file(secretsProperties['WC_FILENAME_INTERNAL'])
98+
storePassword secretsProperties['WC_STORE_PASSWORD_INTERNAL']
99+
keyAlias secretsProperties['WC_KEYSTORE_ALIAS']
100+
keyPassword secretsProperties['WC_KEY_PASSWORD_INTERNAL']
101+
}
102+
upload {
103+
storeFile file(secretsProperties['WC_FILENAME_UPLOAD'])
104+
storePassword secretsProperties['WC_STORE_PASSWORD_UPLOAD']
105+
keyAlias secretsProperties['WC_KEYSTORE_ALIAS']
106+
keyPassword secretsProperties['WC_KEY_PASSWORD_UPLOAD']
90107
}
91108
}
92109
buildTypes {
110+
internal {
111+
applicationIdSuffix ".internal"
112+
versionNameSuffix "-internal"
113+
signingConfig signingConfigs.internal
114+
matchingFallbacks = ['release']
115+
}
93116
debug {
117+
applicationIdSuffix ".debug"
118+
versionNameSuffix "-debug"
94119
signingConfig signingConfigs.debug
95120
}
96121
release {
97-
// Caution! In production, you need to generate your own keystore file.
98-
// see https://reactnative.dev/docs/signed-apk-android.
99-
signingConfig signingConfigs.debug
100122
minifyEnabled enableProguardInReleaseBuilds
101123
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
124+
signingConfig signingConfigs.upload
102125
}
103126
}
104127
packagingOptions {
@@ -112,6 +135,9 @@ dependencies {
112135
implementation("com.facebook.react:react-android")
113136
implementation("com.facebook.react:flipper-integration")
114137

138+
// Import the Firebase BoM
139+
implementation platform('com.google.firebase:firebase-bom:32.7.1')
140+
115141
if (hermesEnabled.toBoolean()) {
116142
implementation("com.facebook.react:hermes-android")
117143
} else {
-2.2 KB
Binary file not shown.

wallets/rn_cli_wallet/android/app/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<uses-permission android:name="android.permission.INTERNET" />
44
<uses-permission android:name="android.permission.CAMERA" />
5+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
56

67
<application
78
android:name=".MainApplication"

wallets/rn_cli_wallet/android/app/src/main/java/com/walletconnect/web3wallet/rnsample/MainActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class MainActivity : ReactActivity() {
1111
* Returns the name of the main component registered from JavaScript. This is used to schedule
1212
* rendering of the component.
1313
*/
14-
override fun getMainComponentName(): String = "RN Web3Wallet"
14+
override fun getMainComponentName(): String = "RNWeb3Wallet"
1515

1616
/**
1717
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]

wallets/rn_cli_wallet/android/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ buildscript {
1515
classpath("com.android.tools.build:gradle")
1616
classpath("com.facebook.react:react-native-gradle-plugin")
1717
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
18+
classpath("com.google.gms:google-services:4.4.0")
1819
}
1920
}
2021

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
rootProject.name = 'RN Web3Wallet'
1+
rootProject.name = 'RNWeb3Wallet'
22
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
33
include ':app'
44
includeBuild('../node_modules/@react-native/gradle-plugin')

wallets/rn_cli_wallet/app.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"name": "RN Web3Wallet",
2+
"name": "RNWeb3Wallet",
33
"displayName": "RN Web3Wallet"
4-
}
4+
}

wallets/rn_cli_wallet/babel.config.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
module.exports = {
22
presets: ['module:@react-native/babel-preset'],
33
plugins: [
4+
['module:react-native-dotenv'],
45
[
56
'module-resolver',
67
{
78
alias: {
8-
'crypto': 'react-native-quick-crypto',
9-
'stream': 'stream-browserify',
10-
'buffer': '@craftzdog/react-native-buffer',
9+
crypto: 'react-native-quick-crypto',
10+
stream: 'stream-browserify',
11+
buffer: '@craftzdog/react-native-buffer',
12+
'@/components': './src/components',
13+
'@/constants': './src/constants',
14+
'@/context': './src/context',
15+
'@/data': './src/data',
16+
'@/hooks': './src/hooks',
17+
'@/navigators': './src/navigators',
18+
'@/icons': './src/icons',
19+
'@/screens': './src/screens',
20+
'@/modals': './src/modals',
21+
'@/utils': './src/utils',
22+
'@/provider': './src/provider',
23+
'@/store': './src/store',
1124
},
1225
},
1326
],
14-
[
15-
'module:react-native-dotenv',
16-
{
17-
envName: 'APP_ENV',
18-
moduleName: '@env',
19-
path: '.env',
20-
blocklist: null,
21-
allowlist: null,
22-
safe: false,
23-
allowUndefined: true,
24-
verbose: false,
25-
},
26-
],
2727
],
2828
};

wallets/rn_cli_wallet/index.js

+30-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
1-
/**
2-
* @format
3-
*/
1+
import 'react-native-gesture-handler';
42

5-
import './polyfills';
63
import {AppRegistry} from 'react-native';
7-
import App from './src/screens/App';
84
import {name as appName} from './app.json';
95

10-
AppRegistry.registerComponent(appName, () => App);
6+
import crypto from 'react-native-quick-crypto';
7+
8+
import App from './src/screens/App';
9+
10+
import './src/utils/FirebaseMessagingConfig';
11+
12+
const polyfillDigest = async (algorithm, data) => {
13+
const algo = algorithm.replace('-', '').toLowerCase();
14+
const hash = crypto.createHash(algo);
15+
hash.update(data);
16+
return hash.digest();
17+
};
18+
19+
// eslint-disable-next-line no-undef
20+
globalThis.crypto = crypto;
21+
// eslint-disable-next-line no-undef
22+
globalThis.crypto.subtle = {
23+
digest: polyfillDigest,
24+
};
25+
26+
function HeadlessCheck({isHeadless}) {
27+
if (isHeadless) {
28+
return null;
29+
}
30+
31+
return <App />;
32+
}
33+
34+
AppRegistry.registerComponent(appName, () => HeadlessCheck);

wallets/rn_cli_wallet/ios/.xcode.env

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
# For example, to use nvm with brew, add the following line
1010
# . "$(brew --prefix nvm)/nvm.sh" --no-use
1111
export NODE_BINARY=$(command -v node)
12+
13+
export NODE_BINARY=/usr/local/bin/node

0 commit comments

Comments
 (0)