@@ -189,17 +189,29 @@ void readStorageValue(Context ctx, String key) {
189189 AsyncStorageAccess asyncStorage = StorageModule . getStorageInstance(ctx);
190190
191191 BuildersKt . launch(GlobalScope . INSTANCE ,
192- Dispatchers . getIO(),
193- CoroutineStart . DEFAULT ,
194- (scope, continuation) - > {
195- List<String > keys = new ArrayList<> ();
196- keys. add(key);
197-
198- List<Entry > entries = (List<Entry > ) asyncStorage. getValues(keys, (Continuation<? super List<? extends Entry > > ) continuation);
199- doSomethingWithValues(entries);
200-
201- return Unit . INSTANCE ;
202- });
192+ Dispatchers . getIO(),
193+ CoroutineStart . DEFAULT ,
194+ (scope, continuation) - > {
195+ List<String > keys = new ArrayList<> ();
196+ keys. add(key);
197+
198+ Continuation<? super List<? extends Entry > > cont = new Continuation () {
199+ @NotNull
200+ @Override
201+ public CoroutineContext getContext () {
202+ return scope. getCoroutineContext();
203+ }
204+
205+ @Override
206+ public void resumeWith (@NotNull Object o ) {
207+ List<Entry > entries = (List<Entry > ) o;
208+ doSomethingWithEntries(entries);
209+ }
210+ };
211+
212+ asyncStorage. getValues(keys, cont);
213+ return Unit . INSTANCE ;
214+ });
203215
204216}
205217```
@@ -212,20 +224,26 @@ void saveStorageValue(Context ctx, String key, String value) {
212224 AsyncStorageAccess asyncStorage = StorageModule . getStorageInstance(ctx);
213225
214226 BuildersKt . launch(GlobalScope . INSTANCE ,
215- Dispatchers . getIO(),
216- CoroutineStart . DEFAULT ,
217- (scope, continuation) - > {
218-
219- List<Entry > entries = new ArrayList<> ();
220- Entry entry = new Entry (key, value);
221- entries. add(entry);
222-
223- asyncStorage. setValues(entries, continuation);
224-
225- return Unit . INSTANCE ;
226- });
227+ Dispatchers . getIO(),
228+ CoroutineStart . DEFAULT ,
229+ (scope, continuation) - > {
230+ Continuation cont = new Continuation () {
231+ @NotNull
232+ @Override
233+ public CoroutineContext getContext () {
234+ return scope. getCoroutineContext();
235+ }
236+
237+ @Override
238+ public void resumeWith (@NotNull Object o ) {}
239+ };
240+
241+ List<Entry > entries = new ArrayList<> ();
242+ Entry entry = new Entry (key, value);
243+ entries. add(entry);
244+ asyncStorage. setValues(entries, cont);
245+ return Unit . INSTANCE ;
246+ });
227247}
228248```
229249
230-
231-
0 commit comments