Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sample] Regression fixes #1290

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
}
Expand Down
13 changes: 10 additions & 3 deletions Sources/Database/SQLiteQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: ", "))
}

Expand All @@ -34,15 +34,15 @@ 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 {
return "DELETE FROM \(table);"
}

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())';"
}
}

Expand All @@ -52,3 +52,10 @@ extension SqliteQuery {
case rowsNotFound
}
}

private extension String {

func screen() -> String {
return replacingOccurrences(of: "'", with: "''")
}
}
Loading