chore: prepare Paperize 4.0.0 release
This commit is contained in:
1 parent
063f05bdba
commit
153cdbe798
12 files changed
+59
-215
No files matched your search
@@ -32,7 +32,7 @@ android {
|
||||
applicationId = "com.anthonyla.paperize"
|
||||
minSdk = 31
|
||||
targetSdk = 36
|
||||
versionCode = 50
|
||||
versionCode = 51
|
||||
versionName = "4.0.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||
tools:ignore="ScopedStorage" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
|
||||
<!-- Features -->
|
||||
<uses-feature
|
||||
android:name="android.software.wallpaper"
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.Manifest
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import androidx.core.content.ContextCompat
|
||||
|
||||
object PermissionUtil {
|
||||
@@ -20,14 +19,4 @@ object PermissionUtil {
|
||||
}
|
||||
}
|
||||
|
||||
fun hasStoragePermission(): Boolean {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
Environment.isExternalStorageManager()
|
||||
} else {
|
||||
// For older versions, we might check READ_EXTERNAL_STORAGE, but the app flow seems to rely on MANAGE for All Files Access
|
||||
// Stick to the existing logic which uses Environment.isExternalStorageManager()
|
||||
Environment.isExternalStorageManager()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+1
-30
@@ -24,7 +24,6 @@ import com.anthonyla.paperize.presentation.screens.privacy.PrivacyScreen
|
||||
import com.anthonyla.paperize.presentation.screens.settings.SettingsScreen
|
||||
import com.anthonyla.paperize.presentation.screens.sort.SortViewScreen
|
||||
import com.anthonyla.paperize.presentation.screens.startup.StartupScreen
|
||||
import com.anthonyla.paperize.presentation.screens.storage.StoragePermissionScreen
|
||||
import com.anthonyla.paperize.presentation.screens.wallpaper_view.WallpaperViewScreen
|
||||
|
||||
/**
|
||||
@@ -47,7 +46,6 @@ fun NavigationGraph(
|
||||
if (animate) { { enterTransitionBackward() } } else { { EnterTransition.None } }
|
||||
val exitBackward: AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition =
|
||||
if (animate) { { exitTransitionBackward() } } else { { ExitTransition.None } }
|
||||
// Helper functions for permission checks
|
||||
val context = androidx.compose.ui.platform.LocalContext.current
|
||||
|
||||
NavHost(
|
||||
@@ -87,10 +85,6 @@ fun NavigationGraph(
|
||||
navController.navigate(NotificationRoute) {
|
||||
popUpTo<WallpaperModeSelectionRoute> { inclusive = true }
|
||||
}
|
||||
} else if (!PermissionUtil.hasStoragePermission()) {
|
||||
navController.navigate(StoragePermissionRoute) {
|
||||
popUpTo<WallpaperModeSelectionRoute> { inclusive = true }
|
||||
}
|
||||
} else {
|
||||
onFirstLaunchComplete()
|
||||
navController.navigate(HomeRoute) {
|
||||
@@ -109,33 +103,10 @@ fun NavigationGraph(
|
||||
popExitTransition = exitBackward
|
||||
) {
|
||||
NotificationPermissionScreen(
|
||||
onContinue = {
|
||||
if (!PermissionUtil.hasStoragePermission()) {
|
||||
navController.navigate(StoragePermissionRoute) {
|
||||
popUpTo<NotificationRoute> { inclusive = true }
|
||||
}
|
||||
} else {
|
||||
onFirstLaunchComplete()
|
||||
navController.navigate(HomeRoute) {
|
||||
popUpTo<NotificationRoute> { inclusive = true }
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// Storage permission screen
|
||||
composable<StoragePermissionRoute>(
|
||||
enterTransition = enterForward,
|
||||
exitTransition = exitForward,
|
||||
popEnterTransition = enterBackward,
|
||||
popExitTransition = exitBackward
|
||||
) {
|
||||
StoragePermissionScreen(
|
||||
onContinue = {
|
||||
onFirstLaunchComplete()
|
||||
navController.navigate(HomeRoute) {
|
||||
popUpTo<StoragePermissionRoute> { inclusive = true }
|
||||
popUpTo<NotificationRoute> { inclusive = true }
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -12,9 +12,6 @@ object StartupRoute
|
||||
@Serializable
|
||||
object NotificationRoute
|
||||
|
||||
@Serializable
|
||||
object StoragePermissionRoute
|
||||
|
||||
@Serializable
|
||||
object WallpaperModeSelectionRoute
|
||||
|
||||
|
||||
-157
@@ -1,157 +0,0 @@
|
||||
package com.anthonyla.paperize.presentation.screens.storage
|
||||
import com.anthonyla.paperize.presentation.theme.AppIconSizes
|
||||
import com.anthonyla.paperize.presentation.components.OnboardingLayout
|
||||
import com.anthonyla.paperize.core.util.PermissionUtil
|
||||
|
||||
import android.content.Intent
|
||||
import android.provider.Settings
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Folder
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.core.net.toUri
|
||||
import com.anthonyla.paperize.R
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.anthonyla.paperize.presentation.theme.AppSpacing
|
||||
|
||||
/**
|
||||
* Screen to request storage permission for wallpaper preview
|
||||
* Allows optional MANAGE_EXTERNAL_STORAGE permission to read current wallpaper
|
||||
*/
|
||||
@Composable
|
||||
fun StoragePermissionScreen(
|
||||
onContinue: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
var permissionGranted by remember { mutableStateOf(PermissionUtil.hasStoragePermission()) }
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
// Check permission status on resume (when user returns from settings)
|
||||
DisposableEffect(lifecycleOwner) {
|
||||
val listener = object : DefaultLifecycleObserver {
|
||||
override fun onResume(owner: LifecycleOwner) {
|
||||
permissionGranted = PermissionUtil.hasStoragePermission()
|
||||
}
|
||||
}
|
||||
lifecycleOwner.lifecycle.addObserver(listener)
|
||||
|
||||
onDispose {
|
||||
lifecycleOwner.lifecycle.removeObserver(listener)
|
||||
}
|
||||
}
|
||||
|
||||
// Automatically continue when permission is granted
|
||||
LaunchedEffect(permissionGranted) {
|
||||
if (permissionGranted) {
|
||||
onContinue()
|
||||
}
|
||||
}
|
||||
|
||||
OnboardingLayout(
|
||||
title = stringResource(R.string.storage_permission_title),
|
||||
modifier = modifier,
|
||||
iconContent = {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Folder,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(AppIconSizes.huge),
|
||||
tint = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
},
|
||||
content = {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(AppSpacing.medium)
|
||||
) {
|
||||
// Cleaner explanation card
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
shape = MaterialTheme.shapes.large,
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.tertiaryContainer.copy(alpha = 0.5f)
|
||||
),
|
||||
border = androidx.compose.foundation.BorderStroke(
|
||||
width = 1.dp,
|
||||
color = MaterialTheme.colorScheme.outlineVariant
|
||||
)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(AppSpacing.large),
|
||||
verticalArrangement = Arrangement.spacedBy(AppSpacing.small),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.storage_permission_description),
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
textAlign = TextAlign.Center,
|
||||
color = MaterialTheme.colorScheme.onTertiaryContainer
|
||||
)
|
||||
|
||||
Text(
|
||||
text = stringResource(R.string.storage_permission_optional),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onTertiaryContainer.copy(alpha = 0.8f),
|
||||
textAlign = TextAlign.Center,
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Medium
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
// Allow button
|
||||
Button(
|
||||
onClick = {
|
||||
if (!PermissionUtil.hasStoragePermission()) {
|
||||
val intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION).apply {
|
||||
data = "package:${context.packageName}".toUri()
|
||||
}
|
||||
context.startActivity(intent)
|
||||
} else {
|
||||
onContinue()
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
shape = MaterialTheme.shapes.large
|
||||
) {
|
||||
Text(
|
||||
text = if (permissionGranted) {
|
||||
stringResource(R.string.permission_granted)
|
||||
} else {
|
||||
stringResource(R.string.allow)
|
||||
},
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.SemiBold,
|
||||
modifier = Modifier.padding(vertical = AppSpacing.small)
|
||||
)
|
||||
}
|
||||
|
||||
// Continue without permission button
|
||||
FilledTonalButton(
|
||||
onClick = onContinue,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
shape = MaterialTheme.shapes.large,
|
||||
colors = ButtonDefaults.filledTonalButtonColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceVariant,
|
||||
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.continue_without_storage),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Medium,
|
||||
modifier = Modifier.padding(vertical = AppSpacing.small)
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
+3
-1
@@ -155,7 +155,9 @@ abstract class GLWallpaperService : WallpaperService() {
|
||||
// where the GL thread held `lock` while acquiring `eventQueue`, and callers held
|
||||
// `eventQueue` while trying to acquire `lock` in requestRender().
|
||||
private val eventQueue = LinkedBlockingQueue<Runnable>()
|
||||
@Suppress("UseKotlinAny")
|
||||
// java.lang.Object is intentional: this monitor uses wait()/notifyAll(), which
|
||||
// Kotlin's Any does not expose directly.
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
private val lock = Object()
|
||||
|
||||
@Volatile private var shouldExit = false
|
||||
|
||||
@@ -102,10 +102,6 @@
|
||||
<string name="notification_permission_description">Allow Paperize to send notifications about wallpaper changes and when the app is running in the background. You can change this anytime in settings.</string>
|
||||
<string name="skip">Skip</string>
|
||||
<string name="permission_granted">Permission Granted</string>
|
||||
<string name="storage_permission_title">Storage Access (Optional)</string>
|
||||
<string name="storage_permission_description">Allow Paperize to access storage to preview your current wallpaper in the app.</string>
|
||||
<string name="storage_permission_optional">This permission is optional. Paperize can still function normally without it, but you won\'t be able to see wallpaper previews.</string>
|
||||
<string name="continue_without_storage">Continue Without Storage Access</string>
|
||||
|
||||
<!-- Content Descriptions for Accessibility -->
|
||||
<string name="content_desc_clear_selection">Clear selection</string>
|
||||
|
||||
Reference in new issue
Block a user