mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Integrations: Fix terms consent display HTTP requests
This commit is contained in:
parent
9a58cbccde
commit
46d8947255
1 changed files with 8 additions and 2 deletions
|
@ -522,7 +522,7 @@ NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain";
|
||||||
MXStrongifyAndReturnIfNil(self);
|
MXStrongifyAndReturnIfNil(self);
|
||||||
|
|
||||||
// Exchange the token for a scalar token
|
// Exchange the token for a scalar token
|
||||||
MXHTTPClient *httpClient = [[MXHTTPClient alloc] initWithBaseURL:config.apiUrl andOnUnrecognizedCertificateBlock:nil];
|
__block MXHTTPClient *httpClient = [[MXHTTPClient alloc] initWithBaseURL:config.apiUrl andOnUnrecognizedCertificateBlock:nil];
|
||||||
|
|
||||||
MXHTTPOperation *operation2 =
|
MXHTTPOperation *operation2 =
|
||||||
[httpClient requestWithMethod:@"POST"
|
[httpClient requestWithMethod:@"POST"
|
||||||
|
@ -530,6 +530,7 @@ NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain";
|
||||||
parameters:tokenObject.JSONDictionary
|
parameters:tokenObject.JSONDictionary
|
||||||
success:^(NSDictionary *JSONResponse)
|
success:^(NSDictionary *JSONResponse)
|
||||||
{
|
{
|
||||||
|
httpClient = nil;
|
||||||
|
|
||||||
NSString *scalarToken;
|
NSString *scalarToken;
|
||||||
MXJSONModelSetString(scalarToken, JSONResponse[@"scalar_token"])
|
MXJSONModelSetString(scalarToken, JSONResponse[@"scalar_token"])
|
||||||
|
@ -551,6 +552,8 @@ NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain";
|
||||||
[operation mutateTo:operation3];
|
[operation mutateTo:operation3];
|
||||||
|
|
||||||
} failure:^(NSError *error) {
|
} failure:^(NSError *error) {
|
||||||
|
httpClient = nil;
|
||||||
|
|
||||||
NSLog(@"[WidgetManager] registerForScalarToken: Failed to register. Error: %@", error);
|
NSLog(@"[WidgetManager] registerForScalarToken: Failed to register. Error: %@", error);
|
||||||
|
|
||||||
if (failure)
|
if (failure)
|
||||||
|
@ -594,12 +597,13 @@ NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain";
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
MXHTTPClient *httpClient = [[MXHTTPClient alloc] initWithBaseURL:config.apiUrl andOnUnrecognizedCertificateBlock:nil];
|
__block MXHTTPClient *httpClient = [[MXHTTPClient alloc] initWithBaseURL:config.apiUrl andOnUnrecognizedCertificateBlock:nil];
|
||||||
|
|
||||||
return [httpClient requestWithMethod:@"GET"
|
return [httpClient requestWithMethod:@"GET"
|
||||||
path:[NSString stringWithFormat:@"account?v=1.1&scalar_token=%@", scalarToken]
|
path:[NSString stringWithFormat:@"account?v=1.1&scalar_token=%@", scalarToken]
|
||||||
parameters:nil
|
parameters:nil
|
||||||
success:^(NSDictionary *JSONResponse) {
|
success:^(NSDictionary *JSONResponse) {
|
||||||
|
httpClient = nil;
|
||||||
|
|
||||||
NSString *userId;
|
NSString *userId;
|
||||||
MXJSONModelSetString(userId, JSONResponse[@"user_id"])
|
MXJSONModelSetString(userId, JSONResponse[@"user_id"])
|
||||||
|
@ -615,6 +619,8 @@ NSString *const WidgetManagerErrorDomain = @"WidgetManagerErrorDomain";
|
||||||
}
|
}
|
||||||
|
|
||||||
} failure:^(NSError *error) {
|
} failure:^(NSError *error) {
|
||||||
|
httpClient = nil;
|
||||||
|
|
||||||
NSHTTPURLResponse *urlResponse = [MXHTTPOperation urlResponseFromError:error];
|
NSHTTPURLResponse *urlResponse = [MXHTTPOperation urlResponseFromError:error];
|
||||||
|
|
||||||
NSLog(@"[WidgetManager] validateScalarToken. Error in modular/account request. statusCode: %@", @(urlResponse.statusCode));
|
NSLog(@"[WidgetManager] validateScalarToken. Error in modular/account request. statusCode: %@", @(urlResponse.statusCode));
|
||||||
|
|
Loading…
Reference in a new issue