去掉自己的长按手势弹复制菜单, 使用系统的

针对自建 SelfHosted 版创建单独的 Info.plist 文件; SelfHosted 版本去掉 Schemes 配置
设置添加查看官网入口
This commit is contained in:
hext 2022-03-02 13:06:01 +08:00
parent d58f6da266
commit 3f61db008f
8 changed files with 108 additions and 33 deletions

View File

@ -134,6 +134,8 @@
526A1E6F2791E00400BA2177 /* PushDeerData.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = PushDeerData.xcdatamodel; sourceTree = "<group>"; };
526A1E722791E03900BA2177 /* Persistence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = "<group>"; };
526A1E7C2792B2A600BA2177 /* MessageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageModel.swift; sourceTree = "<group>"; };
527872C327CE0EE800AD79AD /* Info-SelfHosted.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-SelfHosted.plist"; sourceTree = "<group>"; };
527872C527CE105B00AD79AD /* Info-SelfHosted.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-SelfHosted.plist"; sourceTree = "<group>"; };
5287FF58278B3AAE00249A0E /* HToast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HToast.swift; sourceTree = "<group>"; };
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 = "<group>"; };
@ -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 */

View File

@ -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"
}
},
{

View File

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

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>PushDeer·自架版</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
<string>weixinULAPI</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSBonjourServices</key>
<array>
<string>_adhp._tcp</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
</dict>
</plist>

View File

@ -2,11 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
<string>weixinULAPI</string>
</array>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleURLTypes</key>
@ -22,6 +17,11 @@
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
<string>weixinULAPI</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>

View File

@ -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) {

View File

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

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>PushDeer·自架版</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>NSAppClip</key>
<dict>
<key>NSAppClipRequestEphemeralUserNotification</key>
<false/>
<key>NSAppClipRequestLocationConfirmation</key>
<false/>
</dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSBonjourServices</key>
<array>
<string>_adhp._tcp</string>
</array>
</dict>
</plist>