do cacheInAdvance with Navi

This commit is contained in:
nixzhu
2015-10-20 18:11:12 +08:00
committed by nixzhu
parent 146f09097c
commit 7a1a8de71d
2 changed files with 24 additions and 0 deletions
+17
View File
@@ -12,6 +12,7 @@ import Crashlytics
import AVFoundation
import RealmSwift
import MonkeyKing
import Navi
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -365,6 +366,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// }
// }
// }
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)) {
guard let realm = try? Realm() else {
return
}
let conversations = realm.objects(Conversation)
conversations.forEach { conversation in
if let latestMessage = conversation.messages.last, user = latestMessage.fromFriend {
let userAvatar = UserAvatar(userID: user.userID, avatarStyle: miniAvatarStyle)
AvatarPod.wakeAvatar(userAvatar, completion: { _ ,_ in })
}
}
}
}
private func customAppearce() {
@@ -8,6 +8,7 @@
import UIKit
import RealmSwift
import Navi
let YepNotificationCommentAction = "YepNotificationCommentAction"
let YepNotificationOKAction = "YepNotificationOKAction"
@@ -146,6 +147,12 @@ class ConversationsViewController: UIViewController {
// })
// }
for user in normalUsers() {
let userAvatar = UserAvatar(userID: user.userID, avatarStyle: nanoAvatarStyle)
AvatarPod.wakeAvatar(userAvatar, completion: { _ ,_ in })
}
// 10 image or thumbnail
guard let realm = try? Realm() else {