Skip to content

Commit

Permalink
Merge pull request #568 from zapcannon87/master
Browse files Browse the repository at this point in the history
Release v11.6.6
  • Loading branch information
zapcannon87 authored Aug 22, 2019
2 parents 7555b57 + f64f5c0 commit f4af3a6
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 16 deletions.
6 changes: 4 additions & 2 deletions AVOS/AVOSCloud/File/AVFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ - (instancetype)init

_lock = [[NSLock alloc] init];

_rawJSONData = [NSMutableDictionary dictionaryWithObject:AVFile.className forKey:kLCFile___type];
_rawJSONData = [NSMutableDictionary dictionary];
}

return self;
Expand Down Expand Up @@ -310,7 +310,9 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder

- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_rawJSONData forKey:@"dictionary"];
NSMutableDictionary *dic = [_rawJSONData mutableCopy];
[dic setObject:@"File" forKey:@"__type"];
[aCoder encodeObject:dic forKey:@"dictionary"];
}

// MARK: - Lock
Expand Down
4 changes: 3 additions & 1 deletion AVOS/AVOSCloud/Object/AVObjectUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,9 @@ +(NSDictionary *)dictionaryFromData:(NSData *)data

+(NSDictionary *)dictionaryFromFile:(AVFile *)file
{
return [file rawJSONDataCopy];
NSMutableDictionary *dic = [file rawJSONDataMutableCopy];
[dic setObject:@"File" forKey:@"__type"];
return dic;
}

+(NSDictionary *)dictionaryFromACL:(AVACL *)acl {
Expand Down
18 changes: 10 additions & 8 deletions AVOS/AVOSCloud/Push/AVInstallation.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ + (AVInstallation *)defaultInstallation
dispatch_once(&onceToken, ^{

installation = [[AVInstallation alloc] init];

NSString *path = [AVPersistenceUtils currentInstallationArchivePath];
if ([AVPersistenceUtils fileExist:path]) {
NSMutableDictionary *installationDict = [NSMutableDictionary dictionaryWithDictionary:[AVPersistenceUtils getJSONFromPath:path]];
if (installationDict) {
[AVObjectUtils copyDictionary:installationDict toObject:installation];
}
}
});

return installation;
Expand All @@ -61,14 +69,6 @@ - (id)init
self.deviceType = [AVInstallation deviceType];
self.timeZone = [[NSTimeZone systemTimeZone] name];
self.apnsTopic = [NSBundle mainBundle].bundleIdentifier;

NSString *path = [AVPersistenceUtils currentInstallationArchivePath];
if ([AVPersistenceUtils fileExist:path]) {
NSMutableDictionary *installationDict = [NSMutableDictionary dictionaryWithDictionary:[AVPersistenceUtils getJSONFromPath:path]];
if (installationDict) {
[AVObjectUtils copyDictionary:installationDict toObject:self];
}
}
}
return self;
}
Expand Down Expand Up @@ -132,6 +132,8 @@ +(NSString *)deviceType

- (NSMutableDictionary *)installationDictionaryForCache {
NSMutableDictionary *data = [self postData];
[data removeObjectForKey:@"__type"];
[data removeObjectForKey:@"className"];
return data;
}

Expand Down
2 changes: 1 addition & 1 deletion AVOS/AVOSCloud/UserAgent.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define SDK_VERSION @"v11.6.5"
#define SDK_VERSION @"v11.6.6"
1 change: 1 addition & 0 deletions AVOS/AVOSCloudIM/Conversation/AVIMConversation.m
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,7 @@ - (void)sendMessage:(AVIMMessage *)message
}

if (client.status != AVIMClientStatusOpened) {
message.status = AVIMMessageStatusFailed;
[self invokeInUserInteractQueue:^{
callback(false, ({
AVIMErrorCode code = AVIMErrorCodeClientNotOpen;
Expand Down
11 changes: 11 additions & 0 deletions AVOS/AVOSCloudTests/Swift/AVCloudTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@
//

import XCTest
import AVOSCloud

class AVCloud_TestCase: LCTestBase {

func testError() {
let exp = self.expectation(description: "error")
AVCloud.callFunction(inBackground: "error", withParameters: nil) { (result, error) in
XCTAssertNil(result)
XCTAssertNotNil(error)
exp.fulfill()
}
wait(for: [exp], timeout: 30)
}

}
14 changes: 13 additions & 1 deletion AVOS/AVOSCloudTests/Swift/AVObjectTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class AVObject_TestCase: LCTestBase {

if self.isServerTesting { return }

var objectID: String?

RunLoopSemaphore.wait(async: { (semaphore: RunLoopSemaphore) in

let filePath: String = Bundle(for: type(of: self)).path(forResource: "_10_MB_", ofType: "png")!
Expand All @@ -35,7 +37,7 @@ class AVObject_TestCase: LCTestBase {
semaphore.decrement()

XCTAssertTrue(Thread.isMainThread)

objectID = avObject.objectId
XCTAssertTrue(succeeded)
XCTAssertNil(error)
})
Expand All @@ -44,6 +46,11 @@ class AVObject_TestCase: LCTestBase {

XCTFail("timeout")
})

if let objectID = objectID {
let object = AVObject(className: "Todo", objectId: objectID)
XCTAssertTrue(object.fetch())
}
}

func testc_fetch_all_objects() {
Expand Down Expand Up @@ -88,4 +95,9 @@ class AVObject_TestCase: LCTestBase {
})
}

func testInstallation() {
AVInstallation.default().deviceToken = UUID().uuidString
XCTAssertTrue(AVInstallation.default().save())
}

}
2 changes: 1 addition & 1 deletion AVOSCloud.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AVOSCloud'
s.version = '11.6.5'
s.version = '11.6.6'
s.homepage = 'https://leancloud.cn/'
s.summary = 'LeanCloud Objective-C SDK'
s.authors = 'LeanCloud'
Expand Down
2 changes: 1 addition & 1 deletion AVOSCloudIM.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AVOSCloudIM'
s.version = '11.6.5'
s.version = '11.6.6'
s.homepage = 'https://leancloud.cn/'
s.summary = 'LeanCloud IM Objective-C SDK'
s.authors = 'LeanCloud'
Expand Down
2 changes: 1 addition & 1 deletion AVOSCloudLiveQuery.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AVOSCloudLiveQuery'
s.version = '11.6.5'
s.version = '11.6.6'
s.homepage = 'https://leancloud.cn/'
s.summary = 'LeanCloud LiveQuery Objective-C SDK'
s.authors = 'LeanCloud'
Expand Down

0 comments on commit f4af3a6

Please sign in to comment.