-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
333 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
app/src/main/java/io/github/sds100/keymapper/AppHiltModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.github.sds100.keymapper | ||
|
||
import android.content.Context | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.MainScope | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
class AppHiltModule { | ||
@Singleton | ||
@Provides | ||
fun provideCoroutineScope(@ApplicationContext ctx: Context): CoroutineScope = MainScope() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/src/main/java/io/github/sds100/keymapper/actions/ActionsHiltModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.github.sds100.keymapper.actions | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ViewModelComponent | ||
|
||
@Module | ||
@InstallIn(ViewModelComponent::class) | ||
abstract class ActionsHiltModule { | ||
@Binds | ||
abstract fun provideTestActionUseCase(impl: TestActionUseCaseImpl): TestActionUseCase | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/src/main/java/io/github/sds100/keymapper/data/DataHiltModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.github.sds100.keymapper.data | ||
|
||
import android.content.Context | ||
import androidx.datastore.preferences.preferencesDataStore | ||
import androidx.room.Room | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import io.github.sds100.keymapper.data.db.AppDatabase | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object DataHiltModule { | ||
private val Context.legacyFingerprintMapDataStore by preferencesDataStore("fingerprint_gestures") | ||
|
||
@Singleton | ||
@Provides | ||
fun provideAppDatabase(@ApplicationContext ctx: Context): AppDatabase { | ||
return Room.databaseBuilder( | ||
ctx, | ||
AppDatabase::class.java, | ||
AppDatabase.DATABASE_NAME, | ||
).addMigrations( | ||
AppDatabase.MIGRATION_1_2, | ||
AppDatabase.MIGRATION_2_3, | ||
AppDatabase.MIGRATION_3_4, | ||
AppDatabase.MIGRATION_4_5, | ||
AppDatabase.MIGRATION_5_6, | ||
AppDatabase.MIGRATION_6_7, | ||
AppDatabase.MIGRATION_7_8, | ||
AppDatabase.MIGRATION_8_9, | ||
AppDatabase.MIGRATION_9_10, | ||
AppDatabase.MIGRATION_10_11, | ||
AppDatabase.RoomMigration11To12(ctx.legacyFingerprintMapDataStore), | ||
AppDatabase.MIGRATION_12_13, | ||
).build() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/src/main/java/io/github/sds100/keymapper/mappings/MappingsHiltModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.github.sds100.keymapper.mappings | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ViewModelComponent | ||
import io.github.sds100.keymapper.mappings.fingerprintmaps.AreFingerprintGesturesSupportedUseCase | ||
import io.github.sds100.keymapper.mappings.fingerprintmaps.AreFingerprintGesturesSupportedUseCaseImpl | ||
import io.github.sds100.keymapper.mappings.fingerprintmaps.DetectFingerprintMapsUseCase | ||
import io.github.sds100.keymapper.mappings.fingerprintmaps.DetectFingerprintMapsUseCaseImpl | ||
import io.github.sds100.keymapper.mappings.keymaps.ConfigKeyMapUseCase | ||
import io.github.sds100.keymapper.mappings.keymaps.ConfigKeyMapUseCaseImpl | ||
import io.github.sds100.keymapper.mappings.keymaps.CreateKeyMapShortcutUseCase | ||
import io.github.sds100.keymapper.mappings.keymaps.CreateKeyMapShortcutUseCaseImpl | ||
import io.github.sds100.keymapper.mappings.keymaps.DisplayKeyMapUseCase | ||
import io.github.sds100.keymapper.mappings.keymaps.DisplayKeyMapUseCaseImpl | ||
|
||
@Module | ||
@InstallIn(ViewModelComponent::class) | ||
abstract class MappingsHiltModule { | ||
@Binds | ||
abstract fun provideConfigKeyMapUseCase(impl: ConfigKeyMapUseCaseImpl): ConfigKeyMapUseCase | ||
|
||
@Binds | ||
abstract fun provideDisplaySimpleMappingUseCase(impl: DisplaySimpleMappingUseCaseImpl): DisplaySimpleMappingUseCase | ||
|
||
@Binds | ||
abstract fun providePauseMappingsUseCase(impl: PauseMappingsUseCaseImpl): PauseMappingsUseCase | ||
|
||
@Binds | ||
abstract fun provideDetectFingerprintMapsUseCase(impl: DetectFingerprintMapsUseCaseImpl): DetectFingerprintMapsUseCase | ||
|
||
@Binds | ||
abstract fun provideAreFingerprintGesturesSupportedUseCase(impl: AreFingerprintGesturesSupportedUseCaseImpl): AreFingerprintGesturesSupportedUseCase | ||
|
||
@Binds | ||
abstract fun provideCreateKeyMapShortcutUseCase(impl: CreateKeyMapShortcutUseCaseImpl): CreateKeyMapShortcutUseCase | ||
|
||
@Binds | ||
abstract fun provideDisplayKeyMapUseCase(impl: DisplayKeyMapUseCaseImpl): DisplayKeyMapUseCase | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/src/main/java/io/github/sds100/keymapper/onboarding/OnboardingHiltModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.github.sds100.keymapper.onboarding | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ViewModelComponent | ||
|
||
@Module | ||
@InstallIn(ViewModelComponent::class) | ||
abstract class OnboardingHiltModule { | ||
@Binds | ||
abstract fun provideOnboardingUseCase(impl: OnboardingUseCaseImpl): OnboardingUseCase | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.