From f9043fdacd70798a5f778fc82008b4309abe4d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=C2=A0Koby=C5=82ko?= Date: Sun, 5 Nov 2023 15:32:35 +0100 Subject: [PATCH 1/2] Fix widgets settings not being auth aware --- feature/widget/build.gradle.kts | 3 ++ .../ui/settings/WidgetSettingsActivity.kt | 30 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/feature/widget/build.gradle.kts b/feature/widget/build.gradle.kts index d021d058..9a228aa7 100644 --- a/feature/widget/build.gradle.kts +++ b/feature/widget/build.gradle.kts @@ -9,11 +9,14 @@ android { } dependencies { + implementation(project(":base")) + implementation(project(":prefs")) implementation(project(":core:common")) implementation(project(":core:android")) implementation(project(":core:locale")) implementation(project(":core:designsystem")) implementation(project(":data:services")) + implementation(project(":data:session")) implementation(libs.bundles.viewModel) implementation(libs.bundles.glance) diff --git a/feature/widget/src/main/java/com/twofasapp/feature/widget/ui/settings/WidgetSettingsActivity.kt b/feature/widget/src/main/java/com/twofasapp/feature/widget/ui/settings/WidgetSettingsActivity.kt index 4c08d3cf..05d20dfa 100644 --- a/feature/widget/src/main/java/com/twofasapp/feature/widget/ui/settings/WidgetSettingsActivity.kt +++ b/feature/widget/src/main/java/com/twofasapp/feature/widget/ui/settings/WidgetSettingsActivity.kt @@ -6,11 +6,27 @@ import android.content.Intent import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import com.twofasapp.base.AuthTracker +import com.twofasapp.base.lifecycle.AuthAware +import com.twofasapp.base.lifecycle.AuthLifecycle +import com.twofasapp.data.session.SettingsRepository import com.twofasapp.designsystem.MainAppTheme +import com.twofasapp.designsystem.activity.ActivityHelper +import org.koin.android.ext.android.get +import org.koin.android.ext.android.inject +import org.koin.core.parameter.parametersOf -class WidgetSettingsActivity : ComponentActivity() { +class WidgetSettingsActivity : ComponentActivity(), AuthAware { + + private val settingsRepository: SettingsRepository by inject() + private val authTracker: AuthTracker by inject() override fun onCreate(savedInstanceState: Bundle?) { + ActivityHelper.onCreate( + activity = this, + selectedTheme = settingsRepository.getAppSettings().selectedTheme, + allowScreenshots = settingsRepository.getAppSettings().allowScreenshots, + ) super.onCreate(savedInstanceState) val appWidgetId = intent?.extras?.getInt( AppWidgetManager.EXTRA_APPWIDGET_ID, @@ -20,6 +36,16 @@ class WidgetSettingsActivity : ComponentActivity() { val resultValue = Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId) setResult(Activity.RESULT_CANCELED, resultValue) + authTracker.onWidgetSettingsScreen() + + lifecycle.addObserver( + AuthLifecycle( + authTracker = get(), + navigator = get { parametersOf(this) }, + authAware = this as? AuthAware + ) + ) + setContent { MainAppTheme { WidgetSettingsScreen( @@ -31,4 +57,6 @@ class WidgetSettingsActivity : ComponentActivity() { } } } + + override fun onAuthenticated() = Unit } \ No newline at end of file From 2fc471f1dc382f32f347256398981ba1fb058ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=C2=A0Koby=C5=82ko?= Date: Sun, 5 Nov 2023 15:35:17 +0100 Subject: [PATCH 2/2] Bump version 5.0.1 (5000004) --- app/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2c00d248..aa50c796 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,8 +17,8 @@ android { defaultConfig { applicationId = "com.twofasapp" - versionName = "5.0.0" - versionCode = 5000003 + versionName = "5.0.1" + versionCode = 5000004 val versionCodeOffset = 5000000