fix: 修复网页无法跳转

This commit is contained in:
HuanChengFly 2020-07-16 15:58:05 +08:00
parent d8323ba48b
commit 3f3b3f3f73
2 changed files with 13 additions and 8 deletions

View File

@ -171,8 +171,8 @@
-keep class cn.jzvd.*{*;} -keep class cn.jzvd.*{*;}
-keep class com.gyf.immersionbar.* {*;} -keep class com.gyf.immersionbar.* {*;}
-dontwarn com.gyf.immersionbar.** -dontwarn com.gyf.immersionbar.**
-keep class com.huanchengfly.tieba.post.models.** { *; } -keep class com.huanchengfly.tieba.post.models.** { *; }
-keep class com.huanchengfly.tieba.api.models.** { *; } -keep class com.huanchengfly.tieba.api.models.** { *; }

View File

@ -10,19 +10,16 @@ import com.huanchengfly.tieba.post.utils.NavigationHelper;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class JumpActivity extends AppCompatActivity { public class DispatchActivity extends AppCompatActivity {
public static final String ACTION_JUMP = "com.huanchengfly.tieba.post.ACTION_JUMP";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Uri uri = getIntent().getData(); Uri uri = getIntent().getData();
String action = getIntent().getAction();
NavigationHelper navigationHelper = NavigationHelper.newInstance(this); NavigationHelper navigationHelper = NavigationHelper.newInstance(this);
if (uri != null) { if (uri != null) {
String url = uri.toString(); String url = uri.toString();
Uri newUri = Uri.parse(url.replace("://tieba.baidu.com//", "://tieba.baidu.com/?")); Uri newUri = Uri.parse(url.replace("://tieba.baidu.com//", "://tieba.baidu.com/?"));
if (newUri.getScheme().equalsIgnoreCase("http") || newUri.getScheme().equalsIgnoreCase("https")) { if ("http".equalsIgnoreCase(newUri.getScheme()) || "https".equalsIgnoreCase(newUri.getScheme())) {
navigationHelper.navigationByData(NavigationHelper.ACTION_URL, newUri.toString()); navigationHelper.navigationByData(NavigationHelper.ACTION_URL, newUri.toString());
} else if (newUri.getScheme().equals("tbfrs")) { } else if (newUri.getScheme().equals("tbfrs")) {
navigationHelper.navigationByData(NavigationHelper.ACTION_FORUM, newUri.getQueryParameter("kw")); navigationHelper.navigationByData(NavigationHelper.ACTION_FORUM, newUri.getQueryParameter("kw"));
@ -30,8 +27,16 @@ public class JumpActivity extends AppCompatActivity {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("tid", newUri.getQueryParameter("tid")); map.put("tid", newUri.getQueryParameter("tid"));
navigationHelper.navigationByData(NavigationHelper.ACTION_THREAD, map); navigationHelper.navigationByData(NavigationHelper.ACTION_THREAD, map);
} else if (newUri.getScheme().equals("com.baidu.tieba") && "unidispatch".equals(newUri.getHost())) {
if ("/frs".equals(newUri.getPath())) {
navigationHelper.navigationByData(NavigationHelper.ACTION_FORUM, newUri.getQueryParameter("kw"));
} else if ("/pb".equals(newUri.getPath())) {
Map<String, String> map = new HashMap<>();
map.put("tid", newUri.getQueryParameter("tid"));
navigationHelper.navigationByData(NavigationHelper.ACTION_THREAD, map);
}
} }
} }
this.finish(); finish();
} }
} }