Repo created
This commit is contained in:
parent
75dc487a7a
commit
39c29d175b
6317 changed files with 388324 additions and 2 deletions
7
feature/migration/launcher/api/build.gradle.kts
Normal file
7
feature/migration/launcher/api/build.gradle.kts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
plugins {
|
||||
id(ThunderbirdPlugins.Library.android)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "app.k9mail.feature.migration.launcher.api"
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package app.k9mail.feature.migration.launcher.api
|
||||
|
||||
import android.net.Uri
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
|
||||
interface MigrationManager {
|
||||
/**
|
||||
* Returns whether the features to import accounts by scanning QR codes and importing directly from another
|
||||
* app are included in the app.
|
||||
*/
|
||||
fun isFeatureIncluded(): Boolean
|
||||
|
||||
/**
|
||||
* Returns an [ActivityResultContract] that can be used to start the QR code scanner. In case of success a
|
||||
* content: URI to the account settings in the XML format supported by `SettingsImporter` is returned.
|
||||
*/
|
||||
fun getQrCodeActivityResultContract(): ActivityResultContract<Unit, Uri?>
|
||||
}
|
||||
11
feature/migration/launcher/noop/build.gradle.kts
Normal file
11
feature/migration/launcher/noop/build.gradle.kts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
plugins {
|
||||
id(ThunderbirdPlugins.Library.android)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "app.k9mail.feature.migration.launcher.noop"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.feature.migration.launcher.api)
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package app.k9mail.feature.migration.launcher
|
||||
|
||||
import app.k9mail.feature.migration.launcher.api.MigrationManager
|
||||
import app.k9mail.feature.migration.launcher.noop.NoOpMigrationManager
|
||||
import org.koin.dsl.module
|
||||
|
||||
val featureMigrationModule = module {
|
||||
single<MigrationManager> { NoOpMigrationManager() }
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package app.k9mail.feature.migration.launcher.noop
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
import app.k9mail.feature.migration.launcher.api.MigrationManager
|
||||
|
||||
internal class NoOpMigrationManager : MigrationManager {
|
||||
override fun isFeatureIncluded() = false
|
||||
|
||||
override fun getQrCodeActivityResultContract(): ActivityResultContract<Unit, Uri?> {
|
||||
return ThrowingActivityResultContract()
|
||||
}
|
||||
}
|
||||
|
||||
private class ThrowingActivityResultContract : ActivityResultContract<Unit, Uri?>() {
|
||||
override fun createIntent(context: Context, input: Unit): Intent {
|
||||
error("Feature not enabled")
|
||||
}
|
||||
|
||||
override fun parseResult(resultCode: Int, intent: Intent?): Uri? {
|
||||
error("Feature not enabled")
|
||||
}
|
||||
}
|
||||
12
feature/migration/launcher/thunderbird/build.gradle.kts
Normal file
12
feature/migration/launcher/thunderbird/build.gradle.kts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
plugins {
|
||||
id(ThunderbirdPlugins.Library.android)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "app.k9mail.feature.migration.launcher.thunderbird"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.feature.migration.launcher.api)
|
||||
implementation(projects.feature.migration.qrcode)
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package app.k9mail.feature.migration.launcher
|
||||
|
||||
import app.k9mail.feature.migration.launcher.api.MigrationManager
|
||||
import app.k9mail.feature.migration.launcher.thunderbird.TbMigrationManager
|
||||
import app.k9mail.feature.migration.qrcode.qrCodeModule
|
||||
import org.koin.dsl.module
|
||||
|
||||
val featureMigrationModule = module {
|
||||
includes(qrCodeModule)
|
||||
|
||||
single<MigrationManager> { TbMigrationManager() }
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package app.k9mail.feature.migration.launcher.thunderbird
|
||||
|
||||
import android.net.Uri
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
import app.k9mail.feature.migration.launcher.api.MigrationManager
|
||||
import app.k9mail.feature.migration.qrcode.ui.QrCodeScannerActivityContract
|
||||
|
||||
internal class TbMigrationManager : MigrationManager {
|
||||
override fun isFeatureIncluded() = true
|
||||
|
||||
override fun getQrCodeActivityResultContract(): ActivityResultContract<Unit, Uri?> {
|
||||
return QrCodeScannerActivityContract()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue