添加 自动复制推送内容 的示例

This commit is contained in:
Fin 2018-12-17 18:18:56 +08:00
parent 4ae5086ef0
commit 0ad860c979
6 changed files with 34 additions and 23 deletions

View File

@ -279,7 +279,6 @@
0661A53C204FDA4100965E4E /* Frameworks */,
0661A53D204FDA4100965E4E /* Resources */,
CFBB713B64655C7E71F4587A /* [CP] Embed Pods Frameworks */,
BDEDA44DC34CE9C81E76AECC /* [CP] Copy Pods Resources */,
0632CE2E20EC9098003FDF46 /* Embed App Extensions */,
);
buildRules = (
@ -409,21 +408,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
BDEDA44DC34CE9C81E76AECC /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Bark/Pods-Bark-resources.sh\"\n";
showEnvVarsInLog = 0;
};
CFBB713B64655C7E71F4587A /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;

View File

@ -43,3 +43,6 @@ InvalidURL = "Invalid URL!";
urlParameter = "Clicking on the notification will jump \nto this URL in the parameter";
copyParameter = "If the URL has a copy parameter then the value of the copy \nparameter will be copied";
automaticallyCopyTitle = "Automatically copy push content";
automaticallyCopy = "Automatically copy push content \nwhen a push is received";

View File

@ -43,3 +43,6 @@ InvalidURL = "输入的URL好像不对劲!";
urlParameter = "携带url参数时点击推送会跳转到这个URL";
copyParameter = "下拉推送、锁屏界面左滑查看推送时,可以选择复制推送内容\n携带copy参数时将只复制copy参数的值";
automaticallyCopyTitle = "自动复制推送内容";
automaticallyCopy = "收到推送时,自动复制推送内容。\n携带copy参数时将只复制copy参数的值";

View File

@ -48,7 +48,12 @@ class HomeViewController: BaseViewController {
notice: NSLocalizedString("copyParameter"),
queryParameter: "copy=test",
image: UIImage(named: "copyTest")
)
),
PreviewModel(
body: NSLocalizedString("automaticallyCopyTitle"),
notice: NSLocalizedString("automaticallyCopy"),
queryParameter: "automaticallyCopy=1&copy=optional"
)
]
}()
@ -113,15 +118,15 @@ class HomeViewController: BaseViewController {
let rowheight:[CGFloat] = {
let screenWidth = UIScreen.main.bounds.width
if screenWidth <= 320 {
return [170,170,170,320]
return [170,170,170,320,170]
}
if screenWidth <= 375 {
return [205,205,205,380]
return [205,205,205,380,205]
}
if screenWidth <= 414 {
return [195,195,195,390]
return [195,195,195,390,195]
}
return [205,205,205,380]
return [205,205,205,380,205]
}()
}

View File

@ -20,7 +20,7 @@ class NotificationService: UNNotificationServiceExtension {
if let bestAttemptContent = bestAttemptContent {
let userInfo = bestAttemptContent.userInfo
if userInfo["AutomaticallyCopy"] as? Bool == true{
if userInfo["automaticallyCopy"] as? Bool == true{
if let copy = userInfo["copy"] as? String {
UIPasteboard.general.string = copy
}

View File

@ -36,6 +36,22 @@ DEPENDENCIES:
- SVProgressHUD
- SwiftyJSON
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Alamofire
- DeviceKit
- FDFullscreenPopGesture
- KVOController
- Material
- Motion
- Moya
- ObjectMapper
- Result
- RxSwift
- SnapKit
- SVProgressHUD
- SwiftyJSON
EXTERNAL SOURCES:
DefaultsKit:
:git: https://github.com/nmdias/DefaultsKit
@ -63,4 +79,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 9fe640283f4a4f35eff4a390df2c42a64be57c18
COCOAPODS: 1.4.0
COCOAPODS: 1.5.3