Allow deeplinks back into Signal from iDEAL banking apps.
This commit is contained in:
parent
420e15c179
commit
f5d9fbe91c
3 changed files with 31 additions and 10 deletions
|
@ -594,6 +594,13 @@
|
|||
android:host="signal.group"/>
|
||||
</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">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
|
|
@ -17,8 +17,11 @@ import androidx.lifecycle.ViewModelProvider;
|
|||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
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.PromptBatterySaverDialogFragment;
|
||||
import org.thoughtcrime.securesms.components.settings.app.AppSettingsActivity;
|
||||
import org.thoughtcrime.securesms.components.voice.VoiceNoteMediaController;
|
||||
import org.thoughtcrime.securesms.components.voice.VoiceNoteMediaControllerOwner;
|
||||
import org.thoughtcrime.securesms.conversationlist.RelinkDevicesReminderBottomSheetFragment;
|
||||
|
@ -89,10 +92,7 @@ public class MainActivity extends PassphraseRequiredActivity implements VoiceNot
|
|||
ConversationListTabRepository repository = new ConversationListTabRepository();
|
||||
ConversationListTabsViewModel.Factory factory = new ConversationListTabsViewModel.Factory(repository);
|
||||
|
||||
handleGroupLinkInIntent(getIntent());
|
||||
handleProxyInIntent(getIntent());
|
||||
handleSignalMeIntent(getIntent());
|
||||
handleCallLinkInIntent(getIntent());
|
||||
handleDeeplinkIntent(getIntent());
|
||||
|
||||
CachedInflater.from(this).clear();
|
||||
|
||||
|
@ -134,10 +134,7 @@ public class MainActivity extends PassphraseRequiredActivity implements VoiceNot
|
|||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
handleGroupLinkInIntent(intent);
|
||||
handleProxyInIntent(intent);
|
||||
handleSignalMeIntent(intent);
|
||||
handleCallLinkInIntent(intent);
|
||||
handleDeeplinkIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -203,6 +200,14 @@ public class MainActivity extends PassphraseRequiredActivity implements VoiceNot
|
|||
return navigator;
|
||||
}
|
||||
|
||||
private void handleDeeplinkIntent(Intent intent) {
|
||||
handleGroupLinkInIntent(intent);
|
||||
handleProxyInIntent(intent);
|
||||
handleSignalMeIntent(intent);
|
||||
handleCallLinkInIntent(intent);
|
||||
handleDonateReturnIntent(intent);
|
||||
}
|
||||
|
||||
private void handleGroupLinkInIntent(Intent intent) {
|
||||
Uri data = intent.getData();
|
||||
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() {
|
||||
onFirstRender = true;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ class StripeApi(
|
|||
|
||||
const val RETURN_URL_SCHEME = "sgnlpay"
|
||||
private const val RETURN_URL_3DS = "$RETURN_URL_SCHEME://3DS"
|
||||
|
||||
const val RETURN_URL_IDEAL = "https://signaldonations.org/stripe/return/ideal"
|
||||
}
|
||||
|
||||
sealed class CreatePaymentIntentResult {
|
||||
|
@ -74,7 +76,7 @@ class StripeApi(
|
|||
val parameters = mutableMapOf(
|
||||
"client_secret" to setupIntent.intentClientSecret,
|
||||
"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) {
|
||||
|
@ -122,7 +124,7 @@ class StripeApi(
|
|||
val parameters = mutableMapOf(
|
||||
"client_secret" to paymentIntent.intentClientSecret,
|
||||
"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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue