mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-21 15:50:59 +00:00
Add status notification type and some properties on identity instance
This commit is contained in:
parent
41cd030734
commit
08d4e43ddb
8 changed files with 20 additions and 6 deletions
|
@ -24,6 +24,8 @@ public extension Identity {
|
|||
public let streamingAPI: URL
|
||||
public let title: String
|
||||
public let thumbnail: URL?
|
||||
public let version: String
|
||||
public let maxTootChars: Int?
|
||||
}
|
||||
|
||||
struct Account: Codable, Hashable {
|
||||
|
|
|
@ -9,9 +9,11 @@ extension IdentityDatabase {
|
|||
migrator.registerMigration("0.1.0") { db in
|
||||
try db.create(table: "instance", ifNotExists: true) { t in
|
||||
t.column("uri", .text).primaryKey(onConflict: .replace)
|
||||
t.column("streamingAPI", .text)
|
||||
t.column("title", .text)
|
||||
t.column("streamingAPI", .text).notNull()
|
||||
t.column("title", .text).notNull()
|
||||
t.column("thumbnail", .text)
|
||||
t.column("version", .text).notNull()
|
||||
t.column("maxTootChars", .integer)
|
||||
}
|
||||
|
||||
try db.create(table: "identityRecord", ifNotExists: true) { t in
|
||||
|
|
|
@ -70,7 +70,9 @@ public extension IdentityDatabase {
|
|||
uri: instance.uri,
|
||||
streamingAPI: instance.urls.streamingApi,
|
||||
title: instance.title,
|
||||
thumbnail: instance.thumbnail)
|
||||
thumbnail: instance.thumbnail,
|
||||
version: instance.version,
|
||||
maxTootChars: instance.maxTootChars)
|
||||
.save($0)
|
||||
try IdentityRecord
|
||||
.filter(IdentityRecord.Columns.id == id)
|
||||
|
|
|
@ -144,6 +144,7 @@
|
|||
"preferences.notification-types.reblog" = "Reblog";
|
||||
"preferences.notification-types.mention" = "Mention";
|
||||
"preferences.notification-types.poll" = "Poll";
|
||||
"preferences.notification-types.status" = "Status";
|
||||
"preferences.muted-users" = "Muted Users";
|
||||
"preferences.startup-and-syncing" = "Startup and Syncing";
|
||||
"preferences.startup-and-syncing.home-timeline" = "Home timeline";
|
||||
|
|
|
@ -27,4 +27,5 @@ public struct Instance: Codable, Hashable {
|
|||
public let stats: Stats
|
||||
public let thumbnail: URL?
|
||||
public let contactAccount: Account?
|
||||
public let maxTootChars: Int?
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ public struct PushSubscription: Codable {
|
|||
public var reblog: Bool
|
||||
public var mention: Bool
|
||||
@DecodableDefault.True public var poll: Bool
|
||||
@DecodableDefault.True public var status: Bool
|
||||
}
|
||||
|
||||
public let endpoint: URL
|
||||
|
@ -22,5 +23,6 @@ public extension PushSubscription.Alerts {
|
|||
favourite: true,
|
||||
reblog: true,
|
||||
mention: true,
|
||||
poll: DecodableDefault.True())
|
||||
poll: DecodableDefault.True(),
|
||||
status: DecodableDefault.True())
|
||||
}
|
||||
|
|
|
@ -47,7 +47,8 @@ extension PushSubscriptionEndpoint: Endpoint {
|
|||
"favourite": alerts.favourite,
|
||||
"reblog": alerts.reblog,
|
||||
"mention": alerts.mention,
|
||||
"poll": alerts.poll
|
||||
"poll": alerts.poll,
|
||||
"status": alerts.status
|
||||
]]]
|
||||
case let .update(alerts):
|
||||
return ["data":
|
||||
|
@ -56,7 +57,8 @@ extension PushSubscriptionEndpoint: Endpoint {
|
|||
"favourite": alerts.favourite,
|
||||
"reblog": alerts.reblog,
|
||||
"mention": alerts.mention,
|
||||
"poll": alerts.poll]]]
|
||||
"poll": alerts.poll,
|
||||
"status": alerts.status]]]
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ struct NotificationTypesPreferencesView: View {
|
|||
isOn: $viewModel.pushSubscriptionAlerts.mention)
|
||||
Toggle("preferences.notification-types.poll",
|
||||
isOn: $viewModel.pushSubscriptionAlerts.poll)
|
||||
Toggle("preferences.notification-types.status",
|
||||
isOn: $viewModel.pushSubscriptionAlerts.status)
|
||||
}
|
||||
.navigationTitle("preferences.notification-types")
|
||||
.alertItem($viewModel.alertItem)
|
||||
|
|
Loading…
Reference in a new issue