Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Conflicts:
	Yep/AppDelegate.swift
  • Loading branch information
kevinzhow committed May 5, 2016
2 parents 4d4f7fc + f856344 commit a56298a
Show file tree
Hide file tree
Showing 271 changed files with 4,280 additions and 1,927 deletions.
4 changes: 3 additions & 1 deletion Podfile
Expand Up @@ -3,7 +3,7 @@ platform :ios, '8.0'
use_frameworks! use_frameworks!


def pods def pods
pod 'Kanna' pod 'Kanna', '1.0.2'
pod 'Navi' pod 'Navi'
pod 'Appsee' pod 'Appsee'
pod 'Alamofire' pod 'Alamofire'
Expand All @@ -27,3 +27,5 @@ end
target 'Yep' do target 'Yep' do
pods pods
end end


28 changes: 14 additions & 14 deletions Podfile.lock
@@ -1,24 +1,24 @@
PODS: PODS:
- 1PasswordExtension (1.8) - 1PasswordExtension (1.8.1)
- Alamofire (3.3.1) - Alamofire (3.3.1)
- Appsee (2.2) - Appsee (2.2)
- Base64 (1.1.2) - Base64 (1.1.2)
- DeviceGuru (1.3.7) - DeviceGuru (1.3.7)
- Fabric (1.6.7) - Fabric (1.6.7)
- FXBlurView (1.6.4) - FXBlurView (1.6.4)
- JPush-iOS-SDK (1.8.8) - JPush-iOS-SDK (1.8.8)
- Kanna (1.0.6) - Kanna (1.0.2)
- KeyboardMan (0.6.0) - KeyboardMan (0.6.0)
- Kingfisher (2.2.2) - Kingfisher (2.3.1)
- MonkeyKing (0.0.2) - MonkeyKing (0.0.2)
- Navi (0.4.2) - Navi (0.4.2)
- pop (1.0.9) - pop (1.0.9)
- Proposer (0.8.0) - Proposer (0.8.0)
- Realm (0.98.8): - Realm (0.99.1):
- Realm/Headers (= 0.98.8) - Realm/Headers (= 0.99.1)
- Realm/Headers (0.98.8) - Realm/Headers (0.99.1)
- RealmSwift (0.98.8): - RealmSwift (0.99.1):
- Realm (= 0.98.8) - Realm (= 0.99.1)
- Ruler (0.7.0) - Ruler (0.7.0)
- SocketRocket (0.5.0) - SocketRocket (0.5.0)
- TPKeyboardAvoiding (1.3) - TPKeyboardAvoiding (1.3)
Expand All @@ -32,7 +32,7 @@ DEPENDENCIES:
- Fabric - Fabric
- FXBlurView - FXBlurView
- JPush-iOS-SDK (= 1.8.8) - JPush-iOS-SDK (= 1.8.8)
- Kanna - Kanna (= 1.0.2)
- KeyboardMan - KeyboardMan
- Kingfisher - Kingfisher
- MonkeyKing (= 0.0.2) - MonkeyKing (= 0.0.2)
Expand All @@ -45,23 +45,23 @@ DEPENDENCIES:
- TPKeyboardAvoiding - TPKeyboardAvoiding


SPEC CHECKSUMS: SPEC CHECKSUMS:
1PasswordExtension: 627d5aecf210c7636968faf5a4c3546c9531385b 1PasswordExtension: 00d6f4caae77c19ba33045b8569fbeb9689f0d1d
Alamofire: 369bc67b6f5ac33ded3648d7bd21c5bfb91c2ecc Alamofire: 369bc67b6f5ac33ded3648d7bd21c5bfb91c2ecc
Appsee: c95173e65acaab0ffc8a082c70633c9f5f45d5f0 Appsee: c95173e65acaab0ffc8a082c70633c9f5f45d5f0
Base64: cecfb41a004124895a7bcee567a89bae5a89d49b Base64: cecfb41a004124895a7bcee567a89bae5a89d49b
DeviceGuru: f847629dc0da0145ba48a9fc314e613ca4aa9caf DeviceGuru: f847629dc0da0145ba48a9fc314e613ca4aa9caf
Fabric: caf7580c725e64db144f610ac65cd60956911dc7 Fabric: caf7580c725e64db144f610ac65cd60956911dc7
FXBlurView: db786c2561cb49a09ae98407f52460096ab8a44f FXBlurView: db786c2561cb49a09ae98407f52460096ab8a44f
JPush-iOS-SDK: d4c097d8abbdd0837e24d44b41aacf64a6feddfd JPush-iOS-SDK: d4c097d8abbdd0837e24d44b41aacf64a6feddfd
Kanna: 9f30945bbd293a609f698ea164687ccc0990ff60 Kanna: 059afb193a9f8ea34f46cb55a8b11bf4257efad8
KeyboardMan: 665211f180093f5bb3c6ff7e8b7f858c432c6ccf KeyboardMan: 665211f180093f5bb3c6ff7e8b7f858c432c6ccf
Kingfisher: 7e8de5b0cf7b5dc8ec559d193029a0859df93ef1 Kingfisher: 6d3fbada4829cbc7b89e883e8218c28afeb64e42
MonkeyKing: 9be24307843a80f4cd3eca66adc12c67aefb83bb MonkeyKing: 9be24307843a80f4cd3eca66adc12c67aefb83bb
Navi: f743d94c9879e646ee399b404d0b53100c66a8bd Navi: f743d94c9879e646ee399b404d0b53100c66a8bd
pop: f667631a5108a2e60d9e8797c9b32ddaf2080bce pop: f667631a5108a2e60d9e8797c9b32ddaf2080bce
Proposer: 17cd7fd2509b0d8d7c9e33815d648087c7dcaa81 Proposer: 17cd7fd2509b0d8d7c9e33815d648087c7dcaa81
Realm: 0e293bb62999730599efc3048896bbd4f2e43bcd Realm: 522a0cc8e1f8755ee56d7dc16ca0fc380d045766
RealmSwift: 064262d38113f23ff3508fb20a0a922e696bec01 RealmSwift: 1d9c4299ef5dbf575c5da09fc706ed726327cfa0
Ruler: 51bd16cc00638702ef71713f80073588a6c7e682 Ruler: 51bd16cc00638702ef71713f80073588a6c7e682
SocketRocket: 2c51efccd2d73c99a923407ca4b06e7e9da95dbf SocketRocket: 2c51efccd2d73c99a923407ca4b06e7e9da95dbf
TPKeyboardAvoiding: a5138f318c06fb3e151f886e18ce4a72695d9cbe TPKeyboardAvoiding: a5138f318c06fb3e151f886e18ce4a72695d9cbe
Expand Down
383 changes: 299 additions & 84 deletions Yep.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Yep/Activities/WeChatActivity.swift
Expand Up @@ -9,7 +9,7 @@
import UIKit import UIKit
import MonkeyKing import MonkeyKing


class WeChatActivity: AnyActivity { final class WeChatActivity: AnyActivity {


enum Type { enum Type {


Expand Down
12 changes: 8 additions & 4 deletions Yep/AlbumListController.swift
Expand Up @@ -11,7 +11,7 @@ import Photos


// @note use this model to store the album's 'result, 'count, 'name, 'startDate to avoid request and reserve too much times // @note use this model to store the album's 'result, 'count, 'name, 'startDate to avoid request and reserve too much times


class Album: NSObject { final class Album: NSObject {
var results: PHFetchResult? var results: PHFetchResult?
var count = 0 var count = 0
var name: String? var name: String?
Expand All @@ -21,7 +21,7 @@ class Album: NSObject {


private let defaultAlbumIdentifier = "com.Yep.photoPicker" private let defaultAlbumIdentifier = "com.Yep.photoPicker"


class AlbumListController: UITableViewController { final class AlbumListController: UITableViewController {


var pickedImageSet = Set<PHAsset>() var pickedImageSet = Set<PHAsset>()
var pickedImages = [PHAsset]() var pickedImages = [PHAsset]()
Expand All @@ -32,6 +32,7 @@ class AlbumListController: UITableViewController {
let albumlistCellIdentifier = "AlbumListCell" let albumlistCellIdentifier = "AlbumListCell"


var assetsCollection: [Album]? var assetsCollection: [Album]?



lazy var pickPhotosVC: PickPhotosViewController = { lazy var pickPhotosVC: PickPhotosViewController = {
let vc = UIStoryboard(name: "PickPhotos", bundle: nil).instantiateViewControllerWithIdentifier("PickPhotosViewController") as! PickPhotosViewController let vc = UIStoryboard(name: "PickPhotos", bundle: nil).instantiateViewControllerWithIdentifier("PickPhotosViewController") as! PickPhotosViewController
Expand Down Expand Up @@ -124,9 +125,11 @@ class AlbumListController: UITableViewController {


for (_, result) in results.enumerate() { for (_, result) in results.enumerate() {
result.enumerateObjectsUsingBlock { (collection, idx, stop) in result.enumerateObjectsUsingBlock { (collection, idx, stop) in
if let album = collection as? PHAssetCollection { if let album = collection as? PHAssetCollection{
let assetResults = PHAsset.fetchAssetsInAssetCollection(album, options: options) guard album.localizedTitle != NSLocalizedString("Recently Deleted", comment: "") else { return }


let assetResults = PHAsset.fetchAssetsInAssetCollection(album, options: options)

var count = 0 var count = 0
switch album.assetCollectionType { switch album.assetCollectionType {
case .Album: case .Album:
Expand All @@ -152,6 +155,7 @@ class AlbumListController: UITableViewController {
} }


} }

return list return list
} }


Expand Down
75 changes: 59 additions & 16 deletions Yep/AppDelegate.swift
Expand Up @@ -16,7 +16,7 @@ import Appsee
import CoreSpotlight import CoreSpotlight


@UIApplicationMain @UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate { final class AppDelegate: UIResponder, UIApplicationDelegate {


var window: UIWindow? var window: UIWindow?


Expand All @@ -40,10 +40,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// 默认将 Realm 放在 App Group 里 // 默认将 Realm 放在 App Group 里


let directory: NSURL = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier(YepConfig.appGroupID)! let directory: NSURL = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier(YepConfig.appGroupID)!
let realmPath = directory.URLByAppendingPathComponent("db.realm").path! let realmFileURL = directory.URLByAppendingPathComponent("db.realm")


return Realm.Configuration(path: realmPath, schemaVersion: 31, migrationBlock: { migration, oldSchemaVersion in var config = Realm.Configuration()
}) config.fileURL = realmFileURL
config.schemaVersion = 31
config.migrationBlock = { migration, oldSchemaVersion in
}

return config
} }


enum RemoteNotificationType: String { enum RemoteNotificationType: String {
Expand Down Expand Up @@ -83,6 +88,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
//Fabric.with([Crashlytics.self]) //Fabric.with([Crashlytics.self])
Fabric.with([Appsee.self]) Fabric.with([Appsee.self])


#if JPUSH
/* /*
#if STAGING #if STAGING
let apsForProduction = false let apsForProduction = false
Expand All @@ -92,15 +98,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
JPUSHService.setupWithOption(launchOptions, appKey: "e521aa97cd4cd4eba5b73669", channel: "AppStore", apsForProduction: apsForProduction) JPUSHService.setupWithOption(launchOptions, appKey: "e521aa97cd4cd4eba5b73669", channel: "AppStore", apsForProduction: apsForProduction)
*/ */
APService.setupWithOption(launchOptions) APService.setupWithOption(launchOptions)
#endif
} }


let _ = try? AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.DefaultToSpeaker) let _ = try? AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: AVAudioSessionCategoryOptions.DefaultToSpeaker)


application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum) application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)


// 全局的外观自定义 // 全局的外观自定义
customAppearance() customAppearce()

let isLogined = YepUserDefaults.isLogined let isLogined = YepUserDefaults.isLogined


if isLogined { if isLogined {
Expand All @@ -116,7 +123,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
} else { } else {
startShowStory() startShowStory()
} }

return true return true
} }


Expand Down Expand Up @@ -151,6 +158,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {


UIApplication.sharedApplication().applicationIconBadgeNumber = 0 UIApplication.sharedApplication().applicationIconBadgeNumber = 0


// dynamic shortcut items

configureDynamicShortcuts()

// index searchable items

if YepUserDefaults.isLogined { if YepUserDefaults.isLogined {
indexUserSearchableItems() indexUserSearchableItems()
indexFeedSearchableItems() indexFeedSearchableItems()
Expand Down Expand Up @@ -238,8 +251,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) { func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {


println("didReceiveRemoteNotification: \(userInfo)") println("didReceiveRemoteNotification: \(userInfo)")

#if JPUSH
//JPUSHService.handleRemoteNotification(userInfo) //JPUSHService.handleRemoteNotification(userInfo)
APService.handleRemoteNotification(userInfo) APService.handleRemoteNotification(userInfo)
#endif


guard YepUserDefaults.isLogined, let type = userInfo["type"] as? String, remoteNotificationType = RemoteNotificationType(rawValue: type) else { guard YepUserDefaults.isLogined, let type = userInfo["type"] as? String, remoteNotificationType = RemoteNotificationType(rawValue: type) else {
completionHandler(UIBackgroundFetchResult.NoData) completionHandler(UIBackgroundFetchResult.NoData)
Expand All @@ -260,9 +276,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
syncUnreadMessages() { syncUnreadMessages() {
dispatch_async(dispatch_get_main_queue()) { dispatch_async(dispatch_get_main_queue()) {
NSNotificationCenter.defaultCenter().postNotificationName(YepConfig.Notification.changedFeedConversation, object: nil) NSNotificationCenter.defaultCenter().postNotificationName(YepConfig.Notification.changedFeedConversation, object: nil)
}


completionHandler(UIBackgroundFetchResult.NewData) configureDynamicShortcuts()

completionHandler(UIBackgroundFetchResult.NewData)
}
} }


case .OfficialMessage: case .OfficialMessage:
Expand Down Expand Up @@ -301,14 +319,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {


handleMessageDeletedFromServer(messageID: messageID) handleMessageDeletedFromServer(messageID: messageID)


configureDynamicShortcuts()

case .Mentioned: case .Mentioned:


syncUnreadMessagesAndDoFurtherAction({ _ in syncUnreadMessagesAndDoFurtherAction({ _ in
dispatch_async(dispatch_get_main_queue()) { dispatch_async(dispatch_get_main_queue()) {
NSNotificationCenter.defaultCenter().postNotificationName(YepConfig.Notification.changedFeedConversation, object: nil) NSNotificationCenter.defaultCenter().postNotificationName(YepConfig.Notification.changedFeedConversation, object: nil)
}


completionHandler(UIBackgroundFetchResult.NewData) configureDynamicShortcuts()

completionHandler(UIBackgroundFetchResult.NewData)
}
}) })
} }
} }
Expand All @@ -318,11 +340,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
println(error.description) println(error.description)
} }


// MARK: Shortcuts

func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: (Bool) -> Void) {

handleShortcutItem(shortcutItem)

completionHandler(true)
}

private func handleShortcutItem(shortcutItem: UIApplicationShortcutItem) {

if let window = window {
tryQuickActionWithShortcutItem(shortcutItem, inWindow: window)
}
}

// MARK: Open URL // MARK: Open URL


func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {



if url.absoluteString.contains("/auth/success") { if url.absoluteString.contains("/auth/success") {


NSNotificationCenter.defaultCenter().postNotificationName(YepConfig.Notification.OAuthResult, object: NSNumber(int: 1)) NSNotificationCenter.defaultCenter().postNotificationName(YepConfig.Notification.OAuthResult, object: NSNumber(int: 1))
Expand Down Expand Up @@ -537,7 +574,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
} }


refreshGroupTypeForAllGroups() refreshGroupTypeForAllGroups()


if !YepUserDefaults.isSyncedConversations {
syncMyConversations()
}

syncUnreadMessages { syncUnreadMessages {
syncFriendshipsAndDoFurtherAction { syncFriendshipsAndDoFurtherAction {
syncGroupsAndDoFurtherAction { syncGroupsAndDoFurtherAction {
Expand All @@ -564,10 +605,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {


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


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


func tagsAliasCallback(iResCode: Int, tags: NSSet, alias: NSString) { func tagsAliasCallback(iResCode: Int, tags: NSSet, alias: NSString) {
Expand Down Expand Up @@ -689,7 +732,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
} }
} }


private func customAppearance() { private func customAppearce() {


window?.backgroundColor = UIColor.whiteColor() window?.backgroundColor = UIColor.whiteColor()


Expand All @@ -712,14 +755,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return shadow return shadow
}() }()


let textAttributes = [ let textAttributes: [String: AnyObject] = [
NSForegroundColorAttributeName: UIColor.yepNavgationBarTitleColor(), NSForegroundColorAttributeName: UIColor.yepNavgationBarTitleColor(),
NSShadowAttributeName: shadow, NSShadowAttributeName: shadow,
NSFontAttributeName: UIFont.navigationBarTitleFont() NSFontAttributeName: UIFont.navigationBarTitleFont()
] ]


/* /*
let barButtonTextAttributes = [ let barButtonTextAttributes: [String: AnyObject] = [
NSForegroundColorAttributeName: UIColor.yepTintColor(), NSForegroundColorAttributeName: UIColor.yepTintColor(),
NSFontAttributeName: UIFont.barButtonFont() NSFontAttributeName: UIFont.barButtonFont()
] ]
Expand Down

0 comments on commit a56298a

Please sign in to comment.