Skip to content

Commit

Permalink
Merge pull request #667 from zapcannon87/develop
Browse files Browse the repository at this point in the history
chore: tweak code
  • Loading branch information
zapcannon87 authored Sep 28, 2021
2 parents 22e7788 + a2bb9e1 commit 5ff3f04
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion AVOS/Sources/Foundation/File/LCFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ - (instancetype)initWithLocalPath:(NSString *)localPath
});

NSNumber *fileSize = fileAttributes[NSFileSize];
_rawJSONData[kLCFile_metaData] = fileSize ? @{ kLCFile_size : fileSize } : @{};
_rawJSONData[kLCFile_metaData] = (fileSize != nil) ? @{ kLCFile_size : fileSize } : @{};

_ACL = ({

Expand Down
2 changes: 1 addition & 1 deletion AVOS/Sources/Foundation/LCApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic, readonly) NSString *identifier;
@property (nonatomic, readonly) NSString *key;
@property (nonatomic, readonly) NSString *serverURLString;
@property (nonatomic, readonly, nullable) NSString *serverURLString;
@property (nonatomic, copy, nullable) NSString *RTMServer;

- (void)setWithIdentifier:(NSString *)identifier key:(NSString *)key;
Expand Down
16 changes: 12 additions & 4 deletions AVOS/Sources/Foundation/LCApplication.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,28 @@ - (void)setWithIdentifier:(NSString *)identifier key:(NSString *)key {
_key = [key copy];
}

- (NSString *)identifier {
return [self identifierThrowException];
}

- (NSString *)key {
return [self keyThrowException];
}

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

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

@end
3 changes: 3 additions & 0 deletions AVOS/Sources/Foundation/LCApplication_Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

@interface LCApplication ()

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

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

Expand Down
2 changes: 1 addition & 1 deletion AVOS/Sources/Foundation/Router/LCRouter.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ + (NSString *)serverURLString {
}

+ (void)setServerURLString:(NSString *)URLString {
serverURLString = URLString;
serverURLString = [URLString copy];
}

+ (instancetype)sharedInstance
Expand Down

0 comments on commit 5ff3f04

Please sign in to comment.