Skip to content

Commit

Permalink
fixed the toggle button value?
Browse files Browse the repository at this point in the history
idk probably not cuz ios 13 sucks
  • Loading branch information
cranci1 committed May 1, 2024
1 parent 4ecc1cc commit 1014a74
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 35 deletions.
6 changes: 3 additions & 3 deletions AnimeGen.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@
138C92632BE11887008E37F8 /* API-Pref.swift */,
138C92662BE11CE7008E37F8 /* Features.swift */,
138C92682BE1202D008E37F8 /* Content.swift */,
138C926A2BE120E3008E37F8 /* Developer.swift */,
1312CFE62BE143B0003E135F /* History.swift */,
138C926A2BE120E3008E37F8 /* Developer.swift */,
13C6CA762BDA3ABC0046923C /* Developer-Pref */,
);
path = "App Settings";
Expand Down Expand Up @@ -529,7 +529,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = AnimeGen/AnimeGen.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 33;
CURRENT_PROJECT_VERSION = 38;
DEVELOPMENT_TEAM = 399LMK6Q2Y;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AnimeGen/Info.plist;
Expand Down Expand Up @@ -564,7 +564,7 @@
CODE_SIGN_ENTITLEMENTS = AnimeGen/AnimeGen.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 33;
CURRENT_PROJECT_VERSION = 38;
DEVELOPMENT_TEAM = 399LMK6Q2Y;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AnimeGen/Info.plist;
Expand Down
Binary file not shown.
12 changes: 4 additions & 8 deletions AnimeGen/Settings/App Settings/API-Pref.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,27 @@ struct APIPreferences: View {
}

Toggle("Load Image on Startup", isOn: Binding(
get: { self.loadstart },
get: { UserDefaults.standard.bool(forKey: "enableImageStartup") },
set: { newValue in
self.loadstart = newValue
UserDefaults.standard.set(newValue, forKey: "enableImageStartup")
}
))

Toggle("Display Tags", isOn: Binding(
get: { self.tags },
get: { UserDefaults.standard.bool(forKey: "enableTags") },
set: { newValue in
self.tags = newValue
UserDefaults.standard.set(newValue, forKey: "enableTags")
}
))
Toggle("Display nekos.moe Tags", isOn: Binding(
get: { self.moetags },
get: { UserDefaults.standard.bool(forKey: "enableMoeTags") },
set: { newValue in
self.moetags = newValue
UserDefaults.standard.set(newValue, forKey: "enableMoeTags")
}
))
Toggle("Kyoko 'Note' banner", isOn: Binding(
get: { self.kyokobanner },
get: { UserDefaults.standard.bool(forKey: "enableKyokobanner") },
set: { newValue in
self.kyokobanner = newValue
UserDefaults.standard.set(newValue, forKey: "enableKyokobanner")
}
))
Expand Down
8 changes: 3 additions & 5 deletions AnimeGen/Settings/App Settings/Content.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ struct Contents: View {
""")) {

Toggle("Explicit Contents", isOn: Binding(
get: { self.explicitCont },
get: { UserDefaults.standard.bool(forKey: "enableExplictiCont") },
set: { newValue in
UserDefaults.standard.set(newValue, forKey: "enableExplictiCont")
if newValue {
showAlert = true
} else {
self.explicitCont = newValue
UserDefaults.standard.set(newValue, forKey: "enableExplictiCont")
self.showAlert = true
}
}
))
Expand Down
6 changes: 2 additions & 4 deletions AnimeGen/Settings/App Settings/Developer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ struct DeveloperPref: View {
""")) {

Toggle("Developer Mode", isOn: Binding(
get: { self.developerMode },
get: { UserDefaults.standard.bool(forKey: "enableDeveloperMode") },
set: { newValue in
self.developerMode = newValue
UserDefaults.standard.set(newValue, forKey: "enableDeveloperMode")
}
))

Toggle("Developer Alert", isOn: Binding(
get: { self.developerAlert },
get: { UserDefaults.standard.bool(forKey: "enableDeveloperAlert") },
set: { newValue in
self.developerAlert = newValue
UserDefaults.standard.set(newValue, forKey: "enableDeveloperAlert")
}
))
Expand Down
8 changes: 7 additions & 1 deletion AnimeGen/Settings/App Settings/History.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ struct HistoryPref: View {
NavigationView {
Form {
Section(footer: Text("'Don't clear history': It makes so that the history will not be cleared when closing the app.")) {
Toggle("Don't clear history", isOn: $historyOvertime)
Toggle("Don't clear history", isOn: Binding(
get: { self.historyOvertime },
set: { newValue in
self.historyOvertime = newValue
UserDefaults.standard.set(newValue, forKey: "enableHistoryOvertime")
}
))
}

Section {
Expand Down
49 changes: 35 additions & 14 deletions AnimeGen/Settings/SettingsPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,63 @@ struct SettingsPage: View {

Section(header: Text("App Settings"), footer: Text("You can access different app settings on these pages.")) {
NavigationLink(destination: APIPreferences()) {
Text("APIs Preferences")
.foregroundColor(.accentColor)
HStack {
Image(systemName: "gear")
Text("APIs Preferences")
.foregroundColor(.accentColor)
}
}

NavigationLink(destination: Features()) {
Text("App Features")
.foregroundColor(.accentColor)
HStack {
Image(systemName: "square.grid.2x2")
Text("App Features")
.foregroundColor(.accentColor)
}
}

NavigationLink(destination: Contents()) {
Text("Contents Settings")
.foregroundColor(.accentColor)
HStack {
Image(systemName: "doc.text.magnifyingglass")
Text("Contents Settings")
.foregroundColor(.accentColor)
}
}


NavigationLink(destination: HistoryPref()) {
Text("History Settings")
.foregroundColor(.accentColor)
HStack {
Image(systemName: "clock")
Text("History Settings")
.foregroundColor(.accentColor)
}
}

NavigationLink(destination: DeveloperPref()) {
Text("Developer Preferences")
.foregroundColor(.accentColor)
HStack {
Image(systemName: "hammer")
Text("Developer Preferences")
.foregroundColor(.accentColor)
}
}

}

Section(header: Text("About AnimeGen")) {
NavigationLink(destination: AboutPage()) {
Text("About")
.foregroundColor(.accentColor)
HStack {
Image(systemName: "info.circle")
Text("About")
.foregroundColor(.accentColor)
}
}

NavigationLink(destination: ApiPage()) {
Text("APIs credits")
.foregroundColor(.accentColor)
HStack {
Image(systemName: "list.bullet")
Text("APIs Credits")
.foregroundColor(.accentColor)
}
}

if #available(iOS 14.0, *) {
Expand Down

0 comments on commit 1014a74

Please sign in to comment.