diff --git a/CHANGELOG.md b/CHANGELOG.md index fc2e3167d7..f2fb29d2f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. ## UNRELEASED ### Added ### Changed +* ui: Re-enable Giropay integration (#169) + ### Removed ### Fixed diff --git a/ui/src/main/AndroidManifest.xml b/ui/src/main/AndroidManifest.xml index 7f48104473..d5a889297f 100644 --- a/ui/src/main/AndroidManifest.xml +++ b/ui/src/main/AndroidManifest.xml @@ -8,6 +8,11 @@ + + + + + "); switch (url) { case SUCCESS_URL: @@ -216,6 +230,46 @@ public void error(Throwable t) { }); } + private boolean isGiropayAppLinkUrl(@Nullable final Uri uri, @Nullable Environment environment) { + if (uri != null && uri.getHost() != null) { + return uri.getHost().startsWith(getGiropayAppLinkUrlHost(environment)); + } + return false; + } + + @NonNull + private String getGiropayAppLinkUrlHost(@Nullable final Environment environment) { + if (environment == Environment.PRODUCTION) { + return "app.paydirekt.de"; + } else { + return "app.sandbox.paydirekt.de"; + } + } + + private boolean isGiropayAppAvailable( + @NonNull final Intent intent, + @NonNull final Context context, + @Nullable final Environment environment + ) { + final List intentInfo = context.getPackageManager().queryIntentActivities(intent, 0); + final String appPackageName = getGiropayAppPackage(environment); + for (final ResolveInfo info : intentInfo) { + if (info.activityInfo.packageName.contains(appPackageName)) { + return true; + } + } + return false; + } + + @NonNull + private String getGiropayAppPackage(final @Nullable Environment environment) { + if (environment == Environment.PRODUCTION) { + return "com.gimb.paydirekt.app"; + } else { + return "com.gimb.paydirekt.app.sandbox"; + } + } + private void authenticateAndSave() { Keyguard.unlock(UIUtils.getHostFragmentActivity(getContext()), new Keyguard.Callback() { @Override