Skip to content

Commit ab3b4b2

Browse files
committed
fix kt spotless
Signed-off-by: alperozturk <[email protected]>
1 parent e6bdf5b commit ab3b4b2

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

app/src/main/java/com/nextcloud/client/widget/DashboardWidgetService.kt

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import com.owncloud.android.utils.BitmapUtils
2828
import dagger.android.AndroidInjection
2929
import kotlinx.coroutines.CoroutineScope
3030
import kotlinx.coroutines.Dispatchers
31-
import kotlinx.coroutines.SupervisorJob
3231
import kotlinx.coroutines.launch
3332
import kotlinx.coroutines.withContext
3433
import javax.inject.Inject
@@ -43,22 +42,13 @@ class DashboardWidgetService : RemoteViewsService() {
4342
@Inject
4443
lateinit var widgetRepository: WidgetRepository
4544

46-
private val serviceJob = SupervisorJob()
47-
private val serviceScope = CoroutineScope(Dispatchers.Main + serviceJob)
48-
4945
override fun onCreate() {
5046
super.onCreate()
5147
AndroidInjection.inject(this)
5248
}
5349

54-
override fun onDestroy() {
55-
super.onDestroy()
56-
serviceJob.cancel()
57-
}
58-
5950
override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
6051
return StackRemoteViewsFactory(
61-
serviceScope,
6252
this.applicationContext,
6353
userAccountManager,
6454
clientFactory,
@@ -68,9 +58,7 @@ class DashboardWidgetService : RemoteViewsService() {
6858
}
6959
}
7060

71-
@Suppress("LongParameterList")
7261
class StackRemoteViewsFactory(
73-
private val scope: CoroutineScope,
7462
private val context: Context,
7563
val userAccountManager: UserAccountManager,
7664
val clientFactory: ClientFactory,
@@ -97,7 +85,7 @@ class StackRemoteViewsFactory(
9785
}
9886

9987
override fun onDataSetChanged() {
100-
scope.launch {
88+
CoroutineScope(Dispatchers.IO).launch {
10189
try {
10290
if (!widgetConfiguration.user.isPresent) {
10391
Log_OC.w(TAG, "User not present for widget update")
@@ -176,7 +164,7 @@ class StackRemoteViewsFactory(
176164
}
177165

178166
private fun loadIcon(widgetItem: DashboardWidgetItem, remoteViews: RemoteViews) {
179-
scope.launch {
167+
CoroutineScope(Dispatchers.IO).launch {
180168
val client = OwnCloudClientManagerFactory.getDefaultSingleton()
181169
.getNextcloudClientFor(userAccountManager.user.toOwnCloudAccount(), context)
182170

0 commit comments

Comments
 (0)