Support URLRewrite for pass-cloud.appspot.com

to get a good UX regarding #61
This commit is contained in:
ligi 2016-05-06 00:48:38 +02:00
parent 6e37ffb674
commit b4088884d6
3 changed files with 24 additions and 0 deletions

View file

@ -1069,6 +1069,18 @@
<activity android:name=".ui.quirk_fix.URLRewriteActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:scheme="http"
android:host="pass-cloud.appspot.com"
/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>

View file

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

View file

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