url rewrite for swiss
This commit is contained in:
parent
1b220edf16
commit
cc8bac8fab
2 changed files with 41 additions and 2 deletions
|
@ -570,6 +570,29 @@
|
|||
android:pathPattern="/icheckin2/mbp.do.*"
|
||||
android:scheme="https" />
|
||||
</intent-filter>
|
||||
<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:host="mbp.swiss.com"
|
||||
android:pathPattern="/mobiqa/wap/.*"
|
||||
android:scheme="http" />
|
||||
</intent-filter>
|
||||
<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:host="mbp.swiss.com"
|
||||
android:pathPattern="/mobiqa/wap/.*"
|
||||
android:scheme="https" />
|
||||
</intent-filter>
|
||||
|
||||
|
||||
</activity>
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ public class URLRewriteActivity extends Activity {
|
|||
url = getVirginAustraliaURL();
|
||||
} else if (getIntent().getData().getHost().equals("www.cathaypacific.com")) {
|
||||
url = getCathay();
|
||||
} else if (getIntent().getData().getHost().equals("mbp.swiss.com")) {
|
||||
url = getSwiss();
|
||||
}
|
||||
|
||||
if (url == null) {
|
||||
|
@ -46,7 +48,7 @@ public class URLRewriteActivity extends Activity {
|
|||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, "PassAndroid: URLRewrite Problem");
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"ligi@ligi.de"});
|
||||
intent.putExtra(Intent.EXTRA_TEXT, "foo"+getIntent().getData());
|
||||
intent.putExtra(Intent.EXTRA_TEXT, "foo" + getIntent().getData());
|
||||
intent.setType("text/plain");
|
||||
|
||||
startActivity(Intent.createChooser(intent, "How to send Link?"));
|
||||
|
@ -68,7 +70,6 @@ public class URLRewriteActivity extends Activity {
|
|||
final Intent intent = new Intent(this, PassImportActivity.class);
|
||||
intent.setData(Uri.parse(url));
|
||||
startActivity(intent);
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
|
@ -100,4 +101,19 @@ public class URLRewriteActivity extends Activity {
|
|||
return "https://www.cathaypacific.com/icheckin2/PassbookServlet?v=" + URLEncoder.encode(passId);
|
||||
}
|
||||
|
||||
public String getSwiss() {
|
||||
String url = getIntent().getData().toString();
|
||||
if (url.endsWith("/")) {
|
||||
url = url.substring(0, url.length() - 1);
|
||||
|
||||
}
|
||||
|
||||
final String[] split = url.split("/");
|
||||
|
||||
if (split.length < 6) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return "http://prod.wap.ncrwebhost.mobi/mobiqa/wap/" + split[split.length - 2] + "/" + split[split.length - 1] + "/passbook";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue