diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/model/tab/impl/TrendsTabConfiguration.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/model/tab/impl/TrendsTabConfiguration.kt index 2812b8f8d..5dddcd260 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/model/tab/impl/TrendsTabConfiguration.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/model/tab/impl/TrendsTabConfiguration.kt @@ -21,9 +21,11 @@ package org.mariotaku.twidere.model.tab.impl import android.content.Context import org.mariotaku.twidere.R +import org.mariotaku.twidere.annotation.AccountType import org.mariotaku.twidere.annotation.TabAccountFlags import org.mariotaku.twidere.constant.IntentConstants.EXTRA_PLACE import org.mariotaku.twidere.fragment.TrendsSuggestionsFragment +import org.mariotaku.twidere.model.AccountDetails import org.mariotaku.twidere.model.Tab import org.mariotaku.twidere.model.tab.DrawableHolder import org.mariotaku.twidere.model.tab.StringHolder @@ -84,4 +86,10 @@ class TrendsTabConfiguration : TabConfiguration() { } return true } + + override fun checkAccountAvailability(details: AccountDetails) = when (details.type) { + AccountType.FANFOU, AccountType.TWITTER -> true + else -> false + } + } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/util/ContentNotificationManager.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/util/ContentNotificationManager.kt index 45865bef6..97dd1884b 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/util/ContentNotificationManager.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/util/ContentNotificationManager.kt @@ -191,7 +191,6 @@ class ContentNotificationManager( style.setSummaryText(accountName) val ci = ObjectCursor.indicesFrom(c, ParcelableActivity::class.java) - var timestamp = -1L var newMaxPositionKey = -1L val filteredUserKeys = DataStoreUtils.getFilteredUserKeys(context) var consumed = 0 @@ -214,11 +213,6 @@ class ContentNotificationManager( if (sources.isEmpty()) return@forEachRow false - - if (timestamp == -1L) { - timestamp = activity.timestamp - } - val message = ActivityTitleSummaryMessage.get(context, userColorNameManager, activity, sources, 0, useStarForLikes, nameFirst) ?: return@forEachRow false val summary = message.summary @@ -250,13 +244,9 @@ class ContentNotificationManager( style.setBigContentTitle(title) builder.setNumber(displayCount) builder.setContentIntent(getContentIntent(context, CustomTabType.NOTIFICATIONS_TIMELINE, - NotificationType.INTERACTIONS, accountKey, timestamp)) + NotificationType.INTERACTIONS, accountKey, newMaxPositionKey)) builder.setDeleteIntent(getMarkReadDeleteIntent(context, NotificationType.INTERACTIONS, accountKey, newMaxPositionKey, false)) - if (timestamp != -1L) { - builder.setDeleteIntent(getMarkReadDeleteIntent(context, - NotificationType.INTERACTIONS, accountKey, timestamp, false)) - } } catch (e: IOException) { return } finally { diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/util/content/TwidereSQLiteOpenHelper.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/util/content/TwidereSQLiteOpenHelper.kt index 6745db95d..242299b8f 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/util/content/TwidereSQLiteOpenHelper.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/util/content/TwidereSQLiteOpenHelper.kt @@ -112,10 +112,10 @@ class TwidereSQLiteOpenHelper( for (i in 0 until tabTypes.size) { @CustomTabType val tabType = tabTypes[i] - val conf = TabConfiguration.ofType(tabType) + val conf = TabConfiguration.ofType(tabType) ?: continue val tab = Tab().apply { this.type = tabType - this.icon = conf!!.icon.persistentKey + this.icon = conf.icon.persistentKey this.position = i } db.insert(Tabs.TABLE_NAME, null, creator.create(tab))