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")!)
|
Color(UIColor(named: "uiColors/basic")!)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@Published var device: (sf: String, label: String)
|
||||||
|
|
||||||
init(load: Bool = true) {
|
init(load: Bool = true) {
|
||||||
|
self.device = getDevice()
|
||||||
|
|
||||||
if load {
|
if load {
|
||||||
loadSettings()
|
loadSettings()
|
||||||
Task {
|
Task {
|
||||||
@@ -549,3 +553,16 @@ func getBuildID() -> String {
|
|||||||
}
|
}
|
||||||
return "\(build)"
|
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 {
|
if filteredEvents.isEmpty && !searchInput.isEmpty {
|
||||||
HelpView(searchInput: $searchInput, focusedField: focusedField)
|
HelpView(searchInput: $searchInput, focusedField: focusedField)
|
||||||
} else {
|
} else {
|
||||||
Button("hiiiiiiiiiiiiiii") {
|
|
||||||
withAnimation() {
|
|
||||||
settingsModel.settings.showCompletedInHome.toggle()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
ForEach(filteredEvents) { event in
|
ForEach(filteredEvents) { event in
|
||||||
EventListView(viewModel: viewModel, event: event)
|
EventListView(viewModel: viewModel, event: event)
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ struct SettingsView: View {
|
|||||||
NavigationLink() {
|
NavigationLink() {
|
||||||
iCloudSettingsView(
|
iCloudSettingsView(
|
||||||
viewModel: viewModel,
|
viewModel: viewModel,
|
||||||
|
settingsModel: settingsModel,
|
||||||
hasUbiquitous: $hasUbiquitous,
|
hasUbiquitous: $hasUbiquitous,
|
||||||
lastSyncWasSuccessful: $lastSyncWasSuccessful,
|
lastSyncWasSuccessful: $lastSyncWasSuccessful,
|
||||||
lastSyncWasNormalAgo: $lastSyncWasNormalAgo,
|
lastSyncWasNormalAgo: $lastSyncWasNormalAgo,
|
||||||
|
|||||||
@@ -16,7 +16,13 @@ struct WhatsNewView: View {
|
|||||||
var title: String
|
var title: String
|
||||||
var subtitle: String
|
var subtitle: String
|
||||||
}
|
}
|
||||||
var whatsNew: [WhatsNew] = [
|
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(
|
WhatsNew(
|
||||||
symbol: "bell.badge.fill",
|
symbol: "bell.badge.fill",
|
||||||
title: "Notifications",
|
title: "Notifications",
|
||||||
@@ -25,14 +31,10 @@ struct WhatsNewView: View {
|
|||||||
WhatsNew(
|
WhatsNew(
|
||||||
symbol: "list.bullet.indent",
|
symbol: "list.bullet.indent",
|
||||||
title: "Animations!",
|
title: "Animations!",
|
||||||
subtitle: "I added animations for adding, removing and ticking events, fixing "
|
subtitle: "I added animations for adding, removing and ticking events"
|
||||||
),
|
|
||||||
WhatsNew(
|
|
||||||
symbol: "list.bullet.indent",
|
|
||||||
title: "Animations!",
|
|
||||||
subtitle: "I added animations for adding, removing and ticking events, fixing "
|
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
}
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
List {
|
List {
|
||||||
@@ -52,6 +54,7 @@ struct WhatsNewView: View {
|
|||||||
|
|
||||||
}
|
}
|
||||||
.onDisappear {
|
.onDisappear {
|
||||||
|
settingsModel.settings.showWhatsNew = false
|
||||||
settingsModel.saveSettings()
|
settingsModel.saveSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct iCloudSettingsView: View {
|
struct iCloudSettingsView: View {
|
||||||
@State var viewModel: EventViewModel
|
@ObservedObject var viewModel: EventViewModel
|
||||||
|
@ObservedObject var settingsModel: SettingsViewModel
|
||||||
@State var showPushAlert: Bool = false
|
@State var showPushAlert: Bool = false
|
||||||
@State var showPullAlert: Bool = false
|
@State var showPullAlert: Bool = false
|
||||||
|
|
||||||
@@ -18,19 +19,6 @@ struct iCloudSettingsView: View {
|
|||||||
@Binding var localCountEqualToiCloud: Bool
|
@Binding var localCountEqualToiCloud: Bool
|
||||||
@Binding var icloudCountEqualToLocal: 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 updateStatus: () -> Void
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -107,7 +95,7 @@ struct iCloudSettingsView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ZStack {
|
ZStack {
|
||||||
Image(systemName: device.sf)
|
Image(systemName: settingsModel.device.sf)
|
||||||
.resizable()
|
.resizable()
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.frame(width: 75, height: 75)
|
.frame(width: 75, height: 75)
|
||||||
@@ -117,7 +105,7 @@ struct iCloudSettingsView: View {
|
|||||||
.monospaced()
|
.monospaced()
|
||||||
.bold()
|
.bold()
|
||||||
}
|
}
|
||||||
Text(device.label)
|
Text(settingsModel.device.label)
|
||||||
}
|
}
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
@@ -196,6 +184,7 @@ struct iCloudSettingsView: View {
|
|||||||
#Preview("iCloudSettingsView") {
|
#Preview("iCloudSettingsView") {
|
||||||
iCloudSettingsView(
|
iCloudSettingsView(
|
||||||
viewModel: dummyEventViewModel(),
|
viewModel: dummyEventViewModel(),
|
||||||
|
settingsModel: dummySettingsViewModel(),
|
||||||
hasUbiquitous: .constant(true),
|
hasUbiquitous: .constant(true),
|
||||||
lastSyncWasSuccessful: .constant(true),
|
lastSyncWasSuccessful: .constant(true),
|
||||||
lastSyncWasNormalAgo: .constant(true),
|
lastSyncWasNormalAgo: .constant(true),
|
||||||
|
|||||||
Reference in New Issue
Block a user