Skip to content

Commit

Permalink
code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Velin92 committed Aug 25, 2023
1 parent df726ee commit 6208987
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) NSString *issuer;
@property (nonatomic, readonly, nullable) NSString *account;

-(NSURL * _Nullable) getMasLogoutDeviceURLFromDeviceID: (NSString * ) deviceID;
-(NSURL * _Nullable) getLogoutDeviceURLFromID: (NSString * ) deviceID;

@end

Expand Down
19 changes: 8 additions & 11 deletions MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,18 @@ + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary
return wellKnownAuthentication;
}

-(NSURL * _Nullable) getMasLogoutDeviceURLFromDeviceID: (NSString * ) deviceID
-(NSURL * _Nullable) getLogoutDeviceURLFromID: (NSString * ) deviceID
{
if (_account)
{
NSURLComponents *components = [NSURLComponents componentsWithString:_account];
components.queryItems = @[
[NSURLQueryItem queryItemWithName:@"device_id" value:deviceID],
[NSURLQueryItem queryItemWithName:@"action" value:@"session_end"]
];
return components.URL;
}
else
if (!_account)
{
return nil;
}
NSURLComponents *components = [NSURLComponents componentsWithString:_account];
components.queryItems = @[
[NSURLQueryItem queryItemWithName:@"device_id" value:deviceID],
[NSURLQueryItem queryItemWithName:@"action" value:@"session_end"]
];
return components.URL;
}


Expand Down

0 comments on commit 6208987

Please sign in to comment.