create video call mimetype for raw contacts links

This commit is contained in:
Ehren Kret
2024-05-15 09:21:59 -05:00
committed by Nicholas Tinsley
parent c4e4eaf110
commit 757c0fd2ea
7 changed files with 49 additions and 16 deletions

View File

@@ -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
)
}
}
}

View File

@@ -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);