Skip to content

Commit

Permalink
try to fix UserImageLocalCache not imp issue on RS
Browse files Browse the repository at this point in the history
  • Loading branch information
billypchan committed May 31, 2021
1 parent 8ecbf85 commit cbb94e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Source/Utilis/UserImageLocalCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ extension NSManagedObjectContext
}

// MARK: Cache
@objcMembers open class UserImageLocalCache : NSObject {
//@objcMembers
@objc
open class UserImageLocalCache : NSObject {

fileprivate let log = ZMSLog(tag: "UserImageCache")

Expand All @@ -71,6 +73,7 @@ extension NSManagedObjectContext

/// Create UserImageLocalCache
/// - parameter location: where cache is persisted on disk. Defaults to caches directory if nil.
@objc
public init(location: URL? = nil) {

let largeUserImageCacheName = "largeUserImages"
Expand Down Expand Up @@ -136,6 +139,7 @@ extension NSManagedObjectContext
}
}

@objc
open func userImage(_ user: ZMUser, size: ProfileImageSize) -> Data? {
guard let cacheKey = user.imageCacheKey(for: size) else { return nil }
let data: Data?
Expand Down Expand Up @@ -166,6 +170,7 @@ extension NSManagedObjectContext
}

public extension UserImageLocalCache {
@objc
func wipeCache() {
smallUserImageCache.removeAllObjects()
largeUserImageCache.removeAllObjects()
Expand Down
2 changes: 1 addition & 1 deletion Tests/Source/Model/ZMConnectionTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ - (void)testThatItAddsUserToTheParticipantRoleFromPayload;
@"from": @"3bc5750a-b965-40f8-aff2-831e9b5ac2e9",
@"to": @"c3308f1d-82ee-49cd-897f-2a32ed9ae1d9",
@"last_update": @"2014-04-16T15:01:45.762Z",
@"conversation": @"fef60427-3c53-4ac5-b971-ad5088f5a4c2",
// @"conversation": @"fef60427-3c53-4ac5-b971-ad5088f5a4c2",
@"message": @"Hi Marco C,\n\nLet's connect in Zeta.\n\nJohn"
};

Expand Down

0 comments on commit cbb94e9

Please sign in to comment.