|
@@ -749,6 +749,7 @@ private extension ViewController {
|
|
|
|
|
|
|
|
private func showPaywall() {
|
|
private func showPaywall() {
|
|
|
if let existing = paywallWindow {
|
|
if let existing = paywallWindow {
|
|
|
|
|
+ animatePaywallPresentation(existing)
|
|
|
existing.makeKeyAndOrderFront(nil)
|
|
existing.makeKeyAndOrderFront(nil)
|
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
|
return
|
|
return
|
|
@@ -777,9 +778,11 @@ private extension ViewController {
|
|
|
panel.standardWindowButton(.zoomButton)?.isHidden = true
|
|
panel.standardWindowButton(.zoomButton)?.isHidden = true
|
|
|
panel.center()
|
|
panel.center()
|
|
|
panel.contentViewController = controller
|
|
panel.contentViewController = controller
|
|
|
|
|
+ panel.alphaValue = 0
|
|
|
panel.makeKeyAndOrderFront(nil)
|
|
panel.makeKeyAndOrderFront(nil)
|
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
|
paywallWindow = panel
|
|
paywallWindow = panel
|
|
|
|
|
+ animatePaywallPresentation(panel)
|
|
|
|
|
|
|
|
Task { [weak self] in
|
|
Task { [weak self] in
|
|
|
guard let self else { return }
|
|
guard let self else { return }
|
|
@@ -788,6 +791,28 @@ private extension ViewController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private func animatePaywallPresentation(_ window: NSWindow) {
|
|
|
|
|
+ let finalFrame = window.frame
|
|
|
|
|
+ let targetScreen = window.screen ?? NSScreen.main
|
|
|
|
|
+ let startY: CGFloat
|
|
|
|
|
+ if let screen = targetScreen {
|
|
|
|
|
+ startY = screen.visibleFrame.maxY + 12
|
|
|
|
|
+ } else {
|
|
|
|
|
+ startY = finalFrame.origin.y + 120
|
|
|
|
|
+ }
|
|
|
|
|
+ let startFrame = NSRect(x: finalFrame.origin.x, y: startY, width: finalFrame.width, height: finalFrame.height)
|
|
|
|
|
+
|
|
|
|
|
+ window.setFrame(startFrame, display: false)
|
|
|
|
|
+ window.alphaValue = 0
|
|
|
|
|
+
|
|
|
|
|
+ NSAnimationContext.runAnimationGroup { context in
|
|
|
|
|
+ context.duration = 0.28
|
|
|
|
|
+ context.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
|
|
|
|
|
+ window.animator().alphaValue = 1
|
|
|
|
|
+ window.animator().setFrame(finalFrame, display: true)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@objc private func closePaywallClicked(_ sender: Any?) {
|
|
@objc private func closePaywallClicked(_ sender: Any?) {
|
|
|
if let win = paywallWindow {
|
|
if let win = paywallWindow {
|
|
|
win.performClose(nil)
|
|
win.performClose(nil)
|