Add support for fetching room list

FossilOrigin-Name: 092c122c690b6e64c67120c6c153e82fceb484078dd3d713d56e01ce13c3902d
This commit is contained in:
Jonathan Schleifer 2020-10-03 17:08:07 +00:00
parent 77a2d20fc7
commit c7fc35fb0f
11 changed files with 258 additions and 61 deletions

View file

@ -30,6 +30,10 @@
OF_APPLICATION_DELEGATE(Tests)
@implementation Tests
{
MTXClient *_client;
}
- (void)applicationDidFinishLaunching
{
__auto_type environment = OFApplication.environment;
@ -52,18 +56,39 @@ OF_APPLICATION_DELEGATE(Tests)
[OFApplication terminateWithStatus: 1];
}
of_log(@"Logged in client: %@", client);
_client = [client retain];
of_log(@"Logged in client: %@", _client);
[client asyncLogOutWithBlock: ^ (id exception) {
if (exception != nil) {
of_log(@"Failed to log out: %@\n", exception);
[OFApplication terminateWithStatus: 1];
}
[self fetchRoomList];
}];
}
of_log(@"Logged out client");
- (void)fetchRoomList
{
[_client asyncFetchRoomList: ^ (OFArray<OFString *> *rooms,
id exception) {
if (exception != nil) {
of_log(@"Failed to fetch room list: %@", exception);
[OFApplication terminateWithStatus: 1];
}
[OFApplication terminate];
}];
of_log(@"Fetched room list: %@", rooms);
[self logOut];
}];
}
- (void)logOut
{
[_client asyncLogOutWithBlock: ^ (id exception) {
if (exception != nil) {
of_log(@"Failed to log out: %@\n", exception);
[OFApplication terminateWithStatus: 1];
}
of_log(@"Logged out client");
[OFApplication terminate];
}];
}
@end