Merge remote-tracking branch 'loki/master' into light-theme

This commit is contained in:
Anton Chekulaev 2020-08-31 19:54:47 +10:00
commit 4da13f8541
4 changed files with 12 additions and 8 deletions

View File

@ -185,8 +185,8 @@ dependencies {
implementation "com.opencsv:opencsv:4.6" implementation "com.opencsv:opencsv:4.6"
} }
def canonicalVersionCode = 73 def canonicalVersionCode = 75
def canonicalVersionName = "1.4.5" def canonicalVersionName = "1.4.6"
def postFixSize = 10 def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1, def abiPostFix = ['armeabi-v7a' : 1,

View File

@ -27,6 +27,7 @@ import org.whispersystems.signalservice.api.SignalServiceMessageSender;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment; import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer; import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer;
import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.loki.api.utilities.HTTP;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -52,7 +53,7 @@ public class AttachmentUploadJob extends BaseJob implements InjectableType {
this(new Job.Parameters.Builder() this(new Job.Parameters.Builder()
.addConstraint(NetworkConstraint.KEY) .addConstraint(NetworkConstraint.KEY)
.setLifespan(TimeUnit.DAYS.toMillis(1)) .setLifespan(TimeUnit.DAYS.toMillis(1))
.setMaxAttempts(5) .setMaxAttempts(10)
.build(), .build(),
attachmentId, destination); attachmentId, destination);
} }
@ -102,7 +103,8 @@ public class AttachmentUploadJob extends BaseJob implements InjectableType {
@Override @Override
protected boolean onShouldRetry(@NonNull Exception exception) { protected boolean onShouldRetry(@NonNull Exception exception) {
return exception instanceof IOException; return exception instanceof IOException ||
exception instanceof HTTP.HTTPRequestFailedException;
} }
private SignalServiceAttachment getAttachmentFor(Attachment attachment) { private SignalServiceAttachment getAttachmentFor(Attachment attachment) {

View File

@ -4,6 +4,7 @@ import android.content.Intent
import android.graphics.Bitmap import android.graphics.Bitmap
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.os.Environment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -125,7 +126,7 @@ class ViewMyQRCodeFragment : Fragment() {
} }
private fun shareQRCode() { private fun shareQRCode() {
val directory = requireContext().externalCacheDir val directory = requireContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES)
val fileName = "$hexEncodedPublicKey.png" val fileName = "$hexEncodedPublicKey.png"
val file = File(directory, fileName) val file = File(directory, fileName)
file.createNewFile() file.createNewFile()
@ -137,7 +138,6 @@ class ViewMyQRCodeFragment : Fragment() {
fos.close() fos.close()
val intent = Intent(Intent.ACTION_SEND) val intent = Intent(Intent.ACTION_SEND)
intent.putExtra(Intent.EXTRA_STREAM, FileProviderUtil.getUriFor(requireActivity(), file)) 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.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
intent.type = "image/png" intent.type = "image/png"
startActivity(Intent.createChooser(intent, resources.getString(R.string.fragment_view_my_qr_code_share_title))) startActivity(Intent.createChooser(intent, resources.getString(R.string.fragment_view_my_qr_code_share_title)))

View File

@ -14,8 +14,10 @@ public class FileProviderUtil {
private static final String AUTHORITY = "network.loki.securesms.fileprovider"; private static final String AUTHORITY = "network.loki.securesms.fileprovider";
public static Uri getUriFor(@NonNull Context context, @NonNull File file) { public static Uri getUriFor(@NonNull Context context, @NonNull File file) {
if (Build.VERSION.SDK_INT >= 24) return FileProvider.getUriForFile(context, AUTHORITY, file); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
else return Uri.fromFile(file); return FileProvider.getUriForFile(context, AUTHORITY, file);
else
return Uri.fromFile(file);
} }
public static boolean isAuthority(@NonNull Uri uri) { public static boolean isAuthority(@NonNull Uri uri) {