mirror of
https://github.com/neon443/NearFuture.git
synced 2026-03-11 06:49:12 +00:00
improve whats new
added a global getdevice icon thingy
This commit is contained in:
@@ -130,7 +130,11 @@ class SettingsViewModel: ObservableObject {
|
||||
Color(UIColor(named: "uiColors/basic")!)
|
||||
]
|
||||
|
||||
@Published var device: (sf: String, label: String)
|
||||
|
||||
init(load: Bool = true) {
|
||||
self.device = getDevice()
|
||||
|
||||
if load {
|
||||
loadSettings()
|
||||
Task {
|
||||
@@ -549,3 +553,16 @@ func getBuildID() -> String {
|
||||
}
|
||||
return "\(build)"
|
||||
}
|
||||
|
||||
func getDevice() -> (sf: String, label: String) {
|
||||
let asi = ProcessInfo().isiOSAppOnMac
|
||||
let model = UIDevice().model
|
||||
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")
|
||||
}
|
||||
|
||||
@@ -66,11 +66,6 @@ struct HomeView: View {
|
||||
if filteredEvents.isEmpty && !searchInput.isEmpty {
|
||||
HelpView(searchInput: $searchInput, focusedField: focusedField)
|
||||
} else {
|
||||
Button("hiiiiiiiiiiiiiii") {
|
||||
withAnimation() {
|
||||
settingsModel.settings.showCompletedInHome.toggle()
|
||||
}
|
||||
}
|
||||
ScrollView {
|
||||
ForEach(filteredEvents) { event in
|
||||
EventListView(viewModel: viewModel, event: event)
|
||||
|
||||
@@ -89,6 +89,7 @@ struct SettingsView: View {
|
||||
NavigationLink() {
|
||||
iCloudSettingsView(
|
||||
viewModel: viewModel,
|
||||
settingsModel: settingsModel,
|
||||
hasUbiquitous: $hasUbiquitous,
|
||||
lastSyncWasSuccessful: $lastSyncWasSuccessful,
|
||||
lastSyncWasNormalAgo: $lastSyncWasNormalAgo,
|
||||
|
||||
@@ -16,23 +16,25 @@ struct WhatsNewView: View {
|
||||
var title: String
|
||||
var subtitle: String
|
||||
}
|
||||
var whatsNew: [WhatsNew] = [
|
||||
WhatsNew(
|
||||
symbol: "bell.badge.fill",
|
||||
title: "Notifications",
|
||||
subtitle: "Events now have notifications, reminding you to complete them!"
|
||||
),
|
||||
WhatsNew(
|
||||
symbol: "list.bullet.indent",
|
||||
title: "Animations!",
|
||||
subtitle: "I added animations for adding, removing and ticking events, fixing "
|
||||
),
|
||||
WhatsNew(
|
||||
symbol: "list.bullet.indent",
|
||||
title: "Animations!",
|
||||
subtitle: "I added animations for adding, removing and ticking events, fixing "
|
||||
)
|
||||
]
|
||||
var whatsNew: [WhatsNew] {
|
||||
return [
|
||||
WhatsNew(
|
||||
symbol: settingsModel.device.sf,
|
||||
title: "This Screen",
|
||||
subtitle: "This update add a Whats New page that will tell you (suprise!) What's New"
|
||||
),
|
||||
WhatsNew(
|
||||
symbol: "bell.badge.fill",
|
||||
title: "Notifications",
|
||||
subtitle: "Events now have notifications, reminding you to complete them!"
|
||||
),
|
||||
WhatsNew(
|
||||
symbol: "list.bullet.indent",
|
||||
title: "Animations!",
|
||||
subtitle: "I added animations for adding, removing and ticking events"
|
||||
)
|
||||
]
|
||||
}
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
List {
|
||||
@@ -52,6 +54,7 @@ struct WhatsNewView: View {
|
||||
|
||||
}
|
||||
.onDisappear {
|
||||
settingsModel.settings.showWhatsNew = false
|
||||
settingsModel.saveSettings()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
import SwiftUI
|
||||
|
||||
struct iCloudSettingsView: View {
|
||||
@State var viewModel: EventViewModel
|
||||
@ObservedObject var viewModel: EventViewModel
|
||||
@ObservedObject var settingsModel: SettingsViewModel
|
||||
@State var showPushAlert: Bool = false
|
||||
@State var showPullAlert: Bool = false
|
||||
|
||||
@@ -18,19 +19,6 @@ struct iCloudSettingsView: View {
|
||||
@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 {
|
||||
@@ -107,7 +95,7 @@ struct iCloudSettingsView: View {
|
||||
}
|
||||
}
|
||||
ZStack {
|
||||
Image(systemName: device.sf)
|
||||
Image(systemName: settingsModel.device.sf)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 75, height: 75)
|
||||
@@ -117,7 +105,7 @@ struct iCloudSettingsView: View {
|
||||
.monospaced()
|
||||
.bold()
|
||||
}
|
||||
Text(device.label)
|
||||
Text(settingsModel.device.label)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
@@ -196,6 +184,7 @@ struct iCloudSettingsView: View {
|
||||
#Preview("iCloudSettingsView") {
|
||||
iCloudSettingsView(
|
||||
viewModel: dummyEventViewModel(),
|
||||
settingsModel: dummySettingsViewModel(),
|
||||
hasUbiquitous: .constant(true),
|
||||
lastSyncWasSuccessful: .constant(true),
|
||||
lastSyncWasNormalAgo: .constant(true),
|
||||
|
||||
Reference in New Issue
Block a user