Skip to content

Commit

Permalink
Fix delete confirm dialog
Browse files Browse the repository at this point in the history
Fix Justify
Fix revenuecat
  • Loading branch information
bourvill committed Feb 5, 2025
1 parent f276431 commit f16dc33
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 24 deletions.
20 changes: 8 additions & 12 deletions App/Features/Entry/EntryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ struct EntryView: View {
}
ToolbarItem(placement: toolbarPlacement) {
FontSizeSelectorView()
.buttonStyle(.plain)
}
ToolbarItem(placement: toolbarPlacement) {
Menu(content: {
Expand All @@ -67,17 +66,14 @@ struct EntryView: View {
})
}
}
.actionSheet(isPresented: $showDeleteConfirm) {
ActionSheet(
title: Text("Confirm delete?"),
buttons: [
.destructive(Text("Delete")) {
context.delete(entry)
dismiss()
},
.cancel(),
]
)
.alert("Confirm delete?", isPresented: $showDeleteConfirm) {
Button(role: .destructive, action: {
context.delete(entry)
dismiss()
}, label: {
Text("Delete")
})
Button("Cancel", role: .cancel) {}
}
.sheet(isPresented: $showTag) {
TagListFor(entry: entry)
Expand Down
2 changes: 1 addition & 1 deletion App/Features/Entry/UI/FontSizeSelectorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct FontSizeSelectorView: View {
var body: some View {
HStack {
Button(action: {
withAnimation {
withAnimation(.smooth) {
showSelector = !showSelector
}
}, label: {
Expand Down
12 changes: 8 additions & 4 deletions App/Features/Entry/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ import WebKit
}

func webViewToLastPosition() {
DispatchQueue.main.async {
self.webView.wkWebView.scrollView.setContentOffset(CGPoint(x: 0.0, y: self.webView.entry.screenPositionForWebView), animated: true)
}
webView.wkWebView.scrollView.setContentOffset(
CGPoint(
x: 0.0,
y: webView.entry.screenPositionForWebView
),
animated: true
)
}

func webView(_ webView: WKWebView, didFinish _: WKNavigation!) {
Expand Down Expand Up @@ -77,7 +81,7 @@ import WebKit
func makeUIView(context: Context) -> WKWebView {
wkWebView.navigationDelegate = context.coordinator
wkWebView.scrollView.delegate = context.coordinator
wkWebView.load(content: entry.content, justify: false)
wkWebView.load(content: entry.content, justify: UserDefaults.standard.bool(forKey: "justifyArticle"))

return wkWebView
}
Expand Down
5 changes: 5 additions & 0 deletions App/Features/WallabagPlus/WallabagPlusStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import RevenueCat

@Observable
final class WallabagPlusStore {
private let userDefaultKey = "REVENUECAT_SYNCED"
@ObservationIgnored @BundleKey("REVENUECAT_KEY")
private var revenueCatKey: String

Expand All @@ -14,6 +15,10 @@ final class WallabagPlusStore {
}

func checkPro() async {
if !UserDefaults.standard.bool(forKey: userDefaultKey) {
_ = try? await Purchases.shared.syncPurchases()
UserDefaults.standard.set(true, forKey: userDefaultKey)
}
proUnlocked = await (try? Purchases.shared.customerInfo(fetchPolicy: .fetchCurrent).entitlements.active.keys.contains("pro")) ?? false
}
}
8 changes: 3 additions & 5 deletions SharedLib/Sources/SharedLib/Extension/WKWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import WebKit

public extension WKWebView {
func load(content: String?, justify: Bool) {
DispatchQueue.main.async { [weak self] in
guard let content = self?.contentForWebView(content, justify: justify) else { return }
self?.loadHTMLString(content, baseURL: Bundle.main.bundleURL)
}
guard let content = contentForWebView(content, justify: justify) else { return }
loadHTMLString(content, baseURL: Bundle.main.bundleURL)
}

func contentForWebView(_ content: String?, justify: Bool) -> String? {
nonisolated func contentForWebView(_ content: String?, justify: Bool) -> String? {
do {
guard let content else { return nil }
let html = try String(contentsOfFile: Bundle.main.path(forResource: "article", ofType: "html")!)
Expand Down
4 changes: 2 additions & 2 deletions wallabag.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
MARKETING_VERSION = 7.5.0;
MARKETING_VERSION = 7.5.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1329,7 +1329,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
MARKETING_VERSION = 7.5.0;
MARKETING_VERSION = 7.5.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down

0 comments on commit f16dc33

Please sign in to comment.