Minor cleanup

This commit is contained in:
arkon
2023-01-12 22:53:28 -05:00
parent 4d8289cd36
commit a2ee4e63ae
8 changed files with 43 additions and 45 deletions

View File

@@ -44,12 +44,12 @@ class BackupRestoreService : Service() {
* @param uri path of Uri
*/
fun start(context: Context, uri: Uri) {
if (!isRunning(context)) {
val intent = Intent(context, BackupRestoreService::class.java).apply {
putExtra(BackupConst.EXTRA_URI, uri)
}
ContextCompat.startForegroundService(context, intent)
if (isRunning(context)) return
val intent = Intent(context, BackupRestoreService::class.java).apply {
putExtra(BackupConst.EXTRA_URI, uri)
}
ContextCompat.startForegroundService(context, intent)
}
/**

View File

@@ -166,13 +166,13 @@ class AppUpdateService : Service() {
* @param url the url to the new update.
*/
fun start(context: Context, url: String, title: String? = context.getString(R.string.app_name)) {
if (!isRunning(context)) {
val intent = Intent(context, AppUpdateService::class.java).apply {
putExtra(EXTRA_DOWNLOAD_TITLE, title)
putExtra(EXTRA_DOWNLOAD_URL, url)
}
ContextCompat.startForegroundService(context, intent)
if (isRunning(context)) return
val intent = Intent(context, AppUpdateService::class.java).apply {
putExtra(EXTRA_DOWNLOAD_TITLE, title)
putExtra(EXTRA_DOWNLOAD_URL, url)
}
ContextCompat.startForegroundService(context, intent)
}
/**