Skip to content

Commit

Permalink
fallback JPush 1.8.9
Browse files Browse the repository at this point in the history
  • Loading branch information
nixzhu committed Feb 3, 2016
1 parent 09fb3c1 commit 172b2b1
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def pods
pod 'SocketRocket'
pod 'RealmSwift'
pod 'MonkeyKing', '0.0.2'
pod 'JPush'
pod 'JPush-iOS-SDK', '1.8.8'
pod 'Fabric'
pod 'Crashlytics'
end
Expand Down
6 changes: 3 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PODS:
- DeviceGuru (1.3.3)
- Fabric (1.6.4)
- FXBlurView (1.6.4)
- JPush (2.1.0)
- JPush-iOS-SDK (1.8.8)
- Kanna (1.0.4)
- KeyboardMan (0.5.2)
- Kingfisher (2.0.1)
Expand All @@ -38,7 +38,7 @@ DEPENDENCIES:
- DeviceGuru
- Fabric
- FXBlurView
- JPush
- JPush-iOS-SDK (= 1.8.8)
- Kanna
- KeyboardMan
- Kingfisher
Expand All @@ -61,7 +61,7 @@ SPEC CHECKSUMS:
DeviceGuru: 49c6178d77693f8459ace21cecaf4d1d26297d08
Fabric: ed41fd62173c6bdea24ab02c9d7707161eabb750
FXBlurView: db786c2561cb49a09ae98407f52460096ab8a44f
JPush: 92cb879829f0d81ab17b2c9ad009fdb88c6cf6e5
JPush-iOS-SDK: d4c097d8abbdd0837e24d44b41aacf64a6feddfd
Kanna: 537762df5e2203714769f8351340b3c724adb2bd
KeyboardMan: b081c254c5c0adc794a49b4e97a86cb4ac917a66
Kingfisher: 3af2020040453f710507819e6aa5f5721da03d9b
Expand Down
14 changes: 12 additions & 2 deletions Yep.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
50B2CA941BD0EF7900668AC6 /* MoreMessageTypesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50B2CA931BD0EF7900668AC6 /* MoreMessageTypesView.swift */; };
50B38FB71B69CD960064C132 /* Array+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50B38FB61B69CD960064C132 /* Array+Yep.swift */; };
50B38FCC1B6B37F00064C132 /* FeedbackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50B38FCB1B6B37F00064C132 /* FeedbackViewController.swift */; };
50B6D9F21C61C26100D431E0 /* PushConfig.plist in Resources */ = {isa = PBXBuildFile; fileRef = 50B6D9F11C61C26100D431E0 /* PushConfig.plist */; };
50B8E6161B40F9E700C17EA1 /* YepDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50B8E6151B40F9E700C17EA1 /* YepDownloader.swift */; };
50B8E6181B41340A00C17EA1 /* MessageLoadingProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50B8E6171B41340A00C17EA1 /* MessageLoadingProgressView.swift */; };
50C0909B1ADE234F00CC6389 /* RegisterPickSkillsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50C0909A1ADE234F00CC6389 /* RegisterPickSkillsViewController.swift */; };
Expand Down Expand Up @@ -619,6 +620,7 @@
50B2CA931BD0EF7900668AC6 /* MoreMessageTypesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MoreMessageTypesView.swift; path = Views/MoreMessageTypes/MoreMessageTypesView.swift; sourceTree = "<group>"; };
50B38FB61B69CD960064C132 /* Array+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Array+Yep.swift"; path = "Extensions/Array+Yep.swift"; sourceTree = "<group>"; };
50B38FCB1B6B37F00064C132 /* FeedbackViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FeedbackViewController.swift; path = ViewControllers/Feedback/FeedbackViewController.swift; sourceTree = "<group>"; };
50B6D9F11C61C26100D431E0 /* PushConfig.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = PushConfig.plist; sourceTree = "<group>"; };
50B8E6151B40F9E700C17EA1 /* YepDownloader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YepDownloader.swift; path = Services/YepDownloader.swift; sourceTree = "<group>"; };
50B8E6171B41340A00C17EA1 /* MessageLoadingProgressView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MessageLoadingProgressView.swift; path = Views/ProgressViews/MessageLoadingProgressView.swift; sourceTree = "<group>"; };
50C0909A1ADE234F00CC6389 /* RegisterPickSkillsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RegisterPickSkillsViewController.swift; path = ViewControllers/Register/RegisterPickSkillsViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -868,6 +870,7 @@
isa = PBXGroup;
children = (
0A8F54AF1AB67D11004AD60E /* Info.plist */,
50B6D9F01C61C26100D431E0 /* JPush */,
);
name = "Supporting Files";
sourceTree = "<group>";
Expand Down Expand Up @@ -2031,6 +2034,14 @@
name = Feedback;
sourceTree = "<group>";
};
50B6D9F01C61C26100D431E0 /* JPush */ = {
isa = PBXGroup;
children = (
50B6D9F11C61C26100D431E0 /* PushConfig.plist */,
);
path = JPush;
sourceTree = "<group>";
};
50B8E6191B41341000C17EA1 /* ProgressViews */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2552,6 +2563,7 @@
5012FDDB1BFABDE400294145 /* ProfileFeedsCell.xib in Resources */,
50F5AF9A1BBBD02A0033C9BC /* FeedMediaCell.xib in Resources */,
50A640EA1B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib in Resources */,
50B6D9F21C61C26100D431E0 /* PushConfig.plist in Resources */,
502B60651BD1208E00D9C17E /* CameraCell.xib in Resources */,
0A8F54BB1AB67D11004AD60E /* LaunchScreen.xib in Resources */,
5053AD511AF82A1700B3CBFA /* PickLocationCell.xib in Resources */,
Expand Down Expand Up @@ -3089,7 +3101,6 @@
"$(inherited)",
"-ObjC",
"-l\"c++\"",
"-l\"jpush-ios-2.1.0\"",
"-l\"z\"",
"-framework",
"\"APAddressBook\"",
Expand Down Expand Up @@ -3186,7 +3197,6 @@
"$(inherited)",
"-ObjC",
"-l\"c++\"",
"-l\"jpush-ios-2.1.0\"",
"-l\"z\"",
"-framework",
"\"APAddressBook\"",
Expand Down
14 changes: 10 additions & 4 deletions Yep/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
cacheInAdvance()

delay(0.5) {
// Fabric.with([Crashlytics.self])
//Fabric.with([Crashlytics.self])
Fabric.with([Crashlytics.self, Appsee.self])

/*
#if STAGING
let apsForProduction = false
#else
let apsForProduction = true
#endif
JPUSHService.setupWithOption(launchOptions, appKey: "e521aa97cd4cd4eba5b73669", channel: "AppStore", apsForProduction: apsForProduction)
*/
APService.setupWithOption(launchOptions)
}

let _ = try? AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.DefaultToSpeaker)
Expand Down Expand Up @@ -230,7 +233,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {

println("didReceiveRemoteNotification: \(userInfo)")
JPUSHService.handleRemoteNotification(userInfo)
//JPUSHService.handleRemoteNotification(userInfo)
APService.handleRemoteNotification(userInfo)

if YepUserDefaults.isLogined {

Expand Down Expand Up @@ -453,8 +457,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func registerThirdPartyPushWithDeciveToken(deviceToken: NSData, pusherID: String) {

JPUSHService.registerDeviceToken(deviceToken)
JPUSHService.setTags(Set(["iOS"]), alias: pusherID, callbackSelector:nil, object: nil)
//JPUSHService.registerDeviceToken(deviceToken)
//JPUSHService.setTags(Set(["iOS"]), alias: pusherID, callbackSelector:nil, object: nil)
APService.registerDeviceToken(deviceToken)
APService.setTags(Set(["iOS"]), alias: pusherID, callbackSelector:nil, object: nil)
}

func tagsAliasCallback(iResCode: Int, tags: NSSet, alias: NSString) {
Expand Down
3 changes: 2 additions & 1 deletion Yep/Configs/YepHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ func cancel(cancelableTask: CancelableTask?) {

func unregisterThirdPartyPush() {
dispatch_async(dispatch_get_main_queue()) {
JPUSHService.setAlias(nil, callbackSelector: nil, object: nil)
//JPUSHService.setAlias(nil, callbackSelector: nil, object: nil)
APService.setAlias(nil, callbackSelector: nil, object: nil)
UIApplication.sharedApplication().applicationIconBadgeNumber = 0
}
}
Expand Down
12 changes: 12 additions & 0 deletions Yep/JPush/PushConfig.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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_FOR_PRODUCTION</key>
<string>0</string>
<key>CHANNEL</key>
<string>AppStore</string>
<key>APP_KEY</key>
<string>e521aa97cd4cd4eba5b73669</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,16 @@ class ConversationsViewController: SegueViewController {
category.identifier = "YepMessageNotification"
category.setActions([replyAction, replyOKAction], forContext: UIUserNotificationActionContext.Minimal)

JPUSHService.registerForRemoteNotificationTypes(
//JPUSHService.registerForRemoteNotificationTypes(
APService.registerForRemoteNotificationTypes(
UIUserNotificationType.Badge.rawValue |
UIUserNotificationType.Sound.rawValue |
UIUserNotificationType.Alert.rawValue, categories: [category])

} else {
// 这里才开始向用户提示推送
JPUSHService.registerForRemoteNotificationTypes(
//JPUSHService.registerForRemoteNotificationTypes(
APService.registerForRemoteNotificationTypes(
UIUserNotificationType.Badge.rawValue |
UIUserNotificationType.Sound.rawValue |
UIUserNotificationType.Alert.rawValue, categories: nil)
Expand Down
3 changes: 2 additions & 1 deletion Yep/Yep-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
//

#import <UIKit/UIKit.h>
#import "JPUSHService.h"
#import "APService.h"
//#import "JPUSHService.h"
#import "MZFayeClient.h"

0 comments on commit 172b2b1

Please sign in to comment.