diff --git a/ios/PushDeer-iOS/PushDeer.xcodeproj/project.pbxproj b/ios/PushDeer-iOS/PushDeer.xcodeproj/project.pbxproj index 5556b02..e392858 100644 --- a/ios/PushDeer-iOS/PushDeer.xcodeproj/project.pbxproj +++ b/ios/PushDeer-iOS/PushDeer.xcodeproj/project.pbxproj @@ -43,7 +43,6 @@ 5292F4FD2776BC7A00B9A7BB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5292F4FC2776BC7A00B9A7BB /* Assets.xcassets */; }; 5292F5002776BC7A00B9A7BB /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5292F4FF2776BC7A00B9A7BB /* Preview Assets.xcassets */; }; 52B8CF5F277DE660004CB680 /* AppleSignInButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B8CF5E277DE660004CB680 /* AppleSignInButton.swift */; }; - 52B8CF6B277E0B46004CB680 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 52B8CF6A277E0B46004CB680 /* Assets.xcassets */; }; 52B8CF6E277E0B46004CB680 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 52B8CF6D277E0B46004CB680 /* Preview Assets.xcassets */; }; 52B8CF73277E0B46004CB680 /* PushDeerClip.app in Embed App Clips */ = {isa = PBXBuildFile; fileRef = 52B8CF64277E0B44004CB680 /* PushDeerClip.app */; platformFilter = ios; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 52B8CF78277E0BF1004CB680 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52163EB227773F8400594190 /* MainView.swift */; }; @@ -127,7 +126,6 @@ 5292F4FF2776BC7A00B9A7BB /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 52B8CF5E277DE660004CB680 /* AppleSignInButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleSignInButton.swift; sourceTree = ""; }; 52B8CF64277E0B44004CB680 /* PushDeerClip.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PushDeerClip.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 52B8CF6A277E0B46004CB680 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52B8CF6D277E0B46004CB680 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 52B8CF6F277E0B46004CB680 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52B8CF70277E0B46004CB680 /* PushDeerClip.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PushDeerClip.entitlements; sourceTree = ""; }; @@ -268,7 +266,6 @@ 52B8CF65277E0B44004CB680 /* PushDeerClip */ = { isa = PBXGroup; children = ( - 52B8CF6A277E0B46004CB680 /* Assets.xcassets */, 52B8CF6F277E0B46004CB680 /* Info.plist */, 52E317DD279305BB000B8BB1 /* InfoPlist.strings */, 52B8CF70277E0B46004CB680 /* PushDeerClip.entitlements */, @@ -434,7 +431,6 @@ 52B8CF6E277E0B46004CB680 /* Preview Assets.xcassets in Resources */, 52E317DF279305BB000B8BB1 /* InfoPlist.strings in Resources */, 52B8CF87277E0C5C004CB680 /* Assets.xcassets in Resources */, - 52B8CF6B277E0B46004CB680 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ios/PushDeer-iOS/PushDeer/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/AccentColor.colorset/Contents.json index 7736646..12488f5 100644 --- a/ios/PushDeer-iOS/PushDeer/Assets.xcassets/AccentColor.colorset/Contents.json +++ b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/AccentColor.colorset/Contents.json @@ -11,6 +11,24 @@ } }, "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xB3", + "green" : "0x5D", + "red" : "0x4D" + } + }, + "idiom" : "universal" } ], "info" : { diff --git a/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/BtnBgColor.colorset/Contents.json b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/BtnBgColor.colorset/Contents.json new file mode 100644 index 0000000..8a1f8de --- /dev/null +++ b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/BtnBgColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x89", + "green" : "0x47", + "red" : "0x3B" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x66", + "green" : "0x34", + "red" : "0x2B" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/background2Color.colorset/Contents.json b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/background2Color.colorset/Contents.json new file mode 100644 index 0000000..6e3feb6 --- /dev/null +++ b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/background2Color.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xE5", + "green" : "0xE5", + "red" : "0xE5" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.100", + "green" : "0.100", + "red" : "0.100" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/backgroundColor.colorset/Contents.json b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/backgroundColor.colorset/Contents.json new file mode 100644 index 0000000..0425637 --- /dev/null +++ b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/backgroundColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.000", + "green" : "0.000", + "red" : "0.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/borderColor.colorset/Contents.json b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/borderColor.colorset/Contents.json new file mode 100644 index 0000000..ad5644d --- /dev/null +++ b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/borderColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.667", + "green" : "0.667", + "red" : "0.667" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.365", + "green" : "0.365", + "red" : "0.365" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/text2Color.colorset/Contents.json b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/text2Color.colorset/Contents.json new file mode 100644 index 0000000..d43c3bf --- /dev/null +++ b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/text2Color.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.500", + "green" : "0.500", + "red" : "0.500" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.700", + "green" : "0.700", + "red" : "0.700" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/textColor.colorset/Contents.json b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/textColor.colorset/Contents.json new file mode 100644 index 0000000..1497f8c --- /dev/null +++ b/ios/PushDeer-iOS/PushDeer/Assets.xcassets/Colors/textColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.333", + "green" : "0.333", + "red" : "0.333" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.800", + "green" : "0.800", + "red" : "0.800" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/PushDeer-iOS/PushDeer/View/Common/BaseNavigationView.swift b/ios/PushDeer-iOS/PushDeer/View/Common/BaseNavigationView.swift index 1aa568d..8a7044c 100644 --- a/ios/PushDeer-iOS/PushDeer/View/Common/BaseNavigationView.swift +++ b/ios/PushDeer-iOS/PushDeer/View/Common/BaseNavigationView.swift @@ -14,6 +14,8 @@ struct BaseNavigationView : View { /// 页面主体View @ViewBuilder let contentView: Content + @Environment(\.colorScheme) private var colorScheme + var body: some View { NavigationView { ZStack { @@ -27,7 +29,9 @@ struct BaseNavigationView : View { contentView } .background( - Image("deer.gray").offset(x: -150, y: -10), + Image("deer.gray") + .offset(x: -150, y: -10) + .opacity(colorScheme == .dark ? 0.4 : 1), alignment: .bottom ) .navigationBarTitle(title) @@ -41,5 +45,6 @@ struct BaseNavigationView_Previews: PreviewProvider { BaseNavigationView(title: "标题") { Text("内容") } + .environment(\.colorScheme, .dark) } } diff --git a/ios/PushDeer-iOS/PushDeer/View/DeviceListView.swift b/ios/PushDeer-iOS/PushDeer/View/DeviceListView.swift index 90cb133..ee23764 100644 --- a/ios/PushDeer-iOS/PushDeer/View/DeviceListView.swift +++ b/ios/PushDeer-iOS/PushDeer/View/DeviceListView.swift @@ -61,6 +61,8 @@ struct DeviceListView: View { struct DeviceView_Previews: PreviewProvider { static var previews: some View { - DeviceListView().environmentObject(AppState.shared) + DeviceListView() + .environmentObject(AppState.shared) + .environment(\.colorScheme, .dark) } } diff --git a/ios/PushDeer-iOS/PushDeer/View/KeyItemView.swift b/ios/PushDeer-iOS/PushDeer/View/KeyItemView.swift index cc34e12..34160d8 100644 --- a/ios/PushDeer-iOS/PushDeer/View/KeyItemView.swift +++ b/ios/PushDeer-iOS/PushDeer/View/KeyItemView.swift @@ -45,7 +45,7 @@ struct KeyItemView: View { .font(.system(size: 14)) .disabled(true) .padding(12) - .overlay(RoundedRectangle(cornerRadius: 4).stroke(Color(UIColor.lightGray))) + .overlay(RoundedRectangle(cornerRadius: 4).stroke(Color("borderColor"))) .foregroundColor(Color.gray) HLine().stroke(Color.gray, style: StrokeStyle(lineWidth: 1, dash: [5])) @@ -78,7 +78,7 @@ struct KeyItemView: View { .font(.system(size: 20)) .frame(width: 90, height: 42) .foregroundColor(Color.white) - .background(Color.accentColor) + .background(Color("BtnBgColor")) .cornerRadius(8) } } diff --git a/ios/PushDeer-iOS/PushDeer/View/LoginView.swift b/ios/PushDeer-iOS/PushDeer/View/LoginView.swift index f4b51f6..207993c 100644 --- a/ios/PushDeer-iOS/PushDeer/View/LoginView.swift +++ b/ios/PushDeer-iOS/PushDeer/View/LoginView.swift @@ -40,6 +40,7 @@ struct LoginView: View { } } ) + .overlay(RoundedRectangle(cornerRadius: 6).stroke(Color.white)) .frame(maxWidth: 375, minHeight: 64, maxHeight: 64) .padding() } diff --git a/ios/PushDeer-iOS/PushDeer/View/MessageItemView.swift b/ios/PushDeer-iOS/PushDeer/View/MessageItemView.swift index 013da96..63bd09b 100644 --- a/ios/PushDeer-iOS/PushDeer/View/MessageItemView.swift +++ b/ios/PushDeer-iOS/PushDeer/View/MessageItemView.swift @@ -26,10 +26,10 @@ struct MessageItemView: View { .frame(width: 38, height: 38) Text(messageItem.pushkey_name ?? "") .font(.system(size: 14)) - .foregroundColor(Color(UIColor.darkGray)) + .foregroundColor(Color("text2Color")) Text(messageItem.createdDateStr) .font(.system(size: 12)) - .foregroundColor(Color(UIColor.darkGray)) + .foregroundColor(Color("text2Color")) HLine().stroke(Color(UIColor.lightGray)) .frame(height: 1) } @@ -57,7 +57,7 @@ struct MessageContentView: View { .markdownStyle( DefaultMarkdownStyle( font: .system(size: 14), - foregroundColor: UIColor.darkGray + foregroundColor: UIColor(named: "textColor") ?? UIColor.darkGray ) ) if !(messageItem.desp?.isEmpty ?? true) { @@ -65,7 +65,7 @@ struct MessageContentView: View { .markdownStyle( DefaultMarkdownStyle( font: .system(size: 14), - foregroundColor: UIColor.darkGray + foregroundColor: UIColor(named: "textColor") ?? UIColor.darkGray ) ) } @@ -83,7 +83,7 @@ struct MessageContentView: View { .resizable() .placeholder(content: { ZStack { - Color.gray.opacity(0.5) + Color("background2Color") Image(systemName: "photo") .foregroundColor(.gray) .font(.system(size: 100)) @@ -93,7 +93,7 @@ struct MessageContentView: View { .indicator(.activity) .transition(.fade(duration: 0.5)) .scaledToFill() - .background(Color.white) + .background(Color("backgroundColor")) .contextMenu { Button { guard let image = image else { @@ -134,13 +134,13 @@ struct MessageContentView: View { HStack{ Text(messageItem.text ?? "") .font(.system(size: 14)) - .foregroundColor(Color(UIColor.darkGray)) + .foregroundColor(Color("textColor")) Spacer(minLength: 0) } if !(messageItem.desp?.isEmpty ?? true) { Text(messageItem.desp ?? "") .font(.system(size: 14)) - .foregroundColor(Color(UIColor.darkGray)) + .foregroundColor(Color("textColor")) } } .padding() diff --git a/ios/PushDeer-iOS/PushDeer/View/MessageListView.swift b/ios/PushDeer-iOS/PushDeer/View/MessageListView.swift index 16c6bfe..46f1111 100644 --- a/ios/PushDeer-iOS/PushDeer/View/MessageListView.swift +++ b/ios/PushDeer-iOS/PushDeer/View/MessageListView.swift @@ -93,7 +93,7 @@ struct TestPushView: View { .font(.system(size: 20)) .frame(width: 104, height: 42) .foregroundColor(Color.white) - .background(Color.accentColor) + .background(Color("BtnBgColor")) .cornerRadius(8) .padding(EdgeInsets(top: 12, leading: 26, bottom: 0, trailing: 24)) } diff --git a/ios/PushDeer-iOS/PushDeer/View/SettingsItemView.swift b/ios/PushDeer-iOS/PushDeer/View/SettingsItemView.swift index 8fba721..3ee762b 100644 --- a/ios/PushDeer-iOS/PushDeer/View/SettingsItemView.swift +++ b/ios/PushDeer-iOS/PushDeer/View/SettingsItemView.swift @@ -17,7 +17,7 @@ struct SettingsItemView: View { HStack{ Text(title) .font(.system(size: 18)) - .foregroundColor(Color(UIColor.darkGray)) + .foregroundColor(Color("textColor")) .padding(.leading, 16) Spacer(minLength: 0) Button(button) { @@ -27,7 +27,7 @@ struct SettingsItemView: View { .font(.system(size: 20)) .frame(width: 80, height: 42) .foregroundColor(Color.white) - .background(Color.accentColor) + .background(Color("BtnBgColor")) .cornerRadius(8) .padding() } diff --git a/ios/PushDeer-iOS/PushDeerClip/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/PushDeer-iOS/PushDeerClip/Assets.xcassets/AccentColor.colorset/Contents.json deleted file mode 100644 index eb87897..0000000 --- a/ios/PushDeer-iOS/PushDeerClip/Assets.xcassets/AccentColor.colorset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "colors" : [ - { - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ios/PushDeer-iOS/PushDeerClip/Assets.xcassets/Contents.json b/ios/PushDeer-iOS/PushDeerClip/Assets.xcassets/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/ios/PushDeer-iOS/PushDeerClip/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ios/PushDeer-iOS/README.md b/ios/PushDeer-iOS/README.md index 2a6c062..f74ba96 100644 --- a/ios/PushDeer-iOS/README.md +++ b/ios/PushDeer-iOS/README.md @@ -1,4 +1,4 @@ -# PushDeer-iOS (开发中) +# PushDeer-iOS PushDeer 是一个开放源码的无 App 推送服务. @@ -7,4 +7,41 @@ PushDeer 是一个开放源码的无 App 推送服务. PushDeer-iOS 最低支持 iOS14, 因为苹果轻应用(App Clips)最低支持 iOS14. -由于苹果规定轻应用必须随 APP 一起发布, 所以除了扫码打开轻应用即时享用推送服务, 实际上你也可以下载 APP 使用. \ No newline at end of file +由于苹果规定轻应用必须随 APP 一起发布, 所以除了扫码打开轻应用即时享用推送服务, 实际上你也可以下载 APP 使用. + + +## 开发相关 + +- 语言使用 Swift +- 界面使用 SwiftUI +- 异步使用 Swift Concurrency ( async / await ) +- 第三方库管理 CocoaPods / Swift Package Manager + +## 构建环境 + +- Xcode 13.2.1 +( Swift Concurrency 本来只支持 iOS 15, 从 Xcode 13.2 开始向下兼容到 iOS 13 ) +- CocoaPods 1.11.2 + +## 运行项目 + +1. 运行项目前请先安装 CocoaPods, 并在项目根目录下执行: `pod install` + +2. 然后使用 Xcode 打开项目, 等待 Swift Package Manager 工具自动自动安装依赖库, 完成后即可运行项目. + +3. 如遇 CocoaPods 和 Swift Package Manager 管理的第三方库被墙, 请自行搜索解决. + +### 依赖清单 + +ps: 只列出一级依赖库, 不包含依赖的依赖, 但同样感谢 + +CocoaPods + +- Moya +- SDWebImageSwiftUI +- KRProgressHUD + +Swift Package Manager + +- MarkdownUI +