mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Catch error properly when app update check fails (fixes #8019)
This commit is contained in:
		@@ -133,10 +133,10 @@ class AppUpdateService : Service() {
 | 
			
		||||
                throw Exception("Unsuccessful response")
 | 
			
		||||
            }
 | 
			
		||||
            notifier.promptInstall(apkFile.getUriCompat(this))
 | 
			
		||||
        } catch (error: Exception) {
 | 
			
		||||
            logcat(LogPriority.ERROR, error)
 | 
			
		||||
            if (error is CancellationException ||
 | 
			
		||||
                (error is StreamResetException && error.errorCode == ErrorCode.CANCEL)
 | 
			
		||||
        } catch (e: Exception) {
 | 
			
		||||
            logcat(LogPriority.ERROR, e)
 | 
			
		||||
            if (e is CancellationException ||
 | 
			
		||||
                (e is StreamResetException && e.errorCode == ErrorCode.CANCEL)
 | 
			
		||||
            ) {
 | 
			
		||||
                notifier.cancel()
 | 
			
		||||
            } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -45,9 +45,9 @@ class AboutController : BasicFullComposeController() {
 | 
			
		||||
        activity!!.toast(R.string.update_check_look_for_updates)
 | 
			
		||||
 | 
			
		||||
        viewScope.launchIO {
 | 
			
		||||
            val result = updateChecker.checkForUpdate(activity!!, isUserPrompt = true)
 | 
			
		||||
            withUIContext {
 | 
			
		||||
                try {
 | 
			
		||||
            try {
 | 
			
		||||
                val result = updateChecker.checkForUpdate(activity!!, isUserPrompt = true)
 | 
			
		||||
                withUIContext {
 | 
			
		||||
                    when (result) {
 | 
			
		||||
                        is AppUpdateResult.NewUpdate -> {
 | 
			
		||||
                            NewUpdateDialogController(result).showDialog(router)
 | 
			
		||||
@@ -57,10 +57,10 @@ class AboutController : BasicFullComposeController() {
 | 
			
		||||
                        }
 | 
			
		||||
                        else -> {}
 | 
			
		||||
                    }
 | 
			
		||||
                } catch (error: Exception) {
 | 
			
		||||
                    activity?.toast(error.message)
 | 
			
		||||
                    logcat(LogPriority.ERROR, error)
 | 
			
		||||
                }
 | 
			
		||||
            } catch (e: Exception) {
 | 
			
		||||
                withUIContext { activity?.toast(e.message) }
 | 
			
		||||
                logcat(LogPriority.ERROR, e)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user