mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -195,7 +195,6 @@ public class DcContext {
|
||||
public native void deleteMsgs (int msg_ids[]);
|
||||
public native void forwardMsgs (int msg_ids[], int chat_id);
|
||||
public native boolean resendMsgs (int msg_ids[]);
|
||||
public native int prepareMsg (int chat_id, DcMsg msg);
|
||||
public native int sendMsg (int chat_id, DcMsg msg);
|
||||
public native int sendTextMsg (int chat_id, String text);
|
||||
public native int sendVideochatInvitation(int chat_id);
|
||||
|
||||
@@ -156,7 +156,6 @@ public class DcMsg {
|
||||
public native String getSetupCodeBegin ();
|
||||
public native String getVideochatUrl ();
|
||||
public native int getVideochatType ();
|
||||
public native boolean isIncreation ();
|
||||
public native void setText (String text);
|
||||
public native void setSubject (String text);
|
||||
public native void setHtml (String text);
|
||||
|
||||
@@ -117,6 +117,7 @@ import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener;
|
||||
import org.thoughtcrime.securesms.util.guava.Optional;
|
||||
import org.thoughtcrime.securesms.util.views.ProgressDialog;
|
||||
import org.thoughtcrime.securesms.util.views.Stub;
|
||||
import org.thoughtcrime.securesms.video.recode.VideoRecoder;
|
||||
import org.thoughtcrime.securesms.videochat.VideochatUtil;
|
||||
@@ -173,6 +174,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
private View composePanel;
|
||||
private ScaleStableImageView backgroundView;
|
||||
private MessageRequestsBottomView messageRequestBottomView;
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
private AttachmentTypeSelector attachmentTypeSelector;
|
||||
private AttachmentManager attachmentManager;
|
||||
@@ -1069,7 +1071,17 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
{
|
||||
boolean doSend = true;
|
||||
if (recompress==DcMsg.DC_MSG_VIDEO) {
|
||||
Util.runOnMain(() -> {
|
||||
progressDialog = ProgressDialog.show(
|
||||
ConversationActivity.this,
|
||||
"",
|
||||
getString(R.string.one_moment),
|
||||
true,
|
||||
false
|
||||
);
|
||||
});
|
||||
doSend = VideoRecoder.prepareVideo(ConversationActivity.this, dcChat.getId(), msg);
|
||||
Util.runOnMain(() -> progressDialog.dismiss());
|
||||
}
|
||||
|
||||
if (doSend) {
|
||||
|
||||
@@ -75,7 +75,9 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
|
||||
private DcMsg dcAppMsg;
|
||||
private String baseURL;
|
||||
private String sourceCodeUrl = "";
|
||||
private String selfAddr = "";
|
||||
private String selfAddr;
|
||||
private int sendUpdateMaxSize;
|
||||
private int sendUpdateInterval;
|
||||
private boolean internetAccess = false;
|
||||
private boolean hideActionBar = false;
|
||||
|
||||
@@ -203,7 +205,9 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
|
||||
// this is needed here because if the app is opened while already in landscape mode, onConfigurationChanged() is not triggered
|
||||
setScreenMode(getResources().getConfiguration());
|
||||
}
|
||||
selfAddr = JsonUtils.optString(info, "self_addr");
|
||||
selfAddr = info.optString("self_addr");
|
||||
sendUpdateMaxSize = info.optInt("send_update_max_size");
|
||||
sendUpdateInterval = info.optInt("send_update_interval");
|
||||
|
||||
toggleFakeProxy(!internetAccess);
|
||||
|
||||
@@ -509,6 +513,16 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
|
||||
return dcContext.isCommunity();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public int sendUpdateMaxSize() {
|
||||
return WebxdcActivity.this.sendUpdateMaxSize;
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public int sendUpdateInterval() {
|
||||
return WebxdcActivity.this.sendUpdateInterval;
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public String selfAddr() {
|
||||
if (dcContext.isCommunity() && !TextUtils.isEmpty(dcContext.getCommunityUser())) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.providers.PersistentBlobProvider;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.HashMap;
|
||||
@@ -53,17 +54,19 @@ public class WebxdcStoreActivity extends PassphraseRequiredActionBarActivity {
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
String ext = MediaUtil.getFileExtensionFromUrl(Uri.parse(url).getPath());
|
||||
if ("xdc".equals(ext)) {
|
||||
try {
|
||||
HttpResponse httpResponse = rpc.getHttpResponse(dcContext.getAccountId(), url);
|
||||
Uri uri = PersistentBlobProvider.getInstance().create(WebxdcStoreActivity.this, httpResponse.getBlob(), "application/octet-stream", "app.xdc");
|
||||
Intent intent = new Intent();
|
||||
intent.setData(uri);
|
||||
setResult(Activity.RESULT_OK, intent);
|
||||
finish();
|
||||
} catch (RpcException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(WebxdcStoreActivity.this, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
Util.runOnAnyBackgroundThread(() -> {
|
||||
try {
|
||||
HttpResponse httpResponse = rpc.getHttpResponse(dcContext.getAccountId(), url);
|
||||
Uri uri = PersistentBlobProvider.getInstance().create(WebxdcStoreActivity.this, httpResponse.getBlob(), "application/octet-stream", "app.xdc");
|
||||
Intent intent = new Intent();
|
||||
intent.setData(uri);
|
||||
setResult(Activity.RESULT_OK, intent);
|
||||
finish();
|
||||
} catch (RpcException e) {
|
||||
e.printStackTrace();
|
||||
Util.runOnMain(() -> Toast.makeText(WebxdcStoreActivity.this, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
WebViewActivity.openUrlInBrowser(WebxdcStoreActivity.this, url);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.googlecode.mp4parser.util.Path;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.views.ProgressDialog;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -551,11 +552,9 @@ public class VideoRecoder {
|
||||
}
|
||||
|
||||
// prepareVideo() assumes the msg object is set up properly to being sent;
|
||||
// the function fills out missing information and also recodes the video as needed;
|
||||
// to get a responsive ui, DcChat.prepareMsg() may be called.
|
||||
// the function fills out missing information and also recodes the video as needed.
|
||||
// return: true=video might be prepared, can be sent, false=error
|
||||
public static boolean prepareVideo(Context context, int chatId, DcMsg msg) {
|
||||
|
||||
try {
|
||||
String inPath = msg.getFile();
|
||||
Log.i(TAG, "Preparing video: " + inPath);
|
||||
@@ -623,7 +622,6 @@ public class VideoRecoder {
|
||||
msg.setDimension(vei.resultWidth, vei.resultHeight);
|
||||
}
|
||||
msg.setDuration((int) resultDurationMs);
|
||||
DcHelper.getContext(context).prepareMsg(chatId, msg);
|
||||
|
||||
// calculate bytes
|
||||
vei.estimatedBytes = VideoRecoder.calculateEstimatedSize((float) resultDurationMs / vei.originalDurationMs,
|
||||
|
||||
Reference in New Issue
Block a user