Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/images/readme.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 6 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<div align="center"><b><sub><code>v1.0.0</code></sub></b></div>

**<div align="center" style="padding-top: 1.25rem">[Download](https://swingmx.com/downloads) • <a href="https://github.com/sponsors/swingmx" target="_blank">Sponsor Us ❤️</a> • [Swing Music Docs](https://swingmx.com/guide/introduction.html) • [r/SwingMusicApp](https://www.reddit.com/r/SwingMusicApp)</div>**
**<div align="center" style="padding-top: 1.25rem">[Download](https://github.com/swingmx/android/releases) • <a href="https://github.com/sponsors/swingmx" target="_blank">Sponsor Us ❤️</a> • [Swing Music Docs](https://swingmx.com/guide/introduction.html) • [r/SwingMusicApp](https://www.reddit.com/r/SwingMusicApp)</div>**

##

Expand All @@ -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.
Expand All @@ -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

<table>
<tr>
<td>
<img src="https://github.com/swingmx/android/assets/54077752/0344f6f9-dd70-4a4f-adf9-2a883758af28" width="320" alt="image" />
</td>
<td>
<img src="https://github.com/swingmx/android/assets/54077752/59649546-295b-4e40-8e3e-8e03dd1f7dd7" width="320" alt="image" />
</td>
</tr>
<!--
<tr>
<td>
<img src="https://github.com/swingmx/android/assets/54077752/de0abb9d-95ed-4e2f-91ff-20dbf5288809" width="320" alt="image" />
</td>
<td>
<img src="" width="320" alt="" />
</td>
</tr> -->
</table>
![Image](.github/images/readme.webp)

<!-- [![wakatime](https://wakatime.com/badge/user/99206146-a1fc-4be5-adc8-c2351f27ecef/project/018e7aae-f9e9-42e9-99e1-fc381580884d.svg)](https://wakatime.com/badge/user/99206146-a1fc-4be5-adc8-c2351f27ecef/project/018e7aae-f9e9-42e9-99e1-fc381580884d) -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TokenRefreshWorker>(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<TokenRefreshWorker>(6, TimeUnit.HOURS)
.setConstraints(constraints)
.setBackoffCriteria(
BackoffPolicy.EXPONENTIAL,
15,
TimeUnit.MINUTES
)
.build()

WorkManager.getInstance(context)
.enqueueUniquePeriodicWork(
workManager.enqueueUniquePeriodicWork(
TokenRefreshWorker.WORK_NAME,
ExistingPeriodicWorkPolicy.KEEP,
tokenRefreshWorkRequest
)
}
}