Add preferences for app shortcut search

This commit is contained in:
MM20
2022-03-21 14:58:14 +01:00
parent a4a562e335
commit d6ebbd193a
10 changed files with 129 additions and 41 deletions
@@ -9,6 +9,7 @@ import de.mm20.launcher2.crashreporter.CrashReporter
import de.mm20.launcher2.preferences.migrations.FactorySettingsMigration
import de.mm20.launcher2.preferences.migrations.Migration_1_2
import de.mm20.launcher2.preferences.migrations.Migration_2_3
import de.mm20.launcher2.preferences.migrations.Migration_3_4
typealias LauncherDataStore = DataStore<Settings>
@@ -19,7 +20,8 @@ internal val Context.dataStore: LauncherDataStore by dataStore(
listOf(
FactorySettingsMigration(it),
Migration_1_2(),
Migration_2_3()
Migration_2_3(),
Migration_3_4(),
)
},
corruptionHandler = ReplaceFileCorruptionHandler {
@@ -29,4 +31,4 @@ internal val Context.dataStore: LauncherDataStore by dataStore(
}
)
internal const val SchemaVersion = 3
internal const val SchemaVersion = 4
@@ -65,6 +65,11 @@ fun createFactorySettings(context: Context): Settings {
.newBuilder()
.setEnabled(true)
)
.setAppShortcutSearch(
Settings.AppShortcutSearchSettings
.newBuilder()
.setEnabled(true)
)
.setCalculatorSearch(
Settings.CalculatorSearchSettings
.newBuilder()
@@ -0,0 +1,12 @@
package de.mm20.launcher2.preferences.migrations
import de.mm20.launcher2.preferences.Settings
class Migration_3_4: VersionedMigration(3, 4) {
override suspend fun applyMigrations(builder: Settings.Builder): Settings.Builder {
return builder.setAppShortcutSearch(
Settings.AppShortcutSearchSettings.newBuilder()
.setEnabled(true)
)
}
}
@@ -180,4 +180,9 @@ message Settings {
uint32 border_width = 3;
}
CardSettings cards = 24;
message AppShortcutSearchSettings {
bool enabled = 1;
}
AppShortcutSearchSettings app_shortcut_search = 25;
}