Skip to content

Commit

Permalink
Merge pull request #609 from zapcannon87/develop
Browse files Browse the repository at this point in the history
feat(rtm): perfect reconstruction
  • Loading branch information
zapcannon87 authored Jun 11, 2020
2 parents 398dce0 + 673b73c commit 80dcc86
Show file tree
Hide file tree
Showing 85 changed files with 3,812 additions and 4,792 deletions.
158 changes: 71 additions & 87 deletions AVOS/AVOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
enableUBSanitizer = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -36,6 +38,13 @@
ReferencedContainer = "container:AVOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
<Testables>
<TestableReference
skipped = "NO">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
enableUBSanitizer = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -36,12 +38,19 @@
ReferencedContainer = "container:AVOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "70F315311BDE503B00D691B3"
BlueprintIdentifier = "D3460573238BE9390027E1D5"
BuildableName = "AVOSCloud-macOSTests.xctest"
BlueprintName = "AVOSCloud-macOSTests"
ReferencedContainer = "container:AVOS.xcodeproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
enableUBSanitizer = "YES"
codeCoverageEnabled = "YES">
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
enableUBSanitizer = "YES"
codeCoverageEnabled = "YES">
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
enableUBSanitizer = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -36,6 +38,13 @@
ReferencedContainer = "container:AVOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
<Testables>
<TestableReference
skipped = "NO">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
enableUBSanitizer = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -36,17 +38,14 @@
ReferencedContainer = "container:AVOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "704F3B761BE0D0180033245C"
BuildableName = "AVOSCloudIM-macOSTests.xctest"
BlueprintName = "AVOSCloudIM-macOSTests"
ReferencedContainer = "container:AVOS.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,27 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
enableUBSanitizer = "YES"
codeCoverageEnabled = "YES">
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "838CE3221EC97E6E00B24F5B"
BuildableName = "AVOSCloudLiveQuery-iOSTests.xctest"
BlueprintName = "AVOSCloudLiveQuery-iOSTests"
ReferencedContainer = "container:AVOS.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
enableUBSanitizer = "YES"
codeCoverageEnabled = "YES">
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
Expand Down
24 changes: 24 additions & 0 deletions AVOS/AVOSCloud/AVApplication.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// AVApplication.h
// AVOS
//
// Created by pzheng on 2020/05/20.
// Copyright © 2020 LeanCloud Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface AVApplication : NSObject

@property (nonatomic, readonly) NSString *identifier;
@property (nonatomic, readonly) NSString *key;

+ (instancetype)defaultApplication;

- (void)setWithIdentifier:(NSString *)identifier key:(NSString *)key;

@end

NS_ASSUME_NONNULL_END
47 changes: 47 additions & 0 deletions AVOS/AVOSCloud/AVApplication.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// AVApplication.m
// AVOS
//
// Created by pzheng on 2020/05/20.
// Copyright © 2020 LeanCloud Inc. All rights reserved.
//

#import "AVApplication_Internal.h"

@implementation AVApplication

+ (instancetype)defaultApplication
{
static AVApplication *instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[AVApplication alloc] init];
});
return instance;
}

- (void)setWithIdentifier:(NSString *)identifier key:(NSString *)key
{
_identifier = [identifier copy];
_key = [key copy];
}

- (NSString *)identifierThrowException
{
if (!self.identifier) {
[NSException raise:NSInternalInconsistencyException
format:@"Application identifier not found."];
}
return self.identifier;
}

- (NSString *)keyThrowException
{
if (!self.key) {
[NSException raise:NSInternalInconsistencyException
format:@"Application key not found."];
}
return self.key;
}

@end
16 changes: 16 additions & 0 deletions AVOS/AVOSCloud/AVApplication_Internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// AVApplication_Internal.h
// AVOS
//
// Created by pzheng on 2020/05/29.
// Copyright © 2020 LeanCloud Inc. All rights reserved.
//

#import "AVApplication.h"

@interface AVApplication ()

- (NSString *)identifierThrowException;
- (NSString *)keyThrowException;

@end
36 changes: 13 additions & 23 deletions AVOS/AVOSCloud/AVOSCloud.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,41 @@

#if !TARGET_OS_WATCH
#import "AVAnalytics_Internal.h"
#import "AVAnalyticsUtils.h"
#endif

#import "AVUtils.h"
#include "AVOSCloud_Art.inc"
#import "AVAnalyticsUtils.h"
#import "LCNetworkStatistics.h"
#import "AVObjectUtils.h"

#import "LCRouter_Internal.h"
#import "AVApplication_Internal.h"

@implementation AVOSCloud {
NSString *_applicationId;
NSString *_applicationKey;
AVVerbosePolicy _verbosePolicy;
}
@implementation AVOSCloud

+ (instancetype)sharedInstance
{
static AVOSCloud *instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[AVOSCloud alloc] init];
instance->_verbosePolicy = kAVVerboseAuto;
});
return instance;
}
static AVVerbosePolicy gVerbosePolicy = kAVVerboseAuto;

+ (void)setAllLogsEnabled:(BOOL)enabled {
[AVLogger setAllLogsEnabled:enabled];
}

+ (void)setVerbosePolicy:(AVVerbosePolicy)verbosePolicy {
[AVOSCloud sharedInstance]->_verbosePolicy = verbosePolicy;
gVerbosePolicy = verbosePolicy;
}

+ (void)logApplicationInfo
{
const char *s = (const char *)AVOSCloud_Art_inc;
printf("%s\n", s);
printf("appid: %s\n", [[self getApplicationId] UTF8String]);
#if !TARGET_OS_WATCH
NSDictionary *dict = [AVAnalyticsUtils deviceInfo];
for (NSString *key in dict) {
id value = [dict objectForKey:key];
printf("%s: %s\n", [key UTF8String], [[NSString stringWithFormat:@"%@", value] UTF8String]);
}
#endif
printf("----------------------------------------------------------\n");
}

Expand Down Expand Up @@ -88,26 +78,26 @@ + (void)setApplicationId:(NSString *)applicationId
[appDomain isEqualToString:AppDomainCE]) {
if (![LCRouter serverURLString]) {
[NSException raise:NSInternalInconsistencyException
format:@"Server URL not set."] ;
format:@"Server URL not found."] ;
}
}

[AVOSCloud sharedInstance]->_applicationId = applicationId;
[AVOSCloud sharedInstance]->_applicationKey = clientKey;
[[AVApplication defaultApplication] setWithIdentifier:applicationId
key:clientKey];

[self initializePaasClient];

if ([AVOSCloud sharedInstance]->_verbosePolicy == kAVVerboseShow) {
if (gVerbosePolicy == kAVVerboseShow) {
[self logApplicationInfo];
}
}

+ (NSString *)getApplicationId {
return [AVOSCloud sharedInstance]->_applicationId;
return [[AVApplication defaultApplication] identifierThrowException];
}

+ (NSString *)getClientKey {
return [AVOSCloud sharedInstance]->_applicationKey;
return [[AVApplication defaultApplication] keyThrowException];
}

+ (void)setLastModifyEnabled:(BOOL)enabled {
Expand Down
Loading

0 comments on commit 80dcc86

Please sign in to comment.