From 47a7336bd0a6da8a7c7cb0f4de4f6ced9950a268 Mon Sep 17 00:00:00 2001 From: fulmeek <36341513+fulmeek@users.noreply.github.com> Date: Sun, 13 Mar 2022 17:28:14 +0100 Subject: [PATCH] Show useful error messages --- .../com/tomclaw/appsend_rb/screen/apps/AppsInteractor.kt | 4 ++-- .../com/tomclaw/appsend_rb/screen/apps/AppsPresenter.kt | 4 ++-- .../java/com/tomclaw/appsend_rb/screen/apps/AppsView.kt | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsInteractor.kt b/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsInteractor.kt index 7f46597..5623380 100644 --- a/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsInteractor.kt +++ b/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsInteractor.kt @@ -148,12 +148,12 @@ class AppsInteractorImpl( APPS_DIR_NAME ) if (!(directory.exists() || directory.mkdirs())) { - emitter.onError(IOException("unable to create directory")) + emitter.onError(IOException("unable to create directory " + directory.name)) return@create } val destination = File(directory, getApkName(entity)) if (destination.exists() && !destination.delete()) { - emitter.onError(IOException("unable to delete destination file")) + emitter.onError(IOException("unable to delete destination file " + destination.name)) return@create } val buffer = ByteArray(524288) diff --git a/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsPresenter.kt b/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsPresenter.kt index f691b91..3951bbc 100644 --- a/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsPresenter.kt +++ b/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsPresenter.kt @@ -189,7 +189,7 @@ class AppsPresenterImpl( .subscribe({ file -> router?.shareApk(file) }, { - view?.showAppExportError() + view?.showAppExportError(it.message.toString()) }) } @@ -202,7 +202,7 @@ class AppsPresenterImpl( .subscribe({ file -> view?.showExtractSuccess(file.path) }, { - view?.showAppExportError() + view?.showAppExportError(it.message.toString()) }) } diff --git a/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsView.kt b/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsView.kt index 14a5dc4..2f166e9 100644 --- a/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsView.kt +++ b/app/src/main/java/com/tomclaw/appsend_rb/screen/apps/AppsView.kt @@ -47,7 +47,7 @@ interface AppsView { fun showAppLaunchError() - fun showAppExportError() + fun showAppExportError(msg: String) fun showNoRequestedPermissionsMessage() @@ -183,8 +183,8 @@ class AppsViewImpl( Snackbar.make(recycler, R.string.non_launchable_package, Snackbar.LENGTH_LONG).show() } - override fun showAppExportError() { - Snackbar.make(recycler, R.string.app_extract_failed, Snackbar.LENGTH_LONG).show() + override fun showAppExportError(msg: String) { + Snackbar.make(recycler, msg, Snackbar.LENGTH_LONG).show() } override fun showNoRequestedPermissionsMessage() {