Skip to content

Commit 8a06a6d

Browse files
authored
Merge branch 'develop' into bug/swap-bridge-improvements
2 parents 320d016 + 85cd391 commit 8a06a6d

File tree

47 files changed

+1599
-329
lines changed

Some content is hidden

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

47 files changed

+1599
-329
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ FLAG_WALLET_CONNECT_ENABLED=1
3838
API_LOGGING_ENABLED=1
3939
SENTRY_ENABLED=0
4040
SENTRY_ENVIRONMENT=ci-main
41+
USE_PUBLIC_LOG_DIR=0

.env.e2e

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ MOBILE_DATA_SYNCING_TOGGLE_ENABLE=0
4242
API_LOGGING_ENABLED=1
4343
SENTRY_ENABLED=0
4444
SENTRY_ENVIRONMENT=ci-main
45+
USE_PUBLIC_LOG_DIR=1
46+
VIEW_ID_TRACKER=1

.env.jenkins

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ FLAG_WALLET_CONNECT_ENABLED=1
3939
API_LOGGING_ENABLED=1
4040
SENTRY_ENABLED=0
4141
SENTRY_ENVIRONMENT=ci-main
42+
USE_PUBLIC_LOG_DIR=0
43+
VIEW_ID_TRACKER=1

.env.nightly

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ FLAG_WALLET_CONNECT_ENABLED=1
2626
API_LOGGING_ENABLED=1
2727
SENTRY_ENABLED=1
2828
SENTRY_ENVIRONMENT=ci-nightly
29+
USE_PUBLIC_LOG_DIR=0

.env.release

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ FLAG_WALLET_CONNECT_ENABLED=1
2323
API_LOGGING_ENABLED=0
2424
SENTRY_ENABLED=1
2525
SENTRY_ENVIRONMENT=production
26+
USE_PUBLIC_LOG_DIR=0

ios/Podfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ abstract_target 'Status' do
5757
pod 'react-native-config', :path => '../node_modules/react-native-config'
5858

5959
pod 'SSZipArchive', '2.4.3'
60+
# to fix [!] [!] CocoaPods could not find compatible versions for pod "libwebp"
61+
pod 'libwebp', '1.0.0'
6062
# to fix [!] CocoaPods could not find compatible versions for pod "CryptoSwift"
6163
pod 'CryptoSwift', git: "https://github.com/krzyzanowskim/CryptoSwift", tag: '1.8.0'
6264
pod "react-native-status-keycard", path: "../node_modules/react-native-status-keycard"

ios/Podfile.lock

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,33 @@ PODS:
2323
- secp256k1
2424
- SSZipArchive
2525
- libevent (2.1.12)
26-
- libwebp (1.3.2):
27-
- libwebp/demux (= 1.3.2)
28-
- libwebp/mux (= 1.3.2)
29-
- libwebp/sharpyuv (= 1.3.2)
30-
- libwebp/webp (= 1.3.2)
31-
- libwebp/demux (1.3.2):
26+
- libwebp (1.0.0):
27+
- libwebp/core (= 1.0.0)
28+
- libwebp/dec (= 1.0.0)
29+
- libwebp/demux (= 1.0.0)
30+
- libwebp/dsp (= 1.0.0)
31+
- libwebp/enc (= 1.0.0)
32+
- libwebp/mux (= 1.0.0)
33+
- libwebp/utils (= 1.0.0)
34+
- libwebp/webp (= 1.0.0)
35+
- libwebp/core (1.0.0):
3236
- libwebp/webp
33-
- libwebp/mux (1.3.2):
34-
- libwebp/demux
35-
- libwebp/sharpyuv (1.3.2)
36-
- libwebp/webp (1.3.2):
37-
- libwebp/sharpyuv
37+
- libwebp/dec (1.0.0):
38+
- libwebp/core
39+
- libwebp/demux (1.0.0):
40+
- libwebp/core
41+
- libwebp/dsp (1.0.0):
42+
- libwebp/core
43+
- libwebp/enc (1.0.0):
44+
- libwebp/core
45+
- libwebp/mux (1.0.0):
46+
- libwebp/core
47+
- libwebp/utils (1.0.0):
48+
- libwebp/core
49+
- libwebp/webp (1.0.0)
50+
- MMKV (2.1.0):
51+
- MMKVCore (~> 2.1.0)
52+
- MMKVCore (2.1.1)
3853
- RCT-Folly (2022.05.16.00):
3954
- boost
4055
- DoubleConversion
@@ -936,6 +951,11 @@ PODS:
936951
- React
937952
- react-native-lottie-splash-screen (1.1.2):
938953
- React
954+
- react-native-mmkv (2.12.2):
955+
- glog
956+
- MMKV (>= 1.3.3)
957+
- RCT-Folly (= 2022.05.16.00)
958+
- React-Core
939959
- react-native-netinfo (4.7.0):
940960
- React
941961
- react-native-orientation-locker (1.5.0):
@@ -1205,6 +1225,7 @@ DEPENDENCIES:
12051225
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
12061226
- Keycard (from `https://github.com/status-im/Keycard.swift.git`, tag `3.1.1`)
12071227
- libevent (~> 2.1.12)
1228+
- libwebp (= 1.0.0)
12081229
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
12091230
- RCT-Folly/Fabric (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
12101231
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
@@ -1239,6 +1260,7 @@ DEPENDENCIES:
12391260
- react-native-hole-view (from `../node_modules/react-native-hole-view`)
12401261
- react-native-image-resizer (from `../node_modules/react-native-image-resizer`)
12411262
- react-native-lottie-splash-screen (from `../node_modules/react-native-lottie-splash-screen`)
1263+
- react-native-mmkv (from `../node_modules/react-native-mmkv`)
12421264
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
12431265
- react-native-orientation-locker (from `../node_modules/react-native-orientation-locker`)
12441266
- react-native-pdf (from `../node_modules/react-native-pdf`)
@@ -1296,6 +1318,8 @@ SPEC REPOS:
12961318
- HMSegmentedControl
12971319
- libevent
12981320
- libwebp
1321+
- MMKV
1322+
- MMKVCore
12991323
- SDWebImage
13001324
- SDWebImageWebPCoder
13011325
- SocketRocket
@@ -1386,6 +1410,8 @@ EXTERNAL SOURCES:
13861410
:path: "../node_modules/react-native-image-resizer"
13871411
react-native-lottie-splash-screen:
13881412
:path: "../node_modules/react-native-lottie-splash-screen"
1413+
react-native-mmkv:
1414+
:path: "../node_modules/react-native-mmkv"
13891415
react-native-netinfo:
13901416
:path: "../node_modules/@react-native-community/netinfo"
13911417
react-native-orientation-locker:
@@ -1509,7 +1535,9 @@ SPEC CHECKSUMS:
15091535
HMSegmentedControl: 34c1f54d822d8308e7b24f5d901ec674dfa31352
15101536
Keycard: 3bd24405b9a875b3b3cf1ab1be69b5c30c5f28bc
15111537
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
1512-
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
1538+
libwebp: d7e0c95fe97245c97e08101eba10702ebb0f6101
1539+
MMKV: ce484c1ac40bf76d5f09a0195d2ec5b3d3840d55
1540+
MMKVCore: 1eb661c6c498ab88e3df9ce5d8ff94d05fcc0567
15131541
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
15141542
RCTRequired: 2544c0f1081a5fa12e108bb8cb40e5f4581ccd87
15151543
RCTTypeSafety: 50efabe2b115c11ed03fbf3fd79e2f163ddb5d7c
@@ -1542,6 +1570,7 @@ SPEC CHECKSUMS:
15421570
react-native-hole-view: 6935448993bac79f2b5a4ad7e9741094cf810679
15431571
react-native-image-resizer: 2f1577efa3bc762597681f530c8e8d05ce0ceeb3
15441572
react-native-lottie-splash-screen: 4e1b1fd9d6633f9cd2106d6877eb5ba0147f3e2b
1573+
react-native-mmkv: 1fdc81aa70c1aba09370718e6a63a09cbbbac8d2
15451574
react-native-netinfo: ddaca8bbb9e6e914b1a23787ccb879bc642931c9
15461575
react-native-orientation-locker: 851f6510d8046ea2f14aa169b1e01fcd309a94ba
15471576
react-native-pdf: 103940c90d62adfd259f63cca99c7c0c306b514c
@@ -1596,6 +1625,6 @@ SPEC CHECKSUMS:
15961625
TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654
15971626
Yoga: a716eea57d0d3430219c0a5a233e1e93ee931eb7
15981627

1599-
PODFILE CHECKSUM: 56d9f695324306d6db368d1172d211dfab55b7cb
1628+
PODFILE CHECKSUM: 1a15018a9c864c8f0a1cdec9a6e195e1ab0b1d0d
16001629

16011630
COCOAPODS: 1.15.2

modules/react-native-status/android/src/main/java/im/status/ethereum/module/AccountManager.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,10 @@ class AccountManager(private val reactContext: ReactApplicationContext) : ReactC
120120
@ReactMethod
121121
private fun initializeApplication(request: String, callback: Callback) {
122122
Log.d(TAG, "initializeApplication")
123-
val jsonParams = JSONObject(request)
124-
// for ios, the log dir will be the same as the root data dir, status-go will default to root data dir if logDir is not provided
125-
jsonParams.put("logDir", utils.getLogDirectory()?.absolutePath)
126-
val jsonString = jsonParams.toString()
127123
StatusBackendClient.executeStatusGoRequestWithCallback(
128124
"InitializeApplication",
129-
jsonString,
130-
{ Statusgo.initializeApplication(jsonString) },
125+
request,
126+
{ Statusgo.initializeApplication(request) },
131127
callback
132128
)
133129
}

modules/react-native-status/android/src/main/java/im/status/ethereum/module/LogManager.kt

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ class LogManager(private val reactContext: ReactApplicationContext) : ReactConte
9595
}
9696

9797
@ReactMethod
98-
fun sendLogs(dbJson: String, jsLogs: String, callback: Callback) {
98+
fun sendLogs(dbJson: String, jsLogs: String, usePublicLogDir: Boolean, callback: Callback) {
9999
Log.d(TAG, "sendLogs")
100100
if (!utils.checkAvailability()) {
101101
return
102102
}
103103

104104
val context = reactApplicationContext
105-
val logsTempDir = File(context.cacheDir, "logs") // This path needs to be in sync with android/app/src/main/res/xml/file_provider_paths.xml
105+
val logsTempDir = File(context.cacheDir, Utils.LOGS_DIRECTORY_NAME) // This path needs to be in sync with android/app/src/main/res/xml/file_provider_paths.xml
106106
logsTempDir.mkdir()
107107

108108
val dbFile = File(logsTempDir, "db.json")
@@ -135,7 +135,7 @@ class LogManager(private val reactContext: ReactApplicationContext) : ReactConte
135135
val filesToZip = mutableListOf<File>(dbFile, statusLogFile)
136136

137137
// Get all files from the log directory
138-
val logDirectory = utils.getLogDirectory()
138+
val logDirectory = utils.getLogDirectory(usePublicLogDir)
139139
if (logDirectory != null && logDirectory.exists()) {
140140
val logFiles = logDirectory.listFiles()
141141
if (logFiles != null) {
@@ -192,29 +192,52 @@ class LogManager(private val reactContext: ReactApplicationContext) : ReactConte
192192
}
193193

194194
@ReactMethod(isBlockingSynchronousMethod = true)
195-
fun logFileDirectory(): String? {
196-
return utils.getLogDirectory()?.absolutePath
195+
fun logFileDirectory(usePublicLogDir: Boolean): String? {
196+
Log.d(TAG, "logFileDirectory: usePublicLogDir=$usePublicLogDir")
197+
return utils.getLogDirectory(usePublicLogDir)?.absolutePath
197198
}
198199

199200
@ReactMethod(isBlockingSynchronousMethod = true)
200-
fun setLogLevel(setLogLevelRequest: String): String {
201-
Log.d(TAG, "setLogLevel: $setLogLevelRequest")
201+
fun setProfileLogLevel(setProfileLogLevelRequest: String): String {
202+
Log.d(TAG, "setProfileLogLevel: $setProfileLogLevelRequest")
202203

203204
return StatusBackendClient.executeStatusGoRequestWithResult(
204-
endpoint = "SetLogLevel",
205-
requestBody = setLogLevelRequest,
206-
statusgoFunction = { Statusgo.setLogLevel(setLogLevelRequest) }
205+
endpoint = "SetProfileLogLevel",
206+
requestBody = setProfileLogLevelRequest,
207+
statusgoFunction = { Statusgo.setProfileLogLevel(setProfileLogLevelRequest) }
207208
)
208209
}
209210

210211
@ReactMethod(isBlockingSynchronousMethod = true)
211-
fun setLogEnabled(setLogEnabledRequest: String): String {
212-
Log.d(TAG, "setLogEnabled: $setLogEnabledRequest")
212+
fun setProfileLogEnabled(setProfileLogEnabledRequest: String): String {
213+
Log.d(TAG, "setProfileLogEnabled: $setProfileLogEnabledRequest")
213214

214215
return StatusBackendClient.executeStatusGoRequestWithResult(
215216
endpoint = "SetLogEnabled",
216-
requestBody = setLogEnabledRequest,
217-
statusgoFunction = { Statusgo.setLogEnabled(setLogEnabledRequest) }
217+
requestBody = setProfileLogEnabledRequest,
218+
statusgoFunction = { Statusgo.setProfileLogEnabled(setProfileLogEnabledRequest) }
219+
)
220+
}
221+
222+
@ReactMethod
223+
fun setPreLoginLogLevel(setPreLoginLogLevelRequest: String) {
224+
Log.d(TAG, "setPreLoginLogLevel: $setPreLoginLogLevelRequest")
225+
226+
StatusBackendClient.executeStatusGoRequest(
227+
endpoint = "SetPreLoginLogLevel",
228+
requestBody = setPreLoginLogLevelRequest,
229+
statusgoFunction = { Statusgo.setPreLoginLogLevel(setPreLoginLogLevelRequest) }
230+
)
231+
}
232+
233+
@ReactMethod
234+
fun setPreLoginLogEnabled(setPreLoginLogEnabledRequest: String) {
235+
Log.d(TAG, "setPreLoginLogEnabled: $setPreLoginLogEnabledRequest")
236+
237+
StatusBackendClient.executeStatusGoRequest(
238+
endpoint = "SetPreLoginLogEnabled",
239+
requestBody = setPreLoginLogEnabledRequest,
240+
statusgoFunction = { Statusgo.setPreLoginLogEnabled(setPreLoginLogEnabledRequest) }
218241
)
219242
}
220243

modules/react-native-status/android/src/main/java/im/status/ethereum/module/Utils.kt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Utils(private val reactContext: ReactApplicationContext) : ReactContextBas
1818

1919
companion object {
2020
private const val TAG = "Utils"
21+
const val LOGS_DIRECTORY_NAME = "logs"
2122
}
2223

2324
override fun getName(): String {
@@ -38,8 +39,22 @@ class Utils(private val reactContext: ReactApplicationContext) : ReactContextBas
3839
return getNoBackupDirectory()
3940
}
4041

41-
fun getLogDirectory(): File? {
42-
return File(getNoBackupDirectory(), "logs")
42+
@ReactMethod(isBlockingSynchronousMethod = true)
43+
fun getMMKVStoragePath(): String {
44+
return pathCombine(reactContext.noBackupFilesDir.absolutePath, "/mmkv")
45+
}
46+
47+
fun getLogDirectory(usePublicLogDir: Boolean): File? {
48+
return if (usePublicLogDir) {
49+
StatusBackendClient.getInstance()?.let { client ->
50+
if (client.serverEnabled && client.rootDataDir != null) {
51+
return File(client.rootDataDir!!, LOGS_DIRECTORY_NAME)
52+
}
53+
}
54+
reactContext.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)
55+
} else {
56+
File(getNoBackupDirectory(), LOGS_DIRECTORY_NAME)
57+
}
4358
}
4459

4560
fun getKeyUID(json: String): String {

0 commit comments

Comments
 (0)