mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-29 04:17:12 +01:00
Merge pull request #469 from andrewrasch/link-handling-fixes
Update link handling for amp and v.redd.it
This commit is contained in:
commit
cf9829046a
@ -272,70 +272,100 @@
|
||||
|
||||
<data
|
||||
android:host="www.reddit.com"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*"/>
|
||||
<data
|
||||
android:host="reddit.com"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*" />
|
||||
<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"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="amp.reddit.com"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="m.reddit.com"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="old.reddit.com"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="new.reddit.com"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="np.reddit.com"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="reddit.app.link"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="redd.it"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="s.reddit.com"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="click.redditmail.com"
|
||||
android:scheme="https" />
|
||||
android:scheme="https"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="www.reddit.com"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="reddit.com"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="amp.reddit.com"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="m.reddit.com"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="old.reddit.com"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="new.reddit.com"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="np.reddit.com"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="reddit.app.link"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="redd.it"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="s.reddit.com"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
<data
|
||||
android:host="click.redditmail.com"
|
||||
android:scheme="http" />
|
||||
android:scheme="http"
|
||||
android:pathPattern=".*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
|
@ -50,6 +50,7 @@ public class LinkResolverActivity extends AppCompatActivity {
|
||||
private static final String IMGUR_IMAGE_PATTERN = "/\\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 GOOGLE_AMP_PATTERN = "/amp/s/amp.reddit.com/.*";
|
||||
|
||||
@Inject
|
||||
@Named("default")
|
||||
@ -268,6 +269,13 @@ public class LinkResolverActivity extends AppCompatActivity {
|
||||
} else {
|
||||
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 {
|
||||
deepLinkError(uri);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user