diff --git a/Podfile.lock b/Podfile.lock index 366f4f3d..63c83053 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -17,7 +17,7 @@ PODS: - MZFayeClient (1.0.1): - Base64 (~> 1.0.1) - SocketRocket (~> 0.4) - - Navi (0.3.8) + - Navi (0.3.9) - pop (1.0.8) - Proposer (0.7.1) - Realm (0.96.2): @@ -67,7 +67,7 @@ SPEC CHECKSUMS: Kingfisher: b39315e9dbed7e8ffe73a9ca1be2ee006d1d57e4 MonkeyKing: 9be24307843a80f4cd3eca66adc12c67aefb83bb MZFayeClient: 65e7ef67e61fbe7a7a8b196130541c9f06bcb5d8 - Navi: fd0be0452eacbaa3c0b2a8c815dbc9c08e059ce9 + Navi: 24f5c81aeb46b89d27168ec1d459581230ae2675 pop: bb773ae2c791ca2629de13b347e7a8b450fa6a57 Proposer: e9759ad71a6702fd94315a0bff1f8c116edf6f07 Realm: 3ce8448151c571e90b85002d984d7f93f54fc8a3 diff --git a/Yep/AppDelegate.swift b/Yep/AppDelegate.swift index d4468f7c..46b2a537 100644 --- a/Yep/AppDelegate.swift +++ b/Yep/AppDelegate.swift @@ -477,7 +477,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { 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 }) + AvatarPod.wakeAvatar(userAvatar, completion: { _ , _, _ in }) } } } diff --git a/Yep/Caches/ImageCache.swift b/Yep/Caches/ImageCache.swift index 92b26aab..3cb03bf2 100644 --- a/Yep/Caches/ImageCache.swift +++ b/Yep/Caches/ImageCache.swift @@ -37,9 +37,9 @@ class ImageCache { cacheSize = deviceSize } - let attachmentOriginKey = "attachment-\(attachmentURL.absoluteString)" + let attachmentOriginKey = "attachment-0.0-0.0-\(attachmentURL.absoluteString)" - let attachmentSizeKey = "attachment-\(cacheSize)-\(attachmentURL.absoluteString)" + let attachmentSizeKey = "attachment-\(cacheSize.width)-\(cacheSize.height)-\(attachmentURL.absoluteString)" let OptionsInfos: KingfisherManager.Options = (forceRefresh: false, lowPriority: false, cacheMemoryOnly: false, shouldDecode: false, queue: cacheAttachmentQueue, scale: UIScreen.mainScreen().scale) //查找当前 Size 的 Cache @@ -71,8 +71,6 @@ class ImageCache { }) } - Kingfisher.ImageCache.defaultCache.storeImage(finalImage, forKey: attachmentSizeKey) - dispatch_async(dispatch_get_main_queue()) { completion(url: attachmentURL, image: finalImage) } @@ -94,7 +92,7 @@ class ImageCache { if cacheSize != CGSizeZero { storeImage = storeImage.resizeToTargetSize(cacheSize) } - + Kingfisher.ImageCache.defaultCache.storeImage(storeImage, originalData: UIImageJPEGRepresentation(storeImage, 1.0), forKey: attachmentSizeKey, toDisk: true, completionHandler: nil) let finalImage = storeImage.decodedImage() diff --git a/Yep/Configs/YepConfig.swift b/Yep/Configs/YepConfig.swift index e5bb128c..a0dbb6d9 100644 --- a/Yep/Configs/YepConfig.swift +++ b/Yep/Configs/YepConfig.swift @@ -12,8 +12,8 @@ import CoreLocation import Kingfisher let avatarFadeTransitionDuration: NSTimeInterval = 0.0 -let bigAvatarFadeTransitionDuration: NSTimeInterval = 0.2 -let imageFadeTransitionDuration: NSTimeInterval = 0.3 +let bigAvatarFadeTransitionDuration: NSTimeInterval = 0.15 +let imageFadeTransitionDuration: NSTimeInterval = 0.2 let MediaOptionsInfos: KingfisherOptionsInfo = [ .Options([.BackgroundDecode, .LowPriority]), @@ -180,7 +180,7 @@ class YepConfig { static let minTextWidth: CGFloat = 17 - static let gapBetweenDotImageViewAndBubble: CGFloat = 5 + static let gapBetweenDotImageViewAndBubble: CGFloat = 13 static let gapBetweenAvatarImageViewAndBubble: CGFloat = 5 diff --git a/Yep/Images.xcassets/icon_dot_failed.imageset/icon_dot_failed.pdf b/Yep/Images.xcassets/icon_dot_failed.imageset/icon_dot_failed.pdf index 36f5a5b9..7e4e01ab 100644 Binary files a/Yep/Images.xcassets/icon_dot_failed.imageset/icon_dot_failed.pdf and b/Yep/Images.xcassets/icon_dot_failed.imageset/icon_dot_failed.pdf differ diff --git a/Yep/Images.xcassets/icon_dot_sending.imageset/icon_dot_sending.pdf b/Yep/Images.xcassets/icon_dot_sending.imageset/icon_dot_sending.pdf index d5fadbd8..e2030dec 100644 Binary files a/Yep/Images.xcassets/icon_dot_sending.imageset/icon_dot_sending.pdf and b/Yep/Images.xcassets/icon_dot_sending.imageset/icon_dot_sending.pdf differ diff --git a/Yep/Images.xcassets/icon_dot_unread.imageset/icon_dot_unread.pdf b/Yep/Images.xcassets/icon_dot_unread.imageset/icon_dot_unread.pdf index 7ec03727..ed35046c 100644 Binary files a/Yep/Images.xcassets/icon_dot_unread.imageset/icon_dot_unread.pdf and b/Yep/Images.xcassets/icon_dot_unread.imageset/icon_dot_unread.pdf differ diff --git a/Yep/ViewControllers/Conversations/ConversationsViewController.swift b/Yep/ViewControllers/Conversations/ConversationsViewController.swift index ab090c27..fffbfefa 100644 --- a/Yep/ViewControllers/Conversations/ConversationsViewController.swift +++ b/Yep/ViewControllers/Conversations/ConversationsViewController.swift @@ -149,7 +149,7 @@ class ConversationsViewController: UIViewController { for user in normalUsers() { let userAvatar = UserAvatar(userID: user.userID, avatarStyle: nanoAvatarStyle) - AvatarPod.wakeAvatar(userAvatar, completion: { _, _ in }) + AvatarPod.wakeAvatar(userAvatar, completion: { _, _, _ in }) } /* diff --git a/Yep/ViewControllers/MediaPreview/MediaPreviewViewController.swift b/Yep/ViewControllers/MediaPreview/MediaPreviewViewController.swift index b2c649cf..75f4b928 100644 --- a/Yep/ViewControllers/MediaPreview/MediaPreviewViewController.swift +++ b/Yep/ViewControllers/MediaPreview/MediaPreviewViewController.swift @@ -10,6 +10,7 @@ import UIKit import AVFoundation import MonkeyKing import Kingfisher +import Ruler let mediaPreviewWindow = UIWindow(frame: UIScreen.mainScreen().bounds) @@ -140,19 +141,24 @@ class MediaPreviewViewController: UIViewController { }, completion: { [weak self] _ in self?.mediasCollectionView.alpha = 1 + let fade: (() -> Void)? = { [weak self] in + self?.topPreviewImageView.alpha = 0 + self?.bottomPreviewImageView.alpha = 0 + } + UIView.animateWithDuration(0.25, delay: 0.0, options: .CurveLinear, animations: { [weak self] in self?.mediaControlView.alpha = 1 - }, completion: nil) + }, completion: { _ in + Ruler.iPhoneHorizontal(fade, nil, nil).value?() + }) - // 原图需要更快的显示出来,避免停留在 thumbnial 太久 - - UIView.animateWithDuration(0.1, delay: 0.0, options: .CurveLinear, animations: { [weak self] in - self?.topPreviewImageView.alpha = 0 - self?.bottomPreviewImageView.alpha = 0 + UIView.animateWithDuration(0.1, delay: 0.1, options: .CurveLinear, animations: { + Ruler.iPhoneHorizontal(nil, fade, fade).value?() + }, completion: { [weak self] _ in - self?.showFinished = true - println("showFinished") + self?.showFinished = true + println("showFinished") }) }) diff --git a/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.xib b/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.xib index 7cdf7ee8..e3c5161f 100644 --- a/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.xib +++ b/Yep/Views/Cells/ChatRightAudio/ChatRightAudioCell.xib @@ -1,8 +1,8 @@ - + - + @@ -54,7 +54,7 @@ - + @@ -77,7 +77,7 @@ - + diff --git a/Yep/Views/Cells/ChatRightBase/ChatRightBaseCell.swift b/Yep/Views/Cells/ChatRightBase/ChatRightBaseCell.swift index 07588ff6..91c3c3b1 100644 --- a/Yep/Views/Cells/ChatRightBase/ChatRightBaseCell.swift +++ b/Yep/Views/Cells/ChatRightBase/ChatRightBaseCell.swift @@ -28,10 +28,11 @@ class ChatRightBaseCell: ChatBaseCell { dotImageView.image = UIImage(named: "icon_dot_sending") dotImageView.hidden = false - delay(0.1, work: { [weak self] in - self?.showSendingAnimation() - }) - + delay(0.1) { [weak self] in + if let messageSendState = self?.messageSendState where messageSendState == .NotSend { + self?.showSendingAnimation() + } + } case MessageSendState.Successed: dotImageView.image = UIImage(named: "icon_dot_unread") diff --git a/Yep/Views/Cells/ChatRightImage/ChatRightImageCell.xib b/Yep/Views/Cells/ChatRightImage/ChatRightImageCell.xib index 5549996a..056b5f07 100644 --- a/Yep/Views/Cells/ChatRightImage/ChatRightImageCell.xib +++ b/Yep/Views/Cells/ChatRightImage/ChatRightImageCell.xib @@ -1,8 +1,8 @@ - + - + @@ -22,7 +22,7 @@ - + @@ -38,6 +38,6 @@ - + diff --git a/Yep/Views/Cells/ChatRightLocation/ChatRightLocationCell.xib b/Yep/Views/Cells/ChatRightLocation/ChatRightLocationCell.xib index b9e2f7cb..4ad55b5b 100644 --- a/Yep/Views/Cells/ChatRightLocation/ChatRightLocationCell.xib +++ b/Yep/Views/Cells/ChatRightLocation/ChatRightLocationCell.xib @@ -1,8 +1,8 @@ - + - + @@ -25,7 +25,7 @@ - + @@ -53,6 +53,6 @@ - + diff --git a/Yep/Views/Cells/ChatRightText/ChatRightTextCell.xib b/Yep/Views/Cells/ChatRightText/ChatRightTextCell.xib index b3b27867..c36f8e4c 100644 --- a/Yep/Views/Cells/ChatRightText/ChatRightTextCell.xib +++ b/Yep/Views/Cells/ChatRightText/ChatRightTextCell.xib @@ -1,8 +1,8 @@ - + - + @@ -25,7 +25,7 @@ - + @@ -64,6 +64,6 @@ - + diff --git a/Yep/Views/Cells/ChatRightVideo/ChatRightVideoCell.xib b/Yep/Views/Cells/ChatRightVideo/ChatRightVideoCell.xib index caf44d1e..926b2bd0 100644 --- a/Yep/Views/Cells/ChatRightVideo/ChatRightVideoCell.xib +++ b/Yep/Views/Cells/ChatRightVideo/ChatRightVideoCell.xib @@ -1,8 +1,8 @@ - + - + @@ -29,7 +29,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.swift b/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.swift index daed5de0..79cde55f 100644 --- a/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.swift +++ b/Yep/Views/Cells/ProfileHeader/ProfileHeaderCell.swift @@ -126,7 +126,7 @@ class ProfileHeaderCell: UICollectionViewCell { let avatarStyle = AvatarStyle.Original let plainAvatar = PlainAvatar(avatarURLString: avatarURLString, avatarStyle: avatarStyle) - AvatarPod.wakeAvatar(plainAvatar) { [weak self] finished, image in + AvatarPod.wakeAvatar(plainAvatar) { [weak self] finished, image, _ in if finished { self?.blurImage(image) { blurredImage in