File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
app/src/main/java/com/github/droidworksstudio/launcher/ui/activities Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ import com.github.droidworksstudio.launcher.utils.Constants
4444import com.github.droidworksstudio.launcher.viewmodel.AppViewModel
4545import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel
4646import dagger.hilt.android.AndroidEntryPoint
47+ import kotlinx.coroutines.Dispatchers
4748import kotlinx.coroutines.launch
49+ import kotlinx.coroutines.withContext
4850import java.io.BufferedReader
4951import java.io.FileOutputStream
5052import java.io.InputStreamReader
@@ -427,10 +429,16 @@ class MainActivity : AppCompatActivity() {
427429 Constants .BACKUP_READ_APPS -> {
428430 data?.data?.also { uri ->
429431 lifecycleScope.launch {
430- appHelper.restoreAppInfo(applicationContext, appDao, uri)
432+ try {
433+ withContext(Dispatchers .IO ) {
434+ appHelper.restoreAppInfo(applicationContext, appDao, uri)
435+ }
436+ AppReloader .restartApp(applicationContext)
437+ } catch (t: Throwable ) {
438+ applicationContext.showLongToast(" Restore failed: ${t.message} " )
439+ }
431440 }
432441 }
433- AppReloader .restartApp(applicationContext)
434442 }
435443 }
436444 }
You can’t perform that action at this time.
0 commit comments