Skip to content

Commit 5ff3f04

Browse files
authored
Merge pull request #667 from zapcannon87/develop
chore: tweak code
2 parents 22e7788 + a2bb9e1 commit 5ff3f04

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

AVOS/Sources/Foundation/File/LCFile.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ - (instancetype)initWithLocalPath:(NSString *)localPath
188188
});
189189

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

193193
_ACL = ({
194194

AVOS/Sources/Foundation/LCApplication.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ NS_ASSUME_NONNULL_BEGIN
166166

167167
@property (nonatomic, readonly) NSString *identifier;
168168
@property (nonatomic, readonly) NSString *key;
169-
@property (nonatomic, readonly) NSString *serverURLString;
169+
@property (nonatomic, readonly, nullable) NSString *serverURLString;
170170
@property (nonatomic, copy, nullable) NSString *RTMServer;
171171

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

AVOS/Sources/Foundation/LCApplication.m

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,20 +193,28 @@ - (void)setWithIdentifier:(NSString *)identifier key:(NSString *)key {
193193
_key = [key copy];
194194
}
195195

196+
- (NSString *)identifier {
197+
return [self identifierThrowException];
198+
}
199+
200+
- (NSString *)key {
201+
return [self keyThrowException];
202+
}
203+
196204
- (NSString *)identifierThrowException {
197-
if (!self.identifier) {
205+
if (!_identifier || _identifier.length == 0) {
198206
[NSException raise:NSInternalInconsistencyException
199207
format:@"Application identifier not found."];
200208
}
201-
return self.identifier;
209+
return _identifier;
202210
}
203211

204212
- (NSString *)keyThrowException {
205-
if (!self.key) {
213+
if (!_key || _key.length == 0) {
206214
[NSException raise:NSInternalInconsistencyException
207215
format:@"Application key not found."];
208216
}
209-
return self.key;
217+
return _key;
210218
}
211219

212220
@end

AVOS/Sources/Foundation/LCApplication_Internal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
@interface LCApplication ()
1212

13+
@property (nonatomic) NSString *identifier;
14+
@property (nonatomic) NSString *key;
15+
1316
- (NSString *)identifierThrowException;
1417
- (NSString *)keyThrowException;
1518

AVOS/Sources/Foundation/Router/LCRouter.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ + (NSString *)serverURLString {
3030
}
3131

3232
+ (void)setServerURLString:(NSString *)URLString {
33-
serverURLString = URLString;
33+
serverURLString = [URLString copy];
3434
}
3535

3636
+ (instancetype)sharedInstance

0 commit comments

Comments
 (0)