-
Notifications
You must be signed in to change notification settings - Fork 14
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
61 changed files
with
293 additions
and
620 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
6 changes: 3 additions & 3 deletions
6
...ain/settings/DefaultSettingsRepository.kt → ...to/mauth/core/settings/DefaultSettings.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
8 changes: 3 additions & 5 deletions
8
...uth/domain/settings/SettingsRepository.kt → ...com/xinto/mauth/core/settings/Settings.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 |
---|---|---|
@@ -1,14 +1,12 @@ | ||
package com.xinto.mauth.domain.settings | ||
package com.xinto.mauth.core.settings | ||
|
||
import com.xinto.mauth.domain.settings.model.SortSetting | ||
import com.xinto.mauth.core.settings.model.SortSetting | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface SettingsRepository { | ||
|
||
interface Settings { | ||
fun getSecureMode(): Flow<Boolean> | ||
fun getSortMode(): Flow<SortSetting> | ||
|
||
suspend fun setSecureMode(value: Boolean) | ||
suspend fun setSortMode(value: SortSetting) | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...auth/domain/settings/model/SortSetting.kt → .../mauth/core/settings/model/SortSetting.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.xinto.mauth.di | ||
|
||
import androidx.room.Room | ||
import com.xinto.mauth.core.otp.generator.DefaultOtpGenerator | ||
import com.xinto.mauth.core.otp.generator.OtpGenerator | ||
import com.xinto.mauth.core.otp.parser.DefaultOtpUriParser | ||
import com.xinto.mauth.core.otp.parser.OtpUriParser | ||
import com.xinto.mauth.core.otp.transformer.DefaultKeyTransformer | ||
import com.xinto.mauth.core.otp.transformer.KeyTransformer | ||
import com.xinto.mauth.db.AccountDatabase | ||
import com.xinto.mauth.domain.AccountRepository | ||
import com.xinto.mauth.domain.OtpRepository | ||
import com.xinto.mauth.domain.QrRepository | ||
import com.xinto.mauth.domain.SettingsRepository | ||
import com.xinto.mauth.core.settings.DefaultSettings | ||
import com.xinto.mauth.core.settings.Settings | ||
import com.xinto.mauth.ui.screen.account.AccountViewModel | ||
import com.xinto.mauth.ui.screen.home.HomeViewModel | ||
import com.xinto.mauth.ui.screen.qrscan.QrScanViewModel | ||
import com.xinto.mauth.ui.screen.settings.SettingsViewModel | ||
import org.apache.commons.codec.binary.Base32 | ||
import org.koin.android.ext.koin.androidContext | ||
import org.koin.androidx.viewmodel.dsl.viewModelOf | ||
import org.koin.core.module.dsl.singleOf | ||
import org.koin.dsl.bind | ||
import org.koin.dsl.module | ||
|
||
object MauthDI { | ||
|
||
val CoreModule = module { | ||
singleOf(::DefaultOtpGenerator) bind OtpGenerator::class | ||
singleOf(::DefaultOtpUriParser) bind OtpUriParser::class | ||
single { | ||
DefaultKeyTransformer(Base32()) | ||
} bind KeyTransformer::class | ||
singleOf(::DefaultSettings) bind Settings::class | ||
} | ||
|
||
val DbModule = module { | ||
single { | ||
Room.databaseBuilder(androidContext(), AccountDatabase::class.java, "accounts") | ||
.addMigrations(AccountDatabase.Migrate3to4) | ||
.addMigrations(AccountDatabase.Migrate4To5) | ||
.build() | ||
} | ||
|
||
single { | ||
val db: AccountDatabase = get() | ||
db.accountsDao() | ||
} | ||
|
||
single { | ||
val db: AccountDatabase = get() | ||
db.rtdataDao() | ||
} | ||
} | ||
|
||
val DomainModule = module { | ||
singleOf(::AccountRepository) | ||
singleOf(::OtpRepository) | ||
singleOf(::QrRepository) | ||
singleOf(::SettingsRepository) | ||
} | ||
|
||
val UiModule = module { | ||
viewModelOf(::AccountViewModel) | ||
viewModelOf(::SettingsViewModel) | ||
viewModelOf(::QrScanViewModel) | ||
viewModelOf(::HomeViewModel) | ||
} | ||
|
||
val all = listOf(CoreModule, DbModule, DomainModule, UiModule) | ||
|
||
} |
20 changes: 0 additions & 20 deletions
20
app/src/main/java/com/xinto/mauth/di/core/CoreOtpModule.kt
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
app/src/main/java/com/xinto/mauth/di/db/DbAccountModule.kt
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
app/src/main/java/com/xinto/mauth/di/domain/DomainAccountModule.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
app/src/main/java/com/xinto/mauth/di/domain/DomainOtpModule.kt
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
app/src/main/java/com/xinto/mauth/di/domain/DomainQrModule.kt
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
app/src/main/java/com/xinto/mauth/di/domain/DomainSettingsModule.kt
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.