|
@ -19,6 +19,7 @@ import android.view.View; |
|
|
import android.widget.ImageButton; |
|
|
import android.widget.ImageButton; |
|
|
import android.widget.Toast; |
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
|
|
|
|
import com.google.firebase.messaging.FirebaseMessaging; |
|
|
import com.mikepenz.fontawesome_typeface_library.FontAwesome; |
|
|
import com.mikepenz.fontawesome_typeface_library.FontAwesome; |
|
|
import com.mikepenz.google_material_typeface_library.GoogleMaterial; |
|
|
import com.mikepenz.google_material_typeface_library.GoogleMaterial; |
|
|
import com.mikepenz.iconics.IconicsDrawable; |
|
|
import com.mikepenz.iconics.IconicsDrawable; |
|
@ -522,8 +523,10 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
if (topicsBookmarked == null) return; |
|
|
if (topicsBookmarked == null) return; |
|
|
if (bookmark.matchExists(topicsBookmarked)) { |
|
|
if (bookmark.matchExists(topicsBookmarked)) { |
|
|
topicsBookmarked.remove(bookmark.findIndex(topicsBookmarked)); |
|
|
topicsBookmarked.remove(bookmark.findIndex(topicsBookmarked)); |
|
|
|
|
|
FirebaseMessaging.getInstance().unsubscribeFromTopic(bookmark.getId()); |
|
|
} else { |
|
|
} else { |
|
|
topicsBookmarked.add(new Bookmark(bookmark.getTitle(), bookmark.getId(), true)); |
|
|
topicsBookmarked.add(new Bookmark(bookmark.getTitle(), bookmark.getId(), true)); |
|
|
|
|
|
FirebaseMessaging.getInstance().subscribeToTopic(bookmark.getId()); |
|
|
} |
|
|
} |
|
|
updateTopicBookmarks(); |
|
|
updateTopicBookmarks(); |
|
|
} |
|
|
} |
|
@ -552,7 +555,11 @@ public abstract class BaseActivity extends AppCompatActivity { |
|
|
topicsBookmarked.get(bookmark.findIndex(topicsBookmarked)).toggleNotificationsEnabled(); |
|
|
topicsBookmarked.get(bookmark.findIndex(topicsBookmarked)).toggleNotificationsEnabled(); |
|
|
updateTopicBookmarks(); |
|
|
updateTopicBookmarks(); |
|
|
|
|
|
|
|
|
//TODO toggle firebase here!
|
|
|
if (topicsBookmarked.get(bookmark.findIndex(topicsBookmarked)).isNotificationsEnabled()){ |
|
|
|
|
|
FirebaseMessaging.getInstance().subscribeToTopic(bookmark.getId()); |
|
|
|
|
|
} else { |
|
|
|
|
|
FirebaseMessaging.getInstance().unsubscribeFromTopic(bookmark.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return topicsBookmarked.get(bookmark.findIndex(topicsBookmarked)).isNotificationsEnabled(); |
|
|
return topicsBookmarked.get(bookmark.findIndex(topicsBookmarked)).isNotificationsEnabled(); |
|
|
} |
|
|
} |
|
|