-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4394576
commit 755cd03
Showing
71 changed files
with
2,708 additions
and
1,249 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
FolderColor.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
FolderColor.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"pins" : [ | ||
{ | ||
"identity" : "swiftuiflux", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/Dimillian/SwiftUIFlux", | ||
"state" : { | ||
"branch" : "master", | ||
"revision" : "39b885558fdee277f7ca2a8c81900123e9bc436f" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
Binary file removed
BIN
-32.8 KB
...r.xcodeproj/project.xcworkspace/xcuserdata/hbc.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
Binary file added
BIN
+171 KB
...j/project.xcworkspace/xcuserdata/huangbaocheng.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
5 changes: 1 addition & 4 deletions
5
...r/Document.xcdatamodeld/.xccurrentversion → ...rdatad/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +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> | ||
<key>_XCCurrentVersionName</key> | ||
<string>Document.xcdatamodel</string> | ||
</dict> | ||
<dict /> | ||
</plist> |
6 changes: 6 additions & 0 deletions
6
...Color.xcodeproj/xcuserdata/huangbaocheng.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Bucket | ||
uuid = "F8131F91-EED3-4375-A8D9-1A2AA3111D02" | ||
type = "1" | ||
version = "2.0"> | ||
</Bucket> |
66 changes: 66 additions & 0 deletions
66
FolderColor.xcodeproj/xcuserdata/huangbaocheng.xcuserdatad/xcschemes/FolderColor.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
version = "1.7"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "05EC100F2823DCF300982154" | ||
BuildableName = "FolderColor.app" | ||
BlueprintName = "FolderColor" | ||
ReferencedContainer = "container:FolderColor.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
shouldAutocreateTestPlan = "YES"> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "05EC100F2823DCF300982154" | ||
BuildableName = "FolderColor.app" | ||
BlueprintName = "FolderColor" | ||
ReferencedContainer = "container:FolderColor.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// AppReducer.swift | ||
// FolderColor | ||
// | ||
// Created by 黄宝成 on 2022/5/8. | ||
// | ||
|
||
import Foundation | ||
import SwiftUIFlux | ||
|
||
func appStateReducer(state: AppState, action: Action) -> AppState { | ||
|
||
var state = state | ||
|
||
state.colorState = colorReducer(state: state.colorState, action: action) | ||
|
||
return state | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// | ||
// AppState.swift | ||
// FolderColor | ||
// | ||
// Created by 黄宝成 on 2022/5/8. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
import SwiftUIFlux | ||
|
||
fileprivate var savePath: URL! | ||
fileprivate let encoder = JSONEncoder() | ||
fileprivate let decoder = JSONDecoder() | ||
|
||
struct AppState: FluxState, Codable { | ||
var colorState: ColorState | ||
|
||
init() { | ||
do { | ||
let icloudDirectory = FileManager.default.url(forUbiquityContainerIdentifier: nil) | ||
let documentDirectory = try FileManager.default.url(for: .documentDirectory, | ||
in: .userDomainMask, | ||
appropriateFor: nil, | ||
create: false) | ||
if let icloudDirectory = icloudDirectory { | ||
try FileManager.default.startDownloadingUbiquitousItem(at: icloudDirectory) | ||
} | ||
|
||
savePath = (icloudDirectory ?? documentDirectory).appendingPathComponent("userData") | ||
} catch let error { | ||
fatalError("Couldn't create save state data with error: \(error)") | ||
} | ||
|
||
if let data = try? Data(contentsOf: savePath), | ||
let savedState = try? decoder.decode(AppState.self, from: data) { | ||
colorState = savedState.colorState | ||
} else { | ||
colorState = initColorState() | ||
} | ||
} | ||
|
||
func archiveState() { | ||
let colorState = self.colorState | ||
|
||
DispatchQueue.global().async { | ||
let savingState = self | ||
|
||
guard let data = try? encoder.encode(savingState) else { | ||
return | ||
} | ||
|
||
do { | ||
try data.write(to: savePath) | ||
} catch let error { | ||
print("Error while saving app state :\(error)") | ||
} | ||
} | ||
} | ||
|
||
func sizeOfArchivedState() -> String { | ||
do { | ||
let resources = try savePath.resourceValues(forKeys: [.fileSizeKey]) | ||
let formatter = ByteCountFormatter() | ||
|
||
formatter.allowedUnits = .useKB | ||
formatter.countStyle = .file | ||
|
||
return formatter.string(fromByteCount: Int64(resources.fileSize ?? 0)) | ||
|
||
} catch { | ||
return "0" | ||
} | ||
} | ||
|
||
func deleteArchivedState() { | ||
do { | ||
try FileManager.default.removeItem(at: savePath) | ||
print("Successfully deleted saved state data.") | ||
} catch let error { | ||
print("Error while deleting app state: \(error)") | ||
} | ||
} | ||
|
||
#if DEBUG | ||
init(colorState: ColorState) { | ||
self.colorState = colorState | ||
} | ||
#endif | ||
} |
11 changes: 11 additions & 0 deletions
11
FolderColor/Assets.xcassets/AccentColor.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 33 additions & 23 deletions
56
FolderColor/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,68 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "16@1x.png", | ||
"idiom" : "mac", | ||
"size" : "16x16", | ||
"scale" : "1x" | ||
"scale" : "1x", | ||
"size" : "16x16" | ||
}, | ||
{ | ||
"filename" : "16@2x.png", | ||
"idiom" : "mac", | ||
"size" : "16x16", | ||
"scale" : "2x" | ||
"scale" : "2x", | ||
"size" : "16x16" | ||
}, | ||
{ | ||
"filename" : "32@1x.png", | ||
"idiom" : "mac", | ||
"size" : "32x32", | ||
"scale" : "1x" | ||
"scale" : "1x", | ||
"size" : "32x32" | ||
}, | ||
{ | ||
"filename" : "32@2x.png", | ||
"idiom" : "mac", | ||
"size" : "32x32", | ||
"scale" : "2x" | ||
"scale" : "2x", | ||
"size" : "32x32" | ||
}, | ||
{ | ||
"filename" : "128@1x.png", | ||
"idiom" : "mac", | ||
"size" : "128x128", | ||
"scale" : "1x" | ||
"scale" : "1x", | ||
"size" : "128x128" | ||
}, | ||
{ | ||
"filename" : "128@2x.png", | ||
"idiom" : "mac", | ||
"size" : "128x128", | ||
"scale" : "2x" | ||
"scale" : "2x", | ||
"size" : "128x128" | ||
}, | ||
{ | ||
"filename" : "256@1x.png", | ||
"idiom" : "mac", | ||
"size" : "256x256", | ||
"scale" : "1x" | ||
"scale" : "1x", | ||
"size" : "256x256" | ||
}, | ||
{ | ||
"filename" : "256@2x.png", | ||
"idiom" : "mac", | ||
"size" : "256x256", | ||
"scale" : "2x" | ||
"scale" : "2x", | ||
"size" : "256x256" | ||
}, | ||
{ | ||
"filename" : "512@1x.png", | ||
"idiom" : "mac", | ||
"size" : "512x512", | ||
"scale" : "1x" | ||
"scale" : "1x", | ||
"size" : "512x512" | ||
}, | ||
{ | ||
"filename" : "512@2x.png", | ||
"idiom" : "mac", | ||
"size" : "512x512", | ||
"scale" : "2x" | ||
"scale" : "2x", | ||
"size" : "512x512" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Folder.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "Folder@2x.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.