夜间模式配色优化(之前某些UI有点看不清); 更新 readme 说明文件

This commit is contained in:
hext 2022-01-16 00:10:47 +08:00
parent c5bd3b2ab4
commit 5a58906068
18 changed files with 308 additions and 38 deletions

View File

@ -43,7 +43,6 @@
5292F4FD2776BC7A00B9A7BB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5292F4FC2776BC7A00B9A7BB /* Assets.xcassets */; }; 5292F4FD2776BC7A00B9A7BB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5292F4FC2776BC7A00B9A7BB /* Assets.xcassets */; };
5292F5002776BC7A00B9A7BB /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5292F4FF2776BC7A00B9A7BB /* Preview 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 */; }; 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 */; }; 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, ); }; }; 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 */; }; 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 = "<group>"; }; 5292F4FF2776BC7A00B9A7BB /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
52B8CF5E277DE660004CB680 /* AppleSignInButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleSignInButton.swift; sourceTree = "<group>"; }; 52B8CF5E277DE660004CB680 /* AppleSignInButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleSignInButton.swift; sourceTree = "<group>"; };
52B8CF64277E0B44004CB680 /* PushDeerClip.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PushDeerClip.app; sourceTree = BUILT_PRODUCTS_DIR; }; 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 = "<group>"; };
52B8CF6D277E0B46004CB680 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; }; 52B8CF6D277E0B46004CB680 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
52B8CF6F277E0B46004CB680 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 52B8CF6F277E0B46004CB680 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
52B8CF70277E0B46004CB680 /* PushDeerClip.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PushDeerClip.entitlements; sourceTree = "<group>"; }; 52B8CF70277E0B46004CB680 /* PushDeerClip.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PushDeerClip.entitlements; sourceTree = "<group>"; };
@ -268,7 +266,6 @@
52B8CF65277E0B44004CB680 /* PushDeerClip */ = { 52B8CF65277E0B44004CB680 /* PushDeerClip */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
52B8CF6A277E0B46004CB680 /* Assets.xcassets */,
52B8CF6F277E0B46004CB680 /* Info.plist */, 52B8CF6F277E0B46004CB680 /* Info.plist */,
52E317DD279305BB000B8BB1 /* InfoPlist.strings */, 52E317DD279305BB000B8BB1 /* InfoPlist.strings */,
52B8CF70277E0B46004CB680 /* PushDeerClip.entitlements */, 52B8CF70277E0B46004CB680 /* PushDeerClip.entitlements */,
@ -434,7 +431,6 @@
52B8CF6E277E0B46004CB680 /* Preview Assets.xcassets in Resources */, 52B8CF6E277E0B46004CB680 /* Preview Assets.xcassets in Resources */,
52E317DF279305BB000B8BB1 /* InfoPlist.strings in Resources */, 52E317DF279305BB000B8BB1 /* InfoPlist.strings in Resources */,
52B8CF87277E0C5C004CB680 /* Assets.xcassets in Resources */, 52B8CF87277E0C5C004CB680 /* Assets.xcassets in Resources */,
52B8CF6B277E0B46004CB680 /* Assets.xcassets in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -11,6 +11,24 @@
} }
}, },
"idiom" : "universal" "idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xB3",
"green" : "0x5D",
"red" : "0x4D"
}
},
"idiom" : "universal"
} }
], ],
"info" : { "info" : {

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -14,6 +14,8 @@ struct BaseNavigationView<Content : View> : View {
/// View /// View
@ViewBuilder let contentView: Content @ViewBuilder let contentView: Content
@Environment(\.colorScheme) private var colorScheme
var body: some View { var body: some View {
NavigationView { NavigationView {
ZStack { ZStack {
@ -27,7 +29,9 @@ struct BaseNavigationView<Content : View> : View {
contentView contentView
} }
.background( .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 alignment: .bottom
) )
.navigationBarTitle(title) .navigationBarTitle(title)
@ -41,5 +45,6 @@ struct BaseNavigationView_Previews: PreviewProvider {
BaseNavigationView(title: "标题") { BaseNavigationView(title: "标题") {
Text("内容") Text("内容")
} }
.environment(\.colorScheme, .dark)
} }
} }

View File

@ -61,6 +61,8 @@ struct DeviceListView: View {
struct DeviceView_Previews: PreviewProvider { struct DeviceView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
DeviceListView().environmentObject(AppState.shared) DeviceListView()
.environmentObject(AppState.shared)
.environment(\.colorScheme, .dark)
} }
} }

View File

@ -45,7 +45,7 @@ struct KeyItemView: View {
.font(.system(size: 14)) .font(.system(size: 14))
.disabled(true) .disabled(true)
.padding(12) .padding(12)
.overlay(RoundedRectangle(cornerRadius: 4).stroke(Color(UIColor.lightGray))) .overlay(RoundedRectangle(cornerRadius: 4).stroke(Color("borderColor")))
.foregroundColor(Color.gray) .foregroundColor(Color.gray)
HLine().stroke(Color.gray, style: StrokeStyle(lineWidth: 1, dash: [5])) HLine().stroke(Color.gray, style: StrokeStyle(lineWidth: 1, dash: [5]))
@ -78,7 +78,7 @@ struct KeyItemView: View {
.font(.system(size: 20)) .font(.system(size: 20))
.frame(width: 90, height: 42) .frame(width: 90, height: 42)
.foregroundColor(Color.white) .foregroundColor(Color.white)
.background(Color.accentColor) .background(Color("BtnBgColor"))
.cornerRadius(8) .cornerRadius(8)
} }
} }

View File

@ -40,6 +40,7 @@ struct LoginView: View {
} }
} }
) )
.overlay(RoundedRectangle(cornerRadius: 6).stroke(Color.white))
.frame(maxWidth: 375, minHeight: 64, maxHeight: 64) .frame(maxWidth: 375, minHeight: 64, maxHeight: 64)
.padding() .padding()
} }

View File

@ -26,10 +26,10 @@ struct MessageItemView: View {
.frame(width: 38, height: 38) .frame(width: 38, height: 38)
Text(messageItem.pushkey_name ?? "") Text(messageItem.pushkey_name ?? "")
.font(.system(size: 14)) .font(.system(size: 14))
.foregroundColor(Color(UIColor.darkGray)) .foregroundColor(Color("text2Color"))
Text(messageItem.createdDateStr) Text(messageItem.createdDateStr)
.font(.system(size: 12)) .font(.system(size: 12))
.foregroundColor(Color(UIColor.darkGray)) .foregroundColor(Color("text2Color"))
HLine().stroke(Color(UIColor.lightGray)) HLine().stroke(Color(UIColor.lightGray))
.frame(height: 1) .frame(height: 1)
} }
@ -57,7 +57,7 @@ struct MessageContentView: View {
.markdownStyle( .markdownStyle(
DefaultMarkdownStyle( DefaultMarkdownStyle(
font: .system(size: 14), font: .system(size: 14),
foregroundColor: UIColor.darkGray foregroundColor: UIColor(named: "textColor") ?? UIColor.darkGray
) )
) )
if !(messageItem.desp?.isEmpty ?? true) { if !(messageItem.desp?.isEmpty ?? true) {
@ -65,7 +65,7 @@ struct MessageContentView: View {
.markdownStyle( .markdownStyle(
DefaultMarkdownStyle( DefaultMarkdownStyle(
font: .system(size: 14), font: .system(size: 14),
foregroundColor: UIColor.darkGray foregroundColor: UIColor(named: "textColor") ?? UIColor.darkGray
) )
) )
} }
@ -83,7 +83,7 @@ struct MessageContentView: View {
.resizable() .resizable()
.placeholder(content: { .placeholder(content: {
ZStack { ZStack {
Color.gray.opacity(0.5) Color("background2Color")
Image(systemName: "photo") Image(systemName: "photo")
.foregroundColor(.gray) .foregroundColor(.gray)
.font(.system(size: 100)) .font(.system(size: 100))
@ -93,7 +93,7 @@ struct MessageContentView: View {
.indicator(.activity) .indicator(.activity)
.transition(.fade(duration: 0.5)) .transition(.fade(duration: 0.5))
.scaledToFill() .scaledToFill()
.background(Color.white) .background(Color("backgroundColor"))
.contextMenu { .contextMenu {
Button { Button {
guard let image = image else { guard let image = image else {
@ -134,13 +134,13 @@ struct MessageContentView: View {
HStack{ HStack{
Text(messageItem.text ?? "") Text(messageItem.text ?? "")
.font(.system(size: 14)) .font(.system(size: 14))
.foregroundColor(Color(UIColor.darkGray)) .foregroundColor(Color("textColor"))
Spacer(minLength: 0) Spacer(minLength: 0)
} }
if !(messageItem.desp?.isEmpty ?? true) { if !(messageItem.desp?.isEmpty ?? true) {
Text(messageItem.desp ?? "") Text(messageItem.desp ?? "")
.font(.system(size: 14)) .font(.system(size: 14))
.foregroundColor(Color(UIColor.darkGray)) .foregroundColor(Color("textColor"))
} }
} }
.padding() .padding()

View File

@ -93,7 +93,7 @@ struct TestPushView: View {
.font(.system(size: 20)) .font(.system(size: 20))
.frame(width: 104, height: 42) .frame(width: 104, height: 42)
.foregroundColor(Color.white) .foregroundColor(Color.white)
.background(Color.accentColor) .background(Color("BtnBgColor"))
.cornerRadius(8) .cornerRadius(8)
.padding(EdgeInsets(top: 12, leading: 26, bottom: 0, trailing: 24)) .padding(EdgeInsets(top: 12, leading: 26, bottom: 0, trailing: 24))
} }

View File

@ -17,7 +17,7 @@ struct SettingsItemView: View {
HStack{ HStack{
Text(title) Text(title)
.font(.system(size: 18)) .font(.system(size: 18))
.foregroundColor(Color(UIColor.darkGray)) .foregroundColor(Color("textColor"))
.padding(.leading, 16) .padding(.leading, 16)
Spacer(minLength: 0) Spacer(minLength: 0)
Button(button) { Button(button) {
@ -27,7 +27,7 @@ struct SettingsItemView: View {
.font(.system(size: 20)) .font(.system(size: 20))
.frame(width: 80, height: 42) .frame(width: 80, height: 42)
.foregroundColor(Color.white) .foregroundColor(Color.white)
.background(Color.accentColor) .background(Color("BtnBgColor"))
.cornerRadius(8) .cornerRadius(8)
.padding() .padding()
} }

View File

@ -1,11 +0,0 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,6 +0,0 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,4 +1,4 @@
# PushDeer-iOS (开发中) # PushDeer-iOS
PushDeer 是一个开放源码的无 App 推送服务. PushDeer 是一个开放源码的无 App 推送服务.
@ -8,3 +8,40 @@ PushDeer 是一个开放源码的无 App 推送服务.
PushDeer-iOS 最低支持 iOS14, 因为苹果轻应用(App Clips)最低支持 iOS14. PushDeer-iOS 最低支持 iOS14, 因为苹果轻应用(App Clips)最低支持 iOS14.
由于苹果规定轻应用必须随 APP 一起发布, 所以除了扫码打开轻应用即时享用推送服务, 实际上你也可以下载 APP 使用. 由于苹果规定轻应用必须随 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