Merge branch 'release_1.10'

This commit is contained in:
Daniel D’Aquino
2024-09-18 19:14:07 -07:00
15 changed files with 76 additions and 42 deletions

View File

@@ -9,7 +9,7 @@ import Foundation
enum FriendFilter: String, StringCodable {
case all
case friends
case friends_of_friends
init?(from string: String) {
guard let ff = FriendFilter(rawValue: string) else {
@@ -27,8 +27,17 @@ enum FriendFilter: String, StringCodable {
switch self {
case .all:
return true
case .friends:
case .friends_of_friends:
return contacts.is_in_friendosphere(pubkey)
}
}
func description() -> String {
switch self {
case .all:
return NSLocalizedString("All", comment: "Human-readable short description of the 'friends filter' when it is set to 'all'")
case .friends_of_friends:
return NSLocalizedString("Friends of friends", comment: "Human-readable short description of the 'friends filter' when it is set to 'friends-of-friends'")
}
}
}

View File

@@ -27,7 +27,7 @@ func process_local_notification(state: HeadlessDamusState, event ev: NostrEvent)
func should_display_notification(state: HeadlessDamusState, event ev: NostrEvent, mode: UserSettingsStore.NotificationsMode) -> Bool {
// Do not show notification if it's coming from a mode different from the one selected by our user
guard state.settings.notifications_mode == mode else {
guard state.settings.notification_mode == mode else {
return false
}

View File

@@ -51,7 +51,7 @@ struct NostrPost {
}
/// Parse the post's contents to find more tags to apply to the final nostr event
private func make_post_tags(post_blocks: [Block], tags: [[String]]) -> PostTags {
func make_post_tags(post_blocks: [Block], tags: [[String]]) -> PostTags {
var new_tags = tags
for post_block in post_blocks {
@@ -89,10 +89,12 @@ struct NostrPost {
// MARK: - Helper structures and functions
/// A struct used for temporarily holding tag information that was parsed from a post contents to aid in building a nostr event
fileprivate struct PostTags {
let blocks: [Block]
let tags: [[String]]
extension NostrPost {
/// A struct used for temporarily holding tag information that was parsed from a post contents to aid in building a nostr event
struct PostTags {
let blocks: [Block]
let tags: [[String]]
}
}
func parse_post_blocks(content: String) -> [Block] {

View File

@@ -18,7 +18,7 @@ struct PushNotificationClient {
mutating func set_device_token(new_device_token: Data) async throws {
self.device_token = new_device_token
if settings.enable_experimental_push_notifications && settings.notifications_mode == .push {
if settings.enable_push_notifications && settings.notification_mode == .push {
try await self.send_token()
}
}

View File

@@ -155,8 +155,8 @@ class UserSettingsStore: ObservableObject {
@Setting(key: "like_notification", default_value: true)
var like_notification: Bool
@StringSetting(key: "notifications_mode", default_value: .local)
var notifications_mode: NotificationsMode
@StringSetting(key: "notification_mode", default_value: .push)
var notification_mode: NotificationsMode
@Setting(key: "notification_only_from_following", default_value: false)
var notification_only_from_following: Bool
@@ -207,8 +207,9 @@ class UserSettingsStore: ObservableObject {
@Setting(key: "always_show_onboarding_suggestions", default_value: false)
var always_show_onboarding_suggestions: Bool
@Setting(key: "enable_experimental_push_notifications", default_value: false)
var enable_experimental_push_notifications: Bool
// @Setting(key: "enable_experimental_push_notifications", default_value: false)
// This was a feature flag setting during early development, but now this is enabled for everyone.
var enable_push_notifications: Bool = true
@StringSetting(key: "push_notification_environment", default_value: .production)
var push_notification_environment: PushNotificationClient.Environment