0 Commits
19 changed files with 238 additions and 217 deletions

No files matched your search

+5 -5
View File
@@ -8,10 +8,10 @@
// Configuration settings file format documentation can be found at: // Configuration settings file format documentation can be found at:
// https://developer.apple.com/documentation/xcode/adding-a-build-configuration-file-to-your-project // https://developer.apple.com/documentation/xcode/adding-a-build-configuration-file-to-your-project
TEAM_ID = 4UMKR5C7LL TEAM_ID = 8JGND254B7
BUNDLE_ID = com.aarti.NearFuture BUNDLE_ID = com.neon443.NearFuture
BUNDLE_ID_WIDGETS = com.aarti.NearFuture.widgets BUNDLE_ID_WIDGETS = com.neon443.NearFuture.widgets
GROUP_ID = group.NearFuture GROUP_ID = group.NearFuture
VERSION = 5.0.1 VERSION = 5
NAME = Near Future NAME = Near Future
BUILD_NUMBER = 52 BUILD_NUMBER = 1
-8
View File
@@ -19,14 +19,6 @@ struct ArchiveView: View {
ScrollView { ScrollView {
ForEach(filteredEvents) { event in ForEach(filteredEvents) { event in
EventListView(viewModel: viewModel, event: event) EventListView(viewModel: viewModel, event: event)
.contextMenu() {
Button(role: .destructive) {
viewModel.removeEvent(event)
} label: {
Label("Delete", systemImage: "trash")
.tint(.red )
}
}
} }
} }
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
-8
View File
@@ -34,14 +34,6 @@ struct HomeView: View {
if filteredEvents.contains(event) { if filteredEvents.contains(event) {
EventListView(viewModel: viewModel, event: event) EventListView(viewModel: viewModel, event: event)
.id(event) .id(event)
.contextMenu() {
Button(role: .destructive) {
viewModel.removeEvent(event)
} label: {
Label("Delete", systemImage: "trash")
.tint(.red)
}
}
} }
} }
} }
+6 -12
View File
@@ -639,7 +639,6 @@
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
INFOPLIST_KEY_NSHumanReadableCopyright = ""; INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@@ -652,7 +651,7 @@
REGISTER_APP_GROUPS = YES; REGISTER_APP_GROUPS = YES;
SDKROOT = macosx; SDKROOT = macosx;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 6.0; SWIFT_VERSION = 5.0;
}; };
name = Debug; name = Debug;
}; };
@@ -671,7 +670,6 @@
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
INFOPLIST_KEY_NSHumanReadableCopyright = ""; INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@@ -684,7 +682,7 @@
REGISTER_APP_GROUPS = YES; REGISTER_APP_GROUPS = YES;
SDKROOT = macosx; SDKROOT = macosx;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 6.0; SWIFT_VERSION = 5.0;
}; };
name = Release; name = Release;
}; };
@@ -831,13 +829,12 @@
CURRENT_PROJECT_VERSION = "$(BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(BUILD_NUMBER)";
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"NearFuture/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"NearFuture/Preview Content\"";
DEVELOPMENT_TEAM = 4UMKR5C7LL; DEVELOPMENT_TEAM = "$(TEAM_ID)";
ENABLE_HARDENED_RUNTIME = NO; ENABLE_HARDENED_RUNTIME = NO;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "Near Future"; INFOPLIST_KEY_CFBundleDisplayName = "Near Future";
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
@@ -866,8 +863,7 @@
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES; SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Debug; name = Debug;
@@ -885,13 +881,12 @@
CURRENT_PROJECT_VERSION = "$(BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(BUILD_NUMBER)";
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"NearFuture/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"NearFuture/Preview Content\"";
DEVELOPMENT_TEAM = 4UMKR5C7LL; DEVELOPMENT_TEAM = "$(TEAM_ID)";
ENABLE_HARDENED_RUNTIME = NO; ENABLE_HARDENED_RUNTIME = NO;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "Near Future"; INFOPLIST_KEY_CFBundleDisplayName = "Near Future";
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO; INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES; "INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
@@ -917,8 +912,7 @@
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES; SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Release; name = Release;
+1 -9
View File
@@ -35,17 +35,9 @@ struct ArchiveView: View {
) )
} label: { } label: {
EventListView(viewModel: viewModel, event: event) EventListView(viewModel: viewModel, event: event)
.id(event) .id(event.complete)
} }
.transition(.moveAndFadeReversed) .transition(.moveAndFadeReversed)
.contextMenu() {
Button(role: .destructive) {
viewModel.removeEvent(event)
} label: {
Label("Delete", systemImage: "trash")
.tint(.red)
}
}
} }
.padding(.horizontal) .padding(.horizontal)
} }
+12 -14
View File
@@ -16,6 +16,8 @@ struct AddEventView: View {
@State var showNeedsNameAlert: Bool = false @State var showNeedsNameAlert: Bool = false
@State var isSymbolPickerPresented: Bool = false @State var isSymbolPickerPresented: Bool = false
@State private var bye: Bool = false
@FocusState private var focusedField: Field? @FocusState private var focusedField: Field?
private enum Field { private enum Field {
case Name, Notes case Name, Notes
@@ -70,15 +72,15 @@ struct AddEventView: View {
// dscription // dscription
ZStack { ZStack {
if event.notes.isEmpty { TextField("Event Notes", text: $event.notes)
HStack { .textFieldStyle(RoundedBorderTextFieldStyle())
Text("Event Notes") .padding(.trailing, event.notes.isEmpty ? 0 : 30)
.opacity(0.5) .animation(.spring, value: event.notes)
Spacer() .focused($focusedField, equals: Field.Notes)
.submitLabel(.done)
.onSubmit {
focusedField = nil
} }
}
TextEditor(text: $event.notes)
.lineLimit(10)
} }
ColorPicker("Event Color", selection: $event.color.colorBind) ColorPicker("Event Color", selection: $event.color.colorBind)
@@ -150,14 +152,13 @@ struct AddEventView: View {
viewModel.addEvent( viewModel.addEvent(
newEvent: event newEvent: event
) )
bye.toggle()
resetAddEventView() resetAddEventView()
#if canImport(UIKit)
UINotificationFeedbackGenerator().notificationOccurred(.success)
#endif
} label: { } label: {
Label("Save", systemImage: "checkmark") Label("Save", systemImage: "checkmark")
} }
.tint(.accent) .tint(.accent)
.modifier(hapticSuccess(trigger: bye))
.disabled(event.name.isEmpty) .disabled(event.name.isEmpty)
.onTapGesture { .onTapGesture {
if event.name.isEmpty { if event.name.isEmpty {
@@ -179,9 +180,6 @@ struct AddEventView: View {
Button() { Button() {
viewModel.editEvent(event) viewModel.editEvent(event)
dismiss() dismiss()
#if canImport(UIKit)
UINotificationFeedbackGenerator().notificationOccurred(.success)
#endif
} label: { } label: {
Label("Done", systemImage: "checkmark") Label("Done", systemImage: "checkmark")
} }
+31 -2
View File
@@ -90,6 +90,19 @@ struct EventListView: View {
.onTapGesture { .onTapGesture {
openWindow(value: event.id) openWindow(value: event.id)
} }
.contextMenu() {
Button(role: .destructive) {
let eventToModify = viewModel.events.firstIndex() { currEvent in
currEvent.id == event.id
}
if let eventToModify = eventToModify {
viewModel.events.remove(at: eventToModify)
viewModel.saveEvents()
}
} label: {
Label("Delete", systemImage: "trash")
}
}
} }
#else #else
var body: some View { var body: some View {
@@ -163,9 +176,15 @@ struct EventListView: View {
) )
.clipShape(RoundedRectangle(cornerRadius: 15)) .clipShape(RoundedRectangle(cornerRadius: 15))
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
.swipeActions(edge: .trailing, allowsFullSwipe: true) { .contextMenu() {
Button(role: .destructive) { Button(role: .destructive) {
viewModel.removeEvent(event) let eventToModify = viewModel.events.firstIndex() { currEvent in
currEvent.id == event.id
}
if let eventToModify = eventToModify {
viewModel.events.remove(at: eventToModify)
viewModel.saveEvents()
}
} label: { } label: {
Label("Delete", systemImage: "trash") Label("Delete", systemImage: "trash")
} }
@@ -177,6 +196,16 @@ struct EventListView: View {
#Preview("EventListView") { #Preview("EventListView") {
let vm = dummyEventViewModel() let vm = dummyEventViewModel()
ZStack { ZStack {
Color.black
VStack {
ForEach(0..<50) { _ in
Rectangle()
.foregroundStyle(randomColor().opacity(0.5))
.padding(-10)
}
.ignoresSafeArea(.all)
.blur(radius: 5)
}
VStack { VStack {
ForEach(vm.events) { event in ForEach(vm.events) { event in
EventListView( EventListView(
+1 -9
View File
@@ -59,17 +59,9 @@ struct HomeView: View {
) )
} label: { } label: {
EventListView(viewModel: viewModel, event: event) EventListView(viewModel: viewModel, event: event)
.id(event) .id(event.complete)
} }
.transition(.moveAndFade) .transition(.moveAndFade)
.contextMenu() {
Button(role: .destructive) {
viewModel.removeEvent(event)
} label: {
Label("Delete", systemImage: "trash")
.tint(.red)
}
}
} }
.padding(.horizontal) .padding(.horizontal)
// } // }
+57 -11
View File
@@ -66,19 +66,65 @@ struct ImportView: View {
fgColor = .yellow fgColor = .yellow
} }
} }
.alert("Are you sure?", isPresented: $showAlert) { .blur(radius: showAlert ? 2 : 0)
Button(role: .destructive) { Group {
importEvents() Rectangle()
} label: { .frame(maxWidth: .infinity, maxHeight: .infinity)
Text("Replace Events") .foregroundStyle(replaceCurrentEvents ? .red.opacity(0.25) : .black.opacity(0.2))
} .animation(.default, value: replaceCurrentEvents)
Button() { .ignoresSafeArea()
importEvents() ZStack {
} label: { Rectangle()
Text("Add to Events") .clipShape(RoundedRectangle(cornerRadius: 25))
.foregroundStyle(.one) VStack(alignment: .center) {
Text("Are you sure?")
.font(.largeTitle)
.bold()
.foregroundStyle(replaceCurrentEvents ? .red : .two)
.animation(.default, value: replaceCurrentEvents)
Text("This will replace your current events!")
.lineLimit(nil)
.multilineTextAlignment(.center)
.opacity(replaceCurrentEvents ? 1 : 0)
.animation(.default, value: replaceCurrentEvents)
.foregroundStyle(.two)
Toggle("Replace Events", isOn: $replaceCurrentEvents)
.foregroundStyle(.two)
Spacer()
HStack {
Button() {
withAnimation {
showAlert.toggle()
}
importEvents()
} label: {
Text("cancel")
.font(.title2)
.bold()
}
.buttonStyle(BorderedProminentButtonStyle())
Spacer()
Button() {
withAnimation {
showAlert.toggle()
}
importEvents()
} label: {
Text("yes")
.font(.title2)
.bold()
}
.buttonStyle(BorderedProminentButtonStyle())
}
.padding()
}
.padding()
} }
.frame(maxWidth: 250, maxHeight: 250)
} }
.opacity(showAlert ? 1 : 0)
} }
} }
} }
+19 -19
View File
@@ -154,25 +154,25 @@ struct EventWidgetView: View {
.foregroundColor(event.date < Date() ? .red : .primary) .foregroundColor(event.date < Date() ? .red : .primary)
.padding(.trailing, -12) .padding(.trailing, -12)
} else { } else {
// Button( Button(
// intent: CompleteEvent( intent: CompleteEvent(
// eventID: IntentParameter( eventID: IntentParameter(
// title: LocalizedStringResource( title: LocalizedStringResource(
// stringLiteral: event.id.uuidString stringLiteral: event.id.uuidString
// ) )
// ) )
// ) )
// ) { ) {
// if event.complete { if event.complete {
// Circle() Circle()
// .frame(width: 10) .frame(width: 10)
// .foregroundStyle(.green) .foregroundStyle(.green)
// } else { } else {
// Circle() Circle()
// .frame(width: 10) .frame(width: 10)
// .foregroundStyle(.gray) .foregroundStyle(.gray)
// } }
// } }
Text(daysUntilEvent(event.date).long) Text(daysUntilEvent(event.date).long)
.font(.caption) .font(.caption)
.multilineTextAlignment(.trailing) .multilineTextAlignment(.trailing)
-4
View File
@@ -1,4 +0,0 @@
We do not collect any data from your usage of this app.
This means we cannot sell, use or leak any usage data as we simply do not have any.
I am not responsible for any data loss.
Feel free to inspect source code.
+2 -28
View File
@@ -1,32 +1,6 @@
<div align="center"> # NearFuture
<br/>
<p>
<img src="https://github.com/neon443/NearFuture/blob/main/Resources/Assets.xcassets/AppIcon.appiconset/NearFutureIcon.png?raw=true" title="dockphobia" alt="dockphobia icon" width="100" />
</p>
<h3>Near Future</h3>
<p>
<a href="https://apps.apple.com/us/app/near-future-event-tracker/id6744963429">
download
<img alt="GitHub Release" src="https://img.shields.io/itunes/v/6744963429">
</a>
</p>
<p>
make your Dock scared of the mouse
<br/>
<a href="https://neon443.github.io">
made by neon443
</a>
</p>
<br/>
</div>
<div align="center"> [App Store](https://apps.apple.com/us/app/near-future-event-tracker/id6744963429)
<a href="https://shipwrecked.hackclub.com/?t=ghrm" target="_blank">
<img src="https://hc-cdn.hel1.your-objectstorage.com/s/v3/739361f1d440b17fc9e2f74e49fc185d86cbec14_badge.png"
alt="This project is part of Shipwrecked, the world's first hackathon on an island!"
style="width: 25%;">
</a>
</div>
**Near Future** is a SwiftUI App to help people track upcoming events - Holidays, Trips, Birthdays, Weddings, Anniversaries. **Near Future** is a SwiftUI App to help people track upcoming events - Holidays, Trips, Birthdays, Weddings, Anniversaries.
+13 -21
View File
@@ -11,7 +11,7 @@ struct CompleteEventButton: View {
@ObservedObject var viewModel: EventViewModel @ObservedObject var viewModel: EventViewModel
@Binding var event: Event @Binding var event: Event
@MainActor @State var timer: Timer? @State var timer: Timer?
@State var largeTick: Bool = false @State var largeTick: Bool = false
@State var completeInProgress: Bool = false @State var completeInProgress: Bool = false
@State var completeStartTime: Date = .now @State var completeStartTime: Date = .now
@@ -34,28 +34,20 @@ struct CompleteEventButton: View {
completeStartTime = .now completeStartTime = .now
progress = 0 progress = 0
timer = Timer(timeInterval: 0.02, repeats: true) { timer in timer = Timer(timeInterval: 0.01, repeats: true) { timer in
DispatchQueue.main.async { guard completeInProgress else { return }
guard completeInProgress else { return } guard timer.isValid else { return }
guard let timer = self.timer else { return } let elapsed = Date().timeIntervalSince(completeStartTime)
guard timer.isValid else { return } progress = min(1, elapsed)
let elapsed = Date().timeIntervalSince(completeStartTime)
progress = min(1, elapsed) if progress >= 1 {
withAnimation { completeInProgress = false }
viewModel.completeEvent(&event)
#if canImport(UIKit) #if canImport(UIKit)
UIImpactFeedbackGenerator(style: .light).impactOccurred() UINotificationFeedbackGenerator().notificationOccurred(.success)
#endif #endif
timer.invalidate()
if progress >= 1 { progress = 0
withAnimation { completeInProgress = false }
viewModel.completeEvent(&event)
#if canImport(UIKit)
DispatchQueue.main.asyncAfter(deadline: .now()+0.02) {
UINotificationFeedbackGenerator().notificationOccurred(.success)
}
#endif
timer.invalidate()
progress = 0
}
} }
} }
RunLoop.main.add(timer!, forMode: .common) RunLoop.main.add(timer!, forMode: .common)
+2 -2
View File
@@ -22,14 +22,14 @@ extension View {
extension AnyTransition { extension AnyTransition {
static var moveAndFade: AnyTransition { static var moveAndFade: AnyTransition {
.asymmetric( .asymmetric(
insertion: .opacity, insertion: .move(edge: .leading),
removal: .move(edge: .trailing) removal: .move(edge: .trailing)
) )
.combined(with: .opacity) .combined(with: .opacity)
} }
static var moveAndFadeReversed: AnyTransition { static var moveAndFadeReversed: AnyTransition {
.asymmetric( .asymmetric(
insertion: .opacity, insertion: .move(edge: .trailing),
removal: .move(edge: .leading) removal: .move(edge: .leading)
) )
.combined(with: .opacity) .combined(with: .opacity)
+59 -23
View File
@@ -160,24 +160,20 @@ class EventViewModel: ObservableObject, @unchecked Sendable {
eventUUIDs.remove(at: remove) eventUUIDs.remove(at: remove)
} }
let components = getDateComponents(events[index].date) let components = getDateComponents(events[index].date)
//check the notif matches event details //check the notif matches event details
if req.content.title == events[index].name, if req.content.title == events[index].name,
req.content.subtitle == events[index].notes, req.content.subtitle == events[index].notes,
req.trigger == UNCalendarNotificationTrigger(dateMatching: components, repeats: false) { req.trigger == UNCalendarNotificationTrigger(dateMatching: components, repeats: false) {
//if it does, make sure the notif delets if u complete the veent or in the past //if it does, make sure the notif delets if u complete the veent
if events[index].complete || events[index].date > .now { if events[index].complete {
cancelNotif(req.identifier) cancelNotif(req.identifier)
} else {
//dont cancel the notif
} }
} else { } else {
//reschedult it because the event details have changed
cancelNotif(req.identifier) cancelNotif(req.identifier)
scheduleEventNotif(events[index]) scheduleEventNotif(events[index])
} }
} else { } else {
//cancel notif if the event is deleted (doesnt exist/cannot be matched) //cancel if the event is deleted
cancelNotif(req.identifier) cancelNotif(req.identifier)
} }
} }
@@ -186,14 +182,6 @@ class EventViewModel: ObservableObject, @unchecked Sendable {
scheduleEventNotif(event) scheduleEventNotif(event)
} }
} }
Task {
try? await UNUserNotificationCenter.current().setBadgeCount(await getNotifs().count)
}
print(eventUUIDs.count)
print(events.count(where: {!$0.complete && $0.date < .now}))
print(events.count(where: {!$0.complete && $0.date > .now}))
print(events.count(where: {!$0.complete}))
print(events.count(where: {$0.complete}))
} }
// save to local and icloud // save to local and icloud
@@ -252,13 +240,8 @@ class EventViewModel: ObservableObject, @unchecked Sendable {
} }
} }
func removeEvent(_ eventToRemove: Event) { func removeEvent(at index: IndexSet) {
let eventToModify = self.events.firstIndex() { currEvent in events.remove(atOffsets: index)
currEvent.id == eventToRemove.id
}
if let eventToModify = eventToModify {
self.events.remove(at: eventToModify)
}
saveEvents() //sync local and icl saveEvents() //sync local and icl
} }
@@ -507,7 +490,6 @@ func getBuildID() -> String {
return "\(build)" return "\(build)"
} }
@MainActor
func getDevice() -> (sf: String, label: String) { func getDevice() -> (sf: String, label: String) {
#if canImport(UIKit) #if canImport(UIKit)
let asi = ProcessInfo().isiOSAppOnMac let asi = ProcessInfo().isiOSAppOnMac
@@ -525,3 +507,57 @@ func getDevice() -> (sf: String, label: String) {
return (sf: "desktopcomputer", label: "Mac") return (sf: "desktopcomputer", label: "Mac")
#endif #endif
} }
extension Event: AppEntity {
static let defaultQuery = EventQuery()
static var typeDisplayRepresentation: TypeDisplayRepresentation {
TypeDisplayRepresentation("skdfj")
}
var displayRepresentation: DisplayRepresentation {
DisplayRepresentation("eventsss")
}
}
struct EventQuery: EntityQuery, DynamicOptionsProvider {
typealias Entity = Event
@Dependency var vm: EventViewModel
func results() async throws -> some ResultsCollection {
return vm.events
}
// func defaultResult() async -> DefaultValue? {
// return vm.events[0]
// }
func entities(for identifiers: [Entity.ID]) async throws -> [Entity] {
return vm.events
}
func suggestedEntities() async throws -> some ResultsCollection {
return vm.events //lol cba
}
}
struct CompleteEvent: AppIntent {
static var title: LocalizedStringResource = "Complete An Event"
static var description = IntentDescription("Mark an Event as complete.")
@Parameter(title: "Event ID")
var eventID: String
func perform() async throws -> some IntentResult {
print("s")
let viewModel = EventViewModel()
print("hip")
guard let eventUUID = UUID(uuidString: eventID) else {
print(":sdklfajk")
return .result()
}
print("hii")
if let eventToModify = viewModel.events.firstIndex(where: { $0.id == eventUUID }) {
print("hiii")
viewModel.events[eventToModify].complete = true
viewModel.saveEvents()
}
return .result()
}
}
+1 -2
View File
@@ -18,7 +18,6 @@ struct NFSettings: Codable, Equatable {
var prevAppVersion: String = getVersion()+getBuildID() var prevAppVersion: String = getVersion()+getBuildID()
} }
@MainActor
class SettingsViewModel: ObservableObject { class SettingsViewModel: ObservableObject {
@Published var settings: NFSettings = NFSettings() @Published var settings: NFSettings = NFSettings()
@@ -37,7 +36,7 @@ class SettingsViewModel: ObservableObject {
"pink" "pink"
] ]
@Published var device: (sf: String, label: String) = ("", "") @Published var device: (sf: String, label: String)
init(load: Bool = true) { init(load: Bool = true) {
self.device = getDevice() self.device = getDevice()
@@ -8,7 +8,7 @@
import Foundation import Foundation
class SymbolsLoader: ObservableObject { class SymbolsLoader: ObservableObject {
private var allSymbols: [String] = [] @Published var allSymbols: [String] = []
init() { init() {
self.allSymbols = getAllSymbols() self.allSymbols = getAllSymbols()
@@ -16,7 +16,7 @@ class SymbolsLoader: ObservableObject {
func getSymbols(_ searched: String) -> [String] { func getSymbols(_ searched: String) -> [String] {
if searched.isEmpty { if searched.isEmpty {
return [] return allSymbols
} else { } else {
return allSymbols.filter() { $0.localizedCaseInsensitiveContains(searched) } return allSymbols.filter() { $0.localizedCaseInsensitiveContains(searched) }
} }
+1 -11
View File
@@ -31,17 +31,7 @@ struct SymbolsPicker: View {
NavigationStack { NavigationStack {
GeometryReader { geo in GeometryReader { geo in
ScrollView { ScrollView {
if searchInput.isEmpty { if symbols.isEmpty {
HStack {
Image(systemName: "magnifyingglass")
.resizable().scaledToFit()
.frame(width: 30)
Text("Start a Search")
.font(.title)
.bold()
}
.padding()
} else if symbols.isEmpty {
HStack { HStack {
Image(systemName: "magnifyingglass") Image(systemName: "magnifyingglass")
.resizable().scaledToFit() .resizable().scaledToFit()
+26 -27
View File
@@ -8,43 +8,26 @@
import Foundation import Foundation
import SwiftUI import SwiftUI
struct hapticHeavy<T: Equatable>: ViewModifier { struct hapticHeavy: ViewModifier {
var trigger: T var trigger: any Equatable
init(trigger: T) { init(trigger: any Equatable) {
self.trigger = trigger self.trigger = trigger
} }
func body(content: Content) -> some View { func body(content: Content) -> some View {
content if #available(iOS 17, *) {
.onChange(of: trigger) { _ in content
#if canImport(UIKit) .sensoryFeedback(.impact(weight: .heavy, intensity: 1), trigger: trigger)
UIImpactFeedbackGenerator(style: .rigid).impactOccurred() } else {
#endif content
} }
}
}
struct hapticSuccess<T: Equatable>: ViewModifier {
var trigger: T
init(trigger: T) {
self.trigger = trigger
}
func body(content: Content) -> some View {
content
.onChange(of: trigger) { _ in
#if canImport(UIKit)
UINotificationFeedbackGenerator().notificationOccurred(.success)
#endif
}
} }
} }
struct glassButton: ViewModifier { struct glassButton: ViewModifier {
func body(content: Content) -> some View { func body(content: Content) -> some View {
if #available(iOS 19, *) { if #available(iOS 19, macOS 16, *) {
content.buttonStyle(.glass) content.buttonStyle(.glass)
} else { } else {
content.buttonStyle(.borderedProminent) content.buttonStyle(.borderedProminent)
@@ -54,6 +37,22 @@ struct glassButton: ViewModifier {
} }
} }
struct hapticSuccess: ViewModifier {
var trigger: any Equatable
init(trigger: any Equatable) {
self.trigger = trigger
}
func body(content: Content) -> some View {
if #available(iOS 17, *) {
content.sensoryFeedback(.success, trigger: trigger)
} else {
content
}
}
}
struct navigationInlineLarge: ViewModifier { struct navigationInlineLarge: ViewModifier {
func body(content: Content) -> some View { func body(content: Content) -> some View {
#if os(macOS) #if os(macOS)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.