From 3f61db008fc0fa134a7c527170c084d8ab4fdd85 Mon Sep 17 00:00:00 2001 From: hext Date: Wed, 2 Mar 2022 13:06:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=87=AA=E5=B7=B1=E7=9A=84?= =?UTF-8?q?=E9=95=BF=E6=8C=89=E6=89=8B=E5=8A=BF=E5=BC=B9=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E8=8F=9C=E5=8D=95,=20=E4=BD=BF=E7=94=A8=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=9A=84=20=E9=92=88=E5=AF=B9=E8=87=AA=E5=BB=BA=20SelfHosted?= =?UTF-8?q?=20=E7=89=88=E5=88=9B=E5=BB=BA=E5=8D=95=E7=8B=AC=E7=9A=84=20Inf?= =?UTF-8?q?o.plist=20=E6=96=87=E4=BB=B6;=20SelfHosted=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=20Schemes=20=E9=85=8D=E7=BD=AE=20=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=B7=BB=E5=8A=A0=E6=9F=A5=E7=9C=8B=E5=AE=98=E7=BD=91?= =?UTF-8?q?=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PushDeer.xcodeproj/project.pbxproj | 22 +++++++----- .../xcshareddata/swiftpm/Package.resolved | 4 +-- ios/PushDeer-iOS/PushDeer/Env.swift | 2 ++ .../PushDeer/Info-SelfHosted.plist | 28 +++++++++++++++ ios/PushDeer-iOS/PushDeer/Info.plist | 10 +++--- .../PushDeer/View/MessageItemView.swift | 34 +++++++++---------- .../PushDeer/View/SettingsView.swift | 15 ++++++++ .../PushDeerClip/Info-SelfHosted.plist | 26 ++++++++++++++ 8 files changed, 108 insertions(+), 33 deletions(-) create mode 100644 ios/PushDeer-iOS/PushDeer/Info-SelfHosted.plist create mode 100644 ios/PushDeer-iOS/PushDeerClip/Info-SelfHosted.plist diff --git a/ios/PushDeer-iOS/PushDeer.xcodeproj/project.pbxproj b/ios/PushDeer-iOS/PushDeer.xcodeproj/project.pbxproj index 193f003..51cf733 100644 --- a/ios/PushDeer-iOS/PushDeer.xcodeproj/project.pbxproj +++ b/ios/PushDeer-iOS/PushDeer.xcodeproj/project.pbxproj @@ -134,6 +134,8 @@ 526A1E6F2791E00400BA2177 /* PushDeerData.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = PushDeerData.xcdatamodel; sourceTree = ""; }; 526A1E722791E03900BA2177 /* Persistence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = ""; }; 526A1E7C2792B2A600BA2177 /* MessageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageModel.swift; sourceTree = ""; }; + 527872C327CE0EE800AD79AD /* Info-SelfHosted.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-SelfHosted.plist"; sourceTree = ""; }; + 527872C527CE105B00AD79AD /* Info-SelfHosted.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-SelfHosted.plist"; sourceTree = ""; }; 5287FF58278B3AAE00249A0E /* HToast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HToast.swift; sourceTree = ""; }; 5292F4F52776BC7900B9A7BB /* PushDeer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PushDeer.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5292F4F82776BC7900B9A7BB /* PushDeerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushDeerApp.swift; sourceTree = ""; }; @@ -260,6 +262,7 @@ isa = PBXGroup; children = ( 52450F442784A95D003652D8 /* Info.plist */, + 527872C327CE0EE800AD79AD /* Info-SelfHosted.plist */, 52E317DA279305BB000B8BB1 /* Localizable.strings */, 52E317D7279305BB000B8BB1 /* InfoPlist.strings */, 52450F362784822C003652D8 /* Service */, @@ -303,6 +306,7 @@ isa = PBXGroup; children = ( 52B8CF6F277E0B46004CB680 /* Info.plist */, + 527872C527CE105B00AD79AD /* Info-SelfHosted.plist */, 52E317DD279305BB000B8BB1 /* InfoPlist.strings */, 52B8CF70277E0B46004CB680 /* PushDeerClip.entitlements */, 5222E12F27B3F73C000B4223 /* PushDeerClip-SelfHosted.entitlements */, @@ -758,8 +762,8 @@ "ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = PushDeer/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = "PushDeer·自架版"; + INFOPLIST_FILE = "PushDeer/Info-SelfHosted.plist"; + INFOPLIST_KEY_CFBundleDisplayName = PushDeer; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity"; INFOPLIST_KEY_NSLocalNetworkUsageDescription = "APP需要访问本地网络以供调试(仅在开发时)"; INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "APP为您提供保存图片到相册的功能"; @@ -802,8 +806,8 @@ "APPCLIP=1", ); GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = PushDeerClip/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = "PushDeer·自架版"; + INFOPLIST_FILE = "PushDeerClip/Info-SelfHosted.plist"; + INFOPLIST_KEY_CFBundleDisplayName = PushDeer; INFOPLIST_KEY_NSLocalNetworkUsageDescription = "APP需要访问本地网络以供调试(仅在开发时)"; INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "APP为您提供保存图片到相册的功能"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; @@ -901,8 +905,8 @@ "ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = PushDeer/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = "PushDeer·自架版"; + INFOPLIST_FILE = "PushDeer/Info-SelfHosted.plist"; + INFOPLIST_KEY_CFBundleDisplayName = PushDeer; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity"; INFOPLIST_KEY_NSLocalNetworkUsageDescription = "APP需要访问本地网络以供调试(仅在开发时)"; INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "APP为您提供保存图片到相册的功能"; @@ -944,8 +948,8 @@ "APPCLIP=1", ); GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = PushDeerClip/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = "PushDeer·自架版"; + INFOPLIST_FILE = "PushDeerClip/Info-SelfHosted.plist"; + INFOPLIST_KEY_CFBundleDisplayName = PushDeer; INFOPLIST_KEY_NSLocalNetworkUsageDescription = "APP需要访问本地网络以供调试(仅在开发时)"; INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "APP为您提供保存图片到相册的功能"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; @@ -1299,7 +1303,7 @@ repositoryURL = "https://github.com/gonzalezreal/MarkdownUI"; requirement = { kind = upToNextMinorVersion; - minimumVersion = 1.0.0; + minimumVersion = 1.1.0; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/ios/PushDeer-iOS/PushDeer.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ios/PushDeer-iOS/PushDeer.xcworkspace/xcshareddata/swiftpm/Package.resolved index d638329..770fc5a 100644 --- a/ios/PushDeer-iOS/PushDeer.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ios/PushDeer-iOS/PushDeer.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -24,8 +24,8 @@ "repositoryURL": "https://github.com/gonzalezreal/MarkdownUI", "state": { "branch": null, - "revision": "94e07c111f1ef0a9c997d2fadac984e8bb7d7405", - "version": "1.0.0" + "revision": "4c164300337a35d002188a83a878346819b203c0", + "version": "1.1.0" } }, { diff --git a/ios/PushDeer-iOS/PushDeer/Env.swift b/ios/PushDeer-iOS/PushDeer/Env.swift index c0bdee5..414a088 100644 --- a/ios/PushDeer-iOS/PushDeer/Env.swift +++ b/ios/PushDeer-iOS/PushDeer/Env.swift @@ -25,5 +25,7 @@ struct Env { static let wxAppid = "wx3ae07931d0555a24" /// 微信开发者Universal Link static let wxUniversalLink = "https://vip.pushdeer.com/app/" + /// PushDeer 官网地址 + static let officialWebsite = "https://www.pushdeer.com" } diff --git a/ios/PushDeer-iOS/PushDeer/Info-SelfHosted.plist b/ios/PushDeer-iOS/PushDeer/Info-SelfHosted.plist new file mode 100644 index 0000000..6a8cee0 --- /dev/null +++ b/ios/PushDeer-iOS/PushDeer/Info-SelfHosted.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDisplayName + PushDeer·自架版 + CFBundleAllowMixedLocalizations + + LSApplicationQueriesSchemes + + weixin + weixinULAPI + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + NSBonjourServices + + _adhp._tcp + + UIBackgroundModes + + remote-notification + + + diff --git a/ios/PushDeer-iOS/PushDeer/Info.plist b/ios/PushDeer-iOS/PushDeer/Info.plist index 1bb74ca..22e6259 100644 --- a/ios/PushDeer-iOS/PushDeer/Info.plist +++ b/ios/PushDeer-iOS/PushDeer/Info.plist @@ -2,11 +2,6 @@ - LSApplicationQueriesSchemes - - weixin - weixinULAPI - CFBundleAllowMixedLocalizations CFBundleURLTypes @@ -22,6 +17,11 @@ + LSApplicationQueriesSchemes + + weixin + weixinULAPI + NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/ios/PushDeer-iOS/PushDeer/View/MessageItemView.swift b/ios/PushDeer-iOS/PushDeer/View/MessageItemView.swift index d5b4759..99ceed9 100644 --- a/ios/PushDeer-iOS/PushDeer/View/MessageItemView.swift +++ b/ios/PushDeer-iOS/PushDeer/View/MessageItemView.swift @@ -96,7 +96,7 @@ struct MessageContentView: View { } } .padding() -#if targetEnvironment(macCatalyst) +//#if targetEnvironment(macCatalyst) .contextMenu { Button { UIPasteboard.general.string = (messageItem.text ?? "") + "\n" + (messageItem.desp ?? "") @@ -105,22 +105,22 @@ struct MessageContentView: View { Label("复制",systemImage: "doc.on.doc") } } -#endif -#if !targetEnvironment(macCatalyst) - .onLongPressGesture { - UIImpactFeedbackGenerator().impactOccurred() - showActionSheet = true - } - .actionSheet(isPresented: $showActionSheet) { - ActionSheet(title: Text("复制消息内容"), message: nil, buttons: [ - .default(Text("复制"), action: { - UIPasteboard.general.string = (messageItem.text ?? "") + "\n" + (messageItem.desp ?? "") - HToast.showSuccess(NSLocalizedString("已复制", comment: "")) - }), - .cancel() - ]) - } -#endif +//#endif +//#if !targetEnvironment(macCatalyst) +// .onLongPressGesture { +// UIImpactFeedbackGenerator().impactOccurred() +// showActionSheet = true +// } +// .actionSheet(isPresented: $showActionSheet) { +// ActionSheet(title: Text("复制消息内容"), message: nil, buttons: [ +// .default(Text("复制"), action: { +// UIPasteboard.general.string = (messageItem.text ?? "") + "\n" + (messageItem.desp ?? "") +// HToast.showSuccess(NSLocalizedString("已复制", comment: "")) +// }), +// .cancel() +// ]) +// } +//#endif } .fullScreenCover(item: $showUrl) { diff --git a/ios/PushDeer-iOS/PushDeer/View/SettingsView.swift b/ios/PushDeer-iOS/PushDeer/View/SettingsView.swift index e6db527..8883f06 100644 --- a/ios/PushDeer-iOS/PushDeer/View/SettingsView.swift +++ b/ios/PushDeer-iOS/PushDeer/View/SettingsView.swift @@ -12,6 +12,7 @@ import AuthenticationServices /// 设置界面 struct SettingsView: View { @EnvironmentObject private var store: AppState + @State private var showUrl: URL? var body: some View { BaseNavigationView(title: "设置") { @@ -46,6 +47,15 @@ struct SettingsView: View { } .padding(EdgeInsets(top: 18, leading: 20, bottom: 0, trailing: 20)) + SettingsItemView(title: NSLocalizedString("PushDeer官网", comment: ""), button: NSLocalizedString("查看", comment: "")) { + if store.isUseBuiltInBrowser { + showUrl = URL(string: Env.officialWebsite) + } else { + UIApplication.shared.open(URL(string: Env.officialWebsite)!, options: [:], completionHandler: nil) + } + } + .padding(EdgeInsets(top: 18, leading: 20, bottom: 0, trailing: 20)) + #if !targetEnvironment(macCatalyst) CardView { HStack{ @@ -74,6 +84,11 @@ struct SettingsView: View { store.userInfo = try await HttpRequest.getUserInfo() } } + .fullScreenCover(item: $showUrl) { + + } content: { url in + SafariView(url: url) + } } func userName() -> String { diff --git a/ios/PushDeer-iOS/PushDeerClip/Info-SelfHosted.plist b/ios/PushDeer-iOS/PushDeerClip/Info-SelfHosted.plist new file mode 100644 index 0000000..e28c23b --- /dev/null +++ b/ios/PushDeer-iOS/PushDeerClip/Info-SelfHosted.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDisplayName + PushDeer·自架版 + CFBundleAllowMixedLocalizations + + NSAppClip + + NSAppClipRequestEphemeralUserNotification + + NSAppClipRequestLocationConfirmation + + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + NSBonjourServices + + _adhp._tcp + + +