mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-30 11:34:43 +01:00
Manage theme insertion callbacks behaviour (#892)
This commit is contained in:
parent
41504e779b
commit
a12e65aa0e
@ -19,12 +19,11 @@ public class InsertCustomTheme {
|
||||
CustomTheme customTheme, boolean checkDuplicate,
|
||||
InsertCustomThemeListener insertCustomThemeListener) {
|
||||
executor.execute(() -> {
|
||||
if (checkDuplicate) {
|
||||
if (redditDataRoomDatabase.customThemeDao().getCustomTheme(customTheme.name) != null) {
|
||||
handler.post(insertCustomThemeListener::duplicate);
|
||||
}
|
||||
}
|
||||
CustomTheme previousTheme = redditDataRoomDatabase.customThemeDao().getCustomTheme(customTheme.name);
|
||||
|
||||
if (checkDuplicate && previousTheme != null) {
|
||||
handler.post(insertCustomThemeListener::duplicate);
|
||||
} else {
|
||||
if (customTheme.isLightTheme) {
|
||||
redditDataRoomDatabase.customThemeDao().unsetLightTheme();
|
||||
CustomThemeSharedPreferencesUtils.insertThemeToSharedPreferences(customTheme, lightThemeSharedPreferences);
|
||||
@ -46,6 +45,7 @@ public class InsertCustomTheme {
|
||||
redditDataRoomDatabase.customThemeDao().insert(customTheme);
|
||||
|
||||
handler.post(insertCustomThemeListener::success);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user