Compare commits
No files matched your search
@@ -8,10 +8,9 @@
|
|||||||
// 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
|
|
||||||
GROUP_ID = group.NearFuture
|
GROUP_ID = group.NearFuture
|
||||||
VERSION = 5.0.1
|
VERSION = 3.0.1
|
||||||
NAME = Near Future
|
NAME = Near Future
|
||||||
BUILD_NUMBER = 52
|
BUILD_NUMBER = 1
|
||||||
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 609 KiB |
|
After Width: | Height: | Size: 534 KiB |
|
After Width: | Height: | Size: 13 KiB |
@@ -1,40 +0,0 @@
|
|||||||
//
|
|
||||||
// AboutView.swift
|
|
||||||
// MacNearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 28/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct AboutView: View {
|
|
||||||
var body: some View {
|
|
||||||
VStack(alignment: .center) {
|
|
||||||
Image(nsImage: #imageLiteral(resourceName: "NearFutureIcon.png"))
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 100)
|
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 25))
|
|
||||||
Text("Near Future")
|
|
||||||
.bold()
|
|
||||||
.monospaced()
|
|
||||||
.font(.title)
|
|
||||||
Text("Version " + getVersion() + " (\(getBuildID()))")
|
|
||||||
.padding(.bottom)
|
|
||||||
Text("© 2024-2025 neon443, Inc")
|
|
||||||
.padding(.bottom)
|
|
||||||
Link("Developer Website", destination: URL(string: "https://neon443.xyz")!)
|
|
||||||
}
|
|
||||||
.padding()
|
|
||||||
.padding()
|
|
||||||
.containerBackground(.ultraThinMaterial, for: .window)
|
|
||||||
.toolbar(removing: .title)
|
|
||||||
.toolbarBackground(.hidden, for: .windowToolbar)
|
|
||||||
.windowMinimizeBehavior(.disabled)
|
|
||||||
.windowFullScreenBehavior(.disabled)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
AboutView()
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>com.apple.developer.icloud-container-identifiers</key>
|
|
||||||
<array/>
|
|
||||||
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
|
|
||||||
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
|
|
||||||
<key>com.apple.security.app-sandbox</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.application-groups</key>
|
|
||||||
<array>
|
|
||||||
<string>group.NearFuture</string>
|
|
||||||
</array>
|
|
||||||
<key>com.apple.security.files.user-selected.read-only</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
//
|
|
||||||
// MacNearFutureApp.swift
|
|
||||||
// MacNearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 21/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
@main
|
|
||||||
struct NearFutureApp: App {
|
|
||||||
@Environment(\.openWindow) var openWindow
|
|
||||||
@StateObject var viewModel: EventViewModel = EventViewModel()
|
|
||||||
@StateObject var settingsModel: SettingsViewModel = SettingsViewModel()
|
|
||||||
|
|
||||||
var body: some Scene {
|
|
||||||
WindowGroup {
|
|
||||||
ContentView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
settingsModel: settingsModel
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.defaultSize(width: 550, height: 650)
|
|
||||||
.commands {
|
|
||||||
CommandGroup(replacing: CommandGroupPlacement.appInfo) {
|
|
||||||
Button("About Near Future") {
|
|
||||||
openWindow(id: "about")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
NearFutureCommands()
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowGroup("Edit Event", for: Event.ID.self) { $eventID in
|
|
||||||
if viewModel.events.first(where: {$0.id == eventID}) == nil {
|
|
||||||
AddEventView(
|
|
||||||
viewModel: viewModel
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
EditEventView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
event: Binding(
|
|
||||||
get: {
|
|
||||||
viewModel.events.first(where: {$0.id == eventID}) ?? viewModel.template
|
|
||||||
},
|
|
||||||
set: { newValue in
|
|
||||||
viewModel.editEvent(newValue)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.defaultSize(width: 480, height: 550)
|
|
||||||
.windowIdealSize(.fitToContent)
|
|
||||||
.restorationBehavior(.disabled)
|
|
||||||
|
|
||||||
Window("About Near Future", id: "about") {
|
|
||||||
AboutView()
|
|
||||||
}
|
|
||||||
.windowBackgroundDragBehavior(.enabled)
|
|
||||||
.windowResizability(.contentSize)
|
|
||||||
.restorationBehavior(.disabled)
|
|
||||||
.defaultPosition(UnitPoint.center)
|
|
||||||
|
|
||||||
Settings {
|
|
||||||
SettingsView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
settingsModel: settingsModel
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
//
|
|
||||||
// NFCommands.swift
|
|
||||||
// MacNearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 21/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct NearFutureCommands: Commands {
|
|
||||||
var body: some Commands {
|
|
||||||
CommandGroup(after: CommandGroupPlacement.appInfo) {
|
|
||||||
// Text("hi")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
//
|
|
||||||
// ArchiveView.swift
|
|
||||||
// MacNearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 28/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct ArchiveView: View {
|
|
||||||
@StateObject var viewModel: EventViewModel
|
|
||||||
@StateObject var settingsModel: SettingsViewModel
|
|
||||||
|
|
||||||
var filteredEvents: [Event] {
|
|
||||||
return viewModel.events.filter { $0.complete }
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
ScrollView {
|
|
||||||
ForEach(filteredEvents) { event in
|
|
||||||
EventListView(viewModel: viewModel, event: event)
|
|
||||||
.contextMenu() {
|
|
||||||
Button(role: .destructive) {
|
|
||||||
viewModel.removeEvent(event)
|
|
||||||
} label: {
|
|
||||||
Label("Delete", systemImage: "trash")
|
|
||||||
.tint(.red )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.scrollContentBackground(.hidden)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
ArchiveView(
|
|
||||||
viewModel: dummyEventViewModel(),
|
|
||||||
settingsModel: dummySettingsViewModel()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
//
|
|
||||||
// ContentView.swift
|
|
||||||
// MacNearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 21/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct ContentView: View {
|
|
||||||
@StateObject var viewModel: EventViewModel
|
|
||||||
@StateObject var settingsModel: SettingsViewModel
|
|
||||||
|
|
||||||
@State private var showAddEventView: Bool = false
|
|
||||||
@State private var symbolSearchInput: String = ""
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
NavigationSplitView {
|
|
||||||
List {
|
|
||||||
NavigationLink {
|
|
||||||
HomeView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
settingsModel: settingsModel
|
|
||||||
)
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "house")
|
|
||||||
Text("Home")
|
|
||||||
}
|
|
||||||
NavigationLink {
|
|
||||||
ArchiveView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
settingsModel: settingsModel
|
|
||||||
)
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "tray.full")
|
|
||||||
Text("Archive")
|
|
||||||
}
|
|
||||||
NavigationLink {
|
|
||||||
SymbolsPicker(
|
|
||||||
selection: .constant(""),
|
|
||||||
browsing: true
|
|
||||||
)
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "star.circle")
|
|
||||||
Text("Symbols")
|
|
||||||
}
|
|
||||||
NavigationLink {
|
|
||||||
SettingsView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
settingsModel: settingsModel
|
|
||||||
)
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "gear")
|
|
||||||
Text("Settings")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} detail: {
|
|
||||||
Text("Welcome to Near Future")
|
|
||||||
}
|
|
||||||
.tint(settingsModel.settings.tint.color)
|
|
||||||
.frame(minWidth: 450, minHeight: 550)
|
|
||||||
.containerBackground(.regularMaterial, for: .window)
|
|
||||||
.sheet(isPresented: $settingsModel.settings.showWhatsNew) {
|
|
||||||
WhatsNewView(settingsModel: settingsModel)
|
|
||||||
.presentationSizing(.form)
|
|
||||||
}
|
|
||||||
.sheet(isPresented: $showAddEventView) {
|
|
||||||
AddEventView(
|
|
||||||
viewModel: viewModel
|
|
||||||
)
|
|
||||||
.presentationSizing(.page)
|
|
||||||
}
|
|
||||||
.toolbar {
|
|
||||||
Button() {
|
|
||||||
showAddEventView.toggle()
|
|
||||||
} label: {
|
|
||||||
Label("New", systemImage: "plus")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
ContentView(
|
|
||||||
viewModel: dummyEventViewModel(),
|
|
||||||
settingsModel: dummySettingsViewModel()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
//
|
|
||||||
// HomeView.swift
|
|
||||||
// MacNearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 28/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct HomeView: View {
|
|
||||||
@StateObject var viewModel: EventViewModel
|
|
||||||
@StateObject var settingsModel: SettingsViewModel
|
|
||||||
|
|
||||||
@State private var searchInput: String = ""
|
|
||||||
|
|
||||||
var filteredEvents: [Event] {
|
|
||||||
if searchInput.isEmpty {
|
|
||||||
if settingsModel.settings.showCompletedInHome {
|
|
||||||
return viewModel.events
|
|
||||||
} else {
|
|
||||||
return viewModel.events.filter() { !$0.complete }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return viewModel.events.filter {
|
|
||||||
$0.name.localizedCaseInsensitiveContains(searchInput) ||
|
|
||||||
$0.notes.localizedCaseInsensitiveContains(searchInput)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
ScrollView {
|
|
||||||
ForEach(viewModel.events) { event in
|
|
||||||
if filteredEvents.contains(event) {
|
|
||||||
EventListView(viewModel: viewModel, event: event)
|
|
||||||
.id(event)
|
|
||||||
.contextMenu() {
|
|
||||||
Button(role: .destructive) {
|
|
||||||
viewModel.removeEvent(event)
|
|
||||||
} label: {
|
|
||||||
Label("Delete", systemImage: "trash")
|
|
||||||
.tint(.red)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.searchable(text: $searchInput)
|
|
||||||
.scrollContentBackground(.hidden)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
HomeView(
|
|
||||||
viewModel: dummyEventViewModel(),
|
|
||||||
settingsModel: dummySettingsViewModel()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
//
|
|
||||||
// SettingsView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 13/06/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct SettingsView: View {
|
|
||||||
@ObservedObject var viewModel: EventViewModel
|
|
||||||
@ObservedObject var settingsModel: SettingsViewModel
|
|
||||||
|
|
||||||
@State private var importStr: String = ""
|
|
||||||
|
|
||||||
func changeIcon(to toIcon: String) {
|
|
||||||
if let nsimage = NSImage(named: toIcon) {
|
|
||||||
let nsImageView = NSImageView(image: nsimage)
|
|
||||||
nsImageView.frame = NSRect(x: 0, y: 0, width: 128, height: 128)
|
|
||||||
NSApplication.shared.dockTile.contentView = nsImageView
|
|
||||||
NSApplication.shared.dockTile.display()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
NavigationStack {
|
|
||||||
List {
|
|
||||||
ScrollView(.horizontal) {
|
|
||||||
HStack {
|
|
||||||
ForEach(settingsModel.accentChoices, id: \.self) { choice in
|
|
||||||
let color = Color(nsColor: NSColor(named: "uiColors/\(choice)")!)
|
|
||||||
ZStack {
|
|
||||||
Button() {
|
|
||||||
settingsModel.changeTint(to: choice)
|
|
||||||
changeIcon(to: choice)
|
|
||||||
} label: {
|
|
||||||
Circle()
|
|
||||||
.foregroundStyle(color)
|
|
||||||
.frame(width: 30)
|
|
||||||
}
|
|
||||||
.buttonStyle(.plain)
|
|
||||||
if ColorCodable(color) == settingsModel.settings.tint {
|
|
||||||
let needContrast: Bool = ColorCodable(color) == settingsModel.settings.tint
|
|
||||||
Circle()
|
|
||||||
.foregroundStyle(needContrast ? .two : .one)
|
|
||||||
.frame(width: 10)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Button("Show What's New") {
|
|
||||||
settingsModel.settings.showWhatsNew = true
|
|
||||||
}
|
|
||||||
Toggle("Show completed Events in Home", isOn: $settingsModel.settings.showCompletedInHome)
|
|
||||||
.onChange(of: settingsModel.settings.showCompletedInHome) { _ in
|
|
||||||
settingsModel.saveSettings()
|
|
||||||
}
|
|
||||||
NavigationLink() {
|
|
||||||
List {
|
|
||||||
if !settingsModel.notifsGranted {
|
|
||||||
Text("\(Image(systemName: "xmark")) Notifications disabled for Near Future")
|
|
||||||
.foregroundStyle(.red)
|
|
||||||
Button("Request Notifications") {
|
|
||||||
Task.detached {
|
|
||||||
let requestNotifsResult = await requestNotifs()
|
|
||||||
await MainActor.run {
|
|
||||||
settingsModel.notifsGranted = requestNotifsResult
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Text("\(Image(systemName: "checkmark")) Notifications enabled for Near Future")
|
|
||||||
.foregroundStyle(.green)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "bell.badge.fill")
|
|
||||||
Text("Notifications")
|
|
||||||
}
|
|
||||||
NavigationLink() {
|
|
||||||
iCloudSettingsView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
settingsModel: settingsModel
|
|
||||||
)
|
|
||||||
} label: {
|
|
||||||
HStack {
|
|
||||||
Image(systemName: "icloud.fill")
|
|
||||||
Text("iCloud")
|
|
||||||
Spacer()
|
|
||||||
Circle()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
.foregroundStyle(viewModel.iCloudStatusColor)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onAppear {
|
|
||||||
viewModel.sync()
|
|
||||||
viewModel.updateiCStatus()
|
|
||||||
}
|
|
||||||
NavigationLink() {
|
|
||||||
ImportView(viewModel: viewModel, importStr: $importStr)
|
|
||||||
} label: {
|
|
||||||
Label("Import Events", systemImage: "tray.and.arrow.down.fill")
|
|
||||||
.foregroundStyle(.one)
|
|
||||||
}
|
|
||||||
NavigationLink() {
|
|
||||||
ExportView(viewModel: viewModel)
|
|
||||||
} label: {
|
|
||||||
Label("Export Events", systemImage: "square.and.arrow.up")
|
|
||||||
.foregroundStyle(.one)
|
|
||||||
}
|
|
||||||
|
|
||||||
Text("Tip")
|
|
||||||
.font(.subheadline)
|
|
||||||
Text("Near Future has Widgets!")
|
|
||||||
|
|
||||||
Text("Danger Zone")
|
|
||||||
.foregroundStyle(.red)
|
|
||||||
.font(.subheadline)
|
|
||||||
Button("Delete local data", role: .destructive) {
|
|
||||||
viewModel.dangerClearLocalData()
|
|
||||||
}
|
|
||||||
Button("Delete iCloud data", role: .destructive) {
|
|
||||||
viewModel.dangerCleariCloudData()
|
|
||||||
}
|
|
||||||
Button("Delete all data", role: .destructive) {
|
|
||||||
viewModel.dangerClearLocalData()
|
|
||||||
viewModel.dangerCleariCloudData()
|
|
||||||
}
|
|
||||||
|
|
||||||
Text("Debug")
|
|
||||||
.foregroundStyle(.red)
|
|
||||||
.font(.subheadline)
|
|
||||||
Button("Reset UserDefaults", role: .destructive) {
|
|
||||||
viewModel.dangerResetLocalData()
|
|
||||||
}
|
|
||||||
Button("Reset iCloud", role: .destructive) {
|
|
||||||
viewModel.dangerResetiCloud()
|
|
||||||
}
|
|
||||||
|
|
||||||
// AboutView()
|
|
||||||
|
|
||||||
.modifier(navigationInlineLarge())
|
|
||||||
.scrollContentBackground(.hidden)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
SettingsView(
|
|
||||||
viewModel: dummyEventViewModel(),
|
|
||||||
settingsModel: dummySettingsViewModel()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"originHash" : "19df39f99b22f4ef95b73ed292ffb0c8d7694dd4c9db2b96ea73b091b7b1a026",
|
||||||
|
"pins" : [
|
||||||
|
{
|
||||||
|
"identity" : "sfsymbolspicker",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/alessiorubicini/SFSymbolsPicker",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "73c909b8a7fc77a30dd04208e33f759f8b52c4c8",
|
||||||
|
"version" : "1.0.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version" : 3
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1640"
|
LastUpgradeVersion = "1630"
|
||||||
version = "1.7">
|
version = "1.7">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
@@ -15,9 +15,9 @@
|
|||||||
buildForAnalyzing = "YES">
|
buildForAnalyzing = "YES">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "A90D49252DDE0FA400781124"
|
BlueprintIdentifier = "A920C2832D24011300E4F9B1"
|
||||||
BuildableName = "Near Future.app"
|
BuildableName = "NearFuture.app"
|
||||||
BlueprintName = "MacNearFuture"
|
BlueprintName = "NearFuture"
|
||||||
ReferencedContainer = "container:NearFuture.xcodeproj">
|
ReferencedContainer = "container:NearFuture.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildActionEntry>
|
</BuildActionEntry>
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = ""
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
@@ -44,9 +44,9 @@
|
|||||||
runnableDebuggingMode = "0">
|
runnableDebuggingMode = "0">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "A90D49252DDE0FA400781124"
|
BlueprintIdentifier = "A920C2832D24011300E4F9B1"
|
||||||
BuildableName = "Near Future.app"
|
BuildableName = "NearFuture.app"
|
||||||
BlueprintName = "MacNearFuture"
|
BlueprintName = "NearFuture"
|
||||||
ReferencedContainer = "container:NearFuture.xcodeproj">
|
ReferencedContainer = "container:NearFuture.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
@@ -61,9 +61,9 @@
|
|||||||
runnableDebuggingMode = "0">
|
runnableDebuggingMode = "0">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "A90D49252DDE0FA400781124"
|
BlueprintIdentifier = "A920C2832D24011300E4F9B1"
|
||||||
BuildableName = "Near Future.app"
|
BuildableName = "NearFuture.app"
|
||||||
BlueprintName = "MacNearFuture"
|
BlueprintName = "NearFuture"
|
||||||
ReferencedContainer = "container:NearFuture.xcodeproj">
|
ReferencedContainer = "container:NearFuture.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
@@ -4,29 +4,24 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>SchemeUserState</key>
|
<key>SchemeUserState</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>MacNearFuture.xcscheme_^#shared#^_</key>
|
<key>NearFuture nodebug.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
|
||||||
<key>orderHint</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
</dict>
|
|
||||||
<key>NearFuture.xcscheme_^#shared#^_</key>
|
|
||||||
<dict>
|
|
||||||
<key>orderHint</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<key>NearFutureWidgetsExtension.xcscheme_^#shared#^_</key>
|
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>2</integer>
|
<integer>2</integer>
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>NearFuture.xcscheme_^#shared#^_</key>
|
||||||
|
<dict>
|
||||||
|
<key>orderHint</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
</dict>
|
||||||
|
<key>NearFutureWidgetsExtension.xcscheme_^#shared#^_</key>
|
||||||
|
<dict>
|
||||||
|
<key>orderHint</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SuppressBuildableAutocreation</key>
|
<key>SuppressBuildableAutocreation</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>A90D49252DDE0FA400781124</key>
|
|
||||||
<dict>
|
|
||||||
<key>primary</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
<key>A920C2832D24011300E4F9B1</key>
|
<key>A920C2832D24011300E4F9B1</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>primary</key>
|
<key>primary</key>
|
||||||
|
|||||||
@@ -0,0 +1,258 @@
|
|||||||
|
//
|
||||||
|
// AddEventView.swift
|
||||||
|
// NearFuture
|
||||||
|
//
|
||||||
|
// Created by Nihaal Sharma on 25/12/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import SFSymbolsPicker
|
||||||
|
|
||||||
|
struct AddEventView: View {
|
||||||
|
@ObservedObject var viewModel: EventViewModel
|
||||||
|
|
||||||
|
@Binding var eventName: String
|
||||||
|
@Binding var eventComplete: Bool
|
||||||
|
@Binding var eventCompleteDesc: String
|
||||||
|
@Binding var eventSymbol: String
|
||||||
|
@Binding var eventColor: Color
|
||||||
|
@Binding var eventNotes: String
|
||||||
|
@Binding var eventDate: Date
|
||||||
|
@Binding var eventTime: Bool
|
||||||
|
@Binding var eventRecurrence: Event.RecurrenceType
|
||||||
|
|
||||||
|
@State var adding: Bool
|
||||||
|
@State var showNeedsNameAlert: Bool = false
|
||||||
|
@State var isSymbolPickerPresented = false
|
||||||
|
|
||||||
|
@FocusState private var focusedField: Field?
|
||||||
|
private enum Field {
|
||||||
|
case Name, Notes
|
||||||
|
}
|
||||||
|
|
||||||
|
@Environment(\.dismiss) var dismiss
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
NavigationStack {
|
||||||
|
Form {
|
||||||
|
Section(
|
||||||
|
header:
|
||||||
|
Text("Event Details")
|
||||||
|
.font(.headline)
|
||||||
|
.foregroundColor(.accentColor)
|
||||||
|
) {
|
||||||
|
// name & symbol
|
||||||
|
HStack(spacing: 5) {
|
||||||
|
Button() {
|
||||||
|
isSymbolPickerPresented.toggle()
|
||||||
|
} label: {
|
||||||
|
Image(systemName: eventSymbol)
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
.foregroundStyle(eventColor)
|
||||||
|
}
|
||||||
|
.frame(width: 20)
|
||||||
|
.buttonStyle(.borderless)
|
||||||
|
.sheet(isPresented: $isSymbolPickerPresented) {
|
||||||
|
SymbolsPicker(
|
||||||
|
selection: $eventSymbol,
|
||||||
|
title: "Choose a Symbol",
|
||||||
|
searchLabel: "Search...",
|
||||||
|
autoDismiss: true)
|
||||||
|
}
|
||||||
|
ColorPicker("", selection: $eventColor, supportsOpacity: false)
|
||||||
|
.fixedSize()
|
||||||
|
ZStack {
|
||||||
|
TextField("Event Name", text: $eventName)
|
||||||
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
|
.padding(.trailing, eventName.isEmpty ? 0 : 30)
|
||||||
|
.animation(.spring, value: eventName)
|
||||||
|
.focused($focusedField, equals: Field.Name)
|
||||||
|
.submitLabel(.next)
|
||||||
|
.onSubmit {
|
||||||
|
focusedField = .Notes
|
||||||
|
}
|
||||||
|
MagicClearButton(text: $eventName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dscription
|
||||||
|
ZStack {
|
||||||
|
TextField("Event Notes", text: $eventNotes)
|
||||||
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
|
.padding(.trailing, eventNotes.isEmpty ? 0 : 30)
|
||||||
|
.animation(.spring, value: eventNotes)
|
||||||
|
.focused($focusedField, equals: Field.Notes)
|
||||||
|
.submitLabel(.done)
|
||||||
|
.onSubmit {
|
||||||
|
focusedField = nil
|
||||||
|
}
|
||||||
|
MagicClearButton(text: $eventNotes)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// date picker
|
||||||
|
HStack {
|
||||||
|
DatePicker("", selection: $eventDate, displayedComponents: .date)
|
||||||
|
.datePickerStyle(WheelDatePickerStyle())
|
||||||
|
Button() {
|
||||||
|
eventDate = Date()
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "arrow.uturn.left")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
}
|
||||||
|
.buttonStyle(BorderlessButtonStyle())
|
||||||
|
.frame(width: 20)
|
||||||
|
}
|
||||||
|
|
||||||
|
Toggle("Schedule a Time", isOn: $eventTime)
|
||||||
|
if eventTime {
|
||||||
|
DatePicker(
|
||||||
|
"",
|
||||||
|
selection: $eventDate,
|
||||||
|
displayedComponents: .hourAndMinute
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// re-ocurrence Picker
|
||||||
|
Picker("Recurrence", selection: $eventRecurrence) {
|
||||||
|
ForEach(Event.RecurrenceType.allCases, id: \.self) { recurrence in
|
||||||
|
Text(recurrence.rawValue.capitalized)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pickerStyle(SegmentedPickerStyle())
|
||||||
|
Text(
|
||||||
|
describeOccurrence(
|
||||||
|
date: eventDate,
|
||||||
|
recurrence: eventRecurrence
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.scrollContentBackground(.hidden)
|
||||||
|
.navigationTitle("\(adding ? "Add Event" : "")")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .topBarLeading) {
|
||||||
|
if adding {
|
||||||
|
Button() {
|
||||||
|
resetAddEventView()
|
||||||
|
dismiss()
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "xmark.circle.fill")
|
||||||
|
.symbolRenderingMode(.hierarchical)
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: 30)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ToolbarItem(placement: .topBarTrailing) {
|
||||||
|
if adding {
|
||||||
|
Button {
|
||||||
|
viewModel.addEvent(
|
||||||
|
newEvent: Event(
|
||||||
|
name: eventName,
|
||||||
|
complete: eventComplete,
|
||||||
|
completeDesc: eventCompleteDesc,
|
||||||
|
symbol: eventSymbol,
|
||||||
|
color: ColorCodable(eventColor),
|
||||||
|
notes: eventNotes,
|
||||||
|
date: eventDate,
|
||||||
|
time: eventTime,
|
||||||
|
recurrence: eventRecurrence
|
||||||
|
)
|
||||||
|
)
|
||||||
|
resetAddEventView()
|
||||||
|
} label: {
|
||||||
|
Text("Save")
|
||||||
|
.font(.headline)
|
||||||
|
.cornerRadius(10)
|
||||||
|
.buttonStyle(BorderedProminentButtonStyle())
|
||||||
|
}
|
||||||
|
.disabled(eventName.isEmpty)
|
||||||
|
.onTapGesture {
|
||||||
|
if eventName.isEmpty {
|
||||||
|
showNeedsNameAlert.toggle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.alert("Missing Name", isPresented: $showNeedsNameAlert) {
|
||||||
|
Button("OK", role: .cancel) {
|
||||||
|
showNeedsNameAlert.toggle()
|
||||||
|
focusedField = .Name
|
||||||
|
}
|
||||||
|
} message: {
|
||||||
|
Text("Give your Event a name before saving.")
|
||||||
|
}
|
||||||
|
if eventName.isEmpty {
|
||||||
|
HStack {
|
||||||
|
Image(systemName: "exclamationmark")
|
||||||
|
.foregroundStyle(.red)
|
||||||
|
Text("Give your event a name.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func resetAddEventView() {
|
||||||
|
//reset addeventView
|
||||||
|
eventName = viewModel.template.name
|
||||||
|
eventComplete = viewModel.template.complete
|
||||||
|
eventCompleteDesc = viewModel.template.completeDesc
|
||||||
|
eventSymbol = viewModel.template.symbol
|
||||||
|
eventColor = randomColor()
|
||||||
|
eventNotes = viewModel.template.notes
|
||||||
|
eventDate = viewModel.template.date
|
||||||
|
eventTime = viewModel.template.time
|
||||||
|
eventRecurrence = viewModel.template.recurrence
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
struct MagicClearButton: View {
|
||||||
|
@Binding var text: String
|
||||||
|
var body: some View {
|
||||||
|
HStack {
|
||||||
|
Spacer()
|
||||||
|
Button {
|
||||||
|
text = ""
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "xmark.circle.fill")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: text.isEmpty ? 0 : 25)
|
||||||
|
.symbolRenderingMode(.hierarchical)
|
||||||
|
.padding(.trailing, -5)
|
||||||
|
.animation(.spring, value: text.isEmpty)
|
||||||
|
}
|
||||||
|
.buttonStyle(.borderless)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
let vm = dummyEventViewModel()
|
||||||
|
Color.orange
|
||||||
|
.ignoresSafeArea(.all)
|
||||||
|
.sheet(isPresented: .constant(true)) {
|
||||||
|
AddEventView(
|
||||||
|
viewModel: vm,
|
||||||
|
eventName: .constant(vm.template.notes),
|
||||||
|
eventComplete: .constant(vm.template.complete),
|
||||||
|
eventCompleteDesc: .constant(vm.template.completeDesc),
|
||||||
|
eventSymbol: .constant(vm.template.symbol),
|
||||||
|
eventColor: .constant(vm.template.color.color),
|
||||||
|
eventNotes: .constant(vm.template.notes),
|
||||||
|
eventDate: .constant(vm.template.date),
|
||||||
|
eventTime: .constant(vm.template.time),
|
||||||
|
eventRecurrence: .constant(vm.template.recurrence),
|
||||||
|
adding: true
|
||||||
|
)
|
||||||
|
.presentationDragIndicator(.visible)
|
||||||
|
.presentationBackground(.ultraThinMaterial)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
//
|
||||||
|
// ArchiveView.swift
|
||||||
|
// NearFuture
|
||||||
|
//
|
||||||
|
// Created by neon443 on 25/04/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct ArchiveView: View {
|
||||||
|
@ObservedObject var viewModel: EventViewModel
|
||||||
|
@State var showAddEvent: Bool = false
|
||||||
|
@State var hey: UUID = UUID()
|
||||||
|
init(viewModel: EventViewModel) {
|
||||||
|
self.viewModel = viewModel
|
||||||
|
}
|
||||||
|
var body: some View {
|
||||||
|
NavigationStack {
|
||||||
|
ZStack {
|
||||||
|
backgroundGradient
|
||||||
|
if viewModel.events.filter({$0.complete}).isEmpty {
|
||||||
|
HelpView(showAddEvent: $showAddEvent)
|
||||||
|
} else {
|
||||||
|
ScrollView {
|
||||||
|
ForEach(viewModel.events.filter({$0.complete})) { event in
|
||||||
|
EventListView(viewModel: viewModel, event: event)
|
||||||
|
}
|
||||||
|
.padding(.horizontal)
|
||||||
|
.id(hey)
|
||||||
|
.onReceive(viewModel.objectWillChange) {
|
||||||
|
hey = UUID()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.scrollContentBackground(.hidden)
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .topBarTrailing) {
|
||||||
|
AddEventButton(showingAddEventView: $showAddEvent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sheet(isPresented: $showAddEvent) {
|
||||||
|
AddEventView(
|
||||||
|
viewModel: viewModel,
|
||||||
|
eventName: $viewModel.editableTemplate.name,
|
||||||
|
eventComplete: $viewModel.editableTemplate.complete,
|
||||||
|
eventCompleteDesc: $viewModel.editableTemplate.completeDesc,
|
||||||
|
eventSymbol: $viewModel.editableTemplate.symbol,
|
||||||
|
eventColor: $viewModel.editableTemplate.color.colorBind,
|
||||||
|
eventNotes: $viewModel.editableTemplate.notes,
|
||||||
|
eventDate: $viewModel.editableTemplate.date,
|
||||||
|
eventTime: $viewModel.editableTemplate.time,
|
||||||
|
eventRecurrence: $viewModel.editableTemplate.recurrence,
|
||||||
|
adding: true
|
||||||
|
)
|
||||||
|
.presentationDragIndicator(.visible)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
ArchiveView(viewModel: dummyEventViewModel())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -31,70 +31,54 @@
|
|||||||
"size" : "1024x1024"
|
"size" : "1024x1024"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "MacNearFutureIcon16.png",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "16x16"
|
"size" : "16x16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "MacNearFutureIcon32.png",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "16x16"
|
"size" : "16x16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "MacNearFutureIcon32.png",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "32x32"
|
"size" : "32x32"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "MacNearFutureIcon64.png",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "32x32"
|
"size" : "32x32"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "MacNearFutureIcon128.png",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "128x128"
|
"size" : "128x128"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "MacNearFutureIcon256.png",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "128x128"
|
"size" : "128x128"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "MacNearFutureIcon256.png",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "256x256"
|
"size" : "256x256"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "MacNearFutureIcon512.png",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "256x256"
|
"size" : "256x256"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "MacNearFutureIcon512.png",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "512x512"
|
"size" : "512x512"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "MacNearFutureIcon.png",
|
|
||||||
"idiom" : "mac",
|
"idiom" : "mac",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "512x512"
|
"size" : "512x512"
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "NearFutureIcon.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "watchos",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 609 KiB |
|
After Width: | Height: | Size: 534 KiB |
@@ -0,0 +1,197 @@
|
|||||||
|
//
|
||||||
|
// ContentView.swift
|
||||||
|
// NearFuture
|
||||||
|
//
|
||||||
|
// Created by Nihaal Sharma on 24/12/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import SwiftData
|
||||||
|
|
||||||
|
enum Field {
|
||||||
|
case Search
|
||||||
|
}
|
||||||
|
enum Tab {
|
||||||
|
case Home
|
||||||
|
case Archive
|
||||||
|
case Statistics
|
||||||
|
case Settings
|
||||||
|
case Gradient
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ContentView: View {
|
||||||
|
@StateObject var viewModel: EventViewModel
|
||||||
|
@State private var eventName = ""
|
||||||
|
@State private var eventComplete = false
|
||||||
|
@State private var eventCompleteDesc = ""
|
||||||
|
@State private var eventSymbol = "star"
|
||||||
|
@State private var eventColor: Color = randomColor()
|
||||||
|
@State private var eventNotes = ""
|
||||||
|
@State private var eventDate = Date()
|
||||||
|
@State private var eventTime = false
|
||||||
|
@State private var eventRecurrence: Event.RecurrenceType = .none
|
||||||
|
@State var hey: UUID = UUID()
|
||||||
|
@State private var showingAddEventView = false
|
||||||
|
@State private var searchInput: String = ""
|
||||||
|
var filteredEvents: [Event] {
|
||||||
|
if searchInput.isEmpty {
|
||||||
|
return viewModel.events
|
||||||
|
} else {
|
||||||
|
return viewModel.events.filter {
|
||||||
|
$0.name.localizedCaseInsensitiveContains(searchInput) ||
|
||||||
|
$0.notes.localizedCaseInsensitiveContains(searchInput)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var noEvents: Bool {
|
||||||
|
if viewModel.events.count == 0 {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@FocusState private var focusedField: Field?
|
||||||
|
@FocusState private var focusedTab: Tab?
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
TabView {
|
||||||
|
NavigationStack {
|
||||||
|
ZStack {
|
||||||
|
backgroundGradient
|
||||||
|
VStack {
|
||||||
|
ZStack {
|
||||||
|
SearchBar(searchInput: $searchInput)
|
||||||
|
.focused($focusedField, equals: Field.Search)
|
||||||
|
.onSubmit {
|
||||||
|
focusedField = nil
|
||||||
|
}
|
||||||
|
MagicClearButton(text: $searchInput)
|
||||||
|
.onTapGesture {
|
||||||
|
focusedField = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.horizontal)
|
||||||
|
if filteredEvents.isEmpty && !searchInput.isEmpty {
|
||||||
|
HelpView(searchInput: $searchInput, focusedField: focusedField)
|
||||||
|
} else {
|
||||||
|
ScrollView {
|
||||||
|
ForEach(filteredEvents) { event in
|
||||||
|
EventListView(viewModel: viewModel, event: event)
|
||||||
|
}
|
||||||
|
.onDelete(perform: viewModel.removeEvent)
|
||||||
|
.id(hey)
|
||||||
|
.onReceive(viewModel.objectWillChange) {
|
||||||
|
hey = UUID()
|
||||||
|
}
|
||||||
|
.padding(.horizontal)
|
||||||
|
if /*!searchInput.isEmpty && */filteredEvents.isEmpty {
|
||||||
|
HelpView(searchInput: $searchInput, focusedField: focusedField)
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.navigationTitle("Near Future")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.sheet(isPresented: $showingAddEventView) {
|
||||||
|
AddEventView(
|
||||||
|
viewModel: viewModel,
|
||||||
|
eventName: $eventName,
|
||||||
|
eventComplete: $eventComplete,
|
||||||
|
eventCompleteDesc: $eventCompleteDesc,
|
||||||
|
eventSymbol: $eventSymbol,
|
||||||
|
eventColor: $eventColor,
|
||||||
|
eventNotes: $eventNotes,
|
||||||
|
eventDate: $eventDate,
|
||||||
|
eventTime: $eventTime,
|
||||||
|
eventRecurrence: $eventRecurrence,
|
||||||
|
adding: true //adding event
|
||||||
|
)
|
||||||
|
.presentationDragIndicator(.visible)
|
||||||
|
.presentationBackground(.ultraThinMaterial)
|
||||||
|
}
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .topBarTrailing) {
|
||||||
|
AddEventButton(showingAddEventView: $showingAddEventView)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.tabItem {
|
||||||
|
Label("Home", systemImage: "house")
|
||||||
|
}
|
||||||
|
.focused($focusedTab, equals: Tab.Home)
|
||||||
|
ArchiveView(viewModel: viewModel)
|
||||||
|
.tabItem() {
|
||||||
|
Label("Archive", systemImage: "tray.full")
|
||||||
|
}
|
||||||
|
.focused($focusedTab, equals: Tab.Archive)
|
||||||
|
StatsView(viewModel: viewModel)
|
||||||
|
.tabItem {
|
||||||
|
Label("Statistics", systemImage: "chart.pie")
|
||||||
|
}
|
||||||
|
.focused($focusedTab, equals: Tab.Statistics)
|
||||||
|
SettingsView(viewModel: viewModel)
|
||||||
|
.tabItem {
|
||||||
|
Label("Settings", systemImage: "gear")
|
||||||
|
}
|
||||||
|
.focused($focusedTab, equals: Tab.Settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
ContentView(viewModel: dummyEventViewModel())
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SearchBar: View {
|
||||||
|
@Binding var searchInput: String
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
TextField(
|
||||||
|
"\(Image(systemName: "magnifyingglass")) Search",
|
||||||
|
text: $searchInput
|
||||||
|
)
|
||||||
|
.padding(.trailing, searchInput.isEmpty ? 0 : 30)
|
||||||
|
.animation(.spring, value: searchInput)
|
||||||
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
|
.submitLabel(.done)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AddEventButton: View {
|
||||||
|
@Binding var showingAddEventView: Bool
|
||||||
|
var body: some View {
|
||||||
|
Button() {
|
||||||
|
showingAddEventView.toggle()
|
||||||
|
} label: {
|
||||||
|
ZStack {
|
||||||
|
Circle()
|
||||||
|
.frame(width: 33)
|
||||||
|
.foregroundStyle(.one)
|
||||||
|
Image(systemName: "plus")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: 15)
|
||||||
|
.bold()
|
||||||
|
.foregroundStyle(.two)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension View {
|
||||||
|
var appearance: ColorScheme {
|
||||||
|
return UITraitCollection.current.userInterfaceStyle == .dark ? .dark : .light
|
||||||
|
}
|
||||||
|
var backgroundGradient: some View {
|
||||||
|
return LinearGradient(
|
||||||
|
gradient: Gradient(colors: [.bgTop, .two]),
|
||||||
|
startPoint: .top,
|
||||||
|
endPoint: .bottom
|
||||||
|
)
|
||||||
|
.ignoresSafeArea(.all)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
//
|
||||||
|
// EditEventView.swift
|
||||||
|
// NearFuture
|
||||||
|
//
|
||||||
|
// Created by Nihaal Sharma on 02/01/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct EditEventView: View {
|
||||||
|
@Environment(\.dismiss) var dismiss
|
||||||
|
@ObservedObject var viewModel: EventViewModel
|
||||||
|
@Binding var event: Event
|
||||||
|
|
||||||
|
fileprivate func saveEdits() {
|
||||||
|
//if there is an event in vM.events with the id of the event we r editing,
|
||||||
|
//firstindex - loops through the arr and finds first element where that events id matches editing event's id
|
||||||
|
if let index = viewModel.events.firstIndex(where: { xEvent in
|
||||||
|
xEvent.id == event.id
|
||||||
|
}) {
|
||||||
|
viewModel.events[index] = event
|
||||||
|
}
|
||||||
|
viewModel.saveEvents()
|
||||||
|
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
AddEventView(
|
||||||
|
viewModel: viewModel,
|
||||||
|
eventName: $event.name,
|
||||||
|
eventComplete: $event.complete,
|
||||||
|
eventCompleteDesc: $event.completeDesc,
|
||||||
|
eventSymbol: $event.symbol,
|
||||||
|
eventColor: $event.color.colorBind,
|
||||||
|
eventNotes: $event.notes,
|
||||||
|
eventDate: $event.date,
|
||||||
|
eventTime: $event.time,
|
||||||
|
eventRecurrence: $event.recurrence,
|
||||||
|
adding: false //bc we editing existing event
|
||||||
|
)
|
||||||
|
.navigationTitle("Edit Event")
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .topBarTrailing) {
|
||||||
|
Button() {
|
||||||
|
saveEdits()
|
||||||
|
} label: {
|
||||||
|
Text("Done")
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
.disabled(event.name == "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
let vm = dummyEventViewModel()
|
||||||
|
EditEventView(
|
||||||
|
viewModel: vm,
|
||||||
|
event: .constant(vm.example)
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
//
|
||||||
|
// EventListView.swift
|
||||||
|
// NearFuture
|
||||||
|
//
|
||||||
|
// Created by neon443 on 18/04/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import SwiftData
|
||||||
|
|
||||||
|
struct EventListView: View {
|
||||||
|
@ObservedObject var viewModel: EventViewModel
|
||||||
|
@State var event: Event
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
NavigationLink() {
|
||||||
|
EditEventView(
|
||||||
|
viewModel: viewModel,
|
||||||
|
event: $event
|
||||||
|
)
|
||||||
|
} label: {
|
||||||
|
ZStack {
|
||||||
|
HStack {
|
||||||
|
RoundedRectangle(cornerRadius: 5)
|
||||||
|
.frame(width: 7)
|
||||||
|
.foregroundStyle(
|
||||||
|
event.color.color.opacity(
|
||||||
|
event.complete ? 0.5 : 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
HStack {
|
||||||
|
Image(systemName: event.symbol)
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
.shadow(radius: 5)
|
||||||
|
.foregroundStyle(
|
||||||
|
.one.opacity(
|
||||||
|
event.complete ? 0.5 : 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Text("\(event.name)")
|
||||||
|
.font(.headline)
|
||||||
|
.foregroundStyle(.one)
|
||||||
|
.strikethrough(event.complete)
|
||||||
|
}
|
||||||
|
if !event.notes.isEmpty {
|
||||||
|
Text(event.notes)
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundStyle(.one.opacity(0.8))
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
event.date.formatted(
|
||||||
|
date: .long,
|
||||||
|
time: event.time ? .shortened : .omitted
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundStyle(
|
||||||
|
.one.opacity(
|
||||||
|
event.complete ? 0.5 : 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if event.recurrence != .none {
|
||||||
|
Text("Occurs \(event.recurrence.rawValue)")
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundStyle(
|
||||||
|
.one.opacity(event.complete ? 0.5 : 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
VStack {
|
||||||
|
Text("\(daysUntilEvent(event.date, short: false))")
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundStyle(.one)
|
||||||
|
}
|
||||||
|
Button() {
|
||||||
|
withAnimation {
|
||||||
|
event.complete.toggle()
|
||||||
|
}
|
||||||
|
let eventToModify = viewModel.events.firstIndex() { currEvent in
|
||||||
|
currEvent.id == event.id
|
||||||
|
}
|
||||||
|
if let eventToModify = eventToModify {
|
||||||
|
viewModel.events[eventToModify] = event
|
||||||
|
viewModel.saveEvents()
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
if event.complete {
|
||||||
|
ZStack {
|
||||||
|
Circle()
|
||||||
|
.foregroundStyle(.green)
|
||||||
|
Image(systemName: "checkmark")
|
||||||
|
.resizable()
|
||||||
|
.foregroundStyle(.white)
|
||||||
|
.scaledToFit()
|
||||||
|
.bold()
|
||||||
|
.frame(width: 15)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Image(systemName: "circle")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.foregroundStyle(event.color.color)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.buttonStyle(.borderless)
|
||||||
|
.frame(maxWidth: 25, maxHeight: 25)
|
||||||
|
.shadow(radius: 5)
|
||||||
|
.padding(.trailing, 5)
|
||||||
|
}
|
||||||
|
.padding(.vertical, 5)
|
||||||
|
.background(.ultraThinMaterial)
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.stroke(
|
||||||
|
.one.opacity(appearance == .dark ? 0.5 : 1),
|
||||||
|
lineWidth: 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.clipShape(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
}
|
||||||
|
.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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview("EventListView") {
|
||||||
|
let vm = dummyEventViewModel()
|
||||||
|
ZStack {
|
||||||
|
Color.black
|
||||||
|
VStack {
|
||||||
|
ForEach(0..<50) { _ in
|
||||||
|
Rectangle()
|
||||||
|
.foregroundStyle(randomColor().opacity(0.5))
|
||||||
|
.padding(-10)
|
||||||
|
}
|
||||||
|
.ignoresSafeArea(.all)
|
||||||
|
.blur(radius: 5)
|
||||||
|
}
|
||||||
|
VStack {
|
||||||
|
ForEach(vm.events) { event in
|
||||||
|
EventListView(
|
||||||
|
viewModel: vm,
|
||||||
|
event: event
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(.horizontal, 10)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,10 +13,6 @@ enum HelpType {
|
|||||||
case Archive
|
case Archive
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Field {
|
|
||||||
case Search
|
|
||||||
}
|
|
||||||
|
|
||||||
struct HelpView: View {
|
struct HelpView: View {
|
||||||
/// initialises a Search HelpView
|
/// initialises a Search HelpView
|
||||||
///
|
///
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict/>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,392 @@
|
|||||||
|
//
|
||||||
|
// Item.swift
|
||||||
|
// NearFuture
|
||||||
|
//
|
||||||
|
// Created by Nihaal Sharma on 24/12/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import SwiftData
|
||||||
|
import SwiftUI
|
||||||
|
import WidgetKit
|
||||||
|
|
||||||
|
//@Model
|
||||||
|
//final class Item {
|
||||||
|
// var timestamp: Date
|
||||||
|
//
|
||||||
|
// init(timestamp: Date) {
|
||||||
|
// self.timestamp = timestamp
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
struct Event: Identifiable, Codable {
|
||||||
|
var id = UUID()
|
||||||
|
var name: String
|
||||||
|
var complete: Bool
|
||||||
|
var completeDesc: String
|
||||||
|
var symbol: String
|
||||||
|
var color: ColorCodable
|
||||||
|
var notes: String
|
||||||
|
var date: Date
|
||||||
|
var time: Bool
|
||||||
|
var recurrence: RecurrenceType
|
||||||
|
|
||||||
|
enum RecurrenceType: String, Codable, CaseIterable {
|
||||||
|
case none, daily, weekly, monthly, yearly
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ColorCodable: Codable {
|
||||||
|
var red: Double
|
||||||
|
var green: Double
|
||||||
|
var blue: Double
|
||||||
|
|
||||||
|
var color: Color {
|
||||||
|
Color(red: red, green: green, blue: blue)
|
||||||
|
}
|
||||||
|
var colorBind: Color {
|
||||||
|
get {
|
||||||
|
return Color(
|
||||||
|
red: red,
|
||||||
|
green: green,
|
||||||
|
blue: blue
|
||||||
|
)
|
||||||
|
} set {
|
||||||
|
let cc = ColorCodable(newValue)
|
||||||
|
self.red = cc.red
|
||||||
|
self.green = cc.green
|
||||||
|
self.blue = cc.blue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init(_ color: Color) {
|
||||||
|
let uiColor = UIColor(color)
|
||||||
|
var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 1.0
|
||||||
|
uiColor.getRed(&r, green: &g, blue: &b, alpha: &a)
|
||||||
|
|
||||||
|
self.red = Double(r)
|
||||||
|
self.green = Double(g)
|
||||||
|
self.blue = Double(b)
|
||||||
|
}
|
||||||
|
init(red: Double, green: Double, blue: Double) {
|
||||||
|
self.red = red
|
||||||
|
self.green = green
|
||||||
|
self.blue = blue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func daysUntilEvent(_ eventDate: Date, short: Bool, sepLines: Bool = false) -> String {
|
||||||
|
let calendar = Calendar.current
|
||||||
|
let currentDate = Date()
|
||||||
|
let components = calendar.dateComponents([.day], from: currentDate, to: eventDate)
|
||||||
|
guard let days = components.day else { return "N/A" }
|
||||||
|
guard days >= 0 else {
|
||||||
|
if short {
|
||||||
|
return "\(days)d"
|
||||||
|
} else {
|
||||||
|
return "\(-days)\(sepLines ? "\n" : " ")day\(-days == 1 ? "" : "s") ago"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
guard days != 0 else {
|
||||||
|
return "Today"
|
||||||
|
}
|
||||||
|
if short {
|
||||||
|
return "\(days)d"
|
||||||
|
} else {
|
||||||
|
return "\(days)\(sepLines ? "\n" : " ")day\(days == 1 ? "" : "s")"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EventViewModel: ObservableObject {
|
||||||
|
@Published var events: [Event] = []
|
||||||
|
@Published var icloudData: [Event] = []
|
||||||
|
|
||||||
|
public let template: Event = Event(
|
||||||
|
name: "",
|
||||||
|
complete: false,
|
||||||
|
completeDesc: "",
|
||||||
|
symbol: "star",
|
||||||
|
color: ColorCodable(randomColor()),
|
||||||
|
notes: "",
|
||||||
|
date: Date(),
|
||||||
|
time: false,
|
||||||
|
recurrence: .none
|
||||||
|
)
|
||||||
|
@Published var editableTemplate: Event = Event(
|
||||||
|
name: "",
|
||||||
|
complete: false,
|
||||||
|
completeDesc: "",
|
||||||
|
symbol: "star",
|
||||||
|
color: ColorCodable(randomColor()),
|
||||||
|
notes: "",
|
||||||
|
date: Date(),
|
||||||
|
time: false,
|
||||||
|
recurrence: .none
|
||||||
|
)
|
||||||
|
@Published var example: Event = Event(
|
||||||
|
name: "event",
|
||||||
|
complete: false,
|
||||||
|
completeDesc: "dofajiof",
|
||||||
|
symbol: "star",
|
||||||
|
color: ColorCodable(.orange),
|
||||||
|
notes: "lksdjfakdflkasjlkjl",
|
||||||
|
date: Date(),
|
||||||
|
time: true,
|
||||||
|
recurrence: .daily
|
||||||
|
)
|
||||||
|
|
||||||
|
@Published var lastSync: Date? = nil
|
||||||
|
@Published var icloudEventCount: Int = 0
|
||||||
|
@Published var localEventCount: Int = 0
|
||||||
|
@Published var syncStatus: String = "Not Synced"
|
||||||
|
|
||||||
|
init(load: Bool = true) {
|
||||||
|
if load {
|
||||||
|
loadEvents()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//appgroup or regular userdefaults
|
||||||
|
let appGroupUserDefaults = UserDefaults(suiteName: "group.NearFuture") ?? UserDefaults.standard
|
||||||
|
|
||||||
|
//icloud store
|
||||||
|
let icloudStore = NSUbiquitousKeyValueStore.default
|
||||||
|
|
||||||
|
// load from icloud or local
|
||||||
|
func loadEvents() {
|
||||||
|
//load icloud 1st
|
||||||
|
if let icData = icloudStore.data(forKey: "events") {
|
||||||
|
let decoder = JSONDecoder()
|
||||||
|
if let decodedIcEvents = try? decoder.decode([Event].self, from: icData) {
|
||||||
|
self.icloudData = decodedIcEvents
|
||||||
|
self.events = decodedIcEvents
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if events.isEmpty, let savedData = appGroupUserDefaults.data(forKey: "events") {
|
||||||
|
let decoder = JSONDecoder()
|
||||||
|
if let decodedEvents = try? decoder.decode([Event].self, from: savedData) {
|
||||||
|
self.events = decodedEvents
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateSyncStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
// save to local and icloud
|
||||||
|
func saveEvents() {
|
||||||
|
let encoder = JSONEncoder()
|
||||||
|
if let encoded = try? encoder.encode(events) {
|
||||||
|
appGroupUserDefaults.set(encoded, forKey: "events")
|
||||||
|
|
||||||
|
//sync
|
||||||
|
icloudStore.set(encoded, forKey: "events")
|
||||||
|
icloudStore.synchronize()
|
||||||
|
|
||||||
|
updateSyncStatus()
|
||||||
|
loadEvents()
|
||||||
|
WidgetCenter.shared.reloadAllTimelines()//reload all widgets when saving events
|
||||||
|
objectWillChange.send()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func updateSyncStatus() {
|
||||||
|
lastSync = Date()
|
||||||
|
icloudEventCount = icloudData.count
|
||||||
|
localEventCount = events.count
|
||||||
|
|
||||||
|
if icloudEventCount == localEventCount {
|
||||||
|
syncStatus = "Successful"
|
||||||
|
} else {
|
||||||
|
syncStatus = "Pending"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func addEvent(newEvent: Event) {
|
||||||
|
events.append(newEvent)
|
||||||
|
saveEvents() //sync with icloud
|
||||||
|
}
|
||||||
|
|
||||||
|
func removeEvent(at index: IndexSet) {
|
||||||
|
events.remove(atOffsets: index)
|
||||||
|
saveEvents() //sync local and icl
|
||||||
|
}
|
||||||
|
|
||||||
|
func hasUbiquitousKeyValueStore() -> Bool {
|
||||||
|
let icloud = NSUbiquitousKeyValueStore.default
|
||||||
|
|
||||||
|
let key = "com.neon443.NearFuture.testkey"
|
||||||
|
let value = "testValue"
|
||||||
|
|
||||||
|
icloud.set(value, forKey: key)
|
||||||
|
icloud.synchronize()
|
||||||
|
|
||||||
|
if icloud.string(forKey: key) != nil {
|
||||||
|
icloud.removeObject(forKey: key)
|
||||||
|
icloud.synchronize()
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
print("!has UbiquitousKeyValueStore")
|
||||||
|
icloud.removeObject(forKey: key)
|
||||||
|
icloud.synchronize()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func sync() {
|
||||||
|
NSUbiquitousKeyValueStore.default.synchronize()
|
||||||
|
loadEvents()
|
||||||
|
}
|
||||||
|
|
||||||
|
func replaceLocalWithiCloudData() {
|
||||||
|
icloudStore.synchronize()
|
||||||
|
self.events = self.icloudData
|
||||||
|
saveEvents()
|
||||||
|
}
|
||||||
|
|
||||||
|
func replaceiCloudWithLocalData() {
|
||||||
|
icloudStore.synchronize()
|
||||||
|
self.icloudData = self.events
|
||||||
|
saveEvents()
|
||||||
|
}
|
||||||
|
|
||||||
|
func exportEvents() -> String? {
|
||||||
|
let encoder = JSONEncoder()
|
||||||
|
|
||||||
|
// Custom date encoding strategy to handle date formatting
|
||||||
|
let dateFormatter = DateFormatter()
|
||||||
|
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
|
||||||
|
encoder.dateEncodingStrategy = .formatted(dateFormatter)
|
||||||
|
|
||||||
|
do {
|
||||||
|
// Encode the events array to JSON data
|
||||||
|
let encodedData = try encoder.encode(events)
|
||||||
|
|
||||||
|
// Convert the JSON data to a string
|
||||||
|
if let jsonString = String(data: encodedData, encoding: .utf8) {
|
||||||
|
return jsonString
|
||||||
|
} else {
|
||||||
|
print("Failed to convert encoded data to string")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
print("Failed to encode events: \(error.localizedDescription)")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func importEvents(_ imp: String) {
|
||||||
|
guard let impData = imp.data(using: .utf8) else {
|
||||||
|
print("Failed to convert string to data")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a JSONDecoder
|
||||||
|
let decoder = JSONDecoder()
|
||||||
|
|
||||||
|
// Add a custom date formatter for decoding the date string
|
||||||
|
let dateFormatter = DateFormatter()
|
||||||
|
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" // Adjust this to the date format you're using
|
||||||
|
decoder.dateDecodingStrategy = .formatted(dateFormatter)
|
||||||
|
|
||||||
|
do {
|
||||||
|
// Attempt to decode the events from the provided data
|
||||||
|
let decoded = try decoder.decode([Event].self, from: impData)
|
||||||
|
print("Successfully decoded events: \(decoded)")
|
||||||
|
|
||||||
|
// Save and reload after importing events
|
||||||
|
self.events = decoded
|
||||||
|
saveEvents()
|
||||||
|
loadEvents()
|
||||||
|
} catch {
|
||||||
|
// Print error if decoding fails
|
||||||
|
print("Failed to decode events: \(error.localizedDescription)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//MARK: Danger Zone
|
||||||
|
func dangerClearLocalData() {
|
||||||
|
UserDefaults.standard.removeObject(forKey: "events")
|
||||||
|
appGroupUserDefaults.removeObject(forKey: "events")
|
||||||
|
events.removeAll()
|
||||||
|
updateSyncStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
func dangerCleariCloudData() {
|
||||||
|
icloudStore.removeObject(forKey: "events")
|
||||||
|
icloudStore.synchronize()
|
||||||
|
icloudData.removeAll()
|
||||||
|
updateSyncStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
func dangerResetLocalData() {
|
||||||
|
let userDFDict = UserDefaults.standard.dictionaryRepresentation()
|
||||||
|
for key in userDFDict.keys {
|
||||||
|
UserDefaults.standard.removeObject(forKey: key)
|
||||||
|
}
|
||||||
|
|
||||||
|
let appGUSDDict = appGroupUserDefaults.dictionaryRepresentation()
|
||||||
|
for key in appGUSDDict.keys {
|
||||||
|
appGroupUserDefaults.removeObject(forKey: key)
|
||||||
|
}
|
||||||
|
|
||||||
|
events.removeAll()
|
||||||
|
updateSyncStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
func dangerResetiCloud() {
|
||||||
|
let icloudDict = icloudStore.dictionaryRepresentation
|
||||||
|
for key in icloudDict.keys {
|
||||||
|
icloudStore.removeObject(forKey: key)
|
||||||
|
}
|
||||||
|
icloudStore.synchronize()
|
||||||
|
icloudData.removeAll()
|
||||||
|
updateSyncStatus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class dummyEventViewModel: EventViewModel {
|
||||||
|
override init(load: Bool = false) {
|
||||||
|
super.init(load: false)
|
||||||
|
self.events = [self.example, self.template, self.example, self.template]
|
||||||
|
self.events[0].complete.toggle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func describeOccurrence(date: Date, recurrence: Event.RecurrenceType) -> String {
|
||||||
|
let dateString = date.formatted(date: .long, time: .omitted)
|
||||||
|
let recurrenceDescription: String
|
||||||
|
|
||||||
|
switch recurrence {
|
||||||
|
case .none:
|
||||||
|
recurrenceDescription = "Occurs once on"
|
||||||
|
case .daily:
|
||||||
|
recurrenceDescription = "Repeats every day from"
|
||||||
|
case .weekly:
|
||||||
|
recurrenceDescription = "Repeats every week from"
|
||||||
|
case .monthly:
|
||||||
|
recurrenceDescription = "Repeats every month from"
|
||||||
|
case .yearly:
|
||||||
|
recurrenceDescription = "Repeats every year from"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "\(recurrenceDescription) \(dateString)"
|
||||||
|
}
|
||||||
|
|
||||||
|
func randomRainbowColor() -> Color {
|
||||||
|
return [
|
||||||
|
Color.red,
|
||||||
|
Color.orange,
|
||||||
|
Color.yellow,
|
||||||
|
Color.green,
|
||||||
|
Color.blue,
|
||||||
|
Color.indigo,
|
||||||
|
Color.purple
|
||||||
|
].randomElement()!
|
||||||
|
}
|
||||||
|
|
||||||
|
func randomColor() -> Color {
|
||||||
|
let r = Double.random(in: 0...1)
|
||||||
|
let g = Double.random(in: 0...1)
|
||||||
|
let b = Double.random(in: 0...1)
|
||||||
|
return Color(red: r, green: g, blue: b)
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
//
|
||||||
|
// NearFutureApp.swift
|
||||||
|
// NearFuture
|
||||||
|
//
|
||||||
|
// Created by Nihaal Sharma on 24/12/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import SwiftData
|
||||||
|
|
||||||
|
@main
|
||||||
|
struct NearFutureApp: App {
|
||||||
|
// var sharedModelContainer: ModelContainer = {
|
||||||
|
// let schema = Schema([
|
||||||
|
// Item.self,
|
||||||
|
// ])
|
||||||
|
// let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
|
||||||
|
//
|
||||||
|
// do {
|
||||||
|
// return try ModelContainer(for: schema, configurations: [modelConfiguration])
|
||||||
|
// } catch {
|
||||||
|
// fatalError("Could not create ModelContainer: \(error)")
|
||||||
|
// }
|
||||||
|
// }()
|
||||||
|
|
||||||
|
var body: some Scene {
|
||||||
|
WindowGroup {
|
||||||
|
ContentView(viewModel: EventViewModel())
|
||||||
|
}
|
||||||
|
// .modelContainer(sharedModelContainer)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// AppIntent.swift
|
||||||
|
// NearFutureWidgets
|
||||||
|
//
|
||||||
|
// Created by Nihaal Sharma on 02/01/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import WidgetKit
|
||||||
|
import AppIntents
|
||||||
|
|
||||||
|
struct ConfigurationAppIntent: WidgetConfigurationIntent {
|
||||||
|
static var title: LocalizedStringResource = "Configuration"
|
||||||
|
static var description = IntentDescription("This is an example widget.")
|
||||||
|
|
||||||
|
// An example configurable parameter.
|
||||||
|
@Parameter(title: "Favorite Emoji", default: "😃")
|
||||||
|
var favoriteEmoji: String
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
{
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
"author" : "xcode",
|
"author" : "xcode",
|
||||||
"version" : 1
|
"version" : 1
|
||||||
},
|
|
||||||
"properties" : {
|
|
||||||
"provides-namespace" : true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
|
"size" : "1024x1024"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>NSExtension</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSExtensionPointIdentifier</key>
|
||||||
|
<string>com.apple.widgetkit-extension</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
//
|
||||||
|
// NearFutureWidgets.swift
|
||||||
|
// NearFutureWidgets
|
||||||
|
//
|
||||||
|
// Created by Nihaal Sharma on 02/01/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import WidgetKit
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct Provider: AppIntentTimelineProvider {
|
||||||
|
func placeholder(in context: Context) -> SimpleEntry {
|
||||||
|
SimpleEntry(date: Date(), configuration: ConfigurationAppIntent())
|
||||||
|
}
|
||||||
|
|
||||||
|
func snapshot(for configuration: ConfigurationAppIntent, in context: Context) async -> SimpleEntry {
|
||||||
|
SimpleEntry(date: Date(), configuration: configuration)
|
||||||
|
}
|
||||||
|
|
||||||
|
func timeline(for configuration: ConfigurationAppIntent, in context: Context) async -> Timeline<SimpleEntry> {
|
||||||
|
var entries: [SimpleEntry] = []
|
||||||
|
|
||||||
|
// Generate a timeline consisting of five entries an hour apart, starting from the current date.
|
||||||
|
let currentDate = Date()
|
||||||
|
for hourOffset in 0 ..< 5 {
|
||||||
|
let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)!
|
||||||
|
let entry = SimpleEntry(date: entryDate, configuration: configuration)
|
||||||
|
entries.append(entry)
|
||||||
|
}
|
||||||
|
|
||||||
|
return Timeline(entries: entries, policy: .atEnd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SimpleEntry: TimelineEntry {
|
||||||
|
let date: Date
|
||||||
|
let configuration: ConfigurationAppIntent
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NearFutureWidgetsEntryView : View {
|
||||||
|
var entry: Provider.Entry
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack {
|
||||||
|
Text("Time:")
|
||||||
|
Text(entry.date, style: .time)
|
||||||
|
|
||||||
|
Text("Favorite Emoji:")
|
||||||
|
Text(entry.configuration.favoriteEmoji)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NearFutureWidgets: Widget {
|
||||||
|
let kind: String = "NearFutureWidgets"
|
||||||
|
|
||||||
|
var body: some WidgetConfiguration {
|
||||||
|
AppIntentConfiguration(kind: kind, intent: ConfigurationAppIntent.self, provider: Provider()) { entry in
|
||||||
|
NearFutureWidgetsEntryView(entry: entry)
|
||||||
|
.containerBackground(.fill.tertiary, for: .widget)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ConfigurationAppIntent {
|
||||||
|
fileprivate static var smiley: ConfigurationAppIntent {
|
||||||
|
let intent = ConfigurationAppIntent()
|
||||||
|
intent.favoriteEmoji = "😀"
|
||||||
|
return intent
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate static var starEyes: ConfigurationAppIntent {
|
||||||
|
let intent = ConfigurationAppIntent()
|
||||||
|
intent.favoriteEmoji = "🤩"
|
||||||
|
return intent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview(as: .systemSmall) {
|
||||||
|
NearFutureWidgets()
|
||||||
|
} timeline: {
|
||||||
|
SimpleEntry(date: .now, configuration: .smiley)
|
||||||
|
SimpleEntry(date: .now, configuration: .starEyes)
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// NearFutureWidgetsBundle.swift
|
||||||
|
// NearFutureWidgets
|
||||||
|
//
|
||||||
|
// Created by Nihaal Sharma on 02/01/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import WidgetKit
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@main
|
||||||
|
struct NearFutureWidgetsBundle: WidgetBundle {
|
||||||
|
var body: some Widget {
|
||||||
|
NearFutureWidgets()
|
||||||
|
NearFutureWidgetsLiveActivity()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
//
|
||||||
|
// NearFutureWidgetsLiveActivity.swift
|
||||||
|
// NearFutureWidgets
|
||||||
|
//
|
||||||
|
// Created by Nihaal Sharma on 02/01/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import ActivityKit
|
||||||
|
import WidgetKit
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct NearFutureWidgetsAttributes: ActivityAttributes {
|
||||||
|
public struct ContentState: Codable, Hashable {
|
||||||
|
// Dynamic stateful properties about your activity go here!
|
||||||
|
var emoji: String
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fixed non-changing properties about your activity go here!
|
||||||
|
var name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NearFutureWidgetsLiveActivity: Widget {
|
||||||
|
var body: some WidgetConfiguration {
|
||||||
|
ActivityConfiguration(for: NearFutureWidgetsAttributes.self) { context in
|
||||||
|
// Lock screen/banner UI goes here
|
||||||
|
VStack {
|
||||||
|
Text("Hello \(context.state.emoji)")
|
||||||
|
}
|
||||||
|
.activityBackgroundTint(Color.cyan)
|
||||||
|
.activitySystemActionForegroundColor(Color.black)
|
||||||
|
|
||||||
|
} dynamicIsland: { context in
|
||||||
|
DynamicIsland {
|
||||||
|
// Expanded UI goes here. Compose the expanded UI through
|
||||||
|
// various regions, like leading/trailing/center/bottom
|
||||||
|
DynamicIslandExpandedRegion(.leading) {
|
||||||
|
Text("Leading")
|
||||||
|
}
|
||||||
|
DynamicIslandExpandedRegion(.trailing) {
|
||||||
|
Text("Trailing")
|
||||||
|
}
|
||||||
|
DynamicIslandExpandedRegion(.bottom) {
|
||||||
|
Text("Bottom \(context.state.emoji)")
|
||||||
|
// more content
|
||||||
|
}
|
||||||
|
} compactLeading: {
|
||||||
|
Text("L")
|
||||||
|
} compactTrailing: {
|
||||||
|
Text("T \(context.state.emoji)")
|
||||||
|
} minimal: {
|
||||||
|
Text(context.state.emoji)
|
||||||
|
}
|
||||||
|
.widgetURL(URL(string: "http://www.apple.com"))
|
||||||
|
.keylineTint(Color.red)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension NearFutureWidgetsAttributes {
|
||||||
|
fileprivate static var preview: NearFutureWidgetsAttributes {
|
||||||
|
NearFutureWidgetsAttributes(name: "World")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension NearFutureWidgetsAttributes.ContentState {
|
||||||
|
fileprivate static var smiley: NearFutureWidgetsAttributes.ContentState {
|
||||||
|
NearFutureWidgetsAttributes.ContentState(emoji: "😀")
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate static var starEyes: NearFutureWidgetsAttributes.ContentState {
|
||||||
|
NearFutureWidgetsAttributes.ContentState(emoji: "🤩")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview("Notification", as: .content, using: NearFutureWidgetsAttributes.preview) {
|
||||||
|
NearFutureWidgetsLiveActivity()
|
||||||
|
} contentStates: {
|
||||||
|
NearFutureWidgetsAttributes.ContentState.smiley
|
||||||
|
NearFutureWidgetsAttributes.ContentState.starEyes
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
//
|
||||||
|
// SettingsView.swift
|
||||||
|
// NearFuture
|
||||||
|
//
|
||||||
|
// Created by Nihaal Sharma on 29/12/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct SettingsView: View {
|
||||||
|
@State var viewModel: EventViewModel
|
||||||
|
|
||||||
|
@State private var hasUbiquitous: Bool = false
|
||||||
|
@State private var lastSyncWasSuccessful: Bool = false
|
||||||
|
@State private var lastSyncWasNormalAgo: Bool = false
|
||||||
|
@State private var localCountEqualToiCloud: Bool = false
|
||||||
|
@State private var icloudCountEqualToLocal: Bool = false
|
||||||
|
@State private var importStr: String = ""
|
||||||
|
|
||||||
|
func updateStatus() {
|
||||||
|
let vm = viewModel
|
||||||
|
hasUbiquitous = vm.hasUbiquitousKeyValueStore()
|
||||||
|
lastSyncWasSuccessful = vm.syncStatus.contains("Success")
|
||||||
|
lastSyncWasNormalAgo = vm.lastSync?.timeIntervalSinceNow.isNormal ?? false
|
||||||
|
localCountEqualToiCloud = vm.localEventCount == vm.icloudEventCount
|
||||||
|
icloudCountEqualToLocal = vm.icloudEventCount == vm.localEventCount
|
||||||
|
}
|
||||||
|
|
||||||
|
var iCloudStatusColor: Color {
|
||||||
|
let allTrue = hasUbiquitous && lastSyncWasSuccessful && lastSyncWasNormalAgo && localCountEqualToiCloud && icloudCountEqualToLocal
|
||||||
|
let someTrue = hasUbiquitous || lastSyncWasSuccessful || lastSyncWasNormalAgo || localCountEqualToiCloud || icloudCountEqualToLocal
|
||||||
|
|
||||||
|
if allTrue {
|
||||||
|
return .green
|
||||||
|
} else if someTrue {
|
||||||
|
return .orange
|
||||||
|
} else {
|
||||||
|
return .red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
NavigationStack {
|
||||||
|
ZStack {
|
||||||
|
backgroundGradient
|
||||||
|
List {
|
||||||
|
NavigationLink() {
|
||||||
|
iCloudSettingsView(
|
||||||
|
viewModel: viewModel,
|
||||||
|
hasUbiquitous: $hasUbiquitous,
|
||||||
|
lastSyncWasSuccessful: $lastSyncWasSuccessful,
|
||||||
|
lastSyncWasNormalAgo: $lastSyncWasNormalAgo,
|
||||||
|
localCountEqualToiCloud: $localCountEqualToiCloud,
|
||||||
|
icloudCountEqualToLocal: $icloudCountEqualToLocal,
|
||||||
|
updateStatus: updateStatus
|
||||||
|
)
|
||||||
|
} label: {
|
||||||
|
HStack {
|
||||||
|
Image(systemName: "icloud.fill")
|
||||||
|
Text("iCloud")
|
||||||
|
Spacer()
|
||||||
|
Circle()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
.foregroundStyle(iCloudStatusColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onAppear {
|
||||||
|
viewModel.sync()
|
||||||
|
updateStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
NavigationLink() {
|
||||||
|
NavigationStack() {
|
||||||
|
Button() {
|
||||||
|
UIPasteboard.general.string = "\(viewModel.exportEvents() ?? "")"
|
||||||
|
print(viewModel.exportEvents() as Any)
|
||||||
|
} label: {
|
||||||
|
Text("copy")
|
||||||
|
}
|
||||||
|
Text("\(viewModel.exportEvents() ?? "")")
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "list.bullet.rectangle")
|
||||||
|
Text("Export events")
|
||||||
|
}
|
||||||
|
NavigationLink() {
|
||||||
|
NavigationStack() {
|
||||||
|
VStack {
|
||||||
|
TextEditor(text: $importStr)
|
||||||
|
.foregroundStyle(.foreground, .gray)
|
||||||
|
.background(.gray)
|
||||||
|
.frame(width: 200, height: 400)
|
||||||
|
.shadow(radius: 5)
|
||||||
|
Button() {
|
||||||
|
viewModel.importEvents(importStr)
|
||||||
|
} label: {
|
||||||
|
Text("import events")
|
||||||
|
}
|
||||||
|
.buttonStyle(BorderedProminentButtonStyle())
|
||||||
|
Button() {
|
||||||
|
if let pb = UIPasteboard.general.string {
|
||||||
|
print(pb)
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Text("print pb")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "square.and.arrow.down")
|
||||||
|
Text("Import events")
|
||||||
|
}
|
||||||
|
|
||||||
|
Section("Tip") {
|
||||||
|
Text("Near Future has Widgets!")
|
||||||
|
}
|
||||||
|
|
||||||
|
Section("Danger Zone") {
|
||||||
|
Button("Delete local data", role: .destructive) {
|
||||||
|
viewModel.dangerClearLocalData()
|
||||||
|
}
|
||||||
|
Button("Delete iCloud data", role: .destructive) {
|
||||||
|
viewModel.dangerCleariCloudData()
|
||||||
|
}
|
||||||
|
Button("Delete all data", role: .destructive) {
|
||||||
|
viewModel.dangerClearLocalData()
|
||||||
|
viewModel.dangerCleariCloudData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Section("Debug") {
|
||||||
|
Button("Reset UserDefaults", role: .destructive) {
|
||||||
|
viewModel.dangerResetLocalData()
|
||||||
|
}
|
||||||
|
Button("Reset iCloud", role: .destructive) {
|
||||||
|
viewModel.dangerResetiCloud()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.scrollContentBackground(.hidden)
|
||||||
|
.navigationTitle("Settings")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
SettingsView(viewModel: dummyEventViewModel())
|
||||||
|
}
|
||||||
|
|
||||||
|
func test() -> Void {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// StatsView.swift
|
// StatsView.swift
|
||||||
// NearFuture
|
// NearFuture
|
||||||
//
|
//
|
||||||
// Created by neon443 on 05/01/2025.
|
// Created by Nihaal Sharma on 05/01/2025.
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
@@ -58,7 +58,7 @@ struct StatsView: View {
|
|||||||
}
|
}
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
.navigationTitle("Statistics")
|
.navigationTitle("Statistics")
|
||||||
.modifier(navigationInlineLarge())
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
//
|
|
||||||
// ArchiveView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 25/04/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct ArchiveView: View {
|
|
||||||
@ObservedObject var viewModel: EventViewModel
|
|
||||||
@State var showAddEvent: Bool = false
|
|
||||||
var filteredEvents: [Event] {
|
|
||||||
let filteredEvents = viewModel.events.filter({$0.complete})
|
|
||||||
return filteredEvents.reversed()
|
|
||||||
}
|
|
||||||
var body: some View {
|
|
||||||
NavigationStack {
|
|
||||||
ZStack {
|
|
||||||
backgroundGradient
|
|
||||||
if viewModel.events.filter({$0.complete}).isEmpty {
|
|
||||||
HelpView(showAddEvent: $showAddEvent)
|
|
||||||
} else {
|
|
||||||
ScrollView {
|
|
||||||
ForEach(filteredEvents) { event in
|
|
||||||
NavigationLink() {
|
|
||||||
EditEventView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
event: Binding(
|
|
||||||
get: { event },
|
|
||||||
set: { newValue in
|
|
||||||
viewModel.editEvent(newValue)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} label: {
|
|
||||||
EventListView(viewModel: viewModel, event: event)
|
|
||||||
.id(event)
|
|
||||||
}
|
|
||||||
.transition(.moveAndFadeReversed)
|
|
||||||
.contextMenu() {
|
|
||||||
Button(role: .destructive) {
|
|
||||||
viewModel.removeEvent(event)
|
|
||||||
} label: {
|
|
||||||
Label("Delete", systemImage: "trash")
|
|
||||||
.tint(.red)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding(.horizontal)
|
|
||||||
}
|
|
||||||
.animation(.default, value: filteredEvents)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.transition(.opacity)
|
|
||||||
.scrollContentBackground(.hidden)
|
|
||||||
.toolbar {
|
|
||||||
ToolbarItem(placement: .primaryAction) {
|
|
||||||
AddEventButton(showingAddEventView: $showAddEvent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.navigationTitle("Archive")
|
|
||||||
.modifier(navigationInlineLarge())
|
|
||||||
}
|
|
||||||
.sheet(isPresented: $showAddEvent) {
|
|
||||||
AddEventView(
|
|
||||||
viewModel: viewModel
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
ArchiveView(viewModel: dummyEventViewModel())
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
//
|
|
||||||
// ContentView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 24/12/2024.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
import UserNotifications
|
|
||||||
import SwiftData
|
|
||||||
|
|
||||||
enum Tab {
|
|
||||||
case home
|
|
||||||
case archive
|
|
||||||
case symbols
|
|
||||||
case stats
|
|
||||||
case settings
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ContentView: View {
|
|
||||||
@StateObject var viewModel: EventViewModel
|
|
||||||
@StateObject var settingsModel: SettingsViewModel
|
|
||||||
@State var tabSelection: Tab = .home
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
TabView(selection: $tabSelection) {
|
|
||||||
HomeView(viewModel: viewModel, settingsModel: settingsModel)
|
|
||||||
.tabItem {
|
|
||||||
Label("Home", systemImage: "house")
|
|
||||||
}
|
|
||||||
.tag(Tab.home)
|
|
||||||
ArchiveView(viewModel: viewModel)
|
|
||||||
.tabItem() {
|
|
||||||
Label("Archive", systemImage: "tray.full")
|
|
||||||
}
|
|
||||||
.tag(Tab.archive)
|
|
||||||
SymbolsPicker(
|
|
||||||
selection: .constant(""),
|
|
||||||
browsing: true
|
|
||||||
)
|
|
||||||
.tabItem {
|
|
||||||
Label("Symbols", systemImage: "star.circle")
|
|
||||||
}
|
|
||||||
.tag(Tab.symbols)
|
|
||||||
StatsView(viewModel: viewModel)
|
|
||||||
// SymbolsPickerStoryboardUIViewRepresentable()
|
|
||||||
.tabItem {
|
|
||||||
Label("Statistics", systemImage: "chart.pie")
|
|
||||||
}
|
|
||||||
.tag(Tab.stats)
|
|
||||||
SettingsView(viewModel: viewModel, settingsModel: settingsModel)
|
|
||||||
.tabItem {
|
|
||||||
Label("Settings", systemImage: "gear")
|
|
||||||
}
|
|
||||||
.tag(Tab.settings)
|
|
||||||
}
|
|
||||||
.modifier(hapticHeavy(trigger: tabSelection))
|
|
||||||
.sheet(isPresented: $settingsModel.settings.showWhatsNew) {
|
|
||||||
WhatsNewView(settingsModel: settingsModel)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
ContentView(
|
|
||||||
viewModel: dummyEventViewModel(),
|
|
||||||
settingsModel: dummySettingsViewModel()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,216 +0,0 @@
|
|||||||
//
|
|
||||||
// AddEventView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 25/12/2024.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct AddEventView: View {
|
|
||||||
@ObservedObject var viewModel: EventViewModel
|
|
||||||
|
|
||||||
@State var event: Event = dummyEventViewModel().template
|
|
||||||
|
|
||||||
@State var adding: Bool = true
|
|
||||||
@State var showNeedsNameAlert: Bool = false
|
|
||||||
@State var isSymbolPickerPresented: Bool = false
|
|
||||||
|
|
||||||
@FocusState private var focusedField: Field?
|
|
||||||
private enum Field {
|
|
||||||
case Name, Notes
|
|
||||||
}
|
|
||||||
|
|
||||||
@Environment(\.dismiss) var dismiss
|
|
||||||
|
|
||||||
var isMac: Bool {
|
|
||||||
if #available(iOS 1, *) {
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
ZStack {
|
|
||||||
if !adding {
|
|
||||||
backgroundGradient
|
|
||||||
}
|
|
||||||
NavigationStack {
|
|
||||||
List {
|
|
||||||
Section(
|
|
||||||
header:
|
|
||||||
Text("Event Details")
|
|
||||||
.font(.headline)
|
|
||||||
.foregroundColor(.accentColor)
|
|
||||||
) {
|
|
||||||
// name & symbol
|
|
||||||
HStack(spacing: 5) {
|
|
||||||
Button() {
|
|
||||||
isSymbolPickerPresented.toggle()
|
|
||||||
} label: {
|
|
||||||
Image(systemName: event.symbol)
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
.foregroundStyle(event.color.color)
|
|
||||||
}
|
|
||||||
.frame(width: 20)
|
|
||||||
.buttonStyle(.borderless)
|
|
||||||
.sheet(isPresented: $isSymbolPickerPresented) {
|
|
||||||
SymbolsPicker(
|
|
||||||
selection: $event.symbol
|
|
||||||
)
|
|
||||||
.presentationDetents([.medium])
|
|
||||||
.modifier(presentationSizeForm())
|
|
||||||
}
|
|
||||||
TextField("Event Name", text: $event.name)
|
|
||||||
.textFieldStyle(.roundedBorder)
|
|
||||||
}
|
|
||||||
|
|
||||||
// dscription
|
|
||||||
ZStack {
|
|
||||||
if event.notes.isEmpty {
|
|
||||||
HStack {
|
|
||||||
Text("Event Notes")
|
|
||||||
.opacity(0.5)
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TextEditor(text: $event.notes)
|
|
||||||
.lineLimit(10)
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorPicker("Event Color", selection: $event.color.colorBind)
|
|
||||||
|
|
||||||
// date picker
|
|
||||||
HStack {
|
|
||||||
Spacer()
|
|
||||||
DatePicker("", selection: $event.date, displayedComponents: .date)
|
|
||||||
#if os(iOS)
|
|
||||||
.datePickerStyle(.wheel)
|
|
||||||
#else
|
|
||||||
.datePickerStyle(.graphical)
|
|
||||||
#endif
|
|
||||||
Spacer()
|
|
||||||
Button() {
|
|
||||||
event.date = Date()
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "arrow.uturn.left")
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
}
|
|
||||||
.buttonStyle(BorderlessButtonStyle())
|
|
||||||
.frame(width: 20)
|
|
||||||
}
|
|
||||||
|
|
||||||
DatePicker(
|
|
||||||
"",
|
|
||||||
selection: $event.date,
|
|
||||||
displayedComponents: .hourAndMinute
|
|
||||||
)
|
|
||||||
#if os(macOS)
|
|
||||||
.datePickerStyle(.stepperField)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// re-ocurrence Picker
|
|
||||||
Picker("Recurrence", selection: $event.recurrence) {
|
|
||||||
ForEach(Event.RecurrenceType.allCases, id: \.self) { recurrence in
|
|
||||||
Text(recurrence.rawValue.capitalized)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.pickerStyle(SegmentedPickerStyle())
|
|
||||||
Text(
|
|
||||||
describeOccurrence(
|
|
||||||
date: event.date,
|
|
||||||
recurrence: event.recurrence
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.navigationTitle("\(adding ? "Add Event" : "")")
|
|
||||||
.modifier(navigationInlineLarge())
|
|
||||||
.toolbar {
|
|
||||||
ToolbarItem(placement: .cancellationAction) {
|
|
||||||
if adding {
|
|
||||||
Button() {
|
|
||||||
resetAddEventView()
|
|
||||||
dismiss()
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "xmark")
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.tint(.one)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ToolbarItem() {
|
|
||||||
if adding {
|
|
||||||
Button {
|
|
||||||
viewModel.addEvent(
|
|
||||||
newEvent: event
|
|
||||||
)
|
|
||||||
resetAddEventView()
|
|
||||||
#if canImport(UIKit)
|
|
||||||
UINotificationFeedbackGenerator().notificationOccurred(.success)
|
|
||||||
#endif
|
|
||||||
} label: {
|
|
||||||
Label("Save", systemImage: "checkmark")
|
|
||||||
}
|
|
||||||
.tint(.accent)
|
|
||||||
.disabled(event.name.isEmpty)
|
|
||||||
.onTapGesture {
|
|
||||||
if event.name.isEmpty {
|
|
||||||
showNeedsNameAlert.toggle()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.alert("Missing Name", isPresented: $showNeedsNameAlert) {
|
|
||||||
Button("OK", role: .cancel) {
|
|
||||||
showNeedsNameAlert.toggle()
|
|
||||||
focusedField = .Name
|
|
||||||
}
|
|
||||||
} message: {
|
|
||||||
Text("Give your Event a name before saving.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ToolbarItem(placement: .confirmationAction) {
|
|
||||||
if !adding {
|
|
||||||
Button() {
|
|
||||||
viewModel.editEvent(event)
|
|
||||||
dismiss()
|
|
||||||
#if canImport(UIKit)
|
|
||||||
UINotificationFeedbackGenerator().notificationOccurred(.success)
|
|
||||||
#endif
|
|
||||||
} label: {
|
|
||||||
Label("Done", systemImage: "checkmark")
|
|
||||||
}
|
|
||||||
.disabled(event.name == "")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.navigationTitle("Editing \(event.name) - Ne")
|
|
||||||
}
|
|
||||||
.scrollContentBackground(isMac ? .automatic : .hidden)
|
|
||||||
.presentationDragIndicator(.visible)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func resetAddEventView() {
|
|
||||||
//reset addeventView
|
|
||||||
event = viewModel.template
|
|
||||||
dismiss()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
let vm = dummyEventViewModel()
|
|
||||||
Color.orange
|
|
||||||
.ignoresSafeArea(.all)
|
|
||||||
.sheet(isPresented: .constant(true)) {
|
|
||||||
AddEventView(
|
|
||||||
viewModel: vm,
|
|
||||||
adding: true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
//
|
|
||||||
// EditEventView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 02/01/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct EditEventView: View {
|
|
||||||
@Environment(\.dismiss) var dismiss
|
|
||||||
@ObservedObject var viewModel: EventViewModel
|
|
||||||
@Binding var event: Event
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
AddEventView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
event: event,
|
|
||||||
adding: false //bc we editing existing event
|
|
||||||
)
|
|
||||||
.navigationTitle("Edit Event")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
let vm = dummyEventViewModel()
|
|
||||||
EditEventView(
|
|
||||||
viewModel: vm,
|
|
||||||
event: .constant(vm.example)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
//
|
|
||||||
// EventListView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 18/04/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
import SwiftData
|
|
||||||
|
|
||||||
struct EventListView: View {
|
|
||||||
@ObservedObject var viewModel: EventViewModel
|
|
||||||
@State var event: Event
|
|
||||||
|
|
||||||
@Environment(\.openWindow) var openWindow
|
|
||||||
|
|
||||||
@State var hovering: Bool = false
|
|
||||||
|
|
||||||
#if canImport(AppKit)
|
|
||||||
var body: some View {
|
|
||||||
ZStack {
|
|
||||||
Color.black.opacity(hovering ? 0.5 : 0.0)
|
|
||||||
HStack {
|
|
||||||
RoundedRectangle(cornerRadius: 5)
|
|
||||||
.frame(width: 7)
|
|
||||||
.foregroundStyle(
|
|
||||||
event.color.color.opacity(
|
|
||||||
event.complete ? 0.5 : 1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
HStack {
|
|
||||||
Image(systemName: event.symbol)
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
.shadow(radius: 5)
|
|
||||||
.foregroundStyle(
|
|
||||||
.one.opacity(
|
|
||||||
event.complete ? 0.5 : 1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
Text("\(event.name)")
|
|
||||||
.bold()
|
|
||||||
.foregroundStyle(.one)
|
|
||||||
.strikethrough(event.complete)
|
|
||||||
.multilineTextAlignment(.leading)
|
|
||||||
}
|
|
||||||
if !event.notes.isEmpty {
|
|
||||||
Text(event.notes)
|
|
||||||
.foregroundStyle(.one.opacity(0.8))
|
|
||||||
.multilineTextAlignment(.leading)
|
|
||||||
}
|
|
||||||
Text(
|
|
||||||
event.date.formatted(
|
|
||||||
date: .long,
|
|
||||||
time: .shortened
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.foregroundStyle(
|
|
||||||
.one.opacity(
|
|
||||||
event.complete ? 0.5 : 1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if event.recurrence != .none {
|
|
||||||
Text("Occurs \(event.recurrence.rawValue)")
|
|
||||||
.font(.subheadline)
|
|
||||||
.foregroundStyle(
|
|
||||||
.one.opacity(event.complete ? 0.5 : 1))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
VStack {
|
|
||||||
Text("\(daysUntilEvent(event.date).long)")
|
|
||||||
.multilineTextAlignment(.trailing)
|
|
||||||
.foregroundStyle(event.date.timeIntervalSinceNow < 0 ? .red : .one)
|
|
||||||
}
|
|
||||||
CompleteEventButton(
|
|
||||||
viewModel: viewModel,
|
|
||||||
event: $event
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
|
||||||
}
|
|
||||||
.onHover { isHovering in
|
|
||||||
withAnimation {
|
|
||||||
hovering.toggle()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onTapGesture {
|
|
||||||
openWindow(value: event.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
var body: some View {
|
|
||||||
HStack {
|
|
||||||
RoundedRectangle(cornerRadius: 5)
|
|
||||||
.frame(width: 7)
|
|
||||||
.foregroundStyle(
|
|
||||||
event.color.color.opacity(
|
|
||||||
event.complete ? 0.5 : 1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
HStack {
|
|
||||||
Image(systemName: event.symbol)
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
.shadow(radius: 5)
|
|
||||||
.foregroundStyle(
|
|
||||||
.one.opacity(
|
|
||||||
event.complete ? 0.5 : 1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
Text("\(event.name)")
|
|
||||||
.font(.headline)
|
|
||||||
.foregroundStyle(.one)
|
|
||||||
.strikethrough(event.complete)
|
|
||||||
.multilineTextAlignment(.leading)
|
|
||||||
}
|
|
||||||
if !event.notes.isEmpty {
|
|
||||||
Text(event.notes)
|
|
||||||
.font(.subheadline)
|
|
||||||
.foregroundStyle(.one.opacity(0.8))
|
|
||||||
.multilineTextAlignment(.leading)
|
|
||||||
}
|
|
||||||
Text(
|
|
||||||
event.date.formatted(
|
|
||||||
date: .long,
|
|
||||||
time: .shortened
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.font(.subheadline)
|
|
||||||
.foregroundStyle(
|
|
||||||
.one.opacity(
|
|
||||||
event.complete ? 0.5 : 1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if event.recurrence != .none {
|
|
||||||
Text("Occurs \(event.recurrence.rawValue)")
|
|
||||||
.font(.subheadline)
|
|
||||||
.foregroundStyle(
|
|
||||||
.one.opacity(event.complete ? 0.5 : 1))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
VStack {
|
|
||||||
Text("\(daysUntilEvent(event.date).long)")
|
|
||||||
.font(.subheadline)
|
|
||||||
.foregroundStyle(event.date.timeIntervalSinceNow < 0 ? .red : .one)
|
|
||||||
.multilineTextAlignment(.trailing)
|
|
||||||
}
|
|
||||||
CompleteEventButton(
|
|
||||||
viewModel: viewModel,
|
|
||||||
event: $event
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.padding(.vertical, 5)
|
|
||||||
.overlay(
|
|
||||||
RoundedRectangle(cornerRadius: 15)
|
|
||||||
.stroke(.one.opacity(0.5), lineWidth: 1)
|
|
||||||
)
|
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 15))
|
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
|
||||||
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
|
||||||
Button(role: .destructive) {
|
|
||||||
viewModel.removeEvent(event)
|
|
||||||
} label: {
|
|
||||||
Label("Delete", systemImage: "trash")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview("EventListView") {
|
|
||||||
let vm = dummyEventViewModel()
|
|
||||||
ZStack {
|
|
||||||
VStack {
|
|
||||||
ForEach(vm.events) { event in
|
|
||||||
EventListView(
|
|
||||||
viewModel: vm,
|
|
||||||
event: event
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding(.horizontal, 10)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
//
|
|
||||||
// HomeView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 12/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
import AppIntents
|
|
||||||
|
|
||||||
struct HomeView: View {
|
|
||||||
@ObservedObject var viewModel: EventViewModel
|
|
||||||
@ObservedObject var settingsModel: SettingsViewModel
|
|
||||||
|
|
||||||
@State private var showingAddEventView: Bool = false
|
|
||||||
@State private var searchInput: String = ""
|
|
||||||
@Environment(\.colorScheme) var appearance
|
|
||||||
var darkMode: Bool {
|
|
||||||
return appearance == .dark
|
|
||||||
}
|
|
||||||
var filteredEvents: [Event] {
|
|
||||||
if searchInput.isEmpty {
|
|
||||||
if settingsModel.settings.showCompletedInHome {
|
|
||||||
return viewModel.events
|
|
||||||
} else {
|
|
||||||
return viewModel.events.filter() {!$0.complete}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return viewModel.events.filter {
|
|
||||||
$0.name.localizedCaseInsensitiveContains(searchInput) ||
|
|
||||||
$0.notes.localizedCaseInsensitiveContains(searchInput)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@State private var focusedTab: Tab = .home
|
|
||||||
|
|
||||||
@FocusState private var focusedField: Field?
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
NavigationStack {
|
|
||||||
ZStack {
|
|
||||||
backgroundGradient
|
|
||||||
VStack {
|
|
||||||
if filteredEvents.isEmpty && !searchInput.isEmpty {
|
|
||||||
HelpView(searchInput: $searchInput, focusedField: focusedField)
|
|
||||||
} else {
|
|
||||||
ScrollView {
|
|
||||||
// LazyVStack {
|
|
||||||
ForEach(filteredEvents) { event in
|
|
||||||
NavigationLink() {
|
|
||||||
EditEventView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
event: Binding(
|
|
||||||
get: { event },
|
|
||||||
set: { newValue in
|
|
||||||
viewModel.editEvent(newValue)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} label: {
|
|
||||||
EventListView(viewModel: viewModel, event: event)
|
|
||||||
.id(event)
|
|
||||||
}
|
|
||||||
.transition(.moveAndFade)
|
|
||||||
.contextMenu() {
|
|
||||||
Button(role: .destructive) {
|
|
||||||
viewModel.removeEvent(event)
|
|
||||||
} label: {
|
|
||||||
Label("Delete", systemImage: "trash")
|
|
||||||
.tint(.red)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding(.horizontal)
|
|
||||||
// }
|
|
||||||
if filteredEvents.isEmpty {
|
|
||||||
HelpView(
|
|
||||||
searchInput: $searchInput,
|
|
||||||
focusedField: focusedField
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
.animation(.default, value: filteredEvents)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.searchable(text: $searchInput)
|
|
||||||
.navigationTitle("Near Future")
|
|
||||||
.modifier(navigationInlineLarge())
|
|
||||||
.sheet(isPresented: $showingAddEventView) {
|
|
||||||
AddEventView(
|
|
||||||
viewModel: viewModel
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.toolbar {
|
|
||||||
ToolbarItem(placement: .primaryAction) {
|
|
||||||
AddEventButton(showingAddEventView: $showingAddEventView)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
HomeView(
|
|
||||||
viewModel: dummyEventViewModel(),
|
|
||||||
settingsModel: dummySettingsViewModel()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
//
|
|
||||||
// AboutView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 12/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct AboutView: View {
|
|
||||||
var body: some View {
|
|
||||||
VStack {
|
|
||||||
Image(uiImage: #imageLiteral(resourceName: "NearFutureIcon.png"))
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 100)
|
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 25))
|
|
||||||
Text("Near Future")
|
|
||||||
.bold()
|
|
||||||
.monospaced()
|
|
||||||
.font(.title)
|
|
||||||
.frame(maxWidth: .infinity)
|
|
||||||
Text("Version " + getVersion() + " (\(getBuildID()))")
|
|
||||||
.frame(maxWidth: .infinity)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
AboutView()
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
//
|
|
||||||
// MagicClearButton.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 06/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct MagicClearButton: View {
|
|
||||||
@Binding var text: String
|
|
||||||
var body: some View {
|
|
||||||
HStack {
|
|
||||||
Spacer()
|
|
||||||
Button {
|
|
||||||
text = ""
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "xmark.circle.fill")
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: text.isEmpty ? 0 : 25)
|
|
||||||
.symbolRenderingMode(.hierarchical)
|
|
||||||
.padding(.trailing, -5)
|
|
||||||
.animation(.spring, value: text.isEmpty)
|
|
||||||
}
|
|
||||||
.buttonStyle(.borderless)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct AddEventButton: View {
|
|
||||||
@Binding var showingAddEventView: Bool
|
|
||||||
var body: some View {
|
|
||||||
Button() {
|
|
||||||
showingAddEventView.toggle()
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "plus")
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 15)
|
|
||||||
.bold()
|
|
||||||
.foregroundStyle(.one)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
MagicClearButton(text: .constant("s"))
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
AddEventButton(showingAddEventView: .constant(false))
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
//
|
|
||||||
// ExportView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 02/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct ExportView: View {
|
|
||||||
@ObservedObject var viewModel: EventViewModel
|
|
||||||
var body: some View {
|
|
||||||
List {
|
|
||||||
Button() {
|
|
||||||
#if canImport(UIKit)
|
|
||||||
UIPasteboard.general.string = viewModel.exportEvents()
|
|
||||||
#else
|
|
||||||
NSPasteboard.general.setString(viewModel.exportEvents(), forType: .string)
|
|
||||||
#endif
|
|
||||||
} label: {
|
|
||||||
Label("Copy Events", systemImage: "document.on.clipboard")
|
|
||||||
}
|
|
||||||
Text(viewModel.exportEvents())
|
|
||||||
.textSelection(.enabled)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
ExportView(viewModel: dummyEventViewModel())
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
//
|
|
||||||
// ImportView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 02/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct ImportView: View {
|
|
||||||
@ObservedObject var viewModel: EventViewModel
|
|
||||||
@Binding var importStr: String
|
|
||||||
|
|
||||||
@State private var image: String = "clock.fill"
|
|
||||||
@State private var text: String = "Ready..."
|
|
||||||
@State private var fgColor: Color = .yellow
|
|
||||||
|
|
||||||
@State private var showAlert: Bool = false
|
|
||||||
|
|
||||||
@State private var replaceCurrentEvents: Bool = false
|
|
||||||
|
|
||||||
fileprivate func importEvents() {
|
|
||||||
do throws {
|
|
||||||
try viewModel.importEvents(importStr, replace: replaceCurrentEvents)
|
|
||||||
withAnimation {
|
|
||||||
image = "checkmark.circle.fill"
|
|
||||||
text = "Complete"
|
|
||||||
fgColor = .green
|
|
||||||
}
|
|
||||||
} catch importError.invalidB64 {
|
|
||||||
withAnimation {
|
|
||||||
image = "xmark.app.fill"
|
|
||||||
text = "Invalid base64 input."
|
|
||||||
fgColor = .red
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
withAnimation {
|
|
||||||
image = "xmark.app.fill"
|
|
||||||
text = error.localizedDescription
|
|
||||||
fgColor = .red
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
ZStack(alignment: .center) {
|
|
||||||
List {
|
|
||||||
Section("Status") {
|
|
||||||
Label(text, systemImage: image)
|
|
||||||
.contentTransition(.numericText())
|
|
||||||
.foregroundStyle(fgColor)
|
|
||||||
}
|
|
||||||
TextField("", text: $importStr)
|
|
||||||
Button() {
|
|
||||||
withAnimation {
|
|
||||||
showAlert.toggle()
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Label("Import", systemImage: "tray.and.arrow.down.fill")
|
|
||||||
}
|
|
||||||
.disabled(importStr.isEmpty)
|
|
||||||
.onAppear() {
|
|
||||||
importStr = ""
|
|
||||||
image = "clock.fill"
|
|
||||||
text = "Ready..."
|
|
||||||
fgColor = .yellow
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.alert("Are you sure?", isPresented: $showAlert) {
|
|
||||||
Button(role: .destructive) {
|
|
||||||
importEvents()
|
|
||||||
} label: {
|
|
||||||
Text("Replace Events")
|
|
||||||
}
|
|
||||||
Button() {
|
|
||||||
importEvents()
|
|
||||||
} label: {
|
|
||||||
Text("Add to Events")
|
|
||||||
.foregroundStyle(.one)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
ImportView(
|
|
||||||
viewModel: dummyEventViewModel(),
|
|
||||||
importStr: .constant("kljadfskljafdlkj;==")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
//
|
|
||||||
// SettingsView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 29/12/2024.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct SettingsView: View {
|
|
||||||
@ObservedObject var viewModel: EventViewModel
|
|
||||||
@ObservedObject var settingsModel: SettingsViewModel
|
|
||||||
|
|
||||||
@State private var importStr: String = ""
|
|
||||||
|
|
||||||
func changeIcon(to toIcon: String) {
|
|
||||||
guard UIApplication.shared.supportsAlternateIcons else {
|
|
||||||
print("doesnt tsupport alternate icons")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
guard toIcon != "orange" else {
|
|
||||||
UIApplication.shared.setAlternateIconName(nil) { error in
|
|
||||||
print(error as Any)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
UIApplication.shared.setAlternateIconName(toIcon) { error in
|
|
||||||
print(error as Any)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
NavigationStack {
|
|
||||||
ZStack {
|
|
||||||
backgroundGradient
|
|
||||||
List {
|
|
||||||
ScrollView(.horizontal) {
|
|
||||||
HStack {
|
|
||||||
ForEach(settingsModel.accentChoices, id: \.self) { choice in
|
|
||||||
let color = Color(uiColor: UIColor(named: "uiColors/\(choice)")!)
|
|
||||||
ZStack {
|
|
||||||
Button() {
|
|
||||||
settingsModel.changeTint(to: choice)
|
|
||||||
changeIcon(to: choice)
|
|
||||||
} label: {
|
|
||||||
Circle()
|
|
||||||
.foregroundStyle(color)
|
|
||||||
.frame(width: 30)
|
|
||||||
}
|
|
||||||
.buttonStyle(.plain)
|
|
||||||
if ColorCodable(color) == settingsModel.settings.tint {
|
|
||||||
let needContrast: Bool = ColorCodable(color) == settingsModel.settings.tint
|
|
||||||
Circle()
|
|
||||||
.foregroundStyle(needContrast ? .two : .one)
|
|
||||||
.frame(width: 10)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Button("Show What's New") {
|
|
||||||
settingsModel.settings.showWhatsNew = true
|
|
||||||
}
|
|
||||||
Toggle("Show completed Events in Home", isOn: $settingsModel.settings.showCompletedInHome)
|
|
||||||
.onChange(of: settingsModel.settings.showCompletedInHome) { _ in
|
|
||||||
settingsModel.saveSettings()
|
|
||||||
}
|
|
||||||
NavigationLink() {
|
|
||||||
List {
|
|
||||||
if !settingsModel.notifsGranted {
|
|
||||||
Text("\(Image(systemName: "xmark")) Notifications disabled for Near Future")
|
|
||||||
.foregroundStyle(.red)
|
|
||||||
Button("Request Notifications") {
|
|
||||||
Task.detached {
|
|
||||||
let requestNotifsResult = await requestNotifs()
|
|
||||||
await MainActor.run {
|
|
||||||
settingsModel.notifsGranted = requestNotifsResult
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Text("\(Image(systemName: "checkmark")) Notifications enabled for Near Future")
|
|
||||||
.foregroundStyle(.green)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "bell.badge.fill")
|
|
||||||
Text("Notifications")
|
|
||||||
}
|
|
||||||
NavigationLink() {
|
|
||||||
iCloudSettingsView(
|
|
||||||
viewModel: viewModel,
|
|
||||||
settingsModel: settingsModel
|
|
||||||
)
|
|
||||||
} label: {
|
|
||||||
HStack {
|
|
||||||
Image(systemName: "icloud.fill")
|
|
||||||
Text("iCloud")
|
|
||||||
Spacer()
|
|
||||||
Circle()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
.foregroundStyle(viewModel.iCloudStatusColor)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onAppear {
|
|
||||||
viewModel.sync()
|
|
||||||
viewModel.updateiCStatus()
|
|
||||||
}
|
|
||||||
NavigationLink() {
|
|
||||||
ImportView(viewModel: viewModel, importStr: $importStr)
|
|
||||||
} label: {
|
|
||||||
Label("Import Events", systemImage: "tray.and.arrow.down.fill")
|
|
||||||
.foregroundStyle(.one)
|
|
||||||
}
|
|
||||||
NavigationLink() {
|
|
||||||
ExportView(viewModel: viewModel)
|
|
||||||
} label: {
|
|
||||||
Label("Export Events", systemImage: "square.and.arrow.up")
|
|
||||||
.foregroundStyle(.one)
|
|
||||||
}
|
|
||||||
|
|
||||||
Section("Tip") {
|
|
||||||
Text("Near Future has Widgets!")
|
|
||||||
}
|
|
||||||
|
|
||||||
Section("Danger Zone") {
|
|
||||||
Button("Delete local data", role: .destructive) {
|
|
||||||
viewModel.dangerClearLocalData()
|
|
||||||
}
|
|
||||||
Button("Delete iCloud data", role: .destructive) {
|
|
||||||
viewModel.dangerCleariCloudData()
|
|
||||||
}
|
|
||||||
Button("Delete all data", role: .destructive) {
|
|
||||||
viewModel.dangerClearLocalData()
|
|
||||||
viewModel.dangerCleariCloudData()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Section("Debug") {
|
|
||||||
Button("Reset UserDefaults", role: .destructive) {
|
|
||||||
viewModel.dangerResetLocalData()
|
|
||||||
}
|
|
||||||
Button("Reset iCloud", role: .destructive) {
|
|
||||||
viewModel.dangerResetiCloud()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Section("About") {
|
|
||||||
AboutView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.navigationTitle("Settings")
|
|
||||||
.modifier(navigationInlineLarge())
|
|
||||||
.scrollContentBackground(.hidden)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
SettingsView(
|
|
||||||
viewModel: dummyEventViewModel(),
|
|
||||||
settingsModel: dummySettingsViewModel()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
//
|
|
||||||
// WhatsNewView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 12/05/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct WhatsNewView: View {
|
|
||||||
@ObservedObject var settingsModel: SettingsViewModel
|
|
||||||
@Environment(\.dismiss) var dismiss
|
|
||||||
struct WhatsNewChunk: Identifiable {
|
|
||||||
var id: UUID = UUID()
|
|
||||||
var symbol: String
|
|
||||||
var title: String
|
|
||||||
var subtitle: String
|
|
||||||
}
|
|
||||||
@State var bye: Bool = false
|
|
||||||
var whatsNewChunks: [WhatsNewChunk] {
|
|
||||||
return [
|
|
||||||
WhatsNewChunk(
|
|
||||||
symbol: "desktopcomputer",
|
|
||||||
title: "Mac Native App",
|
|
||||||
subtitle: "New Mac native app (Intel too!)"
|
|
||||||
),
|
|
||||||
WhatsNewChunk(
|
|
||||||
symbol: "iphone.radiowaves.left.and.right",
|
|
||||||
title: "Haptic Feedback",
|
|
||||||
subtitle: "Lovely haptic feedback when completing and adding events, and selecting tabs"
|
|
||||||
),
|
|
||||||
WhatsNewChunk(
|
|
||||||
symbol: "app",
|
|
||||||
title: "App Icons",
|
|
||||||
subtitle: "You now get a special app icon that matches the color you choose in settings!"
|
|
||||||
),
|
|
||||||
WhatsNewChunk(
|
|
||||||
symbol: "apps.iphone",
|
|
||||||
title: "Widgets Day Count Fix",
|
|
||||||
subtitle: "The day count for widgets are now red for overdue events, just like the app, and are now more readable"
|
|
||||||
),
|
|
||||||
WhatsNewChunk(
|
|
||||||
symbol: settingsModel.device.sf,
|
|
||||||
title: "This Screen",
|
|
||||||
subtitle: "This update add a Whats New page that will tell you (suprise!) What's New"
|
|
||||||
),
|
|
||||||
WhatsNewChunk(
|
|
||||||
symbol: "bell.badge.fill",
|
|
||||||
title: "Notifications",
|
|
||||||
subtitle: "Events now have notifications, reminding you to complete them!"
|
|
||||||
),
|
|
||||||
WhatsNewChunk(
|
|
||||||
symbol: "list.bullet.indent",
|
|
||||||
title: "Animations!",
|
|
||||||
subtitle: "I added animations for adding, removing and ticking events - animations are definitely the most important change"
|
|
||||||
)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
var body: some View {
|
|
||||||
NavigationStack {
|
|
||||||
ScrollView {
|
|
||||||
Text("What's New")
|
|
||||||
.font(.largeTitle)
|
|
||||||
.bold()
|
|
||||||
.padding(.vertical)
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
ForEach(whatsNewChunks) { new in
|
|
||||||
WhatsNewChunkView(
|
|
||||||
symbol: new.symbol,
|
|
||||||
title: new.title,
|
|
||||||
subtitle: new.subtitle
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
.padding(.horizontal, 10)
|
|
||||||
}
|
|
||||||
Button() {
|
|
||||||
bye.toggle()
|
|
||||||
dismiss()
|
|
||||||
} label: {
|
|
||||||
Text("Continue")
|
|
||||||
.font(.headline)
|
|
||||||
.frame(height: 40)
|
|
||||||
.bold()
|
|
||||||
// .frame(maxWidth: .infinity)
|
|
||||||
}
|
|
||||||
.foregroundStyle(.orange)
|
|
||||||
.modifier(glassButton())
|
|
||||||
.modifier(hapticHeavy(trigger: bye))
|
|
||||||
}
|
|
||||||
.scrollContentBackground(.hidden)
|
|
||||||
.presentationDragIndicator(.visible)
|
|
||||||
.onDisappear {
|
|
||||||
settingsModel.settings.prevAppVersion = getVersion()+getBuildID()
|
|
||||||
settingsModel.saveSettings()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
Color.accent
|
|
||||||
.ignoresSafeArea(.all)
|
|
||||||
.sheet(isPresented: .constant(true)) {
|
|
||||||
WhatsNewView(settingsModel: dummySettingsViewModel())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct WhatsNewChunkView: View {
|
|
||||||
@State var symbol: String
|
|
||||||
@State var title: String
|
|
||||||
@State var subtitle: String
|
|
||||||
var body: some View {
|
|
||||||
HStack {
|
|
||||||
Image(systemName: symbol)
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 30, height: 30)
|
|
||||||
.foregroundStyle(Color.orange)
|
|
||||||
.padding(.trailing, 15)
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
Text(title)
|
|
||||||
.font(.headline)
|
|
||||||
.bold()
|
|
||||||
Text(subtitle)
|
|
||||||
.foregroundStyle(.gray)
|
|
||||||
.font(.subheadline)
|
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
//
|
|
||||||
// iCloudSettingsView.swift
|
|
||||||
// NearFuture
|
|
||||||
//
|
|
||||||
// Created by neon443 on 18/04/2025.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct iCloudSettingsView: View {
|
|
||||||
@ObservedObject var viewModel: EventViewModel
|
|
||||||
@ObservedObject var settingsModel: SettingsViewModel
|
|
||||||
@State var showPushAlert: Bool = false
|
|
||||||
@State var showPullAlert: Bool = false
|
|
||||||
|
|
||||||
// @Binding var hasUbiquitous: Bool
|
|
||||||
// @Binding var lastSyncWasSuccessful: Bool
|
|
||||||
// @Binding var lastSyncWasNormalAgo: Bool
|
|
||||||
// @Binding var localCountEqualToiCloud: Bool
|
|
||||||
// @Binding var icloudCountEqualToLocal: Bool
|
|
||||||
//
|
|
||||||
// var updateStatus: () -> Void
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
ZStack {
|
|
||||||
backgroundGradient
|
|
||||||
List {
|
|
||||||
Section {
|
|
||||||
HStack {
|
|
||||||
Spacer()
|
|
||||||
VStack {
|
|
||||||
ZStack {
|
|
||||||
Image(systemName: "icloud")
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 75, height: 55)
|
|
||||||
.symbolRenderingMode(.multicolor)
|
|
||||||
Text("\(viewModel.icloudEventCount)")
|
|
||||||
.font(.title2)
|
|
||||||
.monospaced()
|
|
||||||
.bold()
|
|
||||||
}
|
|
||||||
Text("iCloud")
|
|
||||||
HStack {
|
|
||||||
Button(role: .destructive) {
|
|
||||||
showPushAlert.toggle()
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "arrow.up")
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 30, height: 40)
|
|
||||||
}
|
|
||||||
.buttonStyle(BorderedButtonStyle())
|
|
||||||
.alert("Warning", isPresented: $showPushAlert) {
|
|
||||||
Button("OK", role: .destructive) {
|
|
||||||
viewModel.replaceiCloudWithLocalData()
|
|
||||||
viewModel.sync()
|
|
||||||
viewModel.updateiCStatus()
|
|
||||||
}
|
|
||||||
Button("Cancel", role: .cancel) {}
|
|
||||||
} message: {
|
|
||||||
Text("This will replace Events stored in iCloud with Events stored locally.")
|
|
||||||
}
|
|
||||||
|
|
||||||
Button() {
|
|
||||||
viewModel.sync()
|
|
||||||
viewModel.updateiCStatus()
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "arrow.triangle.2.circlepath")
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 30, height: 40)
|
|
||||||
.foregroundStyle(Color.accentColor)
|
|
||||||
}
|
|
||||||
.buttonStyle(BorderedButtonStyle())
|
|
||||||
|
|
||||||
Button(role: .destructive) {
|
|
||||||
showPullAlert.toggle()
|
|
||||||
} label: {
|
|
||||||
Image(systemName: "arrow.down")
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 30, height: 40)
|
|
||||||
}
|
|
||||||
.buttonStyle(BorderedButtonStyle())
|
|
||||||
.alert("Warning", isPresented: $showPullAlert) {
|
|
||||||
Button("OK", role: .destructive) {
|
|
||||||
viewModel.replaceLocalWithiCloudData()
|
|
||||||
viewModel.sync()
|
|
||||||
viewModel.updateiCStatus()
|
|
||||||
}
|
|
||||||
Button("Cancel", role: .cancel) {}
|
|
||||||
} message: {
|
|
||||||
Text("This will replace Events stored locally with Events stored in iCloud.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ZStack {
|
|
||||||
Image(systemName: settingsModel.device.sf)
|
|
||||||
.resizable()
|
|
||||||
.scaledToFit()
|
|
||||||
.frame(width: 75, height: 75)
|
|
||||||
.symbolRenderingMode(.monochrome)
|
|
||||||
Text("\(viewModel.localEventCount)")
|
|
||||||
.font(.title2)
|
|
||||||
.monospaced()
|
|
||||||
.bold()
|
|
||||||
}
|
|
||||||
Text(settingsModel.device.label)
|
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
.listRowSeparator(.hidden)
|
|
||||||
.onAppear {
|
|
||||||
viewModel.sync()
|
|
||||||
viewModel.updateiCStatus()
|
|
||||||
}
|
|
||||||
|
|
||||||
HStack {
|
|
||||||
Circle()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
.foregroundStyle(viewModel.hasUbiquitous ? .green : .red)
|
|
||||||
Text("iCloud")
|
|
||||||
Spacer()
|
|
||||||
Text("\(viewModel.hasUbiquitous ? "" : "Not ")Working")
|
|
||||||
.bold()
|
|
||||||
}
|
|
||||||
|
|
||||||
HStack {
|
|
||||||
Circle()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
.foregroundStyle(viewModel.lastSyncWasSuccessful ? .green : .red)
|
|
||||||
Text("Sync Status")
|
|
||||||
Spacer()
|
|
||||||
Text("\(viewModel.syncStatus)")
|
|
||||||
.bold()
|
|
||||||
}
|
|
||||||
|
|
||||||
HStack {
|
|
||||||
Circle()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
.foregroundStyle(viewModel.lastSyncWasNormalAgo ? .green : .red)
|
|
||||||
Text("Last Sync")
|
|
||||||
Spacer()
|
|
||||||
Text("\(viewModel.lastSync?.formatted(date: .long, time: .standard) ?? "Never")")
|
|
||||||
.bold()
|
|
||||||
}
|
|
||||||
|
|
||||||
HStack {
|
|
||||||
Circle()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
.foregroundStyle(viewModel.localCountEqualToiCloud ? .green : .red)
|
|
||||||
Text("Local Events")
|
|
||||||
Spacer()
|
|
||||||
Text("\(viewModel.localEventCount)")
|
|
||||||
.bold()
|
|
||||||
}
|
|
||||||
|
|
||||||
HStack {
|
|
||||||
Circle()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
.foregroundStyle(viewModel.icloudCountEqualToLocal ? .green : .red)
|
|
||||||
Text("Events in iCloud")
|
|
||||||
Spacer()
|
|
||||||
Text("\(viewModel.icloudEventCount)")
|
|
||||||
.bold()
|
|
||||||
}
|
|
||||||
} header: {
|
|
||||||
Text("Sync Status")
|
|
||||||
} footer: {
|
|
||||||
Text("Pull to sync\nOr use the arrows to force push/pull")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.refreshable {
|
|
||||||
viewModel.sync()
|
|
||||||
viewModel.updateiCStatus()
|
|
||||||
}
|
|
||||||
.scrollContentBackground(.hidden)
|
|
||||||
.navigationTitle("iCloud")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview("iCloudSettingsView") {
|
|
||||||
iCloudSettingsView(
|
|
||||||
viewModel: dummyEventViewModel(),
|
|
||||||
settingsModel: dummySettingsViewModel()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
//
|
||||||
|
// iCloudSettingsView.swift
|
||||||
|
// NearFuture
|
||||||
|
//
|
||||||
|
// Created by neon443 on 18/04/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct iCloudSettingsView: View {
|
||||||
|
@State var viewModel: EventViewModel
|
||||||
|
@State var showPushAlert: Bool = false
|
||||||
|
@State var showPullAlert: Bool = false
|
||||||
|
|
||||||
|
@Binding var hasUbiquitous: Bool
|
||||||
|
@Binding var lastSyncWasSuccessful: Bool
|
||||||
|
@Binding var lastSyncWasNormalAgo: Bool
|
||||||
|
@Binding var localCountEqualToiCloud: Bool
|
||||||
|
@Binding var icloudCountEqualToLocal: Bool
|
||||||
|
|
||||||
|
let asi = ProcessInfo().isiOSAppOnMac
|
||||||
|
let model = UIDevice().model
|
||||||
|
var device: (sf: String, label: String) {
|
||||||
|
if asi {
|
||||||
|
return (sf: "laptopcomputer", label: "Computer")
|
||||||
|
} else if model == "iPhone" {
|
||||||
|
return (sf: model.lowercased(), label: model)
|
||||||
|
} else if model == "iPad" {
|
||||||
|
return (sf: model.lowercased(), label: model)
|
||||||
|
}
|
||||||
|
return (sf: "iphone", label: "iPhone")
|
||||||
|
}
|
||||||
|
|
||||||
|
var updateStatus: () -> Void
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
ZStack {
|
||||||
|
backgroundGradient
|
||||||
|
List {
|
||||||
|
HStack {
|
||||||
|
Spacer()
|
||||||
|
VStack {
|
||||||
|
ZStack {
|
||||||
|
Image(systemName: "icloud")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: 75, height: 55)
|
||||||
|
.symbolRenderingMode(.multicolor)
|
||||||
|
Text("\(viewModel.icloudEventCount)")
|
||||||
|
.font(.title2)
|
||||||
|
.monospaced()
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
Text("iCloud")
|
||||||
|
HStack {
|
||||||
|
Button(role: .destructive) {
|
||||||
|
showPushAlert.toggle()
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "arrow.up")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: 30, height: 40)
|
||||||
|
}
|
||||||
|
.buttonStyle(BorderedButtonStyle())
|
||||||
|
.alert("Warning", isPresented: $showPushAlert) {
|
||||||
|
Button("OK", role: .destructive) {
|
||||||
|
viewModel.replaceiCloudWithLocalData()
|
||||||
|
viewModel.sync()
|
||||||
|
updateStatus()
|
||||||
|
}
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
|
} message: {
|
||||||
|
Text("This will replace Events stored in iCloud with Events stored locally.")
|
||||||
|
}
|
||||||
|
|
||||||
|
Button() {
|
||||||
|
viewModel.sync()
|
||||||
|
updateStatus()
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "arrow.triangle.2.circlepath")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: 30, height: 40)
|
||||||
|
.foregroundStyle(Color.accentColor)
|
||||||
|
}
|
||||||
|
.buttonStyle(BorderedButtonStyle())
|
||||||
|
|
||||||
|
Button(role: .destructive) {
|
||||||
|
showPullAlert.toggle()
|
||||||
|
} label: {
|
||||||
|
Image(systemName: "arrow.down")
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: 30, height: 40)
|
||||||
|
}
|
||||||
|
.buttonStyle(BorderedButtonStyle())
|
||||||
|
.alert("Warning", isPresented: $showPullAlert) {
|
||||||
|
Button("OK", role: .destructive) {
|
||||||
|
viewModel.replaceLocalWithiCloudData()
|
||||||
|
viewModel.sync()
|
||||||
|
updateStatus()
|
||||||
|
}
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
|
} message: {
|
||||||
|
Text("This will replace Events stored locally with Events stored in iCloud.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ZStack {
|
||||||
|
Image(systemName: device.sf)
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: 75, height: 75)
|
||||||
|
.symbolRenderingMode(.monochrome)
|
||||||
|
Text("\(viewModel.localEventCount)")
|
||||||
|
.font(.title2)
|
||||||
|
.monospaced()
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
Text(device.label)
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.listRowSeparator(.hidden)
|
||||||
|
.onAppear {
|
||||||
|
viewModel.sync()
|
||||||
|
updateStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
Circle()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
.foregroundStyle(hasUbiquitous ? .green : .red)
|
||||||
|
Text("iCloud")
|
||||||
|
Spacer()
|
||||||
|
Text("\(hasUbiquitous ? "" : "Not ")Working")
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
Circle()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
.foregroundStyle(lastSyncWasSuccessful ? .green : .red)
|
||||||
|
Text("Sync Status")
|
||||||
|
Spacer()
|
||||||
|
Text("\(viewModel.syncStatus)")
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
Circle()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
.foregroundStyle(lastSyncWasNormalAgo ? .green : .red)
|
||||||
|
Text("Last Sync")
|
||||||
|
Spacer()
|
||||||
|
Text("\(viewModel.lastSync?.formatted() ?? "Never")")
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
Circle()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
.foregroundStyle(localCountEqualToiCloud ? .green : .red)
|
||||||
|
Text("Local Events")
|
||||||
|
Spacer()
|
||||||
|
Text("\(viewModel.localEventCount)")
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
Circle()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
.foregroundStyle(icloudCountEqualToLocal ? .green : .red)
|
||||||
|
Text("Events in iCloud")
|
||||||
|
Spacer()
|
||||||
|
Text("\(viewModel.icloudEventCount)")
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.scrollContentBackground(.hidden)
|
||||||
|
.navigationTitle("iCloud")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview("iCloudSettingsView") {
|
||||||
|
iCloudSettingsView(
|
||||||
|
viewModel: dummyEventViewModel(),
|
||||||
|
hasUbiquitous: .constant(true),
|
||||||
|
lastSyncWasSuccessful: .constant(true),
|
||||||
|
lastSyncWasNormalAgo: .constant(true),
|
||||||
|
localCountEqualToiCloud: .constant(true),
|
||||||
|
icloudCountEqualToLocal: .constant(true),
|
||||||
|
updateStatus: test
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
//
|
||||||
|
// NearFutureTests.swift
|
||||||
|
// NearFutureTests
|
||||||
|
//
|
||||||
|
// Created by neon443 on 26/03/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Testing
|
||||||
|
|
||||||
|
struct NearFutureTests {
|
||||||
|
|
||||||
|
@Test func example() async throws {
|
||||||
|
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,12 +2,11 @@
|
|||||||
// NearFutureWidgets.swift
|
// NearFutureWidgets.swift
|
||||||
// NearFutureWidgets
|
// NearFutureWidgets
|
||||||
//
|
//
|
||||||
// Created by neon443 on 02/01/2025.
|
// Created by Nihaal Sharma on 02/01/2025.
|
||||||
//
|
//
|
||||||
|
|
||||||
import WidgetKit
|
import WidgetKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import AppIntents
|
|
||||||
|
|
||||||
// Timeline Entry for Widget
|
// Timeline Entry for Widget
|
||||||
struct EventWidgetEntry: TimelineEntry {
|
struct EventWidgetEntry: TimelineEntry {
|
||||||
@@ -47,24 +46,6 @@ struct EventWidgetProvider: TimelineProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Event Widget View
|
// Event Widget View
|
||||||
struct EventWidgetView: View {
|
struct EventWidgetView: View {
|
||||||
var entry: EventWidgetEntry
|
var entry: EventWidgetEntry
|
||||||
@@ -147,38 +128,11 @@ struct EventWidgetView: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
//short days till if not large widget
|
//short days till if not large widget
|
||||||
if !isLarge {
|
Text(daysUntilEvent(event.date, short: !isLarge, sepLines: true))
|
||||||
Text(daysUntilEvent(event.date).short)
|
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.multilineTextAlignment(.trailing)
|
.multilineTextAlignment(.trailing)
|
||||||
.foregroundColor(event.date < Date() ? .red : .primary)
|
.foregroundColor(event.color.color)
|
||||||
.padding(.trailing, -12)
|
.padding(.trailing, -12)
|
||||||
} else {
|
|
||||||
// Button(
|
|
||||||
// intent: CompleteEvent(
|
|
||||||
// eventID: IntentParameter(
|
|
||||||
// title: LocalizedStringResource(
|
|
||||||
// stringLiteral: event.id.uuidString
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
// ) {
|
|
||||||
// if event.complete {
|
|
||||||
// Circle()
|
|
||||||
// .frame(width: 10)
|
|
||||||
// .foregroundStyle(.green)
|
|
||||||
// } else {
|
|
||||||
// Circle()
|
|
||||||
// .frame(width: 10)
|
|
||||||
// .foregroundStyle(.gray)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
Text(daysUntilEvent(event.date).long)
|
|
||||||
.font(.caption)
|
|
||||||
.multilineTextAlignment(.trailing)
|
|
||||||
.foregroundColor(event.date < Date() ? .red : .primary)
|
|
||||||
.padding(.trailing, -12)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// NearFutureWidgetsBundle.swift
|
// NearFutureWidgetsBundle.swift
|
||||||
// NearFutureWidgets
|
// NearFutureWidgets
|
||||||
//
|
//
|
||||||
// Created by neon443 on 02/01/2025.
|
// Created by Nihaal Sharma on 02/01/2025.
|
||||||
//
|
//
|
||||||
|
|
||||||
import WidgetKit
|
import WidgetKit
|
||||||
|
|||||||
@@ -2,79 +2,79 @@
|
|||||||
// NearFutureWidgetsLiveActivity.swift
|
// NearFutureWidgetsLiveActivity.swift
|
||||||
// NearFutureWidgets
|
// NearFutureWidgets
|
||||||
//
|
//
|
||||||
// Created by neon443 on 02/01/2025.
|
// Created by Nihaal Sharma on 02/01/2025.
|
||||||
//
|
//
|
||||||
|
|
||||||
//import ActivityKit
|
import ActivityKit
|
||||||
import WidgetKit
|
import WidgetKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
//struct NearFutureWidgetsAttributes: ActivityAttributes {
|
struct NearFutureWidgetsAttributes: ActivityAttributes {
|
||||||
// public struct ContentState: Codable, Hashable {
|
public struct ContentState: Codable, Hashable {
|
||||||
// // Dynamic stateful properties about your activity go here!
|
// Dynamic stateful properties about your activity go here!
|
||||||
// var emoji: String
|
var emoji: String
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // Fixed non-changing properties about your activity go here!
|
|
||||||
// var name: String
|
|
||||||
//}
|
|
||||||
|
|
||||||
//struct NearFutureWidgetsLiveActivity: Widget {
|
// Fixed non-changing properties about your activity go here!
|
||||||
// var body: some WidgetConfiguration {
|
var name: String
|
||||||
// ActivityConfiguration(for: NearFutureWidgetsAttributes.self) { context in
|
}
|
||||||
// // Lock screen/banner UI goes here
|
|
||||||
// VStack {
|
|
||||||
// Text("Hello \(context.state.emoji)")
|
|
||||||
// }
|
|
||||||
// .activityBackgroundTint(Color.cyan)
|
|
||||||
// .activitySystemActionForegroundColor(Color.black)
|
|
||||||
//
|
|
||||||
// } dynamicIsland: { context in
|
|
||||||
// DynamicIsland {
|
|
||||||
// // Expanded UI goes here. Compose the expanded UI through
|
|
||||||
// // various regions, like leading/trailing/center/bottom
|
|
||||||
// DynamicIslandExpandedRegion(.leading) {
|
|
||||||
// Text("Leading")
|
|
||||||
// }
|
|
||||||
// DynamicIslandExpandedRegion(.trailing) {
|
|
||||||
// Text("Trailing")
|
|
||||||
// }
|
|
||||||
// DynamicIslandExpandedRegion(.bottom) {
|
|
||||||
// Text("Bottom \(context.state.emoji)")
|
|
||||||
// // more content
|
|
||||||
// }
|
|
||||||
// } compactLeading: {
|
|
||||||
// Text("L")
|
|
||||||
// } compactTrailing: {
|
|
||||||
// Text("T \(context.state.emoji)")
|
|
||||||
// } minimal: {
|
|
||||||
// Text(context.state.emoji)
|
|
||||||
// }
|
|
||||||
// .widgetURL(URL(string: "http://www.apple.com"))
|
|
||||||
// .keylineTint(Color.red)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//extension NearFutureWidgetsAttributes {
|
|
||||||
// fileprivate static var preview: NearFutureWidgetsAttributes {
|
|
||||||
// NearFutureWidgetsAttributes(name: "World")
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//extension NearFutureWidgetsAttributes.ContentState {
|
struct NearFutureWidgetsLiveActivity: Widget {
|
||||||
// fileprivate static var smiley: NearFutureWidgetsAttributes.ContentState {
|
var body: some WidgetConfiguration {
|
||||||
// NearFutureWidgetsAttributes.ContentState(emoji: "😀")
|
ActivityConfiguration(for: NearFutureWidgetsAttributes.self) { context in
|
||||||
// }
|
// Lock screen/banner UI goes here
|
||||||
//
|
VStack {
|
||||||
// fileprivate static var starEyes: NearFutureWidgetsAttributes.ContentState {
|
Text("Hello \(context.state.emoji)")
|
||||||
// NearFutureWidgetsAttributes.ContentState(emoji: "🤩")
|
}
|
||||||
// }
|
.activityBackgroundTint(Color.cyan)
|
||||||
//}
|
.activitySystemActionForegroundColor(Color.black)
|
||||||
//
|
|
||||||
//#Preview("Notification", as: .content, using: NearFutureWidgetsAttributes.preview) {
|
} dynamicIsland: { context in
|
||||||
// NearFutureWidgetsLiveActivity()
|
DynamicIsland {
|
||||||
//} contentStates: {
|
// Expanded UI goes here. Compose the expanded UI through
|
||||||
// NearFutureWidgetsAttributes.ContentState.smiley
|
// various regions, like leading/trailing/center/bottom
|
||||||
// NearFutureWidgetsAttributes.ContentState.starEyes
|
DynamicIslandExpandedRegion(.leading) {
|
||||||
//}
|
Text("Leading")
|
||||||
|
}
|
||||||
|
DynamicIslandExpandedRegion(.trailing) {
|
||||||
|
Text("Trailing")
|
||||||
|
}
|
||||||
|
DynamicIslandExpandedRegion(.bottom) {
|
||||||
|
Text("Bottom \(context.state.emoji)")
|
||||||
|
// more content
|
||||||
|
}
|
||||||
|
} compactLeading: {
|
||||||
|
Text("L")
|
||||||
|
} compactTrailing: {
|
||||||
|
Text("T \(context.state.emoji)")
|
||||||
|
} minimal: {
|
||||||
|
Text(context.state.emoji)
|
||||||
|
}
|
||||||
|
.widgetURL(URL(string: "http://www.apple.com"))
|
||||||
|
.keylineTint(Color.red)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension NearFutureWidgetsAttributes {
|
||||||
|
fileprivate static var preview: NearFutureWidgetsAttributes {
|
||||||
|
NearFutureWidgetsAttributes(name: "World")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension NearFutureWidgetsAttributes.ContentState {
|
||||||
|
fileprivate static var smiley: NearFutureWidgetsAttributes.ContentState {
|
||||||
|
NearFutureWidgetsAttributes.ContentState(emoji: "😀")
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate static var starEyes: NearFutureWidgetsAttributes.ContentState {
|
||||||
|
NearFutureWidgetsAttributes.ContentState(emoji: "🤩")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview("Notification", as: .content, using: NearFutureWidgetsAttributes.preview) {
|
||||||
|
NearFutureWidgetsLiveActivity()
|
||||||
|
} contentStates: {
|
||||||
|
NearFutureWidgetsAttributes.ContentState.smiley
|
||||||
|
NearFutureWidgetsAttributes.ContentState.starEyes
|
||||||
|
}
|
||||||
@@ -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.
|
|
||||||
@@ -1,32 +1,5 @@
|
|||||||
<div align="center">
|
# NearFuture
|
||||||
<br/>
|
[](https://apps.apple.com/us/app/near-future-event-tracker/id6744963429)
|
||||||
<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">
|
|
||||||
<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.
|
||||||
|
|
||||||
@@ -37,18 +10,17 @@
|
|||||||
- [x] Event colors
|
- [x] Event colors
|
||||||
- [x] Recurrence
|
- [x] Recurrence
|
||||||
- [x] Search
|
- [x] Search
|
||||||
- [x] Notifications
|
- [ ] Notifications
|
||||||
- [ ] Mac App
|
|
||||||
- [ ] Apple Watch App
|
- [ ] Apple Watch App
|
||||||
- [x] Home Screen Widgets
|
- [x] Home Screen Widgets
|
||||||
- [ ] Lock Screen Widgets
|
- [ ] Lock Screen Widgets
|
||||||
- [ ] Later Box
|
- [ ] Later Box
|
||||||
- [ ] Sort by
|
- [ ] Sort by
|
||||||
- [ ] Reorder Events
|
- [ ] Reorder Events
|
||||||
- [x] Archive
|
- [ ] Archive
|
||||||
- [ ] Collaboration
|
- [ ] Collaboration
|
||||||
- [ ] Autocomplete tasks
|
- [ ] Autocomplete tasks
|
||||||
- [x] Settings
|
- [ ] Settings
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- **Event Creation**: Create events with a name, description, date, recurrence, and an icon
|
- **Event Creation**: Create events with a name, description, date, recurrence, and an icon
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 893 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 197 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 729 KiB |
|
Before Width: | Height: | Size: 632 KiB |
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"filename" : "bloo.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "dark"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "blooDark.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "tinted"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "NearFutureIconTint.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "bloo.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "watchos",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 632 KiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 712 KiB |
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"filename" : "blue.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "dark"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "blueDark.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "tinted"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "NearFutureIconTint.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "blue.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "watchos",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 632 KiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 743 KiB |
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"filename" : "green.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "dark"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "greenDark.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "tinted"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "NearFutureIconTint.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "green.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "watchos",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 632 KiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 734 KiB |
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"filename" : "pink.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "dark"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "pinkDark.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "tinted"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "NearFutureIconTint.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "pink.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "watchos",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 632 KiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 728 KiB |
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"filename" : "purple.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "dark"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "purpleDark.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "tinted"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "NearFutureIconTint.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "purple.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "watchos",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 632 KiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 746 KiB |
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"filename" : "red.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "dark"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "redDark.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "tinted"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filename" : "NearFutureIconTint.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "red.png",
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "watchos",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"author" : "xcode",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||