diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java index edda9537..d3a74098 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java +++ b/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(); diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java index e504596d..3b2845ef 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java +++ b/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