Always show UP subscriptions at the bottom
This commit is contained in:
parent
d10344549f
commit
bf419dda23
4 changed files with 9 additions and 8 deletions
|
@ -129,7 +129,7 @@ interface SubscriptionDao {
|
||||||
FROM Subscription AS s
|
FROM Subscription AS s
|
||||||
LEFT JOIN Notification AS n ON s.id=n.subscriptionId AND n.deleted != 1
|
LEFT JOIN Notification AS n ON s.id=n.subscriptionId AND n.deleted != 1
|
||||||
GROUP BY s.id
|
GROUP BY s.id
|
||||||
ORDER BY MAX(n.timestamp) DESC
|
ORDER BY s.upAppId ASC, MAX(n.timestamp) DESC
|
||||||
""")
|
""")
|
||||||
fun listFlow(): Flow<List<SubscriptionWithMetadata>>
|
fun listFlow(): Flow<List<SubscriptionWithMetadata>>
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ interface SubscriptionDao {
|
||||||
FROM Subscription AS s
|
FROM Subscription AS s
|
||||||
LEFT JOIN Notification AS n ON s.id=n.subscriptionId AND n.deleted != 1
|
LEFT JOIN Notification AS n ON s.id=n.subscriptionId AND n.deleted != 1
|
||||||
GROUP BY s.id
|
GROUP BY s.id
|
||||||
ORDER BY MAX(n.timestamp) DESC
|
ORDER BY s.upAppId ASC, MAX(n.timestamp) DESC
|
||||||
""")
|
""")
|
||||||
fun list(): List<SubscriptionWithMetadata>
|
fun list(): List<SubscriptionWithMetadata>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.content.SharedPreferences
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.annotation.WorkerThread
|
import androidx.annotation.WorkerThread
|
||||||
import androidx.lifecycle.*
|
import androidx.lifecycle.*
|
||||||
import androidx.preference.PreferenceManager
|
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
import java.util.concurrent.atomic.AtomicLong
|
import java.util.concurrent.atomic.AtomicLong
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,8 @@ class MainAdapter(private val repository: Repository, private val onClick: (Subs
|
||||||
|
|
||||||
fun bind(subscription: Subscription) {
|
fun bind(subscription: Subscription) {
|
||||||
this.subscription = subscription
|
this.subscription = subscription
|
||||||
var statusMessage = if (subscription.upAppId != null) {
|
val isUnifiedPush = subscription.upAppId != null
|
||||||
|
var statusMessage = if (isUnifiedPush) {
|
||||||
context.getString(R.string.main_item_status_unified_push, subscription.upAppId)
|
context.getString(R.string.main_item_status_unified_push, subscription.upAppId)
|
||||||
} else if (subscription.totalCount == 1) {
|
} else if (subscription.totalCount == 1) {
|
||||||
context.getString(R.string.main_item_status_text_one, subscription.totalCount)
|
context.getString(R.string.main_item_status_text_one, subscription.totalCount)
|
||||||
|
@ -80,15 +81,16 @@ class MainAdapter(private val repository: Repository, private val onClick: (Subs
|
||||||
dateStr
|
dateStr
|
||||||
}
|
}
|
||||||
val globalMutedUntil = repository.getGlobalMutedUntil()
|
val globalMutedUntil = repository.getGlobalMutedUntil()
|
||||||
val showMutedForeverIcon = (subscription.mutedUntil == 1L || globalMutedUntil == 1L) && subscription.upAppId == null
|
val showMutedForeverIcon = (subscription.mutedUntil == 1L || globalMutedUntil == 1L) && !isUnifiedPush
|
||||||
val showMutedUntilIcon = !showMutedForeverIcon && (subscription.mutedUntil > 1L || globalMutedUntil > 1L) && subscription.upAppId == null
|
val showMutedUntilIcon = !showMutedForeverIcon && (subscription.mutedUntil > 1L || globalMutedUntil > 1L) && !isUnifiedPush
|
||||||
nameView.text = topicShortUrl(subscription.baseUrl, subscription.topic)
|
nameView.text = topicShortUrl(subscription.baseUrl, subscription.topic)
|
||||||
statusView.text = statusMessage
|
statusView.text = statusMessage
|
||||||
dateView.text = dateText
|
dateView.text = dateText
|
||||||
|
dateView.visibility = if (isUnifiedPush) View.GONE else View.VISIBLE
|
||||||
notificationDisabledUntilImageView.visibility = if (showMutedUntilIcon) View.VISIBLE else View.GONE
|
notificationDisabledUntilImageView.visibility = if (showMutedUntilIcon) View.VISIBLE else View.GONE
|
||||||
notificationDisabledForeverImageView.visibility = if (showMutedForeverIcon) View.VISIBLE else View.GONE
|
notificationDisabledForeverImageView.visibility = if (showMutedForeverIcon) View.VISIBLE else View.GONE
|
||||||
instantImageView.visibility = if (subscription.instant) View.VISIBLE else View.GONE
|
instantImageView.visibility = if (subscription.instant) View.VISIBLE else View.GONE
|
||||||
if (subscription.upAppId != null || subscription.newCount == 0) {
|
if (isUnifiedPush || subscription.newCount == 0) {
|
||||||
newItemsView.visibility = View.GONE
|
newItemsView.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
newItemsView.visibility = View.VISIBLE
|
newItemsView.visibility = View.VISIBLE
|
||||||
|
|
|
@ -165,7 +165,7 @@
|
||||||
<string name="settings_unified_push_header">UnifiedPush</string>
|
<string name="settings_unified_push_header">UnifiedPush</string>
|
||||||
<string name="settings_unified_push_header_summary">Allows other apps to use ntfy as a message distributor. Find out more at unifiedpush.org.</string>
|
<string name="settings_unified_push_header_summary">Allows other apps to use ntfy as a message distributor. Find out more at unifiedpush.org.</string>
|
||||||
<string name="settings_unified_push_enabled_key">UnifiedPushEnabled</string>
|
<string name="settings_unified_push_enabled_key">UnifiedPushEnabled</string>
|
||||||
<string name="settings_unified_push_enabled_title">Enable distributor</string>
|
<string name="settings_unified_push_enabled_title">Allow distributor use</string>
|
||||||
<string name="settings_unified_push_enabled_summary_on">Apps can use ntfy as distributor</string>
|
<string name="settings_unified_push_enabled_summary_on">Apps can use ntfy as distributor</string>
|
||||||
<string name="settings_unified_push_enabled_summary_off">Apps cannot use ntfy as distributor</string>
|
<string name="settings_unified_push_enabled_summary_off">Apps cannot use ntfy as distributor</string>
|
||||||
<string name="settings_unified_push_base_url_key">UnifiedPushBaseURL</string>
|
<string name="settings_unified_push_base_url_key">UnifiedPushBaseURL</string>
|
||||||
|
|
Loading…
Reference in a new issue