Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e20f211f2 |
No files matched your search
@@ -19,8 +19,8 @@ android {
|
|||||||
applicationId = "com.anthonyla.paperize"
|
applicationId = "com.anthonyla.paperize"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 22
|
versionCode = 23
|
||||||
versionName = "1.5.4"
|
versionName = "1.5.5"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
||||||
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
|
|
||||||
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
|
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
|||||||
+1
@@ -85,6 +85,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
val settingsState = settingsViewModel.state.collectAsStateWithLifecycle()
|
val settingsState = settingsViewModel.state.collectAsStateWithLifecycle()
|
||||||
val isFirstLaunch = runBlocking { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) } ?: true
|
val isFirstLaunch = runBlocking { settingsDataStoreImpl.getBoolean(SettingsConstants.FIRST_LAUNCH) } ?: true
|
||||||
if (isFirstLaunch) {
|
if (isFirstLaunch) {
|
||||||
|
scheduler.cancelWallpaperAlarm()
|
||||||
wallpaperScreenViewModel.onEvent(WallpaperEvent.Reset)
|
wallpaperScreenViewModel.onEvent(WallpaperEvent.Reset)
|
||||||
settingsViewModel.onEvent(SettingsEvent.Reset)
|
settingsViewModel.onEvent(SettingsEvent.Reset)
|
||||||
albumsViewModel.onEvent(AlbumsEvent.Reset)
|
albumsViewModel.onEvent(AlbumsEvent.Reset)
|
||||||
|
|||||||
+20
-5
@@ -5,7 +5,6 @@ import android.app.PendingIntent
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.provider.Settings
|
|
||||||
import com.anthonyla.paperize.core.Type
|
import com.anthonyla.paperize.core.Type
|
||||||
import com.anthonyla.paperize.feature.wallpaper.wallpaper_service.WallpaperService1
|
import com.anthonyla.paperize.feature.wallpaper.wallpaper_service.WallpaperService1
|
||||||
import com.anthonyla.paperize.feature.wallpaper.wallpaper_service.WallpaperService2
|
import com.anthonyla.paperize.feature.wallpaper.wallpaper_service.WallpaperService2
|
||||||
@@ -120,10 +119,7 @@ class WallpaperScheduler (
|
|||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
if (!alarmManager.canScheduleExactAlarms()) {
|
if (!alarmManager.canScheduleExactAlarms()) {
|
||||||
Intent().also {
|
cancelWallpaperAlarm()
|
||||||
it.action = Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM
|
|
||||||
context.startActivity(it)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alarmManager.setExactAndAllowWhileIdle(
|
alarmManager.setExactAndAllowWhileIdle(
|
||||||
@@ -179,6 +175,11 @@ class WallpaperScheduler (
|
|||||||
putExtra("refresh", true)
|
putExtra("refresh", true)
|
||||||
}
|
}
|
||||||
val nextMidnight = LocalDateTime.now().plusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0)
|
val nextMidnight = LocalDateTime.now().plusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0)
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
|
if (!alarmManager.canScheduleExactAlarms()) {
|
||||||
|
cancelWallpaperAlarm()
|
||||||
|
}
|
||||||
|
else {
|
||||||
alarmManager.setExact(
|
alarmManager.setExact(
|
||||||
AlarmManager.RTC_WAKEUP,
|
AlarmManager.RTC_WAKEUP,
|
||||||
nextMidnight.atZone(ZoneId.systemDefault()).toEpochSecond() * 1000,
|
nextMidnight.atZone(ZoneId.systemDefault()).toEpochSecond() * 1000,
|
||||||
@@ -190,6 +191,20 @@ class WallpaperScheduler (
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alarmManager.setExact(
|
||||||
|
AlarmManager.RTC_WAKEUP,
|
||||||
|
nextMidnight.atZone(ZoneId.systemDefault()).toEpochSecond() * 1000,
|
||||||
|
PendingIntent.getBroadcast(
|
||||||
|
context,
|
||||||
|
Type.REFRESH.ordinal,
|
||||||
|
intent,
|
||||||
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the service to change the wallpaper
|
* Use the service to change the wallpaper
|
||||||
|
|||||||
Reference in new issue
Block a user