From b4088884d6d77af04555eb286030c7f4e79dd649 Mon Sep 17 00:00:00 2001 From: ligi Date: Fri, 6 May 2016 00:48:38 +0200 Subject: [PATCH] Support URLRewrite for pass-cloud.appspot.com to get a good UX regarding #61 --- android/src/main/AndroidManifest.xml | 12 ++++++++++++ .../ui/quirk_fix/URLRewriteController.java | 4 ++++ .../unittest/TheURLRewriteController.java | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index eb5f03a1..5b71423b 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1069,6 +1069,18 @@ + + + + + + + + + diff --git a/android/src/main/java/org/ligi/passandroid/ui/quirk_fix/URLRewriteController.java b/android/src/main/java/org/ligi/passandroid/ui/quirk_fix/URLRewriteController.java index 351f7c97..669c6537 100644 --- a/android/src/main/java/org/ligi/passandroid/ui/quirk_fix/URLRewriteController.java +++ b/android/src/main/java/org/ligi/passandroid/ui/quirk_fix/URLRewriteController.java @@ -24,6 +24,10 @@ public class URLRewriteController { } if (uri.getHost()!=null) { + if (uri.getHost().equals("pass-cloud.appspot.com")) { + return uri.getQueryParameter("url"); + } + if (uri.getHost().endsWith(".virginaustralia.com")) { // mobile. or checkin. return getVirginAustraliaURL(uri); } diff --git a/android/src/test/java/org/ligi/passandroid/unittest/TheURLRewriteController.java b/android/src/test/java/org/ligi/passandroid/unittest/TheURLRewriteController.java index de9abf9f..fd4f7d34 100644 --- a/android/src/test/java/org/ligi/passandroid/unittest/TheURLRewriteController.java +++ b/android/src/test/java/org/ligi/passandroid/unittest/TheURLRewriteController.java @@ -11,6 +11,14 @@ public class TheURLRewriteController { private URLRewriteController tested = new URLRewriteController(mock(Tracker.class)); + + @Test + public void testAppspotRewrite() { + final String res = tested.getUrlByUri(Uri.parse("http://pass-cloud.appspot.com/open_or_install?url=http://espass.it/assets/download/pass/movie.espass")); + + assertThat(res).isEqualTo("http://espass.it/assets/download/pass/movie.espass"); + } + @Test public void testPass2URewrite() { final String res = tested.getUrlByUri(Uri.parse("pass2u://import/https://api.passdock.com/passes/17969/e5dfb0afff61b1294235918a6a9ac75255daa89f.pkpass"));