diff --git a/.github/images/readme.webp b/.github/images/readme.webp new file mode 100644 index 00000000..e074da6c Binary files /dev/null and b/.github/images/readme.webp differ diff --git a/README.md b/README.md index 8afc4bb6..72ba92af 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@
v1.0.0
-**
[Download](https://swingmx.com/downloads) • Sponsor Us ❤️ • [Swing Music Docs](https://swingmx.com/guide/introduction.html) • [r/SwingMusicApp](https://www.reddit.com/r/SwingMusicApp)
** +**
[Download](https://github.com/swingmx/android/releases) • Sponsor Us ❤️ • [Swing Music Docs](https://swingmx.com/guide/introduction.html) • [r/SwingMusicApp](https://www.reddit.com/r/SwingMusicApp)
** ## @@ -15,11 +15,10 @@ This client application allows you to stream music on your Android device from y Below is a list of the currently implemented features: -- Playback -- Search tracks -- Album and artist views - Folders view -- Albums and artist views +- Playback +- Albums and Artist view +- Search Tracks, Albums, Artists - Playlists can be viewed in the folder view by enabling the `Show Playlists in folder view` option in `Settings > Folders` in the webclient. More features will be implemented in the future. @@ -28,29 +27,11 @@ More features will be implemented in the future. Download the app from the [releases page](https://github.com/swingmx/android/releases) and install the APK. When you launch the app, you should be prompted to scan a QR code or enter your server details manually. -You can to to `Settings > Pair device` on the webclient to get the QR code. +You can go to `Settings > Pair device` on the webclient to get the QR code. ## Screenshots - - - - - - -
- image - - image -
+![Image](.github/images/readme.webp) diff --git a/auth/src/main/java/com/android/swingmusic/auth/data/workmanager/ScheduleTokenRefreshWork.kt b/auth/src/main/java/com/android/swingmusic/auth/data/workmanager/ScheduleTokenRefreshWork.kt index dd85ddeb..30743e99 100644 --- a/auth/src/main/java/com/android/swingmusic/auth/data/workmanager/ScheduleTokenRefreshWork.kt +++ b/auth/src/main/java/com/android/swingmusic/auth/data/workmanager/ScheduleTokenRefreshWork.kt @@ -6,28 +6,33 @@ import androidx.work.Constraints import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.NetworkType import androidx.work.PeriodicWorkRequestBuilder +import androidx.work.WorkInfo import androidx.work.WorkManager import java.util.concurrent.TimeUnit fun scheduleTokenRefreshWork(context: Context) { - val constraints = Constraints.Builder() - .setRequiredNetworkType(NetworkType.CONNECTED) - .setRequiresBatteryNotLow(true) - .build() + val workManager = WorkManager.getInstance(context) + val workInfos = workManager.getWorkInfosForUniqueWork(TokenRefreshWorker.WORK_NAME).get() - val tokenRefreshWorkRequest = PeriodicWorkRequestBuilder(21, TimeUnit.DAYS) - .setConstraints(constraints) - .setBackoffCriteria( - BackoffPolicy.EXPONENTIAL, - 1, - TimeUnit.HOURS - ) - .build() + // .KEEP failed to work consistently, So, I added this check. + if (workInfos.none { it.state in listOf(WorkInfo.State.ENQUEUED, WorkInfo.State.RUNNING)}) { + val constraints = Constraints.Builder() + .setRequiredNetworkType(NetworkType.CONNECTED) + .build() + + val tokenRefreshWorkRequest = PeriodicWorkRequestBuilder(6, TimeUnit.HOURS) + .setConstraints(constraints) + .setBackoffCriteria( + BackoffPolicy.EXPONENTIAL, + 15, + TimeUnit.MINUTES + ) + .build() - WorkManager.getInstance(context) - .enqueueUniquePeriodicWork( + workManager.enqueueUniquePeriodicWork( TokenRefreshWorker.WORK_NAME, ExistingPeriodicWorkPolicy.KEEP, tokenRefreshWorkRequest ) + } }