Add invites badges (#819)

This commit is contained in:
Alfonso Grillo
2023-04-21 13:14:27 +02:00
committed by GitHub
parent 4db6e68d79
commit 078799c1e2
25 changed files with 124 additions and 48 deletions
@@ -21,6 +21,7 @@ import SwiftUI
final class AppSettings: ObservableObject {
private enum UserDefaultsKeys: String {
case lastVersionLaunched
case seenInvites
case timelineStyle
case enableAnalytics
case enableInAppNotifications
@@ -69,6 +70,11 @@ final class AppSettings: ObservableObject {
@UserPreference(key: UserDefaultsKeys.lastVersionLaunched, storageType: .userDefaults(store))
var lastVersionLaunched: String?
/// The Set of room identifiers of invites that the user already saw in the invites list.
/// This Set is being used to implement badges for unread invites.
@UserPreference(key: UserDefaultsKeys.seenInvites, defaultValue: [], storageType: .userDefaults(store))
var seenInvites: Set<String>
/// The default homeserver address used. This is intentionally a string without a scheme
/// so that it can be passed to Rust as a ServerName for well-known discovery.
let defaultHomeserverAddress = "matrix.org"