From fe1362187ed3dd0b260877eb207a7f67550b302d Mon Sep 17 00:00:00 2001 From: Anton Chekulaev Date: Thu, 27 Aug 2020 20:53:50 +1000 Subject: [PATCH 1/4] Use proper file URI for QR code sharing. --- .../securesms/loki/activities/QRCodeActivity.kt | 4 ++-- src/org/thoughtcrime/securesms/util/FileProviderUtil.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/org/thoughtcrime/securesms/loki/activities/QRCodeActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/QRCodeActivity.kt index eba3f552e9..42af70dbae 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/QRCodeActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/QRCodeActivity.kt @@ -4,6 +4,7 @@ import android.content.Intent import android.graphics.Bitmap import android.net.Uri import android.os.Bundle +import android.os.Environment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -125,7 +126,7 @@ class ViewMyQRCodeFragment : Fragment() { } private fun shareQRCode() { - val directory = requireContext().externalCacheDir + val directory = requireContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES) val fileName = "$hexEncodedPublicKey.png" val file = File(directory, fileName) file.createNewFile() @@ -137,7 +138,6 @@ class ViewMyQRCodeFragment : Fragment() { fos.close() val intent = Intent(Intent.ACTION_SEND) intent.putExtra(Intent.EXTRA_STREAM, FileProviderUtil.getUriFor(requireActivity(), file)) - intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)) intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) intent.type = "image/png" startActivity(Intent.createChooser(intent, resources.getString(R.string.fragment_view_my_qr_code_share_title))) diff --git a/src/org/thoughtcrime/securesms/util/FileProviderUtil.java b/src/org/thoughtcrime/securesms/util/FileProviderUtil.java index 629a5b43bc..316476ff90 100644 --- a/src/org/thoughtcrime/securesms/util/FileProviderUtil.java +++ b/src/org/thoughtcrime/securesms/util/FileProviderUtil.java @@ -14,8 +14,10 @@ public class FileProviderUtil { private static final String AUTHORITY = "network.loki.securesms.fileprovider"; public static Uri getUriFor(@NonNull Context context, @NonNull File file) { - if (Build.VERSION.SDK_INT >= 24) return FileProvider.getUriForFile(context, AUTHORITY, file); - else return Uri.fromFile(file); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) + return FileProvider.getUriForFile(context, AUTHORITY, file); + else + return Uri.fromFile(file); } public static boolean isAuthority(@NonNull Uri uri) { From 4b57114f25f841d3570e76d11f704d2b671ac8d4 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Fri, 28 Aug 2020 08:30:42 +1000 Subject: [PATCH 2/4] Update build number --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a4b18b5276..35037ee020 100644 --- a/build.gradle +++ b/build.gradle @@ -185,7 +185,7 @@ dependencies { implementation "com.opencsv:opencsv:4.6" } -def canonicalVersionCode = 73 +def canonicalVersionCode = 74 def canonicalVersionName = "1.4.5" def postFixSize = 10 From e391ad8edd3bd8515f8c19db7697c5a4bda26d8b Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 31 Aug 2020 10:47:39 +1000 Subject: [PATCH 3/4] Fix attachment upload retrying --- .../thoughtcrime/securesms/jobs/AttachmentUploadJob.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/jobs/AttachmentUploadJob.java b/src/org/thoughtcrime/securesms/jobs/AttachmentUploadJob.java index 766e8f20f6..72a83a47a7 100644 --- a/src/org/thoughtcrime/securesms/jobs/AttachmentUploadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/AttachmentUploadJob.java @@ -27,6 +27,7 @@ import org.whispersystems.signalservice.api.SignalServiceMessageSender; import org.whispersystems.signalservice.api.messages.SignalServiceAttachment; import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer; import org.whispersystems.signalservice.api.push.SignalServiceAddress; +import org.whispersystems.signalservice.loki.api.utilities.HTTP; import java.io.IOException; import java.io.InputStream; @@ -52,7 +53,7 @@ public class AttachmentUploadJob extends BaseJob implements InjectableType { this(new Job.Parameters.Builder() .addConstraint(NetworkConstraint.KEY) .setLifespan(TimeUnit.DAYS.toMillis(1)) - .setMaxAttempts(5) + .setMaxAttempts(10) .build(), attachmentId, destination); } @@ -102,7 +103,8 @@ public class AttachmentUploadJob extends BaseJob implements InjectableType { @Override protected boolean onShouldRetry(@NonNull Exception exception) { - return exception instanceof IOException; + return exception instanceof IOException || + exception instanceof HTTP.HTTPRequestFailedException; } private SignalServiceAttachment getAttachmentFor(Attachment attachment) { From 967b621615bdc62a2f67cd249185f76a98680aec Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 31 Aug 2020 11:22:38 +1000 Subject: [PATCH 4/4] Update version number --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 35037ee020..137160529e 100644 --- a/build.gradle +++ b/build.gradle @@ -185,8 +185,8 @@ dependencies { implementation "com.opencsv:opencsv:4.6" } -def canonicalVersionCode = 74 -def canonicalVersionName = "1.4.5" +def canonicalVersionCode = 75 +def canonicalVersionName = "1.4.6" def postFixSize = 10 def abiPostFix = ['armeabi-v7a' : 1,