@@ -16,6 +16,7 @@ @interface EVTEventStateProvider ()
1616@property (nonatomic , strong ) NSURLSession *session;
1717@property (nonatomic , strong ) NSTimer *timer;
1818@property (nonatomic , assign ) EVTEventState state;
19+ @property (nonatomic , copy ) NSURL *url;
1920
2021@end
2122
@@ -34,7 +35,7 @@ - (instancetype)initWithEnvironment:(EVTEnvironment *)environment
3435 return self;
3536}
3637
37- - (void )__fetchStateWithCompletionHandler : (void (^)(NSString *))completionHandler
38+ - (void )__fetchStateWithCompletionHandler : (void (^)(NSString *, NSString * ))completionHandler
3839{
3940 NSURLSessionDataTask *task = [self .session dataTaskWithURL: self .environment.stateURL completionHandler: ^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
4041 if (error) {
@@ -54,7 +55,7 @@ - (void)__fetchStateWithCompletionHandler:(void (^)(NSString *))completionHandle
5455 }
5556
5657 dispatch_async (dispatch_get_main_queue (), ^{
57- completionHandler (stateDict[@" state" ]);
58+ completionHandler (stateDict[@" state" ], stateDict[ @" url " ] );
5859 });
5960 }];
6061 [task resume ];
@@ -70,14 +71,15 @@ - (void)__stateCheck:(NSTimer *)sender
7071{
7172 __weak typeof (self) weakSelf = self;
7273
73- [self __fetchStateWithCompletionHandler: ^(NSString *stateName) {
74+ [self __fetchStateWithCompletionHandler: ^(NSString *stateName, NSString *url ) {
7475 #ifdef DEBUG
7576 NSLog (@" STATE = %@ " , stateName);
7677 #endif
7778 [self willChangeValueForKey: @" state" ];
7879 if ([stateName isEqualToString: @" PRE" ]) {
7980 weakSelf.state = EVTEventStatePre;
8081 } else if ([stateName isEqualToString: @" LIVE" ]) {
82+ weakSelf.url = [NSURL URLWithString: url];
8183 weakSelf.state = EVTEventStateLive;
8284 } else if ([stateName isEqualToString: @" INTERIM" ]) {
8385 weakSelf.state = EVTEventStateInterim;
0 commit comments