添加复制历史消息

This commit is contained in:
Fin 2020-05-30 18:38:50 +08:00
parent 21a449a899
commit e9348014e7
10 changed files with 65 additions and 9 deletions

View File

@ -602,10 +602,12 @@
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = 5U8LBRXG3A;
INFOPLIST_FILE = NotificationContentExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = me.fin.bark.NotificationContentExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -619,10 +621,12 @@
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = 5U8LBRXG3A;
INFOPLIST_FILE = NotificationContentExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = me.fin.bark.NotificationContentExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -752,10 +756,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Bark/Bark.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = 5U8LBRXG3A;
INFOPLIST_FILE = Bark/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = me.fin.bark;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
@ -771,10 +777,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Bark/Bark.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = 5U8LBRXG3A;
INFOPLIST_FILE = Bark/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = me.fin.bark;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
@ -789,10 +797,12 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_ENTITLEMENTS = NotificationServiceExtension/NotificationServiceExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = 5U8LBRXG3A;
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 1.0.7;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = me.fin.bark.NotificationServiceExtension;
@ -810,10 +820,12 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_ENTITLEMENTS = NotificationServiceExtension/NotificationServiceExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = 5U8LBRXG3A;
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 1.0.7;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = me.fin.bark.NotificationServiceExtension;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.6</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>

View File

@ -19,6 +19,7 @@ Notice2 = "Customed notification content and title";
Copy = "Copied!";
Copy2 = "Copy";
Cancel = "Cancel";
AllowNotifications = "Notifications have been turned off, Please allow notifications and try again";

View File

@ -19,6 +19,7 @@ Notice2 = "推送标题的字号比推送内容粗一点";
Copy = "复制成功";
Copy2 = "复制";
Cancel = "取消";
AllowNotifications = "绑定设备需要推送。请打开推送后重试";

View File

@ -14,6 +14,7 @@ class MessageListViewController: BaseViewController {
let tableView: UITableView = {
let tableView = UITableView()
tableView.separatorStyle = .none
tableView.backgroundColor = Color.grey.lighten5
tableView.register(MessageTableViewCell.self, forCellReuseIdentifier: "cell")
return tableView
}()
@ -92,4 +93,35 @@ extension MessageListViewController: UITableViewDataSource,UITableViewDelegate {
let configuration = UISwipeActionsConfiguration(actions: [action])
return configuration
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let copyAction = UIAlertAction(title: NSLocalizedString("Copy2"), style: .default, handler: {[weak self]
(alert: UIAlertAction) -> Void in
if let message = self?.results?[indexPath.row] {
var str:String = ""
if let title = message.title {
str += "\(title)\n"
}
if let body = message.body {
str += "\(body)\n"
}
if let url = message.url {
str += "\(url)"
}
str = String(str.prefix(str.count - 1))
UIPasteboard.general.string = str
self?.showSnackbar(text: NSLocalizedString("Copy"))
}
})
let cancelAction = UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: {
(alert: UIAlertAction) -> Void in
})
alertController.addAction(copyAction)
alertController.addAction(cancelAction)
Client.shared.currentNavigationController?.present(alertController, animated: true, completion: nil)
}
}

View File

@ -13,7 +13,7 @@ class ArchiveSettingManager: NSObject {
let defaults = UserDefaults.init(suiteName: "group.bark")
var isArchive: Bool {
get {
return defaults?.bool(forKey: "isArchive") ?? true
return defaults?.value(forKey: "isArchive") as? Bool ?? true
}
set{

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0.6</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>

View File

@ -82,7 +82,7 @@ class MessageTableViewCell: UITableViewCell {
}
urlLabel.snp.makeConstraints { (make) in
make.left.equalTo(bodyLabel)
make.left.right.equalTo(bodyLabel)
make.top.equalTo(bodyLabel.snp.bottom).offset(12)
}
if (message?.url?.count ?? 0) > 0{
@ -133,7 +133,13 @@ class MessageTableViewCell: UITableViewCell {
}
@objc func urlTap(){
if let urlStr = self.message?.url, let url = URL(string: urlStr){ Client.shared.currentNavigationController?.present(BarkSFSafariViewController(url: url), animated: true, completion: nil)
if let urlStr = self.message?.url, let url = URL(string: urlStr){
if ["http","https"].contains(url.scheme?.lowercased() ?? ""){
Client.shared.currentNavigationController?.present(BarkSFSafariViewController(url: url), animated: true, completion: nil)
}
else{
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
}
}

View File

@ -166,6 +166,10 @@ class PreviewCardCell: UITableViewCell {
]))
if let title = model.title {
attrStr.append(NSAttributedString(string: "/\(title)", attributes: [
NSAttributedString.Key.foregroundColor: Color.grey.darken1,
NSAttributedString.Key.font : RobotoFont.regular(with: fontSize)
]))
self.titleLabel.text = title
}
if let body = model.body {

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0.6</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>