mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
create video call mimetype for raw contacts links
This commit is contained in:
committed by
Nicholas Tinsley
parent
c4e4eaf110
commit
757c0fd2ea
@@ -86,19 +86,6 @@ class SyncSystemContactLinksJob private constructor(parameters: Parameters) : Ba
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildContactLinkConfiguration(context: Context, account: Account): ContactLinkConfiguration {
|
||||
return ContactLinkConfiguration(
|
||||
account = account,
|
||||
appName = context.getString(R.string.app_name),
|
||||
messagePrompt = { e164 -> context.getString(R.string.ContactsDatabase_message_s, e164) },
|
||||
callPrompt = { e164 -> context.getString(R.string.ContactsDatabase_signal_call_s, e164) },
|
||||
e164Formatter = { number -> PhoneNumberFormatter.get(context).format(number) },
|
||||
messageMimetype = MESSAGE_MIMETYPE,
|
||||
callMimetype = CALL_MIMETYPE,
|
||||
syncTag = CONTACT_TAG
|
||||
)
|
||||
}
|
||||
|
||||
class Factory : Job.Factory<SyncSystemContactLinksJob> {
|
||||
override fun create(parameters: Parameters, serializedData: ByteArray?) = SyncSystemContactLinksJob(parameters)
|
||||
}
|
||||
@@ -110,6 +97,22 @@ class SyncSystemContactLinksJob private constructor(parameters: Parameters) : Ba
|
||||
|
||||
private const val MESSAGE_MIMETYPE = "vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.contact"
|
||||
private const val CALL_MIMETYPE = "vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.call"
|
||||
private const val VIDEO_CALL_MIMETYPE = "vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.videocall"
|
||||
private const val CONTACT_TAG = "__TS"
|
||||
|
||||
fun buildContactLinkConfiguration(context: Context, account: Account): ContactLinkConfiguration {
|
||||
return ContactLinkConfiguration(
|
||||
account = account,
|
||||
appName = context.getString(R.string.app_name),
|
||||
messagePrompt = { e164 -> context.getString(R.string.ContactsDatabase_message_s, e164) },
|
||||
callPrompt = { e164 -> context.getString(R.string.ContactsDatabase_signal_call_s, e164) },
|
||||
videoCallPrompt = { e164 -> context.getString(R.string.ContactsDatabase_signal_video_call_s, e164) },
|
||||
e164Formatter = { number -> PhoneNumberFormatter.get(context).format(number) },
|
||||
messageMimetype = MESSAGE_MIMETYPE,
|
||||
callMimetype = CALL_MIMETYPE,
|
||||
videoCallMimetype = VIDEO_CALL_MIMETYPE,
|
||||
syncTag = CONTACT_TAG
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ import org.signal.core.util.concurrent.SimpleTask;
|
||||
public class VoiceCallShare extends Activity {
|
||||
|
||||
private static final String TAG = Log.tag(VoiceCallShare.class);
|
||||
|
||||
private static final String VIDEO_CALL_MIME_TYPE = "vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.videocall";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -32,7 +34,11 @@ public class VoiceCallShare extends Activity {
|
||||
|
||||
SimpleTask.run(() -> Recipient.external(this, destination), recipient -> {
|
||||
if (!TextUtils.isEmpty(destination)) {
|
||||
ApplicationDependencies.getSignalCallManager().startOutgoingAudioCall(recipient);
|
||||
if (VIDEO_CALL_MIME_TYPE.equals(getIntent().getType())) {
|
||||
ApplicationDependencies.getSignalCallManager().startOutgoingVideoCall(recipient);
|
||||
} else {
|
||||
ApplicationDependencies.getSignalCallManager().startOutgoingAudioCall(recipient);
|
||||
}
|
||||
|
||||
Intent activityIntent = new Intent(this, WebRtcCallActivity.class);
|
||||
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
Reference in New Issue
Block a user