From 6e455e6b2fbd6ad25fec094cd7753b0f856aedc5 Mon Sep 17 00:00:00 2001 From: Stefano Sansone Date: Mon, 26 Feb 2024 22:34:07 +0000 Subject: [PATCH 1/6] fix save article crash --- .../Omnivore/app/src/main/AndroidManifest.xml | 1 + .../app/src/main/res/values-night/themes.xml | 16 ++++++++++++++++ .../Omnivore/app/src/main/res/values/themes.xml | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/android/Omnivore/app/src/main/AndroidManifest.xml b/android/Omnivore/app/src/main/AndroidManifest.xml index cd041b041..b143c2f12 100644 --- a/android/Omnivore/app/src/main/AndroidManifest.xml +++ b/android/Omnivore/app/src/main/AndroidManifest.xml @@ -16,6 +16,7 @@ android:label="@string/app_name" android:supportsRtl="true" android:largeHeap="true" + android:theme="@style/Theme.AppCompat.Translucent" tools:targetApi="31"> @style/Theme.Omnivore + + diff --git a/android/Omnivore/app/src/main/res/values/themes.xml b/android/Omnivore/app/src/main/res/values/themes.xml index d63370f10..a17973375 100644 --- a/android/Omnivore/app/src/main/res/values/themes.xml +++ b/android/Omnivore/app/src/main/res/values/themes.xml @@ -16,4 +16,20 @@ @style/Theme.Omnivore + + From aebf8257d1efff9a56931076f2598365e65dff13 Mon Sep 17 00:00:00 2001 From: Stefano Sansone Date: Mon, 26 Feb 2024 22:38:48 +0000 Subject: [PATCH 2/6] fix SwipeToDismiss extra padding --- .../java/app/omnivore/omnivore/feature/library/LibraryView.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/library/LibraryView.kt b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/library/LibraryView.kt index fea94ab3d..577d5ac40 100644 --- a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/library/LibraryView.kt +++ b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/library/LibraryView.kt @@ -368,7 +368,6 @@ fun LibraryViewContent( ) SwipeToDismiss( state = swipeState, - modifier = Modifier.padding(vertical = 4.dp), directions = setOf(DismissDirection.StartToEnd, DismissDirection.EndToStart), dismissThresholds = { FractionalThreshold(swipeThreshold) }, background = { From b0784c50e8388a0c019121104e6a69c27923302c Mon Sep 17 00:00:00 2001 From: Stefano Sansone Date: Mon, 26 Feb 2024 22:39:08 +0000 Subject: [PATCH 3/6] replace deprecated divider --- .../omnivore/omnivore/feature/savedItemViews/SavedItemCard.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/savedItemViews/SavedItemCard.kt b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/savedItemViews/SavedItemCard.kt index f0c966793..6e802ce98 100644 --- a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/savedItemViews/SavedItemCard.kt +++ b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/savedItemViews/SavedItemCard.kt @@ -15,7 +15,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Divider +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -122,7 +122,7 @@ fun SavedItemCard( } } - Divider(color = MaterialTheme.colorScheme.outlineVariant, thickness = 1.dp) + HorizontalDivider(thickness = 1.dp, color = MaterialTheme.colorScheme.outlineVariant) } } From 64310aa4d944f5488a2d67d0c4d0edc858a46362 Mon Sep 17 00:00:00 2001 From: Stefano Sansone Date: Mon, 26 Feb 2024 22:40:53 +0000 Subject: [PATCH 4/6] bump version --- android/Omnivore/app/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/Omnivore/app/build.gradle.kts b/android/Omnivore/app/build.gradle.kts index 30d2ac471..3d714546e 100644 --- a/android/Omnivore/app/build.gradle.kts +++ b/android/Omnivore/app/build.gradle.kts @@ -27,8 +27,8 @@ android { applicationId = "app.omnivore.omnivore" minSdk = 26 targetSdk = 34 - versionCode = 194 - versionName = "0.194.0" + versionCode = 194001 + versionName = "0.194.1" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { From 8c56f6d50f6dbf9712a656005e088afa5e737f69 Mon Sep 17 00:00:00 2001 From: Stefano Sansone Date: Mon, 26 Feb 2024 22:42:24 +0000 Subject: [PATCH 5/6] bump versions --- android/Omnivore/app/build.gradle.kts | 2 +- android/Omnivore/gradle/libs.versions.toml | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/android/Omnivore/app/build.gradle.kts b/android/Omnivore/app/build.gradle.kts index 3d714546e..bc6c0b888 100644 --- a/android/Omnivore/app/build.gradle.kts +++ b/android/Omnivore/app/build.gradle.kts @@ -168,7 +168,7 @@ dependencies { implementation(libs.androidx.lifecycle.runtimeCompose) - implementation("androidx.core:core-splashscreen:1.0.1") + implementation(libs.androidx.core.splashscreen) } diff --git a/android/Omnivore/gradle/libs.versions.toml b/android/Omnivore/gradle/libs.versions.toml index b67815b52..1a6c6a567 100644 --- a/android/Omnivore/gradle/libs.versions.toml +++ b/android/Omnivore/gradle/libs.versions.toml @@ -4,12 +4,12 @@ accompanistFlowLayout = "0.32.0" androidGradlePlugin = "8.2.2" androidxActivity = "1.8.2" androidxAppCompat = "1.6.1" -androidxComposeBom = "2024.02.00" +androidxComposeBom = "2024.02.01" androidxComposeCompiler = "1.5.9" androidxCore = "1.12.0" androidxDataStore = "1.0.0" androidxEspresso = "3.5.1" -androidxHiltNavigationCompose = "1.1.0" +androidxHiltNavigationCompose = "1.2.0" androidxLifecycle = "2.7.0" androidxNavigation = "2.7.7" androidxSecurity = "1.0.0" @@ -18,6 +18,7 @@ apollo = "3.8.2" chiptextfieldM3 = "0.6.5" coil = "2.5.0" composeMarkdown = "0.3.3" +coreSplashscreen = "1.0.1" gson = "2.10.1" hilt = "2.50" intercom = "15.1.0" @@ -26,7 +27,7 @@ kotlin = "1.9.22" ksp = "1.9.22-1.0.17" kotlinxCoroutines = "1.7.3" playServices = "18.3.0" -playServicesAuth = "20.7.0" +playServicesAuth = "21.0.0" posthog = "2.0.3" pspdfkit = "8.9.1" retrofit = "2.9.0" @@ -48,6 +49,7 @@ androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-toolin androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } androidx-compose-ui-util = { group = "androidx.compose.ui", name = "ui-util" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } +androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "coreSplashscreen" } androidx-dataStore-preferences = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "androidxDataStore" } androidx-hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "androidxHiltNavigationCompose" } androidx-lifecycle-viewModelKtx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "androidxLifecycle" } From b4fc61721949a1555f46b5750b5bd23b35ebd3bc Mon Sep 17 00:00:00 2001 From: Stefano Sansone Date: Mon, 26 Feb 2024 23:37:51 +0000 Subject: [PATCH 6/6] remove accompanist system ui --- android/Omnivore/app/build.gradle.kts | 2 - .../app/omnivore/omnivore/MainActivity.kt | 2 +- .../omnivore/feature/auth/WelcomeScreen.kt | 58 ++++++------------- .../reader/WebReaderLoadingContainer.kt | 14 ----- .../omnivore/feature/root/RootView.kt | 4 +- 5 files changed, 22 insertions(+), 58 deletions(-) diff --git a/android/Omnivore/app/build.gradle.kts b/android/Omnivore/app/build.gradle.kts index bc6c0b888..b3b0602fd 100644 --- a/android/Omnivore/app/build.gradle.kts +++ b/android/Omnivore/app/build.gradle.kts @@ -148,8 +148,6 @@ dependencies { implementation(libs.apollo.runtime) - // TODO: Remove in favor of new Compose libs - implementation(libs.accompanist.systemuicontroller) implementation(libs.accompanist.flowlayout) implementation(libs.coil.kt.compose) diff --git a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/MainActivity.kt b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/MainActivity.kt index 0e4c818ee..4588dba40 100644 --- a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/MainActivity.kt +++ b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/MainActivity.kt @@ -19,7 +19,6 @@ import app.omnivore.omnivore.feature.editinfo.EditInfoViewModel import app.omnivore.omnivore.feature.library.SearchViewModel import app.omnivore.omnivore.feature.root.RootView import app.omnivore.omnivore.feature.save.SaveViewModel -import app.omnivore.omnivore.feature.settings.SettingsViewModel import app.omnivore.omnivore.feature.theme.OmnivoreTheme import com.pspdfkit.PSPDFKit import dagger.hilt.android.AndroidEntryPoint @@ -58,6 +57,7 @@ class MainActivity : ComponentActivity() { enableEdgeToEdge() setContent { + OmnivoreTheme { Box( modifier = Modifier diff --git a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/auth/WelcomeScreen.kt b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/auth/WelcomeScreen.kt index 38f2c156d..c43ecd15b 100644 --- a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/auth/WelcomeScreen.kt +++ b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/auth/WelcomeScreen.kt @@ -4,7 +4,6 @@ import android.annotation.SuppressLint import android.content.Intent import android.net.Uri import androidx.compose.foundation.Image -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.* import androidx.compose.foundation.text.ClickableText import androidx.compose.material3.* @@ -22,31 +21,16 @@ import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.unit.dp import app.omnivore.omnivore.R import app.omnivore.omnivore.feature.theme.OmnivoreTheme -import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.google.android.gms.common.GoogleApiAvailability import kotlinx.coroutines.launch @Composable fun WelcomeScreen(viewModel: LoginViewModel) { - - val systemUiController = rememberSystemUiController() - val useDarkIcons = !isSystemInDarkTheme() - - DisposableEffect(systemUiController, useDarkIcons) { - systemUiController.setSystemBarsColor( - color = Color.Black, - darkIcons = true - ) - onDispose { - systemUiController.setSystemBarsColor( - color = Color.Black, - darkIcons = useDarkIcons - ) - } - } - OmnivoreTheme(darkTheme = false) { - Surface(modifier = Modifier.fillMaxSize(), color = Color(0xFFFCEBA8)) { + Surface( + modifier = Modifier.fillMaxSize(), + color = Color(0xFFFCEBA8) + ) { WelcomeScreenContent(viewModel = viewModel) } } @@ -55,9 +39,9 @@ fun WelcomeScreen(viewModel: LoginViewModel) { @SuppressLint("CoroutineCreationDuringComposition") @Composable fun WelcomeScreenContent(viewModel: LoginViewModel) { - val registrationState: RegistrationState by viewModel - .registrationStateLiveData - .observeAsState(RegistrationState.SocialLogin) + val registrationState: RegistrationState by viewModel.registrationStateLiveData.observeAsState( + RegistrationState.SocialLogin + ) val snackBarHostState = remember { SnackbarHostState() } val coroutineScope = rememberCoroutineScope() @@ -92,11 +76,13 @@ fun WelcomeScreenContent(viewModel: LoginViewModel) { RegistrationState.SocialLogin -> { Text( text = stringResource(id = R.string.welcome_title), + color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.headlineLarge ) Text( text = stringResource(id = R.string.welcome_subtitle), + color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.titleSmall ) @@ -117,8 +103,7 @@ fun WelcomeScreenContent(viewModel: LoginViewModel) { if (viewModel.errorMessage != null) { coroutineScope.launch { - val result = snackBarHostState - .showSnackbar( + val result = snackBarHostState.showSnackbar( viewModel.errorMessage!!, actionLabel = "Dismiss", duration = SnackbarDuration.Indefinite @@ -135,9 +120,8 @@ fun WelcomeScreenContent(viewModel: LoginViewModel) { @Composable fun AuthProviderView(viewModel: LoginViewModel) { - val isGoogleAuthAvailable: Boolean = GoogleApiAvailability - .getInstance() - .isGooglePlayServicesAvailable(LocalContext.current) == 0 + val isGoogleAuthAvailable: Boolean = + GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(LocalContext.current) == 0 Row( horizontalArrangement = Arrangement.Center @@ -153,22 +137,17 @@ fun AuthProviderView(viewModel: LoginViewModel) { AppleAuthButton(viewModel) - ClickableText( - text = AnnotatedString(stringResource(R.string.welcome_screen_action_continue_with_email)), - style = MaterialTheme.typography.titleMedium - .plus(TextStyle(textDecoration = TextDecoration.Underline)), - onClick = { viewModel.showEmailSignIn() } - ) + ClickableText(text = AnnotatedString(stringResource(R.string.welcome_screen_action_continue_with_email)), + style = MaterialTheme.typography.titleMedium.plus(TextStyle(textDecoration = TextDecoration.Underline)), + onClick = { viewModel.showEmailSignIn() }) Spacer(modifier = Modifier.weight(1.0F)) ClickableText( text = AnnotatedString(stringResource(R.string.welcome_screen_action_self_hosting_options)), - style = MaterialTheme.typography.titleMedium - .plus(TextStyle(textDecoration = TextDecoration.Underline)), + style = MaterialTheme.typography.titleMedium.plus(TextStyle(textDecoration = TextDecoration.Underline)), onClick = { viewModel.showSelfHostedSettings() }, - modifier = Modifier - .padding(vertical = 10.dp) + modifier = Modifier.padding(vertical = 10.dp) ) } Spacer(modifier = Modifier.weight(1.0F)) @@ -184,8 +163,7 @@ fun MoreInfoButton() { text = AnnotatedString( stringResource(id = R.string.learn_more), ), - style = MaterialTheme.typography.titleSmall - .plus(TextStyle(textDecoration = TextDecoration.Underline)), + style = MaterialTheme.typography.titleSmall.plus(TextStyle(textDecoration = TextDecoration.Underline)), onClick = { context.startActivity(intent) }, diff --git a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/reader/WebReaderLoadingContainer.kt b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/reader/WebReaderLoadingContainer.kt index 98f7230f6..e58b5f0cb 100644 --- a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/reader/WebReaderLoadingContainer.kt +++ b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/reader/WebReaderLoadingContainer.kt @@ -30,7 +30,6 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState @@ -61,7 +60,6 @@ import app.omnivore.omnivore.feature.notebook.NotebookView import app.omnivore.omnivore.feature.notebook.NotebookViewModel import app.omnivore.omnivore.feature.savedItemViews.SavedItemContextMenu import app.omnivore.omnivore.feature.theme.OmnivoreTheme -import com.google.accompanist.systemuicontroller.rememberSystemUiController import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.launch import kotlin.math.roundToInt @@ -81,18 +79,6 @@ class WebReaderLoadingContainerActivity : ComponentActivity() { viewModel.loadItem(slug = slug, requestID = requestID) setContent { - val systemUiController = rememberSystemUiController() - val useDarkIcons = !isSystemInDarkTheme() - - DisposableEffect(systemUiController, useDarkIcons) { - systemUiController.setSystemBarsColor( - color = Color.Black, - darkIcons = false - ) - - onDispose {} - } - OmnivoreTheme { Box( modifier = Modifier diff --git a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/root/RootView.kt b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/root/RootView.kt index 5e48ad2ff..c56eb5557 100644 --- a/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/root/RootView.kt +++ b/android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/root/RootView.kt @@ -1,5 +1,6 @@ package app.omnivore.omnivore.feature.root +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides @@ -18,6 +19,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController @@ -50,7 +52,7 @@ fun RootView( snackbarHost = { SnackbarHost(snackbarHostState) }, ) { padding -> Box( - modifier = Modifier + modifier = if (!hasAuthToken) Modifier.background(Color(0xFFFCEBA8)) else Modifier .fillMaxSize() .padding(padding) .consumeWindowInsets(padding)