From fbda41622716d0ceac3fe804d0f876f401a02133 Mon Sep 17 00:00:00 2001 From: Matt Gardner Date: Sat, 22 Jun 2024 12:17:54 -0600 Subject: [PATCH 1/4] update swipe actions and tenantId --- Sources/Components/Feed/InAppFeedView.swift | 59 +++++++++++-------- .../Components/Feed/InAppFeedViewModel.swift | 17 +++--- .../FeedNotificationRowSwipeAction.swift | 18 ++++-- .../Components/Feed/Support/SwipeButton.swift | 16 ++++- .../Themes/FeedNotificationRowTheme.swift | 12 ++-- Sources/Modules/MessageModule.swift | 10 +++- .../KnockTests/InAppFeedViewModelTests.swift | 16 ++++- 7 files changed, 98 insertions(+), 50 deletions(-) diff --git a/Sources/Components/Feed/InAppFeedView.swift b/Sources/Components/Feed/InAppFeedView.swift index 6479ec7..5b34666 100644 --- a/Sources/Components/Feed/InAppFeedView.swift +++ b/Sources/Components/Feed/InAppFeedView.swift @@ -20,26 +20,7 @@ extension Knock { public var body: some View { VStack(alignment: .leading, spacing: .zero) { - VStack(alignment: .leading, spacing: .zero) { - if let title = theme.titleString { - Text(title) - .font(theme.titleFont) - .foregroundStyle(theme.titleColor) - .padding(.horizontal, 24) - } - - if viewModel.filterOptions.count > 1 { - filterTabView() - .padding(.bottom, 12) - } - - if let topButtons = viewModel.topButtonActions { - topActionButtonsView(topButtons: topButtons) - .padding(.bottom, 12) - Divider() - } - } - .background(theme.upperBackgroundColor) + topSectionView() ZStack(alignment: .bottom) { Group { @@ -78,16 +59,18 @@ extension Knock { viewModel.feedItemRowTapped(item: item) } .swipeActions(edge: .trailing) { - if let config = theme.rowTheme.swipeLeftConfig { - Knock.SwipeButton(config: config) { - viewModel.didSwipeRow(item: item, swipeAction: config.action) + if let config = theme.rowTheme.archiveSwipeConfig { + let useInverse = item.archived_at != nil + Knock.SwipeButton(config: config, useInverse: useInverse) { + viewModel.didSwipeRow(item: item, swipeAction: config.action, useInverse: useInverse) } } } .swipeActions(edge: .leading) { - if let config = theme.rowTheme.swipeRightConfig { - Knock.SwipeButton(config: config) { - viewModel.didSwipeRow(item: item, swipeAction: config.action) + if let config = theme.rowTheme.markAsReadSwipeConfig { + let useInverse = item.read_at != nil + Knock.SwipeButton(config: config, useInverse: useInverse) { + viewModel.didSwipeRow(item: item, swipeAction: config.action, useInverse: useInverse) } } } @@ -127,6 +110,30 @@ extension Knock { } } + @ViewBuilder + private func topSectionView() -> some View { + VStack(alignment: .leading, spacing: .zero) { + if let title = theme.titleString { + Text(title) + .font(theme.titleFont) + .foregroundStyle(theme.titleColor) + .padding(.horizontal, 24) + } + + if viewModel.filterOptions.count > 1 { + filterTabView() + .padding(.bottom, 12) + } + + if let topButtons = viewModel.topButtonActions { + topActionButtonsView(topButtons: topButtons) + .padding(.bottom, 12) + Divider() + } + } + .background(theme.upperBackgroundColor) + } + @ViewBuilder private func lastRowView() -> some View { HStack { diff --git a/Sources/Components/Feed/InAppFeedViewModel.swift b/Sources/Components/Feed/InAppFeedViewModel.swift index ab3c736..d1ad718 100644 --- a/Sources/Components/Feed/InAppFeedViewModel.swift +++ b/Sources/Components/Feed/InAppFeedViewModel.swift @@ -11,7 +11,7 @@ import Combine extension Knock { public class InAppFeedViewModel: ObservableObject { @Published public var feed: Knock.Feed = Knock.Feed() /// The current feed data. - @Published public var currentTenantId: String? /// The tenant ID associated with the current feed. + // TODO: Double check to make sure tennant behaviour is working as expected. @Published public var filterOptions: [InAppFeedFilter] /// Available filter options for the feed. @Published public var topButtonActions: [Knock.FeedTopActionButtonType]? /// Actions available at the top of the feed interface. @Published internal var brandingRequired: Bool = true @@ -42,13 +42,11 @@ extension Knock { topButtonActions: [Knock.FeedTopActionButtonType]? = [.markAllAsRead(), .archiveRead()] ) { self.feedClientOptions = feedClientOptions - self.currentTenantId = currentTenantId ?? feedClientOptions.tenant self.filterOptions = filterOptions ?? [.init(scope: .all), .init(scope: .unread), .init(scope: .archived)] self.currentFilter = currentFilter ?? filterOptions?.first ?? .init(scope: .all) self.topButtonActions = topButtonActions self.feedClientOptions.status = self.currentFilter.scope - self.feedClientOptions.tenant = self.currentTenantId } // MARK: Public Methods @@ -129,7 +127,7 @@ extension Knock { default: break } - let feedOptions = Knock.FeedClientOptions(status: archivedScope, tenant: currentTenantId, has_tenant: feedClientOptions.has_tenant, archived: feedClientOptions.archived) + let feedOptions = Knock.FeedClientOptions(status: archivedScope, tenant: feedClientOptions.tenant, has_tenant: feedClientOptions.has_tenant, archived: feedClientOptions.archived) do { _ = try await Knock.shared.feedManager?.makeBulkStatusUpdate(type: updatedStatus, options: feedOptions) await optimisticallyBulkUpdateStatus(updatedStatus: updatedStatus, archivedScope: archivedScope) @@ -142,7 +140,7 @@ extension Knock { switch updatedStatus { case .seen: guard item.seen_at == nil else { return } case .read: guard item.read_at == nil else { return } - case .interacted: guard item.inserted_at == nil else { return } + case .interacted: guard item.interacted_at == nil else { return } case .archived: guard item.archived_at == nil else { return } case .unread: guard item.read_at != nil else { return } case .unseen: guard item.seen_at != nil else { return } @@ -173,12 +171,11 @@ extension Knock { // MARK: Button/Swipe Interactions - public func didSwipeRow(item: Knock.FeedItem, swipeAction: FeedNotificationRowSwipeAction) { + public func didSwipeRow(item: Knock.FeedItem, swipeAction: FeedNotificationRowSwipeAction, useInverse: Bool) { Task { switch swipeAction { - case .archive: await updateMessageEngagementStatus(item, updatedStatus: .archived) - case .markAsRead: await updateMessageEngagementStatus(item, updatedStatus: .read) - case .markAsUnread: await updateMessageEngagementStatus(item, updatedStatus: .unread) + case .archive: await updateMessageEngagementStatus(item, updatedStatus: useInverse ? .unarchived : .archived) + case .markAsRead: await updateMessageEngagementStatus(item, updatedStatus: useInverse ? .unread : .read) } } } @@ -249,7 +246,7 @@ extension Knock { private func shouldArchive(item: Knock.FeedItem, scope: Knock.FeedItemScope) -> Bool { switch scope { - case .interacted: return item.inserted_at != nil + case .interacted: return item.interacted_at != nil case .unread: return item.read_at == nil case .read: return item.read_at != nil case .unseen: return item.seen_at == nil diff --git a/Sources/Components/Feed/Models/FeedNotificationRowSwipeAction.swift b/Sources/Components/Feed/Models/FeedNotificationRowSwipeAction.swift index bb68b45..cfac224 100644 --- a/Sources/Components/Feed/Models/FeedNotificationRowSwipeAction.swift +++ b/Sources/Components/Feed/Models/FeedNotificationRowSwipeAction.swift @@ -12,13 +12,18 @@ extension Knock { public enum FeedNotificationRowSwipeAction { case archive case markAsRead - case markAsUnread public var defaultTitle: String { switch self { case .archive: return "Archive" case .markAsRead: return "Read" - case .markAsUnread: return "Unread" + } + } + + public var defaultInverseTitle: String { + switch self { + case .archive: return "Unarchive" + case .markAsRead: return "Unread" } } @@ -26,7 +31,13 @@ extension Knock { switch self { case .archive: return Image(systemName: "archivebox") case .markAsRead: return Image(systemName: "envelope.open") - case .markAsUnread: return Image(systemName: "envelope") + } + } + + public var defaultInverseImage: Image { + switch self { + case .archive: return Image(systemName: "archivebox") + case .markAsRead: return Image(systemName: "envelope") } } @@ -34,7 +45,6 @@ extension Knock { switch self { case .archive: return KnockColor.Green.green9 case .markAsRead: return KnockColor.Blue.blue9 - case .markAsUnread: return KnockColor.Blue.blue9 } } diff --git a/Sources/Components/Feed/Support/SwipeButton.swift b/Sources/Components/Feed/Support/SwipeButton.swift index 7935f32..49690c0 100644 --- a/Sources/Components/Feed/Support/SwipeButton.swift +++ b/Sources/Components/Feed/Support/SwipeButton.swift @@ -10,12 +10,18 @@ import SwiftUI extension Knock { struct SwipeButton: View { let config: SwipeButtonConfig + let useInverse: Bool let action: () -> Void + var body: some View { Button(action: action) { VStack(alignment: .center, spacing: 10) { - config.image - Text(config.title) + if useInverse { + config.inverseImage + } else { + config.image + } + Text(useInverse ? config.inverseTitle : config.title) .font(config.titleFont) .foregroundStyle(config.titleColor) } @@ -27,26 +33,32 @@ extension Knock { public struct SwipeButtonConfig { public var action: Knock.FeedNotificationRowSwipeAction public var title: String + public var inverseTitle: String public var titleFont: Font public var titleColor: Color public var image: Image + public var inverseImage: Image public var swipeColor: Color public var showIcon: Bool public init( action: Knock.FeedNotificationRowSwipeAction, title: String? = nil, + inverseTitle: String? = nil, titleFont: Font? = nil, titleColor: Color? = nil, image: Image? = nil, + inverseImage: Image? = nil, swipeColor: Color? = nil, showIcon: Bool = true ) { self.action = action self.title = title ?? action.defaultTitle + self.inverseTitle = inverseTitle ?? action.defaultInverseTitle self.titleFont = titleFont ?? .knock2.weight(.medium) self.titleColor = titleColor ?? .white self.image = image ?? action.defaultImage + self.inverseImage = inverseImage ?? action.defaultInverseImage self.swipeColor = swipeColor ?? action.defaultSwipeColor self.showIcon = showIcon } diff --git a/Sources/Components/Feed/Themes/FeedNotificationRowTheme.swift b/Sources/Components/Feed/Themes/FeedNotificationRowTheme.swift index 4a1b93b..6ba616f 100644 --- a/Sources/Components/Feed/Themes/FeedNotificationRowTheme.swift +++ b/Sources/Components/Feed/Themes/FeedNotificationRowTheme.swift @@ -14,8 +14,8 @@ extension Knock { public var avatarViewTheme: AvatarViewTheme // Customize styling of avatarview public var notificationContentCSS: String? // Customize the css of the markdown html of the notification body public var backgroundColor: Color // Background color of the FeedNoticationRow - public var swipeRightConfig: SwipeButtonConfig? // Set this to nil to remove the right swipe action - public var swipeLeftConfig: SwipeButtonConfig? // Set this to nil to remove the left swipe action + public var markAsReadSwipeConfig: SwipeButtonConfig? // Set this to nil to remove the mark as read/unread swipe action + public var archiveSwipeConfig: SwipeButtonConfig? // Set this to nil to remove the archive/unarchive swipe action public var unreadNotificationCircleColor: Color // Color of the unread circle indicator in the top left of the row public var sentAtDateFormatter: DateFormatter // DateFormatter for the sent timestamp at the bottom of the row public var sentAtDateFont: Font // Font for sent timestamp @@ -29,8 +29,8 @@ extension Knock { avatarViewTheme: AvatarViewTheme? = nil, notificationContentCSS: String? = nil, backgroundColor: Color? = nil, - swipeRightConfig: SwipeButtonConfig? = FeedNotificationRowSwipeAction.markAsRead.defaultConfig, - swipeLeftConfig: SwipeButtonConfig? = FeedNotificationRowSwipeAction.archive.defaultConfig, + markAsReadSwipeConfig: SwipeButtonConfig? = FeedNotificationRowSwipeAction.markAsRead.defaultConfig, + archiveSwipeConfig: SwipeButtonConfig? = FeedNotificationRowSwipeAction.archive.defaultConfig, unreadNotificationCircleColor: Color? = nil, sentAtDateFormatter: DateFormatter? = nil, sentAtDateFont: Font? = nil, @@ -43,8 +43,8 @@ extension Knock { self.avatarViewTheme = avatarViewTheme ?? .init() self.notificationContentCSS = notificationContentCSS self.backgroundColor = backgroundColor ?? KnockColor.Surface.surface1 - self.swipeRightConfig = swipeRightConfig - self.swipeLeftConfig = swipeLeftConfig + self.markAsReadSwipeConfig = markAsReadSwipeConfig + self.archiveSwipeConfig = archiveSwipeConfig self.unreadNotificationCircleColor = unreadNotificationCircleColor ?? KnockColor.Blue.blue9 self.sentAtDateFormatter = sentAtDateFormatter ?? defaultDateFormatter self.sentAtDateFont = sentAtDateFont ?? .knock2.weight(.medium) diff --git a/Sources/Modules/MessageModule.swift b/Sources/Modules/MessageModule.swift index ee19b00..71e20cc 100644 --- a/Sources/Modules/MessageModule.swift +++ b/Sources/Modules/MessageModule.swift @@ -23,7 +23,12 @@ internal class MessageModule { internal func updateMessageStatus(messageId: String, status: Knock.KnockMessageStatusUpdateType) async throws -> Knock.KnockMessage { do { - let message = try await messageService.updateMessageStatus(messageId: messageId, status: status) + let message = switch status { + case .unarchived: try await messageService.deleteMessageStatus(messageId: messageId, status: .archived) + case .unread: try await messageService.deleteMessageStatus(messageId: messageId, status: .read) + case .unseen: try await messageService.deleteMessageStatus(messageId: messageId, status: .seen) + default: try await messageService.updateMessageStatus(messageId: messageId, status: status) + } Knock.shared.log(type: .debug, category: .message, message: "updateMessageStatus", status: .success, additionalInfo: ["messageId": messageId]) return message } catch let error { @@ -32,6 +37,7 @@ internal class MessageModule { } } + @available(*, deprecated, message: "Use updateMessageStatus() instead") internal func deleteMessageStatus(messageId: String, status: Knock.KnockMessageStatusUpdateType) async throws -> Knock.KnockMessage { do { let message = try await messageService.deleteMessageStatus(messageId: messageId, status: status) @@ -133,10 +139,12 @@ public extension Knock { - message: The KnockMessage that you want to update. - status: The new status to be associated with the KnockMessage. */ + @available(*, deprecated, message: "Use updateMessageStatus() instead") func deleteMessageStatus(message: KnockMessage, status: KnockMessageStatusUpdateType) async throws -> KnockMessage { try await self.messageModule.deleteMessageStatus(messageId: message.id, status: status) } + @available(*, deprecated, message: "Use updateMessageStatus() instead") func deleteMessageStatus(message: KnockMessage, status: KnockMessageStatusUpdateType, completionHandler: @escaping ((Result) -> Void)) { Task { do { diff --git a/Tests/KnockTests/InAppFeedViewModelTests.swift b/Tests/KnockTests/InAppFeedViewModelTests.swift index 8f91155..0424302 100644 --- a/Tests/KnockTests/InAppFeedViewModelTests.swift +++ b/Tests/KnockTests/InAppFeedViewModelTests.swift @@ -111,10 +111,24 @@ final class InAppFeedViewModelTests: XCTestCase { viewModel.feed.entries = [item, item2, item3, item4] await viewModel.optimisticallyBulkUpdateStatus(updatedStatus: .archived) + XCTAssertTrue(viewModel.feed.entries.count == 0) XCTAssertTrue(viewModel.feed.meta.unreadCount == 0) } - func testOptimisticBulkMarkItemAsArchivedWithReadScope() async { + func testOptimisticBulkMarkItemAsArchivedAndShouldHideArchived() async { + let item = generateTestFeedItem(status: .unread) + let item2 = generateTestFeedItem(status: .seen) + let item3 = generateTestFeedItem(status: .unread) + let item4 = generateTestFeedItem(status: .read) + + viewModel.feed.entries = [item, item2, item3, item4] + viewModel.feedClientOptions.archived = .include + await viewModel.optimisticallyBulkUpdateStatus(updatedStatus: .archived) + XCTAssertTrue(viewModel.feed.entries.count == 0) + XCTAssertTrue(viewModel.feed.meta.unreadCount == 0) + } + + func testOptimisticBulkMarkItemAsArchivedWithUnReadScope() async { let item = generateTestFeedItem(status: .unread) let item2 = generateTestFeedItem(status: .unread) let item3 = generateTestFeedItem(status: .unread) From b74506d7129d21729fce3d96e84a84a4a54efd0e Mon Sep 17 00:00:00 2001 From: Matt Gardner Date: Mon, 24 Jun 2024 20:24:23 -0600 Subject: [PATCH 2/4] Added theme for FilterBar --- .../Components/Feed/FeedNotificationRow.swift | 1 - Sources/Components/Feed/InAppFeedView.swift | 36 +------------- .../Feed/Support/ActionButton.swift | 2 + .../Feed/Support/FilterBarView.swift | 49 +++++++++++++++++++ .../Feed/Themes/FilterBarTheme.swift | 30 ++++++++++++ .../Feed/Themes/InAppFeedTheme.swift | 1 + 6 files changed, 83 insertions(+), 36 deletions(-) create mode 100644 Sources/Components/Feed/Support/FilterBarView.swift create mode 100644 Sources/Components/Feed/Themes/FilterBarTheme.swift diff --git a/Sources/Components/Feed/FeedNotificationRow.swift b/Sources/Components/Feed/FeedNotificationRow.swift index c68a98d..ca045a1 100644 --- a/Sources/Components/Feed/FeedNotificationRow.swift +++ b/Sources/Components/Feed/FeedNotificationRow.swift @@ -7,7 +7,6 @@ import SwiftUI import WebKit -import UIKit extension Knock { diff --git a/Sources/Components/Feed/InAppFeedView.swift b/Sources/Components/Feed/InAppFeedView.swift index 5b34666..b6166ff 100644 --- a/Sources/Components/Feed/InAppFeedView.swift +++ b/Sources/Components/Feed/InAppFeedView.swift @@ -121,7 +121,7 @@ extension Knock { } if viewModel.filterOptions.count > 1 { - filterTabView() + FilterBarView(filters: viewModel.filterOptions, selectedFilter: $viewModel.currentFilter) .padding(.bottom, 12) } @@ -151,40 +151,6 @@ extension Knock { } } - @ViewBuilder - private func filterTabView() -> some View { - ZStack(alignment: .bottom) { - Divider() - .frame(height: 1) - .background(KnockColor.Gray.gray4) - - HStack(spacing: .zero - ) { - ForEach(viewModel.filterOptions, id: \.self) { option in - Text(option.title) - .font(.knock2.weight(.medium)) - .foregroundColor(option == viewModel.currentFilter ? KnockColor.Accent.accent11 : KnockColor.Gray.gray11) - .padding(.vertical, 10) - .padding(.horizontal, 16) - .overlay( - Rectangle() - .frame(height: 1) - .foregroundColor(option == viewModel.currentFilter ? KnockColor.Accent.accent9 : .clear), - alignment: .bottom - ) - .onTapGesture { - withAnimation { - viewModel.currentFilter = option - } - } - } - Spacer() - } - .padding(.horizontal, 24) - } - - } - @ViewBuilder private func topActionButtonsView(topButtons: [Knock.FeedTopActionButtonType]) -> some View { HStack(alignment: .center, spacing: 12) { diff --git a/Sources/Components/Feed/Support/ActionButton.swift b/Sources/Components/Feed/Support/ActionButton.swift index c3a9e6c..1fdea1c 100644 --- a/Sources/Components/Feed/Support/ActionButton.swift +++ b/Sources/Components/Feed/Support/ActionButton.swift @@ -17,6 +17,7 @@ extension Knock { Button(action: action) { Text(title) .font(config.font) + .lineLimit(1) .foregroundStyle(config.textColor) .padding(.vertical, 8) .frame(maxWidth: config.fillAvailableSpace ? .infinity : .none) @@ -81,4 +82,5 @@ extension Knock { Knock.ActionButton(title: "Secondary", config: Knock.ActionButton.Style.secondary.defaultConfig) {} Knock.ActionButton(title: "Tertiary", config: Knock.ActionButton.Style.tertiary.defaultConfig) {} } + .padding() } diff --git a/Sources/Components/Feed/Support/FilterBarView.swift b/Sources/Components/Feed/Support/FilterBarView.swift new file mode 100644 index 0000000..8b45005 --- /dev/null +++ b/Sources/Components/Feed/Support/FilterBarView.swift @@ -0,0 +1,49 @@ +// +// FilterBarView.swift +// +// +// Created by Matt Gardner on 6/24/24. +// + +import Foundation +import SwiftUI + +extension Knock { + struct FilterBarView: View { + var filters: [InAppFeedFilter] + @Binding var selectedFilter: InAppFeedFilter + let theme: FilterBarTheme = FilterBarTheme() + + var body: some View { + ZStack(alignment: .bottom) { + Divider() + .frame(height: 1) + .background(KnockColor.Gray.gray4) + + HStack(spacing: .zero + ) { + ForEach(filters, id: \.self) { option in + Text(option.title) + .font(theme.font) + .foregroundColor(option == selectedFilter ? theme.selectedColor : theme.unselectedColor) + .padding(.vertical, 10) + .padding(.horizontal, 16) + .overlay( + Rectangle() + .frame(height: 1) + .foregroundColor(option == selectedFilter ? theme.selectedColor : .clear), + alignment: .bottom + ) + .onTapGesture { + withAnimation { + selectedFilter = option + } + } + } + Spacer() + } + .padding(.horizontal, 24) + } + } + } +} diff --git a/Sources/Components/Feed/Themes/FilterBarTheme.swift b/Sources/Components/Feed/Themes/FilterBarTheme.swift new file mode 100644 index 0000000..734d333 --- /dev/null +++ b/Sources/Components/Feed/Themes/FilterBarTheme.swift @@ -0,0 +1,30 @@ +// +// FilterBarTheme.swift +// +// +// Created by Matt Gardner on 6/24/24. +// + +import Foundation +import SwiftUI + +extension Knock { + public struct FilterBarTheme { + public var selectedColor: Color? + public var unselectedColor: Color? + public var font: Font? + public var fontColor: Color? + + public init( + selectedColor: Color? = nil, + unselectedColor: Color? = nil, + font: Font? = nil, + avatarViewSize: Color? = nil + ) { + self.selectedColor = selectedColor ?? KnockColor.Accent.accent11 + self.unselectedColor = unselectedColor ?? KnockColor.Gray.gray11 + self.font = font ?? .knock2.weight(.medium) + self.fontColor = fontColor ?? KnockColor.Accent.accent11 + } + } +} diff --git a/Sources/Components/Feed/Themes/InAppFeedTheme.swift b/Sources/Components/Feed/Themes/InAppFeedTheme.swift index ea2b927..f4aef3d 100644 --- a/Sources/Components/Feed/Themes/InAppFeedTheme.swift +++ b/Sources/Components/Feed/Themes/InAppFeedTheme.swift @@ -11,6 +11,7 @@ import SwiftUI extension Knock { public struct InAppFeedTheme { public var rowTheme: FeedNotificationRowTheme = .init() + public var filterBarTheme: FilterBarTheme = FilterBarTheme() public var titleString: String? public var titleFont: Font From e92fbccfce962ca7290bb73dc6c3c12ad0de9f8b Mon Sep 17 00:00:00 2001 From: Matt Gardner Date: Mon, 24 Jun 2024 20:27:27 -0600 Subject: [PATCH 3/4] cleanup --- Sources/Components/Feed/InAppFeedViewModel.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Sources/Components/Feed/InAppFeedViewModel.swift b/Sources/Components/Feed/InAppFeedViewModel.swift index d1ad718..548e502 100644 --- a/Sources/Components/Feed/InAppFeedViewModel.swift +++ b/Sources/Components/Feed/InAppFeedViewModel.swift @@ -11,7 +11,6 @@ import Combine extension Knock { public class InAppFeedViewModel: ObservableObject { @Published public var feed: Knock.Feed = Knock.Feed() /// The current feed data. - // TODO: Double check to make sure tennant behaviour is working as expected. @Published public var filterOptions: [InAppFeedFilter] /// Available filter options for the feed. @Published public var topButtonActions: [Knock.FeedTopActionButtonType]? /// Actions available at the top of the feed interface. @Published internal var brandingRequired: Bool = true @@ -23,8 +22,8 @@ extension Knock { } public var feedClientOptions: Knock.FeedClientOptions /// Configuration options for feed. - public let didTapFeedItemButtonPublisher = PassthroughSubject() /// Publisher for feed item button tap events. - public let didTapFeedItemRowPublisher = PassthroughSubject() /// Publisher for feed item row tap events. + public var didTapFeedItemButtonPublisher = PassthroughSubject() /// Publisher for feed item button tap events. + public var didTapFeedItemRowPublisher = PassthroughSubject() /// Publisher for feed item row tap events. public var shouldHideArchived: Bool { (feedClientOptions.archived == .exclude || feedClientOptions.archived == nil) @@ -36,7 +35,6 @@ extension Knock { public init( feedClientOptions: Knock.FeedClientOptions = .init(), - currentTenantId: String? = nil, currentFilter: InAppFeedFilter? = nil, filterOptions: [InAppFeedFilter]? = nil, topButtonActions: [Knock.FeedTopActionButtonType]? = [.markAllAsRead(), .archiveRead()] @@ -45,7 +43,6 @@ extension Knock { self.filterOptions = filterOptions ?? [.init(scope: .all), .init(scope: .unread), .init(scope: .archived)] self.currentFilter = currentFilter ?? filterOptions?.first ?? .init(scope: .all) self.topButtonActions = topButtonActions - self.feedClientOptions.status = self.currentFilter.scope } From efc24111e710007b8dac4b9d0c8373c53bbc808d Mon Sep 17 00:00:00 2001 From: Matt Gardner Date: Tue, 25 Jun 2024 13:43:44 -0600 Subject: [PATCH 4/4] Update version --- Knock.podspec | 2 +- Sources/Knock.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Knock.podspec b/Knock.podspec index 1dcd2b4..4678c78 100644 --- a/Knock.podspec +++ b/Knock.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "Knock" - spec.version = "1.2.0" + spec.version = "1.2.1" spec.summary = "An SDK to build in-app notifications experiences in Swift with Knock.." spec.description = <<-DESC diff --git a/Sources/Knock.swift b/Sources/Knock.swift index 09b00ee..62e739d 100644 --- a/Sources/Knock.swift +++ b/Sources/Knock.swift @@ -10,7 +10,7 @@ import OSLog // Knock client SDK. public class Knock { - internal static let clientVersion = "1.2.0" + internal static let clientVersion = "1.2.1" public static var shared: Knock = Knock()