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

pull/305/head
Anton Chekulaev 4 years ago
commit 4da13f8541

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

@ -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) {

@ -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)))

@ -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) {

Loading…
Cancel
Save