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