diff --git a/Example/WalletApp/PresentationLayer/Wallet/PushMessages/SubscriptionPresenter.swift b/Example/WalletApp/PresentationLayer/Wallet/PushMessages/SubscriptionPresenter.swift index e5b69d57c..bfddfee6e 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/PushMessages/SubscriptionPresenter.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/PushMessages/SubscriptionPresenter.swift @@ -64,7 +64,8 @@ final class SubscriptionPresenter: ObservableObject { case .idle: Task(priority: .high) { @MainActor in loadingState = .loading - isMoreDataAvailable = try await interactor.fetchHistory(after: messages.last?.id, limit: 50) + let isLoaded = try? await interactor.fetchHistory(after: messages.last?.id, limit: 50) + isMoreDataAvailable = isLoaded ?? false loadingState = .idle } } diff --git a/Example/WalletApp/PresentationLayer/Wallet/PushMessages/SubscriptionView.swift b/Example/WalletApp/PresentationLayer/Wallet/PushMessages/SubscriptionView.swift index 647121270..e68fcb5b6 100644 --- a/Example/WalletApp/PresentationLayer/Wallet/PushMessages/SubscriptionView.swift +++ b/Example/WalletApp/PresentationLayer/Wallet/PushMessages/SubscriptionView.swift @@ -49,7 +49,7 @@ struct SubscriptionView: View { private func notificationView(pushMessage: NotifyMessageViewModel) -> some View { VStack(alignment: .center) { HStack(spacing: 12) { - CacheAsyncImage(url: URL(string: pushMessage.imageUrl)) { phase in + CacheAsyncImage(url: URL(string: pushMessage.imageUrl) ?? presenter.subscriptionViewModel.imageUrl) { phase in if let image = phase.image { image .resizable() @@ -58,6 +58,7 @@ struct SubscriptionView: View { .cornerRadius(10, corners: .allCorners) } else { Color.black + .opacity(0.05) .frame(width: 48, height: 48) .cornerRadius(10, corners: .allCorners) } diff --git a/Sources/Database/SQLiteQuery.swift b/Sources/Database/SQLiteQuery.swift index ce2d8d920..ce6078410 100644 --- a/Sources/Database/SQLiteQuery.swift +++ b/Sources/Database/SQLiteQuery.swift @@ -7,7 +7,7 @@ public struct SqliteQuery { for row in rows { values.append(row.encode().values - .map { "'\($0.value)'" } + .map { "'\($0.value.screen())'" } .joined(separator: ", ")) } @@ -34,7 +34,7 @@ public struct SqliteQuery { } public static func select(table: String, where argument: String, equals value: String) -> String { - return "SELECT * FROM \(table) WHERE \(argument) = '\(value)';" + return "SELECT * FROM \(table) WHERE \(argument) = '\(value.screen())';" } public static func delete(table: String) -> String { @@ -42,7 +42,7 @@ public struct SqliteQuery { } public static func delete(table: String, where argument: String, equals value: String) -> String { - return "DELETE FROM \(table) WHERE \(argument) = '\(value)';" + return "DELETE FROM \(table) WHERE \(argument) = '\(value.screen())';" } } @@ -52,3 +52,10 @@ extension SqliteQuery { case rowsNotFound } } + +private extension String { + + func screen() -> String { + return replacingOccurrences(of: "'", with: "''") + } +}