File tree Expand file tree Collapse file tree 7 files changed +44
-7
lines changed
android/src/main/java/com/reactnativecommunity/asyncstorage Expand file tree Collapse file tree 7 files changed +44
-7
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,10 @@ jobs:
218
218
- run :
219
219
name : Build APK
220
220
command : yarn build:e2e:android
221
+ - run :
222
+ name : Build APK with Next storage
223
+ working_directory : example/android
224
+ command : ./gradlew assembleNext --max-workers 2
221
225
- persist_to_workspace :
222
226
root : ~/async_storage
223
227
paths :
@@ -292,6 +296,9 @@ jobs:
292
296
- run :
293
297
name : Run e2e tests
294
298
command : yarn test:e2e:android
299
+ - run :
300
+ name : Run e2e tests for Next storage
301
+ command : yarn detox test -c android.emu.release.next --maxConcurrency 1
295
302
296
303
Release :
297
304
<< : *js_defaults
Original file line number Diff line number Diff line change 3
3
import java .util .ArrayDeque ;
4
4
import java .util .concurrent .Executor ;
5
5
6
- // Adapted from https://android.googlesource.com/platform/frameworks/base.git/+/1488a3a19d4681a41fb45570c15e14d99db1cb66/core/java/android/os/AsyncTask.java#237
6
+ /**
7
+ * Detox is using this implementation detail in its environment setup,
8
+ * so in order for Next storage to work, this class has been made public
9
+ * <p>
10
+ * Adapted from https://android.googlesource.com/platform/frameworks/base.git/+/1488a3a19d4681a41fb45570c15e14d99db1cb66/core/java/android/os/AsyncTask.java#237
11
+ */
7
12
public class SerialExecutor implements Executor {
8
13
private final ArrayDeque <Runnable > mTasks = new ArrayDeque <Runnable >();
9
14
private Runnable mActive ;
@@ -27,6 +32,7 @@ public void run() {
27
32
scheduleNext ();
28
33
}
29
34
}
35
+
30
36
synchronized void scheduleNext () {
31
37
if ((mActive = mTasks .poll ()) != null ) {
32
38
executor .execute (mActive );
Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ fun ReadableArray.toEntryList(): List<Entry> {
14
14
val key = keyValue[0 ]
15
15
val value = keyValue[1 ]
16
16
17
- if (key == null || key !is String ) {
17
+ if (key !is String ) {
18
18
when (key) {
19
19
null -> throw AsyncStorageError .keyIsNull()
20
- !is String -> throw AsyncStorageError .keyNotString()
20
+ else -> throw AsyncStorageError .keyNotString()
21
21
}
22
22
}
23
23
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ import kotlinx.coroutines.launch
19
19
class StorageModule (reactContext : ReactContext ) : ReactContextBaseJavaModule(), CoroutineScope {
20
20
override fun getName () = " RNC_AsyncSQLiteDBStorage"
21
21
22
- // this executor is here only to please detox, which relies on internal implementation
23
- // of current Async Storage
22
+ // this executor is not used by the module, but it must exists
23
+ // Detox relies on this implementation detail to run
24
24
@VisibleForTesting
25
25
private val executor = SerialExecutor (Dispatchers .Main .asExecutor())
26
26
Original file line number Diff line number Diff line change @@ -28,6 +28,12 @@ task fetchDependencies() {
28
28
buildscript {
29
29
ext. kotlinVersion = ' 1.4.21'
30
30
31
+ // Mainly for Detox testing for using Next Storage
32
+ // when building next, force using next storage
33
+ if (gradle. startParameter. getTaskNames(). contains(" assembleNext" )) {
34
+ rootProject. setProperty(" AsyncStorage_useNextStorage" , " true" )
35
+ }
36
+
31
37
repositories {
32
38
google()
33
39
jcenter()
@@ -65,7 +71,17 @@ allprojects {
65
71
}
66
72
}
67
73
68
- androidExtension. buildTypes. release. signingConfig = androidExtension. signingConfigs. test
74
+ androidExtension. buildTypes {
75
+ release {
76
+ signingConfig androidExtension. signingConfigs. test
77
+ }
78
+
79
+ next {
80
+ initWith release
81
+ matchingFallbacks = [" debug" , " release" ]
82
+ }
83
+ }
84
+
69
85
androidExtension. testBuildType = ' release'
70
86
71
87
androidExtension. sourceSets. androidTest. java. srcDirs + = " $rootDir /app/src/androidTest/java"
Original file line number Diff line number Diff line change 22
22
23
23
# Enable dedicated thread pool executor
24
24
AsyncStorage_dedicatedExecutor =true
25
- AsyncStorage_useNextStorage =true
25
+ AsyncStorage_useNextStorage =false
26
26
27
27
android.useAndroidX =true
28
28
android.enableJetifier =true
Original file line number Diff line number Diff line change 128
128
"device" : {
129
129
"avdName" : " Emu_E2E"
130
130
}
131
+ },
132
+ "android.emu.release.next" : {
133
+ "binaryPath" : " example/android/app/build/outputs/apk/next/app-next.apk" ,
134
+ "testBinaryPath" : " example/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk" ,
135
+ "type" : " android.emulator" ,
136
+ "device" : {
137
+ "avdName" : " Emu_E2E"
138
+ }
131
139
}
132
140
}
133
141
},
You can’t perform that action at this time.
0 commit comments