mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
update to new calls-app's API
This commit is contained in:
+1
-1
Submodule jni/deltachat-core-rust updated: 75bcf8660b...5d9b887624
File diff suppressed because one or more lines are too long
@@ -17,6 +17,7 @@ import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -50,7 +51,10 @@ import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.videochat.VideochatActivity;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -166,7 +170,14 @@ public class NotificationCenter {
|
||||
.putExtra(ConversationActivity.CHAT_ID_EXTRA, chatData.chatId)
|
||||
.setAction(Intent.ACTION_VIEW);
|
||||
|
||||
String hash = "#offer=" + payload;
|
||||
String base64 = Base64.encodeToString(payload.getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP);
|
||||
String hash = "";
|
||||
try {
|
||||
hash = "#acceptCall=" + URLEncoder.encode(base64, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(TAG, "Error", e);
|
||||
}
|
||||
|
||||
Intent intent = new Intent(context, VideochatActivity.class);
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.putExtra(VideochatActivity.EXTRA_ACCOUNT_ID, chatData.accountId);
|
||||
|
||||
@@ -4,6 +4,8 @@ import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.PermissionRequest;
|
||||
@@ -23,9 +25,13 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.AvatarUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
|
||||
public class VideochatActivity extends WebViewActivity implements DcEventCenter.DcEventDelegate {
|
||||
private static final String TAG = VideochatActivity.class.getSimpleName();
|
||||
|
||||
public static final String EXTRA_ACCOUNT_ID = "acc_id";
|
||||
public static final String EXTRA_CHAT_ID = "chat_id";
|
||||
@@ -101,8 +107,13 @@ public class VideochatActivity extends WebViewActivity implements DcEventCenter.
|
||||
switch (event.getId()) {
|
||||
case DcContext.DC_EVENT_OUTGOING_CALL_ACCEPTED:
|
||||
if (event.getData1Int() == callId) {
|
||||
String hash = "#answer=" + event.getData2Str();
|
||||
webView.evaluateJavascript("window.location.hash = `"+hash+"`", null);
|
||||
try {
|
||||
String base64 = Base64.encodeToString(event.getData2Str().getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP);
|
||||
String hash = "#onAnswer=" + URLEncoder.encode(base64, "UTF-8");
|
||||
webView.evaluateJavascript("window.location.hash = `"+hash+"`", null);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(TAG, "Error", e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DcContext.DC_EVENT_CALL_ENDED:
|
||||
|
||||
@@ -21,7 +21,7 @@ public class VideochatUtil {
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.putExtra(VideochatActivity.EXTRA_ACCOUNT_ID, accId);
|
||||
intent.putExtra(VideochatActivity.EXTRA_CHAT_ID, chatId);
|
||||
intent.putExtra(VideochatActivity.EXTRA_HASH, "#call");
|
||||
intent.putExtra(VideochatActivity.EXTRA_HASH, "#startCall");
|
||||
activity.startActivity(intent);
|
||||
})
|
||||
.execute();
|
||||
|
||||
Reference in New Issue
Block a user