mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-01-07 00:20:08 +02:00
Fix #669 - Improve regex
This commit is contained in:
parent
fbf7577ef7
commit
9dc1b881e3
1 changed files with 20 additions and 12 deletions
|
@ -1118,8 +1118,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
}
|
}
|
||||||
//Here we know that the intent contains a valid URL
|
//Here we know that the intent contains a valid URL
|
||||||
if (!url.contains("medium.com")) {
|
if (!url.contains("medium.com")) {
|
||||||
Pattern link = Pattern.compile("https?://([\\da-z.-]+\\.[a-z.]{2,10})/(@[\\w._-]*[0-9]*)(/[0-9]+)?$");
|
Pattern link = Pattern.compile("https?://([\\da-z.-]+[à-ü]?\\.[a-z.]{2,10})/(@[\\w._-]*[0-9]*)(/[0-9]+)?$");
|
||||||
Matcher matcherLink = null;
|
Matcher matcherLink;
|
||||||
matcherLink = link.matcher(url);
|
matcherLink = link.matcher(url);
|
||||||
if (matcherLink.find()) {
|
if (matcherLink.find()) {
|
||||||
if (currentAccount == null) {
|
if (currentAccount == null) {
|
||||||
|
@ -1137,10 +1137,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
CrossActionHelper.fetchRemoteStatus(BaseMainActivity.this, currentAccount, url, new CrossActionHelper.Callback() {
|
CrossActionHelper.fetchRemoteStatus(BaseMainActivity.this, currentAccount, url, new CrossActionHelper.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void federatedStatus(Status status) {
|
public void federatedStatus(Status status) {
|
||||||
Intent intent = new Intent(BaseMainActivity.this, ContextActivity.class);
|
if (status != null) {
|
||||||
intent.putExtra(Helper.ARG_STATUS, status);
|
Intent intent = new Intent(BaseMainActivity.this, ContextActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.putExtra(Helper.ARG_STATUS, status);
|
||||||
startActivity(intent);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
} else {
|
||||||
|
Toasty.error(BaseMainActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1155,12 +1159,16 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void federatedAccount(app.fedilab.android.client.entities.api.Account account) {
|
public void federatedAccount(app.fedilab.android.client.entities.api.Account account) {
|
||||||
Intent intent = new Intent(BaseMainActivity.this, ProfileActivity.class);
|
if (account != null) {
|
||||||
Bundle b = new Bundle();
|
Intent intent = new Intent(BaseMainActivity.this, ProfileActivity.class);
|
||||||
b.putSerializable(Helper.ARG_ACCOUNT, account);
|
Bundle b = new Bundle();
|
||||||
intent.putExtras(b);
|
b.putSerializable(Helper.ARG_ACCOUNT, account);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.putExtras(b);
|
||||||
startActivity(intent);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
} else {
|
||||||
|
Toasty.error(BaseMainActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue