Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e98a333 authored by tibbi's avatar tibbi
Browse files

properly catch TransactionTooLargeException when sharing large items

parent 96f3875b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ buildscript {
        propMinSdkVersion = 16
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '3.12.0'
        propVersionName = '3.12.2'
        kotlin_version = '1.2.21'
        support_libs = '27.0.2'
    }
+13 −12
Original line number Diff line number Diff line
@@ -134,15 +134,16 @@ fun Activity.sharePathIntent(path: String, applicationId: String) {
            putExtra(Intent.EXTRA_STREAM, newUri)
            type = getUriMimeType(path, newUri)
            addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
            if (resolveActivity(packageManager) != null) {

            try {
                if (resolveActivity(packageManager) != null) {
                    startActivity(Intent.createChooser(this, getString(R.string.share_via)))
                } catch (e: TransactionTooLargeException) {
                    toast(R.string.maximum_share_reached)
                }
                } else {
                    toast(R.string.no_app_found)
                }
            } catch (e: TransactionTooLargeException) {
                toast(R.string.maximum_share_reached)
            }
        }
    }.start()
}
@@ -170,15 +171,15 @@ fun Activity.sharePathsIntent(paths: ArrayList<String>, applicationId: String) {
                addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
                putParcelableArrayListExtra(Intent.EXTRA_STREAM, newUris)

                if (resolveActivity(packageManager) != null) {
                try {
                    if (resolveActivity(packageManager) != null) {
                        startActivity(Intent.createChooser(this, getString(R.string.share_via)))
                    } catch (e: TransactionTooLargeException) {
                        toast(R.string.maximum_share_reached)
                    }
                    } else {
                        toast(R.string.no_app_found)
                    }
                } catch (e: TransactionTooLargeException) {
                    toast(R.string.maximum_share_reached)
                }
            }
        }
    }.start()