Added support for itpc-protocol. closes #333

This commit is contained in:
daniel oeh 2014-06-15 21:22:36 +02:00
parent a275786640
commit 859eabb7a3
3 changed files with 10 additions and 0 deletions

View File

@ -294,6 +294,7 @@
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="itpc"/>
<data android:scheme="pcast"/>
<data android:scheme="feed"/>
</intent-filter>

View File

@ -33,6 +33,9 @@ public final class URLChecker {
} else if (url.startsWith("pcast://")) {
if (BuildConfig.DEBUG) Log.d(TAG, "Replacing pcast:// with http://");
url = url.replaceFirst("pcast://", "http://");
} else if (url.startsWith("itpc")) {
if (BuildConfig.DEBUG) Log.d(TAG, "Replacing itpc:// with http://");
url = url.replaceFirst("itpc://", "http://");
} else if (!(url.startsWith("http://") || url.startsWith("https://"))) {
if (BuildConfig.DEBUG) Log.d(TAG, "Adding http:// at the beginning of the URL");
builder.append("http://");

View File

@ -37,4 +37,10 @@ public class URLCheckerTest extends AndroidTestCase {
final String out = URLChecker.prepareURL(in);
assertEquals("http://example.com", out);
}
public void testItcpProtocol() {
final String in = "itpc://example.com";
final String out = URLChecker.prepareURL(in);
assertEquals("http://example.com", out);
}
}