Skip to content

Commit

Permalink
clean old entrance
Browse files Browse the repository at this point in the history
  • Loading branch information
ming1016 committed Apr 9, 2024
1 parent 40b40f8 commit 96ebc43
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 248 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 戴铭的开发小册子 5.0

Swift开发的手册,是个 macOS 程序。[在线文字版](https://ming1016.github.io/2021/11/23/daiming-swift-pamphlet/)

![](https://user-images.githubusercontent.com/251980/153746040-8379ad07-4f64-4cb2-b162-40a80fb87d6b.PNG)

## 下载
Expand Down
12 changes: 2 additions & 10 deletions SwiftPamphletApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@
08AEAEDD277EA64900B969E2 /* DBDevNoti.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08AEAEDC277EA64900B969E2 /* DBDevNoti.swift */; };
08AEAEE1277EA70500B969E2 /* DBRepoStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08AEAEE0277EA70500B969E2 /* DBRepoStore.swift */; };
08AEAEF1277F09D000B969E2 /* IntroView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08AEAEF0277F09D000B969E2 /* IntroView.swift */; };
08AEAEF3277F09FA00B969E2 /* NavView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08AEAEF2277F09FA00B969E2 /* NavView.swift */; };
08AEAEF5277F0A1E00B969E2 /* SPSidebar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08AEAEF4277F0A1E00B969E2 /* SPSidebar.swift */; };
08AEAEFA277F3C7400B969E2 /* css.html in Resources */ = {isa = PBXBuildFile; fileRef = 08AEAEF9277F3C7400B969E2 /* css.html */; };
08B4C9392770B26700742084 /* CCYRSSReq.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08B4C9382770B26700742084 /* CCYRSSReq.swift */; };
08B4C93C2774786800742084 /* archiveRepos.json in Resources */ = {isa = PBXBuildFile; fileRef = 08B4C93B2774786800742084 /* archiveRepos.json */; };
Expand Down Expand Up @@ -484,8 +482,6 @@
08AEAEDC277EA64900B969E2 /* DBDevNoti.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DBDevNoti.swift; sourceTree = "<group>"; };
08AEAEE0277EA70500B969E2 /* DBRepoStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DBRepoStore.swift; sourceTree = "<group>"; };
08AEAEF0277F09D000B969E2 /* IntroView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntroView.swift; sourceTree = "<group>"; };
08AEAEF2277F09FA00B969E2 /* NavView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavView.swift; sourceTree = "<group>"; };
08AEAEF4277F0A1E00B969E2 /* SPSidebar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPSidebar.swift; sourceTree = "<group>"; };
08AEAEF9277F3C7400B969E2 /* css.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = css.html; sourceTree = "<group>"; };
08B4C9382770B26700742084 /* CCYRSSReq.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CCYRSSReq.swift; sourceTree = "<group>"; };
08B4C93B2774786800742084 /* archiveRepos.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = archiveRepos.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1016,9 +1012,7 @@
083554E227572BB60095E0EE /* AppVM.swift */,
086A5F432744EE2800FECE02 /* SwiftPamphletAppConfig.swift */,
086A5F062744E88E00FECE02 /* SwiftPamphletAppApp.swift */,
08AEAEF4277F0A1E00B969E2 /* SPSidebar.swift */,
08AEAEF0277F09D000B969E2 /* IntroView.swift */,
08AEAEF2277F09FA00B969E2 /* NavView.swift */,
084E1A6427B51EDB0072BBB6 /* AutoTask.swift */,
);
path = App;
Expand Down Expand Up @@ -1736,7 +1730,6 @@
08ED801C2B9D1EEC0069B7EC /* SettingView.swift in Sources */,
08CD61FE27758B8A008C0935 /* Lexer.swift in Sources */,
086A5F422744EDCE00FECE02 /* IssueVM.swift in Sources */,
08AEAEF3277F09FA00B969E2 /* NavView.swift in Sources */,
086A5F352744ED9600FECE02 /* IssueView.swift in Sources */,
08522BF027CF9FFA005FF059 /* PlayAnimation.swift in Sources */,
08AEAEDD277EA64900B969E2 /* DBDevNoti.swift in Sources */,
Expand Down Expand Up @@ -1770,7 +1763,6 @@
086A5F412744EDCE00FECE02 /* UserVM.swift in Sources */,
08A9E1A42BC2837500A73764 /* APIUserVM.swift in Sources */,
08BE633527BF54A0002BC6A8 /* PlayTextEditorView.swift in Sources */,
08AEAEF5277F0A1E00B969E2 /* SPSidebar.swift in Sources */,
086A5F642754C14F00FECE02 /* PlayTextView.swift in Sources */,
08397E292B9F0A9100DFDD02 /* EditInfoView.swift in Sources */,
086A5F372744ED9600FECE02 /* UserView.swift in Sources */,
Expand Down Expand Up @@ -1943,7 +1935,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 5.0;
MARKETING_VERSION = 6.0;
OTHER_LDFLAGS = (
"-Xlinker",
"-interposable",
Expand Down Expand Up @@ -1986,7 +1978,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 5.0;
MARKETING_VERSION = 6.0;
PRODUCT_BUNDLE_IDENTIFIER = com.starming.SwiftPamphletAppByMing;
PRODUCT_NAME = "戴铭的开发小册子";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
8 changes: 5 additions & 3 deletions SwiftPamphletApp/App/IntroView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
//

import SwiftUI
//import Inject
import MarkdownUI

struct IntroView: View {
// @ObservedObject private var iO = Inject.observer
var body: some View {
VStack(spacing: 15) {
Image("logo")
Expand All @@ -21,7 +20,10 @@ struct IntroView: View {
Text("一本活的开发手册")
Link("GitHub 地址", destination: URL(string: "https://github.com/ming1016/SwiftPamphletApp")!)
}
Text("版本5.0").font(.footnote)
if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
Text("版本\(version)").font(.footnote)
}
Markdown(loadBundleString("1.md"))
}
.frame(minWidth: SPC.detailMinWidth)
// .enableInjection()
Expand Down
18 changes: 0 additions & 18 deletions SwiftPamphletApp/App/NavView.swift

This file was deleted.

124 changes: 0 additions & 124 deletions SwiftPamphletApp/App/SPSidebar.swift

This file was deleted.

84 changes: 1 addition & 83 deletions SwiftPamphletApp/App/SwiftPamphletAppApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ struct SwiftPamphletAppApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
// SwiftPamphletApp() // 老版本
HomeView() // 新版本
// PlayWeatherView()
HomeView()
.modelContainer(for: [IOInfo.self, DeveloperModel.self], isUndoEnabled: true)

}
.windowToolbarStyle(UnifiedWindowToolbarStyle(showsTitle: true)) // 用来控制是否展示标题
Settings {
Expand Down Expand Up @@ -55,86 +52,7 @@ struct V: View {
}
}

struct SwiftPamphletApp: View {

@State var appVM = AppVM()
@State var networkMonitor = NetworkMonitor()

@State var sb = Set<AnyCancellable>()
@State var alertMsg = ""

@State private var showNetworkAlert = false // 网络监控

let timerForDevs = Timer.publish(every: SPC.timerForDevsSec, on: .main, in: .common).autoconnect()
let timerForExp = Timer.publish(every: SPC.timerForExpSec, on: .main, in: .common).autoconnect()
let timerForRss = Timer.publish(every: SPC.timerForRssSec, on: .main, in: .common).autoconnect()
var body: some View {
NavigationView {
SPSidebar()
.onReceive(timerForDevs, perform: { _ in
if SPC.gitHubAccessToken.isEmpty == false || SPC.githubAccessToken().isEmpty == false {
if let userName = appVM.timeForDevsEvent() {
let vm = UserVM(userName: userName)
vm.doing(.notiEvent)
}
}
})
.onReceive(timerForExp) { _ in
if SPC.gitHubAccessToken.isEmpty == false || SPC.githubAccessToken().isEmpty == false {
appVM.timeForExpEvent()
}
}
IssuesListFromCustomView(vm: IssueVM(guideName:"guide-syntax"))
.frame(minWidth:60)
IntroView()
NavView()

} // end NavigationView
.frame(minHeight: 650)
.navigationTitle("戴铭的开发小册子")
.navigationSubtitle(appVM.alertMsg)
.toolbar {
ToolbarItem(placement: ToolbarItemPlacement.navigation) {
Button {
appVM.toggleSidebar()
} label: {
Label("Sidebar", systemImage: "sidebar.left")
}
}

ToolbarItemGroup(placement: ToolbarItemPlacement.automatic) {
// 博客链接用浏览器打开,还有共享菜单进行分享用
if !appVM.webLinkStr.isEmpty {
ShareView(s: appVM.webLinkStr)
Button {
gotoWebBrowser(urlStr: appVM.webLinkStr)
} label: {
Label("Browser", systemImage: "safari")
Text("用浏览器打开")
} // end Button
} // end if

Button {
appVM.toggleLastView()
} label: {
Label("LastView", systemImage: "sidebar.right")
} // end Button

} // end ToolbarItemGroup
} // end .toolbar
.environment(appVM)
// 网络监控
.environment(networkMonitor)
.onChange(of: networkMonitor.hasNetworkConnection, { oldValue, newValue in
showNetworkAlert = !newValue
})
.alert("NO INTERNET",
isPresented: $showNetworkAlert,
actions: {
Text("Close")
})
}
}

// MARK: - UnCat
protocol Jsonable : Identifiable, Decodable, Hashable {}
Expand Down
6 changes: 2 additions & 4 deletions SwiftPamphletApp/GitHubAPI/APIVM/GitHubReq.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class GitHubReq {
let de = JSONDecoder()
de.keyDecodingStrategy = .convertFromSnakeCase

let typeData = try de.decode(type.self, from: data)

return typeData
return try de.decode(type.self, from: data)
}
}

Expand All @@ -49,7 +47,7 @@ enum APIError: Error {
case .server:
return "api 服务出错"
case .client:
return "客户端出错"
return "端侧网络出错"
case .parseError:
return "网络出错"
}
Expand Down
7 changes: 1 addition & 6 deletions SwiftPamphletApp/HomeUI/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ struct HomeView: View {
type: .detail
)
} else {
ContentUnavailableView {
Label("未选",
systemImage: "pencil.tip.crop.circle.badge.plus")
} description: {
Text("请选择或按+号添加内容")
}
IntroView()
}
}
.environment(appVM)
Expand Down

0 comments on commit 96ebc43

Please sign in to comment.