1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-12-22 10:58:01 +01:00

Load README when ow pod URL gets called and no pod selected , fixes #193

This commit is contained in:
Gregor Santner 2018-04-08 18:05:56 +02:00
parent 51093e0c3d
commit 68be2f3a4a
No known key found for this signature in database
GPG key ID: 7E83A7834AECB009
2 changed files with 17 additions and 8 deletions

View file

@ -333,19 +333,26 @@ public class MainActivity extends ThemedActivity
*/
public void openDiasporaUrl(final String url) {
AppLog.v(this, "openDiasporaUrl()");
if (url.startsWith(_appSettings.getPod().getPodUrl().getBaseUrl()) && !url.startsWith("https://dia.so/")) {
if (url != null && url.startsWith("http://127.0.0.1")) {
// This URL seems to be called somehow, but it doesn't make sense ;)
toolbarTop.postDelayed(() -> {
Intent i = new Intent(ACTION_OPEN_EXTERNAL_URL);
i.putExtra(EXTRA_URL, "https://github.com/Diaspora-for-Android/dandelion/blob/master/README.md");
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i);
}, 1000);
return;
}
if (_appSettings.getPod() != null && _appSettings.getPod().getPodUrl() != null && _appSettings.getPod().getPodUrl().getBaseUrl() != null
&& url.startsWith(_appSettings.getPod().getPodUrl().getBaseUrl()) && !url.startsWith("https://dia.so/")) {
DiasporaStreamFragment streamFragment = (DiasporaStreamFragment) getFragment(DiasporaStreamFragment.TAG);
showFragment(streamFragment);
showLastVisitedTimestampMessageIfNeeded(url);
streamFragment.loadUrl(url);
} else {
toolbarTop.postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(ACTION_OPEN_EXTERNAL_URL);
i.putExtra(EXTRA_URL, url);
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i);
}
toolbarTop.postDelayed(() -> {
Intent i = new Intent(ACTION_OPEN_EXTERNAL_URL);
i.putExtra(EXTRA_URL, url);
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i);
}, 1000);
}
}

View file

@ -108,6 +108,8 @@ public class CustomTabsHelper {
sPackageNameToUse = CHROMIUM;
} else if (packagesSupportingCustomTabs.contains(FENNEC)) {
sPackageNameToUse = FENNEC;
}else if (packagesSupportingCustomTabs.contains(KLAR)) {
sPackageNameToUse = KLAR;
}
return sPackageNameToUse;
}