Various fixes due to recent merges
This commit is contained in:
parent
c6e815855e
commit
b1520c549e
|
@ -120,7 +120,7 @@ public class PushNotificationsService: ObservableObject {
|
|||
if let sub = subscriptions.first {
|
||||
isPushEnabled = true
|
||||
isFollowNotificationEnabled = sub.alerts.follow
|
||||
isFavoriteNotificationEnabled = sub.alerts.favorite
|
||||
isFavoriteNotificationEnabled = sub.alerts.favourite
|
||||
isReblogNotificationEnabled = sub.alerts.reblog
|
||||
isMentionNotificationEnabled = sub.alerts.mention
|
||||
isPollNotificationEnabled = sub.alerts.poll
|
||||
|
|
|
@ -4,7 +4,7 @@ import SwiftSoup
|
|||
import SwiftUI
|
||||
|
||||
public struct HTMLString: Decodable, Equatable, Hashable {
|
||||
public var htmlValue: String
|
||||
public let htmlValue: String
|
||||
public let asMarkdown: String
|
||||
public let asRawText: String
|
||||
public let statusesURLs: [URL]
|
||||
|
@ -17,15 +17,6 @@ public struct HTMLString: Decodable, Equatable, Hashable {
|
|||
} catch {
|
||||
htmlValue = ""
|
||||
}
|
||||
|
||||
// https://daringfireball.net/projects/markdown/syntax
|
||||
// HTML2Markdown only auto escapes * on the way out
|
||||
// so we pre-escape all other escapable sequences on
|
||||
// the way in here.
|
||||
|
||||
if let regex = try? NSRegularExpression(pattern: "([\\\\_(){}\\[\\]\\.\\+\\-#!])", options: .caseInsensitive) {
|
||||
htmlValue = regex.stringByReplacingMatches(in: htmlValue, options: [], range: NSRange(location: 0, length: htmlValue.count), withTemplate: "\\\\$1")
|
||||
}
|
||||
|
||||
do {
|
||||
asMarkdown = try HTMLParser().parse(html: htmlValue)
|
||||
|
|
|
@ -2,7 +2,7 @@ import Foundation
|
|||
|
||||
public struct Notification: Decodable, Identifiable {
|
||||
public enum NotificationType: String, CaseIterable {
|
||||
case follow, follow_request, mention, reblog, status, favorite, poll, update
|
||||
case follow, follow_request, mention, reblog, status, favourite, poll, update
|
||||
}
|
||||
|
||||
public let id: String
|
||||
|
@ -17,7 +17,7 @@ public struct Notification: Decodable, Identifiable {
|
|||
|
||||
public static func placeholder() -> Notification {
|
||||
.init(id: UUID().uuidString,
|
||||
type: NotificationType.favorite.rawValue,
|
||||
type: NotificationType.favourite.rawValue,
|
||||
createdAt: "2022-12-16T10:20:54.000Z",
|
||||
account: .placeholder(),
|
||||
status: .placeholder())
|
||||
|
|
|
@ -3,7 +3,7 @@ import Foundation
|
|||
public struct PushSubscription: Identifiable, Decodable {
|
||||
public struct Alerts: Decodable {
|
||||
public let follow: Bool
|
||||
public let favorite: Bool
|
||||
public let favourite: Bool
|
||||
public let reblog: Bool
|
||||
public let mention: Bool
|
||||
public let poll: Bool
|
||||
|
|
|
@ -40,7 +40,7 @@ public enum Accounts: Endpoint {
|
|||
case let .accounts(id):
|
||||
return "accounts/\(id)"
|
||||
case .favorites:
|
||||
return "favorites"
|
||||
return "favourites"
|
||||
case .bookmarks:
|
||||
return "bookmarks"
|
||||
case .followedTags:
|
||||
|
|
|
@ -30,7 +30,7 @@ public enum Push: Endpoint {
|
|||
params.append(.init(name: "data[alerts][status]", value: status ? "true" : "false"))
|
||||
params.append(.init(name: "data[alerts][follow]", value: follow ? "true" : "false"))
|
||||
params.append(.init(name: "data[alerts][reblog]", value: reblog ? "true" : "false"))
|
||||
params.append(.init(name: "data[alerts][favorite]", value: favorite ? "true" : "false"))
|
||||
params.append(.init(name: "data[alerts][favourite]", value: favorite ? "true" : "false"))
|
||||
params.append(.init(name: "data[alerts][poll]", value: poll ? "true" : "false"))
|
||||
params.append(.init(name: "policy", value: "all"))
|
||||
return params
|
||||
|
|
|
@ -29,9 +29,9 @@ public enum Statuses: Endpoint {
|
|||
case let .context(id):
|
||||
return "statuses/\(id)/context"
|
||||
case let .favorite(id):
|
||||
return "statuses/\(id)/favorite"
|
||||
return "statuses/\(id)/favourite"
|
||||
case let .unfavorite(id):
|
||||
return "statuses/\(id)/unfavorite"
|
||||
return "statuses/\(id)/unfavourite"
|
||||
case let .reblog(id):
|
||||
return "statuses/\(id)/reblog"
|
||||
case let .unreblog(id):
|
||||
|
@ -39,7 +39,7 @@ public enum Statuses: Endpoint {
|
|||
case let .rebloggedBy(id, _):
|
||||
return "statuses/\(id)/reblogged_by"
|
||||
case let .favoritedBy(id, _):
|
||||
return "statuses/\(id)/favorited_by"
|
||||
return "statuses/\(id)/favourited_by"
|
||||
case let .pin(id):
|
||||
return "statuses/\(id)/pin"
|
||||
case let .unpin(id):
|
||||
|
|
|
@ -14,7 +14,7 @@ extension Models.Notification.NotificationType {
|
|||
return "notifications.label.follow"
|
||||
case .follow_request:
|
||||
return "notifications.label.follow-request"
|
||||
case .favorite:
|
||||
case .favourite:
|
||||
return "notifications.label.favorite"
|
||||
case .poll:
|
||||
return "notifications.label.poll"
|
||||
|
@ -33,7 +33,7 @@ extension Models.Notification.NotificationType {
|
|||
return "arrow.left.arrow.right.circle.fill"
|
||||
case .follow, .follow_request:
|
||||
return "person.fill.badge.plus"
|
||||
case .favorite:
|
||||
case .favourite:
|
||||
return "star.fill"
|
||||
case .poll:
|
||||
return "chart.bar.fill"
|
||||
|
@ -54,7 +54,7 @@ extension Models.Notification.NotificationType {
|
|||
return "notifications.menu-title.follow"
|
||||
case .follow_request:
|
||||
return "notifications.menu-title.follow-request"
|
||||
case .favorite:
|
||||
case .favourite:
|
||||
return "notifications.menu-title.favorite"
|
||||
case .poll:
|
||||
return "notifications.menu-title.poll"
|
||||
|
|
Loading…
Reference in New Issue