Commit b432728b authored by 哈南's avatar 哈南

完成推送的本地设置,完善还需要后台完成

parent 37b83bbe
......@@ -150,6 +150,7 @@
29F6B9042008B5B400EE4630 /* DepartmentResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29F6B9032008B5B300EE4630 /* DepartmentResultModel.swift */; };
29F6B908200C4F1500EE4630 /* BillCompletedRequestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29F6B907200C4F1500EE4630 /* BillCompletedRequestModel.swift */; };
29F6B90A200C54CD00EE4630 /* RepairOrderCompletedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29F6B909200C54CD00EE4630 /* RepairOrderCompletedViewController.swift */; };
8E99375C209056F5000CF486 /* Appdelegate+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E99375B209056F5000CF486 /* Appdelegate+Extension.swift */; };
F04C5934BDBBB8EA12141331 /* Pods_IFS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35B66002AC5D38FD80592FA3 /* Pods_IFS.framework */; };
/* End PBXBuildFile section */
......@@ -310,6 +311,8 @@
29F6B907200C4F1500EE4630 /* BillCompletedRequestModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BillCompletedRequestModel.swift; sourceTree = "<group>"; };
29F6B909200C54CD00EE4630 /* RepairOrderCompletedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepairOrderCompletedViewController.swift; sourceTree = "<group>"; };
35B66002AC5D38FD80592FA3 /* Pods_IFS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_IFS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8E99375A2090550C000CF486 /* IFS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = IFS.entitlements; sourceTree = "<group>"; };
8E99375B209056F5000CF486 /* Appdelegate+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Appdelegate+Extension.swift"; sourceTree = "<group>"; };
A6BACB82FD689EB241DCA577 /* Pods-IFS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IFS.release.xcconfig"; path = "Pods/Target Support Files/Pods-IFS/Pods-IFS.release.xcconfig"; sourceTree = "<group>"; };
F6BA9AE73F42B2E00206B76C /* Pods-IFS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IFS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-IFS/Pods-IFS.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -658,7 +661,9 @@
29EA0B971FEA2F9C005A6170 /* IFS */ = {
isa = PBXGroup;
children = (
8E99375A2090550C000CF486 /* IFS.entitlements */,
29EA0BF71FEA3156005A6170 /* AppDelegate.swift */,
8E99375B209056F5000CF486 /* Appdelegate+Extension.swift */,
29EA0BAB1FEA3156005A6170 /* Main */,
29EA0BD21FEA3156005A6170 /* Expand */,
29EA0BC41FEA3156005A6170 /* Other */,
......@@ -1022,7 +1027,6 @@
29EA0B921FEA2F9C005A6170 /* Frameworks */,
29EA0B931FEA2F9C005A6170 /* Resources */,
5E336BBD8B004CA3BAB4C722 /* [CP] Embed Pods Frameworks */,
B123549AC6242670D51B8EDE /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -1047,6 +1051,11 @@
CreatedOnToolsVersion = 9.1;
LastSwiftMigration = 0910;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.Push = {
enabled = 1;
};
};
};
};
};
......@@ -1155,21 +1164,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-IFS/Pods-IFS-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
B123549AC6242670D51B8EDE /* [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-IFS/Pods-IFS-resources.sh\"\n";
showEnvVarsInLog = 0;
};
CBE320842D54E4A6128E312F /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......@@ -1261,6 +1255,7 @@
294B8642201974930035BF32 /* PermissionsManager.swift in Sources */,
29D5307B1FFF626500851F00 /* FunctionModel.swift in Sources */,
29EA0C141FEA3156005A6170 /* UIViewController+Extension.swift in Sources */,
8E99375C209056F5000CF486 /* Appdelegate+Extension.swift in Sources */,
29CD9DAF2056856000BB7C8D /* ChildBillDetailBorrowViewController.swift in Sources */,
29EA0C0E1FEA3156005A6170 /* Date+Extensions.swift in Sources */,
29A8D9A62011C602001E865C /* RepairAttachmentTableViewCell.swift in Sources */,
......@@ -1439,6 +1434,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = IFS/IFS.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = W54V2VB863;
......@@ -1464,6 +1460,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = IFS/IFS.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = W54V2VB863;
......
......@@ -15,7 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
registerPush(launchOptions: launchOptions)
AppManager.shareInstance.openLoginVc();
return true
}
......@@ -36,12 +36,29 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
UIApplication.shared.applicationIconBadgeNumber = 0
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
//注册 DeviceToken
JPUSHService.registerDeviceToken(deviceToken)
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
//可选
NSLog("did Fail To Register For Remote Notifications With Error: \(error)")
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
JPUSHService.handleRemoteNotification(userInfo)
completionHandler(UIBackgroundFetchResult.newData)
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
JPUSHService.handleRemoteNotification(userInfo)
}
}
//
// Appdelegate+Extension.swift
// IFS
//
// Created by 飞迪1 on 2018/4/25.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import Foundation
extension AppDelegate:JPUSHRegisterDelegate{
@available(iOS 10.0, *)
func jpushNotificationCenter(_ center: UNUserNotificationCenter!, willPresent notification: UNNotification!, withCompletionHandler completionHandler: ((Int) -> Void)!) {
let userInfo = notification.request.content.userInfo
if notification.request.trigger is UNPushNotificationTrigger {
JPUSHService.handleRemoteNotification(userInfo)
}
// 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以选择设置
completionHandler(Int(UNNotificationPresentationOptions.alert.rawValue|UNNotificationPresentationOptions.sound.rawValue|UNNotificationPresentationOptions.badge.rawValue))
}
@available(iOS 10.0, *)
func jpushNotificationCenter(_ center: UNUserNotificationCenter!, didReceive response: UNNotificationResponse!, withCompletionHandler completionHandler: (() -> Void)!) {
let userInfo = response.notification.request.content.userInfo
if response.notification.request.trigger is UNPushNotificationTrigger {
JPUSHService.handleRemoteNotification(userInfo)
}
// 系统要求执行这个方法
completionHandler()
}
func registerPush(launchOptions: [UIApplicationLaunchOptionsKey: Any]?){
let entity = JPUSHRegisterEntity()
entity.types = Int(JPAuthorizationOptions.alert.rawValue|JPAuthorizationOptions.badge.rawValue|JPAuthorizationOptions.sound.rawValue)
JPUSHService.register(forRemoteNotificationConfig: entity, delegate: self)
JPUSHService.setup(withOption: launchOptions, appKey: "6554c0463b6a9ff2262f4d3d", channel: "App Store", apsForProduction: true)
}
}
......@@ -14,12 +14,12 @@ import Foundation
//public let BaseAttachmentUrl: String = "http://192.168.1.176:9030"
//测试环境
//public let BaseUrl: String = "http://222.180.250.18:7080/ifs-server/rest"
//public let BaseAttachmentUrl: String = "http://222.180.250.18:7080"
public let BaseUrl: String = "http://222.180.250.18:7080/ifs-server/rest"
public let BaseAttachmentUrl: String = "http://222.180.250.18:7080"
//外网开发环境
public let BaseUrl: String = "http://dev.gomoretech.com/ifs-server/rest"
public let BaseAttachmentUrl: String = "http://dev.gomoretech.com"
//public let BaseUrl: String = "http://dev.gomoretech.com/ifs-server/rest"
//public let BaseAttachmentUrl: String = "http://dev.gomoretech.com"
/// 登录
public let loginUrl: String = "/user/login/%@"
......
<?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>aps-environment</key>
<string>development</string>
</dict>
</plist>
......@@ -25,6 +25,16 @@ class HomeViewController: BaseViewController {
uiConfigAction()
addChildContentVc()
updateVersion()
updateJPushAlias()
}
/*iResCode, NSString *iAlias, NSInteger seq*/
func updateJPushAlias(){
guard AppManager.shareInstance.userModel != nil else {
return
}
JPUSHService.setAlias(AppManager.shareInstance.userModel!.userUuid, completion: { (iResCode, iAlias, seq) in
}, seq: 20181824)
}
// MARK: - UI
......
......@@ -15,8 +15,6 @@ class TabBarViewController: UITabBarController {
addChildViewControllers()
}
// MARK: - 添加TabBar控制器
fileprivate func addChildViewControllers() {
setTabBarItem(HomeViewController.instantiateViewController(.Home), navTitle: "首页", tabBarTitle: "首页", imageName: "home_icon")
......
......@@ -13,4 +13,10 @@
#import "NSString+Helper.h"
#import <CommonCrypto/CommonCrypto.h>
#import <UMMobClick/MobClick.h>
// 引入JPush功能所需头文件
#import "JPUSHService.h"
// iOS10注册APNs所需头文件
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
#import <UserNotifications/UserNotifications.h>
#endif
......@@ -22,4 +22,5 @@ target ‘IFS’ do
pod 'PPBadgeViewSwift'
pod 'SVProgressHUD', '~> 2.2.2'
pod 'UMengAnalytics'
pod 'JPush'
end
......@@ -7,6 +7,9 @@ PODS:
- Hero (1.0.1)
- ImagePicker (3.0.0)
- IQKeyboardManager (5.0.7)
- JCore (1.1.7)
- JPush (3.0.8):
- JCore (~> 1.1.7)
- Kingfisher (4.6.1)
- MJRefresh (3.1.15.1)
- Moya (10.0.1):
......@@ -35,6 +38,7 @@ DEPENDENCIES:
- Hero
- ImagePicker
- IQKeyboardManager (~> 5.0.6)
- JPush
- Kingfisher
- MJRefresh (~> 3.1.15.1)
- Moya
......@@ -49,6 +53,33 @@ DEPENDENCIES:
- YXAlertController
- YXKit
SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- Alamofire
- DeviceKit
- DZNEmptyDataSet
- FDFullscreenPopGesture
- HandyJSON
- Hero
- ImagePicker
- IQKeyboardManager
- JCore
- JPush
- Kingfisher
- MJRefresh
- Moya
- PPBadgeViewSwift
- Result
- RxCocoa
- RxSwift
- SKPhotoBrowser
- SnapKit
- SVProgressHUD
- SwiftyJSON
- UMengAnalytics
- YXAlertController
- YXKit
SPEC CHECKSUMS:
Alamofire: f41a599bd63041760b26d393ec1069d9d7b917f4
DeviceKit: fa74d97499660e88081718b16688e19217595dba
......@@ -58,6 +89,8 @@ SPEC CHECKSUMS:
Hero: cee286821578e170d8c0c9c9cda7897357401112
ImagePicker: 973953c25960fe04729a7082a56194321c6762d2
IQKeyboardManager: 0bfa4607d39924116b5c0c8b55b5d789288b5cba
JCore: f7459c81c135281a874a6beafdd321666adcc834
JPush: 9574d072cc37e93fa293ba69b43ce763c440943a
Kingfisher: 1f9157d9c02b380cbd0b7cc890161195164eb634
MJRefresh: 5f8552bc25ca8751c010f621c1098dbdaacbccd6
Moya: 9e621707ff754eeb51ff3ec51a3d54e517c0733a
......@@ -73,6 +106,6 @@ SPEC CHECKSUMS:
YXAlertController: 37a54642cb8e8b43b79004fe9148bb8ff2fab814
YXKit: 73d6ffbcf7530f1159e030460207286e9153b080
PODFILE CHECKSUM: dee9f1dd9eac675051bb335b7b1d13637a8eabc1
PODFILE CHECKSUM: f129d1e18957ae13e839f8aa18e676cc404743df
COCOAPODS: 1.3.1
COCOAPODS: 1.5.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment