Files
rr3-apk/decompiled/sources/androidx/datastore/preferences/SharedPreferencesMigrationKt$getMigrationFunction$1.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

91 lines
4.5 KiB
Java

package androidx.datastore.preferences;
import androidx.datastore.migrations.SharedPreferencesView;
import androidx.datastore.preferences.core.MutablePreferences;
import androidx.datastore.preferences.core.Preferences;
import androidx.datastore.preferences.core.PreferencesKeys;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt__IterablesKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.Boxing;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function3;
@DebugMetadata(c = "androidx.datastore.preferences.SharedPreferencesMigrationKt$getMigrationFunction$1", f = "SharedPreferencesMigration.kt", l = {}, m = "invokeSuspend")
/* loaded from: classes.dex */
public final class SharedPreferencesMigrationKt$getMigrationFunction$1 extends SuspendLambda implements Function3 {
/* synthetic */ Object L$0;
/* synthetic */ Object L$1;
int label;
public SharedPreferencesMigrationKt$getMigrationFunction$1(Continuation continuation) {
super(3, continuation);
}
@Override // kotlin.jvm.functions.Function3
public final Object invoke(SharedPreferencesView sharedPreferencesView, Preferences preferences, Continuation continuation) {
SharedPreferencesMigrationKt$getMigrationFunction$1 sharedPreferencesMigrationKt$getMigrationFunction$1 = new SharedPreferencesMigrationKt$getMigrationFunction$1(continuation);
sharedPreferencesMigrationKt$getMigrationFunction$1.L$0 = sharedPreferencesView;
sharedPreferencesMigrationKt$getMigrationFunction$1.L$1 = preferences;
return sharedPreferencesMigrationKt$getMigrationFunction$1.invokeSuspend(Unit.INSTANCE);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
if (this.label != 0) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
SharedPreferencesView sharedPreferencesView = (SharedPreferencesView) this.L$0;
Preferences preferences = (Preferences) this.L$1;
Set<Preferences.Key<?>> keySet = preferences.asMap().keySet();
ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(keySet, 10));
Iterator<T> it = keySet.iterator();
while (it.hasNext()) {
arrayList.add(((Preferences.Key) it.next()).getName());
}
Map<String, Object> all = sharedPreferencesView.getAll();
LinkedHashMap linkedHashMap = new LinkedHashMap();
for (Map.Entry<String, Object> entry : all.entrySet()) {
if (Boxing.boxBoolean(!arrayList.contains(entry.getKey())).booleanValue()) {
linkedHashMap.put(entry.getKey(), entry.getValue());
}
}
MutablePreferences mutablePreferences = preferences.toMutablePreferences();
for (Map.Entry entry2 : linkedHashMap.entrySet()) {
String str = (String) entry2.getKey();
Object value = entry2.getValue();
if (value instanceof Boolean) {
mutablePreferences.set(PreferencesKeys.booleanKey(str), value);
} else if (value instanceof Float) {
mutablePreferences.set(PreferencesKeys.floatKey(str), value);
} else if (value instanceof Integer) {
mutablePreferences.set(PreferencesKeys.intKey(str), value);
} else if (value instanceof Long) {
mutablePreferences.set(PreferencesKeys.longKey(str), value);
} else if (value instanceof String) {
mutablePreferences.set(PreferencesKeys.stringKey(str), value);
} else if (value instanceof Set) {
Preferences.Key<Set<String>> stringSetKey = PreferencesKeys.stringSetKey(str);
if (value != null) {
mutablePreferences.set(stringSetKey, (Set) value);
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlin.collections.Set<kotlin.String>");
}
} else {
continue;
}
}
return mutablePreferences.toPreferences();
}
}