Browse Source

Board bookmarks hotfix

pull/61/merge
Ezerous 6 years ago
parent
commit
2cf704b693
No known key found for this signature in database GPG Key ID: 262B2954BBA319E3
  1. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
  2. 10
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

6
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java

@ -10,7 +10,6 @@ import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.Toast;
@ -94,7 +93,7 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
thisPageBookmark = new Bookmark(boardTitle, "b" + ThmmyPage.getBoardId(boardUrl), true);
thisPageBookmark = new Bookmark(boardTitle, ThmmyPage.getBoardId(boardUrl), true);
setBoardBookmark(findViewById(R.id.bookmark));
createDrawer();
@ -318,7 +317,8 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
|| !Objects.equals(boardTitle, parsedTitle)) {
boardTitle = parsedTitle;
toolbar.setTitle(boardTitle);
thisPageBookmark = new Bookmark(boardTitle, "b" + ThmmyPage.getBoardId(boardUrl), true);
thisPageBookmark = new Bookmark(boardTitle, ThmmyPage.getBoardId(boardUrl), true);
setBoardBookmark(findViewById(R.id.bookmark));
}
parsedTopics.clear();

10
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -575,10 +575,10 @@ public abstract class BaseActivity extends AppCompatActivity {
if (boardsBookmarked == null) return;
if (bookmark.matchExists(boardsBookmarked)) {
boardsBookmarked.remove(bookmark.findIndex(boardsBookmarked));
FirebaseMessaging.getInstance().unsubscribeFromTopic(bookmark.getId());
FirebaseMessaging.getInstance().unsubscribeFromTopic("b" + bookmark.getId());
} else {
boardsBookmarked.add(new Bookmark(bookmark.getTitle(), bookmark.getId(), false));
FirebaseMessaging.getInstance().subscribeToTopic(bookmark.getId());
boardsBookmarked.add(new Bookmark(bookmark.getTitle(), bookmark.getId(), true));
FirebaseMessaging.getInstance().subscribeToTopic("b" + bookmark.getId());
}
updateBoardBookmarks();
}
@ -630,9 +630,9 @@ public abstract class BaseActivity extends AppCompatActivity {
updateBoardBookmarks();
if (boardsBookmarked.get(bookmark.findIndex(boardsBookmarked)).isNotificationsEnabled())
FirebaseMessaging.getInstance().subscribeToTopic(bookmark.getId());
FirebaseMessaging.getInstance().subscribeToTopic("b" + bookmark.getId());
else
FirebaseMessaging.getInstance().unsubscribeFromTopic(bookmark.getId());
FirebaseMessaging.getInstance().unsubscribeFromTopic("b" + bookmark.getId());
return boardsBookmarked.get(bookmark.findIndex(boardsBookmarked)).isNotificationsEnabled();
} else

Loading…
Cancel
Save