diff --git a/Yep/AppDelegate.swift b/Yep/AppDelegate.swift index 36fd3311..48cb0a7f 100644 --- a/Yep/AppDelegate.swift +++ b/Yep/AppDelegate.swift @@ -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() { diff --git a/Yep/ViewControllers/Conversations/ConversationsViewController.swift b/Yep/ViewControllers/Conversations/ConversationsViewController.swift index 370a95e8..24515fee 100644 --- a/Yep/ViewControllers/Conversations/ConversationsViewController.swift +++ b/Yep/ViewControllers/Conversations/ConversationsViewController.swift @@ -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 {