Skip to content

Commit

Permalink
Fix marking notifications as read
Browse files Browse the repository at this point in the history
  • Loading branch information
Fs00 authored and maniac103 committed Jul 15, 2022
1 parent 1827929 commit dabf46e
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions app/src/main/java/com/gh4a/fragment/NotificationListFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.gh4a.activities.RepositoryActivity;
import com.gh4a.adapter.NotificationAdapter;
import com.gh4a.adapter.RootAdapter;
import com.gh4a.resolver.LinkParser;
import com.gh4a.worker.NotificationsWorker;
import com.gh4a.model.NotificationHolder;
import com.gh4a.resolver.BrowseFilter;
Expand Down Expand Up @@ -138,26 +137,15 @@ public void onItemClick(NotificationHolder item) {
String url = subject.url();
if (url != null) {
Uri uri = ApiHelpers.normalizeUri(Uri.parse(url));
IntentUtils.InitialCommentMarker initialComment =
new IntentUtils.InitialCommentMarker(item.notification.lastReadAt());
LinkParser.ParseResult result = LinkParser.parseUri(getActivity(), uri, initialComment);
if (result != null && result.intent != null) {
intent = result.intent;
} else {
// We either can't handle the URL ourselves or need to resolve it
// asynchronously. Pass it to the BrowseFilter for resolving or redirection
intent = BrowseFilter.makeRedirectionIntent(getActivity(), uri, initialComment);
// Only auto-mark the notification as read if we can handle the URL ourselves
if (result != null) {
markAsRead(null, item.notification);
}
}
intent = BrowseFilter.makeRedirectionIntent(getActivity(), uri,
new IntentUtils.InitialCommentMarker(item.notification.lastReadAt()));
} else {
intent = null;
}
}

if (intent != null) {
markAsRead(null, item.notification);
startActivity(intent);
}
}
Expand Down

0 comments on commit dabf46e

Please sign in to comment.