Skip to content

Commit

Permalink
👷 CI: Merge dev by GitOK
Browse files Browse the repository at this point in the history
  • Loading branch information
nookery committed Sep 25, 2024
2 parents 3e7978c + 3d4c393 commit 7ac8aef
Show file tree
Hide file tree
Showing 79 changed files with 1,549 additions and 772 deletions.
1 change: 1 addition & 0 deletions .gitok/banners/40432DEC-594C-435B-8AF7-82815A87E461.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backgroundId":"blue2green","device":"iMac","features":["Feature 1","Feature 2","Feature 3","Feature 4"],"imageId":"20240925105151.png","inScreen":true,"opacity":0.34146986095183485,"subTitle":"","title":"Banner制作"}
1 change: 1 addition & 0 deletions .gitok/banners/9CD0B08A-A39A-49A0-AC05-78B6B90979D2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backgroundId":"blue2cyan","device":"iMac","features":["Feature 1","Feature 2","Feature 3","Feature 4"],"imageId":"20240925104852.png","inScreen":true,"opacity":0.2778745246008915,"subTitle":"sub3","title":"图标制作"}
2 changes: 1 addition & 1 deletion .gitok/banners/FEDB497A-C082-4815-87DC-6013F2057232.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"backgroundId":"blue2green","device":"iMac","features":["Feature 1","Feature 2","Feature 3","Feature 4"],"inScreen":false,"opacity":0.7054974399717514,"subTitle":"sub3","title":"31"}
{"backgroundId":"green2blue_tl2br","device":"iMac","features":["Git客户端","Banner制作","图标制作","项目管理"],"imageId":"20240925105245.png","inScreen":true,"opacity":0.6097042797344111,"subTitle":"简洁的风格","title":"Git客户端"}
2 changes: 1 addition & 1 deletion .gitok/icons/31.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"backgroundId":"6","iconId":23,"title":"31"}
{"backgroundId":"6","iconId":12,"title":"31"}
2 changes: 1 addition & 1 deletion .gitok/icons/76.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"backgroundId":"green2blue_tl2br","iconId":21,"title":"76"}
{"backgroundId":"blue2purple_l2r","iconId":2,"title":"76"}
1 change: 1 addition & 0 deletions .gitok/icons/C9807F09-0262-48FA-8C3E-562182B59F5D.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"backgroundId":"3","iconId":1,"title":"89"}
Binary file added .gitok/images/20240925105151.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitok/images/20240925105245.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions App/Bootstrap/GitOKApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct GitOKApp: App {
Content()
}
}
.windowToolbarStyle(.unified(showsTitle: false))
.modelContainer(AppConfig.getContainer())
.commands(content: {
DebugCommand()
Expand Down
5 changes: 3 additions & 2 deletions App/Bootstrap/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ struct RootView<Content>: View where Content: View {
.modelContainer(AppConfig.getContainer())
.environmentObject(AppProvider())
.environmentObject(GitProvider())
.environmentObject(BannerProvider())
.environmentObject(IconProvider())
.environmentObject(WebConfig())
.environmentObject(PluginProvider())
.environmentObject(m)
Expand Down Expand Up @@ -54,6 +56,5 @@ struct RootView<Content>: View where Content: View {
RootView(content: {
Content()
})
.frame(height: 800)
.frame(width: 800)
.frame(width: 800, height: 800)
}
1 change: 0 additions & 1 deletion App/Config/AppConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ extension AppConfig {
}
}


#Preview {
AppPreview()
}
1 change: 0 additions & 1 deletion App/Config/DBExt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ extension AppConfig {
let url = AppConfig.getDBFolderURL().appendingPathComponent(dbFileName)

let schema = Schema([
Item.self,
Project.self
])
let modelConfiguration = ModelConfiguration(
Expand Down
29 changes: 17 additions & 12 deletions App/Contact/JsonModel.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SwiftUI
import OSLog
import SwiftUI

protocol JsonModel: Encodable, Identifiable, Equatable, Hashable {
var path: String? { get }
Expand All @@ -20,28 +20,34 @@ extension JsonModel {
guard let path = self.path else {
return
}

do {
try FileManager.default.removeItem(atPath: path)
} catch let e {
print(e)
os_log(.error, "Error deleting item at path: \(path), error: \(e)")
}
}
}

// MARK: Store

extension JsonModel {
func save() {
os_log("\(self.label)Save")
func save() throws {
let verbose = false

guard let p = path else {
os_log("\(label)Can't Save, no path")
return
os_log(.error, "\(label)Can't Save, no path")

throw NSError(domain: "\(label)SaveError", code: 1, userInfo: [NSLocalizedDescriptionKey: "\(label)Can't Save, no path"])
}

if verbose {
os_log("\(self.label)Save to \(p)")
}

self.saveToFile(atPath: p)
}

// 将对象转换为 JSON 字符串
func toJSONString() -> String? {
do {
Expand All @@ -52,7 +58,7 @@ extension JsonModel {
return jsonString
}
} catch {
print("Error encoding BannerModel to JSON: \(error)")
os_log(.error, "Error encoding BannerModel to JSON: \(error)")
}
return nil
}
Expand All @@ -68,14 +74,13 @@ extension JsonModel {
do {
try fileManager.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil)
} catch {
print("Error creating directory: \(error)")
os_log(.error, "Error creating directory: \(error)")
}

do {
try jsonString.write(toFile: path, atomically: true, encoding: .utf8)
print("JSON saved to file: \(path)")
} catch {
print("Error saving JSON to file: \(error)")
os_log(.error, "Error saving JSON to file: \(error)")
}
}
}
Expand Down
66 changes: 66 additions & 0 deletions App/Contact/SuperEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ extension SuperEvent {
}
}

// MARK: Project

extension SuperEvent {
func emitGitProjectDeleted(path: String) {
DispatchQueue.main.async {
NotificationCenter.default.post(name: .gitProjectDeleted, object: self, userInfo: ["path": path])
}
}
}

// MARK: Branch

extension SuperEvent {
Expand Down Expand Up @@ -90,6 +100,62 @@ extension SuperEvent {
}
}

// MARK: Banner

extension SuperEvent {
func emitBannerChanged() {
DispatchQueue.main.async {
NotificationCenter.default.post(name: .bannerChanged, object: self)
}
}

func emitBannerListChanged() {
DispatchQueue.main.async {
NotificationCenter.default.post(name: .bannerListChanged, object: self)
}
}

func emitBannerAdded() {
DispatchQueue.main.async {
NotificationCenter.default.post(name: .bannerAdded, object: self)
}
}

func emitBannerRemoved() {
DispatchQueue.main.async {
NotificationCenter.default.post(name: .bannerRemoved, object: self)
}
}

func emitBannerTitleChanged(title: String, id: String) {
DispatchQueue.main.async {
NotificationCenter.default.post(name: .bannerTitleChanged, object: self, userInfo: ["title": title, "id": id])
}
}
}

// MARK: Icon

extension SuperEvent {
func emitIconDidChange() {
DispatchQueue.main.async {
NotificationCenter.default.post(name: .iconDidChange, object: self)
}
}

func emitIconDidSave() {
DispatchQueue.main.async {
NotificationCenter.default.post(name: .iconDidSave, object: self)
}
}

func emitIconDidFail() {
DispatchQueue.main.async {
NotificationCenter.default.post(name: .iconDidFail, object: self)
}
}
}

// MARK: App

extension SuperEvent {
Expand Down
Loading

0 comments on commit 7ac8aef

Please sign in to comment.