Skip to content
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
2 changes: 2 additions & 0 deletions .github/workflows/nudge-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
- name: Archive (ad-hoc signed)
env:
VERSION: ${{ steps.version.outputs.version }}
KLIPY_API_KEY: ${{ secrets.KLIPY_API_KEY }}
run: |
set -euo pipefail
xcodebuild archive \
Expand All @@ -59,6 +60,7 @@ jobs:
-configuration Release \
-destination 'generic/platform=macOS' \
-archivePath build/Nudge.xcarchive \
KLIPY_API_KEY="${KLIPY_API_KEY}" \
CODE_SIGN_IDENTITY="-" \
CODE_SIGN_STYLE=Manual \
CODE_SIGNING_REQUIRED=YES \
Expand Down
44 changes: 0 additions & 44 deletions .github/workflows/static.yml

This file was deleted.

49 changes: 43 additions & 6 deletions Nudge.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
14D570C92C5F38890011E668 /* NudgeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14D570C82C5F38890011E668 /* NudgeViewModel.swift */; };
14E9FEAE2C7325770062E83F /* Button+Bouncing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14E9FEAD2C7325770062E83F /* Button+Bouncing.swift */; };
14FC6E502C7DED5600C7BEA5 /* DataTypes+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14FC6E4F2C7DED5600C7BEA5 /* DataTypes+Extensions.swift */; };
1FB98063B994504FE32D0A59 /* NudgePasswordPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8405B521985C8120633C3EE /* NudgePasswordPickerView.swift */; };
4056511EC8FE68B0B8A7AE0F /* NudgeRoster.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74A93A85D5B4F91DCE1C994D /* NudgeRoster.swift */; };
5D801A1AF37495A88EB59F2E /* NudgeTeamSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = F41DF965EE177D3892EF7B81 /* NudgeTeamSecret.swift */; };
9F18C9B556E15061567A3991 /* NudgeStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 407FCC9217CDCECC553F619E /* NudgeStats.swift */; };
AAA000000000000000000020 /* NudgeConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA000000000000000000010 /* NudgeConstants.swift */; };
AAA000000000000000000021 /* NudgeIdentity.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA000000000000000000011 /* NudgeIdentity.swift */; };
AAA000000000000000000022 /* NudgeTransport.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA000000000000000000012 /* NudgeTransport.swift */; };
Expand All @@ -50,6 +54,10 @@
B1C448962C9712C4001F0858 /* ActionBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1C448952C9712C4001F0858 /* ActionBar.swift */; };
B1CE8CFE2C6F659400DD9871 /* KeyboardShortcutsHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1CE8CFD2C6F659400DD9871 /* KeyboardShortcutsHelper.swift */; };
B1FEB4992C7686630066EBBC /* PanGesture.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1FEB4982C7686630066EBBC /* PanGesture.swift */; };
B8AC936D553061A2C59E57CE /* NudgeGifService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A70506F0C82739025A3466C /* NudgeGifService.swift */; };
F25174743AD7C7244255A32F /* GifPickerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA2E3C198DF89E1F33A29653 /* GifPickerWindowController.swift */; };
F7291FB50E023ED8310236B8 /* NudgeGifPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B4A5914D74B087D00FF461 /* NudgeGifPickerView.swift */; };
FBE51232E3221DE7A6FC71DF /* AnimatedGifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89B24867B6257865F7198E6 /* AnimatedGifView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -97,6 +105,10 @@
14D570C82C5F38890011E668 /* NudgeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NudgeViewModel.swift; sourceTree = "<group>"; };
14E9FEAD2C7325770062E83F /* Button+Bouncing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Button+Bouncing.swift"; sourceTree = "<group>"; };
14FC6E4F2C7DED5600C7BEA5 /* DataTypes+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DataTypes+Extensions.swift"; sourceTree = "<group>"; };
1A70506F0C82739025A3466C /* NudgeGifService.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NudgeGifService.swift; sourceTree = "<group>"; };
407FCC9217CDCECC553F619E /* NudgeStats.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NudgeStats.swift; sourceTree = "<group>"; };
57B4A5914D74B087D00FF461 /* NudgeGifPickerView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NudgeGifPickerView.swift; sourceTree = "<group>"; };
74A93A85D5B4F91DCE1C994D /* NudgeRoster.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NudgeRoster.swift; sourceTree = "<group>"; };
AAA000000000000000000010 /* NudgeConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NudgeConstants.swift; sourceTree = "<group>"; };
AAA000000000000000000011 /* NudgeIdentity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NudgeIdentity.swift; sourceTree = "<group>"; };
AAA000000000000000000012 /* NudgeTransport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NudgeTransport.swift; sourceTree = "<group>"; };
Expand All @@ -111,6 +123,10 @@
B1C448952C9712C4001F0858 /* ActionBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionBar.swift; sourceTree = "<group>"; };
B1CE8CFD2C6F659400DD9871 /* KeyboardShortcutsHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardShortcutsHelper.swift; sourceTree = "<group>"; };
B1FEB4982C7686630066EBBC /* PanGesture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PanGesture.swift; sourceTree = "<group>"; };
C89B24867B6257865F7198E6 /* AnimatedGifView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AnimatedGifView.swift; sourceTree = "<group>"; };
E8405B521985C8120633C3EE /* NudgePasswordPickerView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NudgePasswordPickerView.swift; sourceTree = "<group>"; };
F41DF965EE177D3892EF7B81 /* NudgeTeamSecret.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = NudgeTeamSecret.swift; sourceTree = "<group>"; };
FA2E3C198DF89E1F33A29653 /* GifPickerWindowController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = GifPickerWindowController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFileSystemSynchronizedRootGroup section */
Expand Down Expand Up @@ -235,6 +251,7 @@
B186542F2C6F455E000B926A /* Notch */,
9A0887332C7AFF7E00C160EA /* Tabs */,
B186542E2C6F453B000B926A /* Music */,
6CC064DE76441B5399B791BD /* GifPicker */,
);
path = components;
sourceTree = "<group>";
Expand Down Expand Up @@ -350,6 +367,16 @@
path = models;
sourceTree = "<group>";
};
6CC064DE76441B5399B791BD /* GifPicker */ = {
isa = PBXGroup;
children = (
57B4A5914D74B087D00FF461 /* NudgeGifPickerView.swift */,
FA2E3C198DF89E1F33A29653 /* GifPickerWindowController.swift */,
);
name = GifPicker;
path = GifPicker;
sourceTree = "<group>";
};
9A0887332C7AFF7E00C160EA /* Tabs */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -377,6 +404,12 @@
AAA000000000000000000013 /* NudgeNotifier.swift */,
AAA000000000000000000014 /* NudgeNotchView.swift */,
AAA000000000000000000015 /* NudgeIdentityPickerView.swift */,
F41DF965EE177D3892EF7B81 /* NudgeTeamSecret.swift */,
74A93A85D5B4F91DCE1C994D /* NudgeRoster.swift */,
407FCC9217CDCECC553F619E /* NudgeStats.swift */,
E8405B521985C8120633C3EE /* NudgePasswordPickerView.swift */,
1A70506F0C82739025A3466C /* NudgeGifService.swift */,
C89B24867B6257865F7198E6 /* AnimatedGifView.swift */,
);
path = Nudge;
sourceTree = "<group>";
Expand Down Expand Up @@ -583,6 +616,14 @@
14FC6E502C7DED5600C7BEA5 /* DataTypes+Extensions.swift in Sources */,
14288E0C2C6F8EC000B9F80C /* AppIcons.swift in Sources */,
B19016242CC15B5000E3F12E /* Constants.swift in Sources */,
5D801A1AF37495A88EB59F2E /* NudgeTeamSecret.swift in Sources */,
4056511EC8FE68B0B8A7AE0F /* NudgeRoster.swift in Sources */,
9F18C9B556E15061567A3991 /* NudgeStats.swift in Sources */,
1FB98063B994504FE32D0A59 /* NudgePasswordPickerView.swift in Sources */,
B8AC936D553061A2C59E57CE /* NudgeGifService.swift in Sources */,
FBE51232E3221DE7A6FC71DF /* AnimatedGifView.swift in Sources */,
F7291FB50E023ED8310236B8 /* NudgeGifPickerView.swift in Sources */,
F25174743AD7C7244255A32F /* GifPickerWindowController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -733,9 +774,7 @@
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Nudge/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Nudge;
Expand Down Expand Up @@ -785,9 +824,7 @@
DEVELOPMENT_TEAM = Q37KAF726J;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Nudge/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Nudge;
Expand Down
3 changes: 2 additions & 1 deletion Nudge/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ struct ContentView: View {
private func handleIncoming(_ ping: NudgePing?) {
guard let ping else { return }
autoCloseTask?.cancel()
NudgeNotifier.postBackup(sender: ping.sender, message: ping.message)
let backupText = ping.message ?? (ping.gif != nil ? "sent a GIF 🎬" : nil)
NudgeNotifier.postBackup(sender: ping.sender, message: backupText)
if Defaults[.nudgePlaySoundOnReceive] {
NSSound(named: NSSound.Name("Pop"))?.play()
}
Expand Down
2 changes: 2 additions & 0 deletions Nudge/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
<array>
<dict/>
</array>
<key>KlipyAPIKey</key>
<string>$(KLIPY_API_KEY)</string>
</dict>
</plist>
72 changes: 72 additions & 0 deletions Nudge/Nudge/AnimatedGifView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// AnimatedGifView.swift
// Nudge
//
// Renders an animated GIF from a remote URL. AppKit's NSImageView plays
// multi-frame GIFs natively, so no third-party dependency is needed. The
// fetched data is cached in-process so re-renders don't re-download.
//

import SwiftUI
import AppKit

/// Lightweight in-process cache of downloaded GIF data, keyed by URL.
@MainActor
private final class GifDataCache {
static let shared = GifDataCache()
private var store: [URL: Data] = [:]
private let maxEntries = 40

func data(for url: URL) -> Data? { store[url] }

func insert(_ data: Data, for url: URL) {
if store.count >= maxEntries, let first = store.keys.first {
store.removeValue(forKey: first)
}
store[url] = data
}
}

struct AnimatedGifView: NSViewRepresentable {
let url: URL

func makeNSView(context: Context) -> NSImageView {
let view = NSImageView()
view.imageScaling = .scaleProportionallyDown
view.animates = true
view.canDrawSubviewsIntoLayer = true
view.setContentHuggingPriority(.defaultLow, for: .horizontal)
view.setContentHuggingPriority(.defaultLow, for: .vertical)
context.coordinator.loadedURL = url
load(into: view)
return view
}

func updateNSView(_ nsView: NSImageView, context: Context) {
// Only reload if the URL changed (avoid restarting playback each pass).
if context.coordinator.loadedURL != url {
context.coordinator.loadedURL = url
load(into: nsView)
}
}

func makeCoordinator() -> Coordinator { Coordinator() }

final class Coordinator {
var loadedURL: URL?
}

private func load(into view: NSImageView) {
if let cached = GifDataCache.shared.data(for: url) {
view.image = NSImage(data: cached)
return
}
let url = self.url
Task { @MainActor in
guard let (data, _) = try? await URLSession.shared.data(from: url),
let image = NSImage(data: data) else { return }
GifDataCache.shared.insert(data, for: url)
view.image = image
}
}
}
12 changes: 4 additions & 8 deletions Nudge/Nudge/NudgeConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@

import Foundation

// Shared 12-char lowercase nonce. Every Ontora teammate's build MUST have the
// same value here. Rotate by changing the constant and shipping a new build.
let nudgeNonce = "k4n9pq7vx2tm"
// Names are no longer hardcoded — users type their own during onboarding,
// and the roster auto-discovers teammates via "hello" broadcasts on the
// shared team topic.

let nudgeUsers: [String] = ["Max", "Leon", "David"]

func ntfyTopic(for user: String) -> String {
"nudge-ontora-\(user.lowercased())-\(nudgeNonce)"
}
let nudgeMaxNameLength = 32
Loading
Loading