diff --git a/build.gradle b/build.gradle index bf92f6b52..acb3b49c7 100644 --- a/build.gradle +++ b/build.gradle @@ -244,7 +244,6 @@ dependencies { annotationProcessor 'androidx.annotation:annotation:1.9.1' implementation 'com.makeramen:roundedimageview:2.1.0' // crops the avatars to circles implementation 'com.pnikosis:materialish-progress:1.5' // used only in the "Progress Wheel" in Share Activity. - implementation 'com.soundcloud.android:android-crop:1.0.1@aar' // used for profile and group avatar selection in Android SDK<19 implementation 'com.github.amulyakhare:TextDrawable:558677ea31' // number of unread messages, // the one-letter circle for the contacts (when there is not avatar) and a white background. implementation 'com.googlecode.mp4parser:isoparser:1.0.6' // MP4 recoding; upgrading eg. to 1.1.22 breaks recoding, however, i have not investigated further, just reset to 1.0.6 diff --git a/flake.nix b/flake.nix index 2730a48b4..687b3f711 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,7 @@ pkgs = import nixpkgs { inherit system overlays; }; android-sdk = android.sdk.${system} (sdkPkgs: with sdkPkgs; [ - build-tools-33-0-1 + build-tools-34-0-0 cmdline-tools-latest platform-tools platforms-android-34 diff --git a/jni/dc_wrapper.c b/jni/dc_wrapper.c index 0b910dc1b..8571a2d54 100644 --- a/jni/dc_wrapper.c +++ b/jni/dc_wrapper.c @@ -1667,6 +1667,18 @@ JNIEXPORT jstring Java_com_b44t_messenger_DcMsg_getPOILocation(JNIEnv *env, jobj } +JNIEXPORT void Java_com_b44t_messenger_DcMsg_setFileAndDeduplicate(JNIEnv *env, jobject obj, jstring file, jstring name, jstring filemime) +{ + CHAR_REF(file); + CHAR_REF(name); + CHAR_REF(filemime); + dc_msg_set_file_and_deduplicate(get_dc_msg(env, obj), filePtr, namePtr, filemimePtr); + CHAR_UNREF(filemime); + CHAR_UNREF(name); + CHAR_UNREF(file); +} + + JNIEXPORT void Java_com_b44t_messenger_DcMsg_setDimension(JNIEnv *env, jobject obj, int width, int height) { dc_msg_set_dimension(get_dc_msg(env, obj), width, height); diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 3dbff5663..9aa3dbcf5 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -329,8 +329,6 @@ android:theme="@style/TextSecure.ScribbleTheme" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> - - = 0) { - ext = filename.substring(i); - filename = filename.substring(0, i); - } - - String path = DcHelper.getBlobdirFile(dcContext, filename, ext); + path = DcHelper.getBlobdirFile(dcContext, filename, "temp"); // copy content to this file if (path != null) { @@ -173,12 +167,11 @@ public class SendRelayedMessageUtil { OutputStream outputStream = new FileOutputStream(path); Util.copy(inputStream, outputStream); } - - return path; } catch (Exception e) { e.printStackTrace(); - return null; + path = null; } + message.setFileAndDeduplicate(path, filename, mimeType); } private static String getHtml(Context context, Uri uri) { diff --git a/src/main/java/org/thoughtcrime/securesms/video/recode/VideoRecoder.java b/src/main/java/org/thoughtcrime/securesms/video/recode/VideoRecoder.java index b47f0e864..df17d04c9 100644 --- a/src/main/java/org/thoughtcrime/securesms/video/recode/VideoRecoder.java +++ b/src/main/java/org/thoughtcrime/securesms/video/recode/VideoRecoder.java @@ -640,10 +640,7 @@ public class VideoRecoder { return false; } - if (!Util.moveFile(tempPath, inPath)) { - alert(context, String.format("Recoding failed for %s: cannot move temporary file %s", inPath, tempPath)); - return false; - } + msg.setFileAndDeduplicate(tempPath, msg.getFilename(), msg.getFilemime()); Log.i(TAG, String.format("recoding for %s done", inPath)); }