Skip to content

Commit

Permalink
please save over sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
cranci1 committed May 24, 2024
1 parent 8ba0b84 commit 14e1294
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 11 deletions.
4 changes: 4 additions & 0 deletions AnimeGen.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
133C4C892BE67CAB00258EDD /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 133C4C882BE67CAB00258EDD /* SceneDelegate.swift */; };
133C4C8B2BE67CAB00258EDD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 133C4C8A2BE67CAB00258EDD /* ViewController.swift */; };
133C4C902BE67CAD00258EDD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 133C4C8F2BE67CAD00258EDD /* Assets.xcassets */; };
1366F0A72C00EB7B00862707 /* ImageSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1366F0A62C00EB7B00862707 /* ImageSettings.swift */; };
136BD7DB2BE7CA6F00ED23AE /* HistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 136BD7D92BE7CA6F00ED23AE /* HistoryView.swift */; };
136BD7DE2BE7CAA300ED23AE /* HistoryButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 136BD7DD2BE7CAA300ED23AE /* HistoryButton.swift */; };
136BD7E02BE7CB4D00ED23AE /* RewindButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 136BD7DF2BE7CB4D00ED23AE /* RewindButton.swift */; };
Expand Down Expand Up @@ -66,6 +67,7 @@
133C4C8A2BE67CAB00258EDD /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
133C4C8F2BE67CAD00258EDD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
133C4C942BE67CAD00258EDD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1366F0A62C00EB7B00862707 /* ImageSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageSettings.swift; sourceTree = "<group>"; };
136BD7D92BE7CA6F00ED23AE /* HistoryView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoryView.swift; sourceTree = "<group>"; };
136BD7DD2BE7CAA300ED23AE /* HistoryButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryButton.swift; sourceTree = "<group>"; };
136BD7DF2BE7CB4D00ED23AE /* RewindButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RewindButton.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -154,6 +156,7 @@
133C4C862BE67CAB00258EDD /* AppDelegate.swift */,
133C4C8A2BE67CAB00258EDD /* ViewController.swift */,
13D4FC2C2BE7719700BC3D1C /* Secrets.swift */,
1366F0A62C00EB7B00862707 /* ImageSettings.swift */,
133C4C8F2BE67CAD00258EDD /* Assets.xcassets */,
13D4FBDF2BE7661A00BC3D1C /* Main.storyboard */,
13D4FC2E2BE779A200BC3D1C /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -369,6 +372,7 @@
13D4FBF22BE76DCA00BC3D1C /* Web-Share.swift in Sources */,
13AC382C2BEFA34A00676546 /* APIsValid.swift in Sources */,
13D4FC242BE770EC00BC3D1C /* pic-re.swift in Sources */,
1366F0A72C00EB7B00862707 /* ImageSettings.swift in Sources */,
133C4C8B2BE67CAB00258EDD /* ViewController.swift in Sources */,
13C1E0402BE92BB300A27DEE /* APIsCredits.swift in Sources */,
1393C3A92BEBC94300704137 /* AppPreff.swift in Sources */,
Expand Down
Binary file not shown.
34 changes: 34 additions & 0 deletions AnimeGen/ImageSettings.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// ImageWidhts.swift
// AnimeGen
//
// Created by cranci on 24/05/24.
//

import Foundation

final class Settings {
static let shared = Settings()

private let defaults = UserDefaults.standard

var imageWidth: Double {
get { return defaults.double(forKey: "ImageWidth") }
set { defaults.set(newValue, forKey: "ImageWidth") }
}

var imageHeight: Double {
get { return defaults.double(forKey: "ImageHeight") }
set { defaults.set(newValue, forKey: "ImageHeight") }
}

private init() {
loadSavedValues()
}

private func loadSavedValues() {
imageWidth = defaults.double(forKey: "ImageWidth")
imageHeight = defaults.double(forKey: "ImageHeight")
}
}

4 changes: 2 additions & 2 deletions AnimeGen/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stepper opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" maximumValue="100" translatesAutoresizingMaskIntoConstraints="NO" id="4Dl-EW-Quf">
<stepper opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minimumValue="0.10000000000000001" maximumValue="1" stepValue="0.10000000000000001" translatesAutoresizingMaskIntoConstraints="NO" id="4Dl-EW-Quf">
<rect key="frame" x="233" y="5" width="94" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
Expand All @@ -265,7 +265,7 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stepper opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" maximumValue="100" translatesAutoresizingMaskIntoConstraints="NO" id="0bt-C6-amM">
<stepper opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.6" minimumValue="0.1" maximumValue="1.0" stepValue="0.1" translatesAutoresizingMaskIntoConstraints="NO" id="0bt-C6-amM">
<rect key="frame" x="233" y="6" width="94" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
Expand Down
9 changes: 0 additions & 9 deletions AnimeGen/Settings/SettingsMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,3 @@ class SettingsMain: UITableViewController {
}
}
}

class Settings {
static let shared = Settings()

var imageWidth: Double = 1.0
var imageHeight: Double = 0.6

private init() {}
}

0 comments on commit 14e1294

Please sign in to comment.