generalize notification handling, open reports in browser

This commit is contained in:
sk
2023-06-03 22:47:20 +02:00
parent 7a6af89375
commit 37622ba9ce
3 changed files with 22 additions and 30 deletions

View File

@@ -1387,6 +1387,23 @@ public class UiUtils {
});
}
public static void showFragmentForNotification(Context context, Notification n, String accountID, Bundle extras) {
if (extras == null) extras = new Bundle();
extras.putString("account", accountID);
if (n.status!=null) {
Status status=n.status;
extras.putParcelable("status", Parcels.wrap(status));
Nav.go((Activity) context, ThreadFragment.class, extras);
} else if (n.report != null) {
String domain = AccountSessionManager.getInstance().getAccount(accountID).domain;
UiUtils.launchWebBrowser(context, "https://"+domain+"/admin/reports/"+n.report.id);
} else if (n.account != null) {
extras.putString("account", accountID);
extras.putParcelable("profileAccount", Parcels.wrap(n.account));
Nav.go((Activity) context, ProfileFragment.class, extras);
}
}
/**
* Wraps a View.OnClickListener to filter multiple clicks in succession.
* Useful for buttons that perform some action that changes their state asynchronously.