Skip to content

Commit a2bb9e1

Browse files
committed
chore: tweak code
1 parent 265af1b commit a2bb9e1

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

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)