mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-10 07:54:25 +01:00
Allow deeplinks back into Signal from iDEAL banking apps.
This commit is contained in:
@@ -594,6 +594,13 @@
|
|||||||
android:host="signal.group"/>
|
android:host="signal.group"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="https" android:host="signaldonations.org" android:pathPrefix="/stripe/return/ideal"/>
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
<intent-filter android:autoVerify="true">
|
<intent-filter android:autoVerify="true">
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|||||||
@@ -17,8 +17,11 @@ import androidx.lifecycle.ViewModelProvider;
|
|||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
import org.signal.core.util.concurrent.LifecycleDisposable;
|
import org.signal.core.util.concurrent.LifecycleDisposable;
|
||||||
|
import org.signal.core.util.logging.Log;
|
||||||
|
import org.signal.donations.StripeApi;
|
||||||
import org.thoughtcrime.securesms.components.DebugLogsPromptDialogFragment;
|
import org.thoughtcrime.securesms.components.DebugLogsPromptDialogFragment;
|
||||||
import org.thoughtcrime.securesms.components.PromptBatterySaverDialogFragment;
|
import org.thoughtcrime.securesms.components.PromptBatterySaverDialogFragment;
|
||||||
|
import org.thoughtcrime.securesms.components.settings.app.AppSettingsActivity;
|
||||||
import org.thoughtcrime.securesms.components.voice.VoiceNoteMediaController;
|
import org.thoughtcrime.securesms.components.voice.VoiceNoteMediaController;
|
||||||
import org.thoughtcrime.securesms.components.voice.VoiceNoteMediaControllerOwner;
|
import org.thoughtcrime.securesms.components.voice.VoiceNoteMediaControllerOwner;
|
||||||
import org.thoughtcrime.securesms.conversationlist.RelinkDevicesReminderBottomSheetFragment;
|
import org.thoughtcrime.securesms.conversationlist.RelinkDevicesReminderBottomSheetFragment;
|
||||||
@@ -89,10 +92,7 @@ public class MainActivity extends PassphraseRequiredActivity implements VoiceNot
|
|||||||
ConversationListTabRepository repository = new ConversationListTabRepository();
|
ConversationListTabRepository repository = new ConversationListTabRepository();
|
||||||
ConversationListTabsViewModel.Factory factory = new ConversationListTabsViewModel.Factory(repository);
|
ConversationListTabsViewModel.Factory factory = new ConversationListTabsViewModel.Factory(repository);
|
||||||
|
|
||||||
handleGroupLinkInIntent(getIntent());
|
handleDeeplinkIntent(getIntent());
|
||||||
handleProxyInIntent(getIntent());
|
|
||||||
handleSignalMeIntent(getIntent());
|
|
||||||
handleCallLinkInIntent(getIntent());
|
|
||||||
|
|
||||||
CachedInflater.from(this).clear();
|
CachedInflater.from(this).clear();
|
||||||
|
|
||||||
@@ -134,10 +134,7 @@ public class MainActivity extends PassphraseRequiredActivity implements VoiceNot
|
|||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
handleGroupLinkInIntent(intent);
|
handleDeeplinkIntent(intent);
|
||||||
handleProxyInIntent(intent);
|
|
||||||
handleSignalMeIntent(intent);
|
|
||||||
handleCallLinkInIntent(intent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -203,6 +200,14 @@ public class MainActivity extends PassphraseRequiredActivity implements VoiceNot
|
|||||||
return navigator;
|
return navigator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleDeeplinkIntent(Intent intent) {
|
||||||
|
handleGroupLinkInIntent(intent);
|
||||||
|
handleProxyInIntent(intent);
|
||||||
|
handleSignalMeIntent(intent);
|
||||||
|
handleCallLinkInIntent(intent);
|
||||||
|
handleDonateReturnIntent(intent);
|
||||||
|
}
|
||||||
|
|
||||||
private void handleGroupLinkInIntent(Intent intent) {
|
private void handleGroupLinkInIntent(Intent intent) {
|
||||||
Uri data = intent.getData();
|
Uri data = intent.getData();
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
@@ -231,6 +236,13 @@ public class MainActivity extends PassphraseRequiredActivity implements VoiceNot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleDonateReturnIntent(Intent intent) {
|
||||||
|
Uri data = intent.getData();
|
||||||
|
if (data != null && data.toString().startsWith(StripeApi.RETURN_URL_IDEAL)) {
|
||||||
|
startActivity(AppSettingsActivity.manageSubscriptions(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onFirstRender() {
|
public void onFirstRender() {
|
||||||
onFirstRender = true;
|
onFirstRender = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ class StripeApi(
|
|||||||
|
|
||||||
const val RETURN_URL_SCHEME = "sgnlpay"
|
const val RETURN_URL_SCHEME = "sgnlpay"
|
||||||
private const val RETURN_URL_3DS = "$RETURN_URL_SCHEME://3DS"
|
private const val RETURN_URL_3DS = "$RETURN_URL_SCHEME://3DS"
|
||||||
|
|
||||||
|
const val RETURN_URL_IDEAL = "https://signaldonations.org/stripe/return/ideal"
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class CreatePaymentIntentResult {
|
sealed class CreatePaymentIntentResult {
|
||||||
@@ -74,7 +76,7 @@ class StripeApi(
|
|||||||
val parameters = mutableMapOf(
|
val parameters = mutableMapOf(
|
||||||
"client_secret" to setupIntent.intentClientSecret,
|
"client_secret" to setupIntent.intentClientSecret,
|
||||||
"payment_method" to paymentMethodId,
|
"payment_method" to paymentMethodId,
|
||||||
"return_url" to RETURN_URL_3DS
|
"return_url" to if (paymentSource is IDEALPaymentSource) RETURN_URL_IDEAL else RETURN_URL_3DS
|
||||||
)
|
)
|
||||||
|
|
||||||
if (paymentSource.type.isBankTransfer) {
|
if (paymentSource.type.isBankTransfer) {
|
||||||
@@ -122,7 +124,7 @@ class StripeApi(
|
|||||||
val parameters = mutableMapOf(
|
val parameters = mutableMapOf(
|
||||||
"client_secret" to paymentIntent.intentClientSecret,
|
"client_secret" to paymentIntent.intentClientSecret,
|
||||||
"payment_method" to paymentMethodId,
|
"payment_method" to paymentMethodId,
|
||||||
"return_url" to RETURN_URL_3DS
|
"return_url" to if (paymentSource is IDEALPaymentSource) RETURN_URL_IDEAL else RETURN_URL_3DS
|
||||||
)
|
)
|
||||||
|
|
||||||
if (paymentSource.type.isBankTransfer) {
|
if (paymentSource.type.isBankTransfer) {
|
||||||
|
|||||||
Reference in New Issue
Block a user