Update link handling for amp and v.redd.it

Added manifest entries for google.com amp links (reddit only) and v.redd.it. Updated handling of google amp links in LinkResolverActivity.
This commit is contained in:
andrewrasch 2021-09-21 22:10:38 -04:00
parent d6c3bfddd7
commit 1fb3ba6e3f
2 changed files with 15 additions and 0 deletions

View File

@ -276,6 +276,13 @@
<data <data
android:host="reddit.com" android:host="reddit.com"
android:scheme="https" /> android:scheme="https" />
<data
android:host="www.google.com"
android:scheme="https"
android:pathPattern="/amp/s/amp.reddit.com/.*"/>
<data
android:host="v.redd.it"
android:scheme="https" />
<data <data
android:host="amp.reddit.com" android:host="amp.reddit.com"
android:scheme="https" /> android:scheme="https" />

View File

@ -50,6 +50,7 @@ public class LinkResolverActivity extends AppCompatActivity {
private static final String IMGUR_IMAGE_PATTERN = "/\\w+/?"; private static final String IMGUR_IMAGE_PATTERN = "/\\w+/?";
private static final String RPAN_BROADCAST_PATTERN = "/rpan/r/[\\w-]+/\\w+/?\\w+/?"; private static final String RPAN_BROADCAST_PATTERN = "/rpan/r/[\\w-]+/\\w+/?\\w+/?";
private static final String WIKI_PATTERN = "/[rR]/[\\w-]+/(wiki|w)/?\\w+"; private static final String WIKI_PATTERN = "/[rR]/[\\w-]+/(wiki|w)/?\\w+";
private static final String GOOGLE_AMP_PATTERN = "/amp/s/amp.reddit.com/.*";
@Inject @Inject
@Named("default") @Named("default")
@ -266,6 +267,13 @@ public class LinkResolverActivity extends AppCompatActivity {
} else { } else {
deepLinkError(uri); deepLinkError(uri);
} }
} else if (authority.contains("google.com") ){
if ( path.matches(GOOGLE_AMP_PATTERN) ) {
String url = path.substring(11, path.length()); // skipping past amp straight to reddit
handleUri(Uri.parse("https://" + url));
} else {
deepLinkError(uri);
}
} else { } else {
deepLinkError(uri); deepLinkError(uri);
} }