aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-03-25 16:18:57 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-03-25 16:18:57 +0000
commita615b2d20e1537a51a68ac99cdef66de6c73ed00 (patch)
tree0250e5562b7dea28a9ea2d727ad40a63ab016c63 /app
parent12036d05e27a2b9af25dc1de1a0a06bc3123a0a5 (diff)
downloadinfinity-for-reddit-a615b2d20e1537a51a68ac99cdef66de6c73ed00.tar
infinity-for-reddit-a615b2d20e1537a51a68ac99cdef66de6c73ed00.tar.gz
infinity-for-reddit-a615b2d20e1537a51a68ac99cdef66de6c73ed00.tar.bz2
infinity-for-reddit-a615b2d20e1537a51a68ac99cdef66de6c73ed00.tar.lz
infinity-for-reddit-a615b2d20e1537a51a68ac99cdef66de6c73ed00.tar.xz
infinity-for-reddit-a615b2d20e1537a51a68ac99cdef66de6c73ed00.tar.zst
infinity-for-reddit-a615b2d20e1537a51a68ac99cdef66de6c73ed00.zip
Fix post link parsing in LinkResolverActivity.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java12
-rw-r--r--app/src/main/res/xml/interface_preferences.xml3
2 files changed, 8 insertions, 7 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
index 0ba911c8..dc0e21ad 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
@@ -7,6 +7,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
+import android.util.Log;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
@@ -31,13 +32,13 @@ public class LinkResolverActivity extends AppCompatActivity {
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
public static final String EXTRA_IS_NSFW = "EIN";
- private static final String POST_PATTERN = "/r/\\w+/comments/\\w+/?\\w+/?";
- private static final String POST_PATTERN_2 = "/(u|U|user)/\\w+/comments/\\w+/?\\w+/?";
- private static final String COMMENT_PATTERN = "/(r|u|U|user)/\\w+/comments/\\w+/?\\w+/\\w+/?";
+ private static final String POST_PATTERN = "/r/[\\w-]+/comments/\\w+/?\\w+/?";
+ private static final String POST_PATTERN_2 = "/(u|U|user)/[\\w-]+/comments/\\w+/?\\w+/?";
+ private static final String COMMENT_PATTERN = "/(r|u|U|user)/[\\w-]+/comments/\\w+/?\\w+/\\w+/?";
private static final String SUBREDDIT_PATTERN = "/[rR]/[\\w-]+/?";
private static final String USER_PATTERN = "/(u|U|user)/[\\w-]+/?";
- private static final String SIDEBAR_PATTERN = "/[rR]/\\w+/about/sidebar";
- private static final String MULTIREDDIT_PATTERN = "/user/\\w+/m/\\w+/?";
+ private static final String SIDEBAR_PATTERN = "/[rR]/[\\w-]+/about/sidebar";
+ private static final String MULTIREDDIT_PATTERN = "/user/[\\w-]+/m/\\w+/?";
private static final String MULTIREDDIT_PATTERN_2 = "/[rR]/(\\w+\\+?)+/?";
private static final String REDD_IT_POST_PATTERN = "/\\w+/?";
private static final String GFYCAT_PATTERN = "(/ifr)?/[\\w-]+$";
@@ -245,6 +246,7 @@ public class LinkResolverActivity extends AppCompatActivity {
}
private void deepLinkError(Uri uri) {
+ Log.i("ASDASFD", "s " + uri.toString());
PackageManager pm = getPackageManager();
String authority = uri.getAuthority();
diff --git a/app/src/main/res/xml/interface_preferences.xml b/app/src/main/res/xml/interface_preferences.xml
index a834ac10..201b13cd 100644
--- a/app/src/main/res/xml/interface_preferences.xml
+++ b/app/src/main/res/xml/interface_preferences.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<Preference
app:title="@string/settings_font_title"