mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
remove old videochat invitations
This commit is contained in:
@@ -965,13 +965,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
AttachmentManager.selectGallery(this, PICK_GALLERY); break;
|
||||
case AttachmentTypeSelector.ADD_DOCUMENT:
|
||||
AttachmentManager.selectDocument(this, PICK_DOCUMENT); break;
|
||||
case AttachmentTypeSelector.INVITE_VIDEO_CHAT:
|
||||
if (isMultiUser()) {
|
||||
VideochatUtil.startMeeting(this, chatId);
|
||||
} else {
|
||||
VideochatUtil.startCall(this, chatId);
|
||||
}
|
||||
break;
|
||||
case AttachmentTypeSelector.ADD_CONTACT_INFO:
|
||||
startContactChooserActivity(); break;
|
||||
case AttachmentTypeSelector.ADD_LOCATION:
|
||||
|
||||
@@ -35,19 +35,17 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
|
||||
public static final int ADD_GALLERY = 1;
|
||||
public static final int ADD_DOCUMENT = 2;
|
||||
public static final int INVITE_VIDEO_CHAT = 3;
|
||||
public static final int ADD_CONTACT_INFO = 4;
|
||||
public static final int TAKE_PHOTO = 5;
|
||||
public static final int ADD_LOCATION = 6;
|
||||
public static final int RECORD_VIDEO = 7;
|
||||
public static final int ADD_WEBXDC = 8;
|
||||
public static final int ADD_CONTACT_INFO = 3;
|
||||
public static final int TAKE_PHOTO = 4;
|
||||
public static final int ADD_LOCATION = 5;
|
||||
public static final int RECORD_VIDEO = 6;
|
||||
public static final int ADD_WEBXDC = 7;
|
||||
|
||||
private static final int ANIMATION_DURATION = 300;
|
||||
|
||||
private final @NonNull LoaderManager loaderManager;
|
||||
private final @NonNull RecentPhotoViewRail recentRail;
|
||||
private final @NonNull ImageView imageButton;
|
||||
private final @NonNull ImageView videoChatButton;
|
||||
private final @NonNull ImageView documentButton;
|
||||
private final @NonNull ImageView contactButton;
|
||||
private final @NonNull ImageView cameraButton;
|
||||
@@ -70,7 +68,6 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
this.chatId = chatId;
|
||||
this.recentRail = ViewUtil.findById(layout, R.id.recent_photos);
|
||||
this.imageButton = ViewUtil.findById(layout, R.id.gallery_button);
|
||||
this.videoChatButton = ViewUtil.findById(layout, R.id.invite_video_chat_button);
|
||||
this.documentButton = ViewUtil.findById(layout, R.id.document_button);
|
||||
this.contactButton = ViewUtil.findById(layout, R.id.contact_button);
|
||||
this.cameraButton = ViewUtil.findById(layout, R.id.camera_button);
|
||||
@@ -79,7 +76,6 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
this.webxdcButton = ViewUtil.findById(layout, R.id.webxdc_button);
|
||||
|
||||
this.imageButton.setOnClickListener(new PropagatingClickListener(ADD_GALLERY));
|
||||
this.videoChatButton.setOnClickListener(new PropagatingClickListener(INVITE_VIDEO_CHAT));
|
||||
this.documentButton.setOnClickListener(new PropagatingClickListener(ADD_DOCUMENT));
|
||||
this.contactButton.setOnClickListener(new PropagatingClickListener(ADD_CONTACT_INFO));
|
||||
this.cameraButton.setOnClickListener(new PropagatingClickListener(TAKE_PHOTO));
|
||||
@@ -92,10 +88,6 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
ViewUtil.findById(layout, R.id.location_linear_layout).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (!DcHelper.isWebrtcConfigOk(DcHelper.getContext(context))) {
|
||||
ViewUtil.findById(layout, R.id.invite_video_chat_linear_layout).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
setLocationButtonImage(context);
|
||||
|
||||
setContentView(layout);
|
||||
@@ -139,7 +131,6 @@ public class AttachmentTypeSelector extends PopupWindow {
|
||||
animateButtonIn(locationButton, ANIMATION_DURATION / 4);
|
||||
animateButtonIn(documentButton, ANIMATION_DURATION / 4);
|
||||
animateButtonIn(webxdcButton, 0);
|
||||
animateButtonIn(videoChatButton, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -69,7 +69,6 @@ public class DcHelper {
|
||||
public static final String CONFIG_BCC_SELF = "bcc_self";
|
||||
public static final String CONFIG_SHOW_EMAILS = "show_emails";
|
||||
public static final String CONFIG_MEDIA_QUALITY = "media_quality";
|
||||
public static final String CONFIG_WEBRTC_INSTANCE = "webrtc_instance";
|
||||
public static final String CONFIG_PROXY_ENABLED = "proxy_enabled";
|
||||
public static final String CONFIG_PROXY_URL = "proxy_url";
|
||||
public static final String CONFIG_VERIFIED_ONE_ON_ONE_CHATS = "verified_one_on_one_chats";
|
||||
@@ -397,11 +396,6 @@ public class DcHelper {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isWebrtcConfigOk(DcContext dcContext) {
|
||||
String instance = dcContext.getConfig(DcHelper.CONFIG_WEBRTC_INSTANCE);
|
||||
return (instance != null && !instance.isEmpty());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static ThreadRecord getThreadRecord(Context context, DcLot summary, DcChat chat) { // adapted from ThreadDatabase.getCurrent()
|
||||
int chatId = chat.getId();
|
||||
|
||||
@@ -159,12 +159,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
submitDebugLog.setOnPreferenceClickListener(new ViewLogListener());
|
||||
}
|
||||
|
||||
Preference webrtcInstance = this.findPreference("pref_webrtc_instance");
|
||||
if (webrtcInstance != null) {
|
||||
webrtcInstance.setOnPreferenceClickListener(new WebrtcInstanceListener());
|
||||
}
|
||||
updateWebrtcSummary();
|
||||
|
||||
Preference webxdcStore = this.findPreference(Prefs.WEBXDC_STORE_URL_PREF);
|
||||
if (webxdcStore != null) {
|
||||
webxdcStore.setOnPreferenceClickListener(new WebxdcStoreUrlListener());
|
||||
@@ -331,29 +325,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
private class WebrtcInstanceListener implements Preference.OnPreferenceClickListener {
|
||||
@Override
|
||||
public boolean onPreferenceClick(@NonNull Preference preference) {
|
||||
View gl = View.inflate(requireActivity(), R.layout.single_line_input, null);
|
||||
EditText inputField = gl.findViewById(R.id.input_field);
|
||||
inputField.setHint(R.string.videochat_instance_placeholder);
|
||||
inputField.setText(dcContext.getConfig(DcHelper.CONFIG_WEBRTC_INSTANCE));
|
||||
inputField.setSelection(inputField.getText().length());
|
||||
inputField.setInputType(TYPE_TEXT_VARIATION_URI);
|
||||
new AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.videochat_instance)
|
||||
.setMessage(getString(R.string.videochat_instance_explain_2)+"\n\n"+getString(R.string.videochat_instance_example))
|
||||
.setView(gl)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
dcContext.setConfig(DcHelper.CONFIG_WEBRTC_INSTANCE, inputField.getText().toString());
|
||||
updateWebrtcSummary();
|
||||
})
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private class WebxdcStoreUrlListener implements Preference.OnPreferenceClickListener {
|
||||
@Override
|
||||
public boolean onPreferenceClick(@NonNull Preference preference) {
|
||||
@@ -377,14 +348,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWebrtcSummary() {
|
||||
Preference webrtcInstance = this.findPreference("pref_webrtc_instance");
|
||||
if (webrtcInstance != null) {
|
||||
webrtcInstance.setSummary(DcHelper.isWebrtcConfigOk(dcContext)?
|
||||
dcContext.getConfig(DcHelper.CONFIG_WEBRTC_INSTANCE) : getString(R.string.none));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWebxdcStoreSummary() {
|
||||
Preference preference = this.findPreference(Prefs.WEBXDC_STORE_URL_PREF);
|
||||
if (preference != null) {
|
||||
|
||||
@@ -18,23 +18,6 @@ import org.thoughtcrime.securesms.util.IntentUtils;
|
||||
|
||||
public class VideochatUtil {
|
||||
|
||||
public static void startMeeting(Activity activity, int chatId) {
|
||||
DcContext dcContext = DcHelper.getContext(activity);
|
||||
DcChat dcChat = dcContext.getChat(chatId);
|
||||
|
||||
new AlertDialog.Builder(activity)
|
||||
.setTitle(activity.getString(R.string.videochat_invite_user_to_videochat, dcChat.getName()))
|
||||
.setMessage(R.string.videochat_invite_user_hint)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
||||
int msgId = dcContext.sendVideochatInvitation(dcChat.getId());
|
||||
if (msgId != 0) {
|
||||
joinMeeting(activity, msgId);
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
public static void joinMeeting(Activity activity, int msgId) {
|
||||
DcContext dcContext = DcHelper.getContext(activity);
|
||||
DcMsg dcMsg = dcContext.getMsg(msgId);
|
||||
|
||||
Reference in New Issue
Block a user