Differences From Artifact [247888a299]:
- File
tests/tests.m
— part of check-in
[17e299f073]
at
2020-10-03 21:56:23
on branch trunk
— Initial support for sync
Only sends the sync, does not do anything with the response yet. Handling the response will be implemented in the next several commits, piece by piece. (user: js, size: 4125) [annotate] [blame] [check-ins using]
To Artifact [9eabf30e59]:
- File tests/tests.m — part of check-in [4df5567c11] at 2020-10-06 20:48:14 on branch trunk — Initial skeleton for handling sync (user: js, size: 4364) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | @end OF_APPLICATION_DELEGATE(Tests) @implementation Tests { MTXClient *_client; } - (void)applicationDidFinishLaunching { __auto_type environment = OFApplication.environment; if (environment[@"OBJMATRIX_USER"] == nil || environment[@"OBJMATRIX_PASS"] == nil || | > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | @end OF_APPLICATION_DELEGATE(Tests) @implementation Tests { MTXClient *_client; OFString *_roomID; } - (void)applicationDidFinishLaunching { __auto_type environment = OFApplication.environment; if (environment[@"OBJMATRIX_USER"] == nil || environment[@"OBJMATRIX_PASS"] == nil || |
︙ | ︙ | |||
102 103 104 105 106 107 108 | [_client joinRoom: room block: ^ (OFString *roomID, id exception) { if (exception != nil) { of_log(@"Failed to join room %@: %@", room, exception); [OFApplication terminateWithStatus: 1]; } | > | > > > > > > > > > > > > > > > | | | | | | | | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | [_client joinRoom: room block: ^ (OFString *roomID, id exception) { if (exception != nil) { of_log(@"Failed to join room %@: %@", room, exception); [OFApplication terminateWithStatus: 1]; } _roomID = [roomID copy]; of_log(@"Joined room %@", _roomID); [self sync2]; }]; } - (void)sync2 { [_client syncWithTimeout: 5 block: ^ (id exception) { if (exception != nil) { of_log(@"Failed to sync: %@", exception); [OFApplication terminateWithStatus: 1]; } of_log(@"Synced"); [self sendMessage]; }]; } - (void)sendMessage { [_client sendMessage: @"ObjMatrix test successful!" roomID: _roomID block: ^ (id exception) { if (exception != nil) { of_log(@"Failed to send message to room %@: %@", _roomID, exception); [OFApplication terminateWithStatus: 1]; } of_log(@"Message sent to %@", _roomID); [self leaveRoom]; }]; } - (void)leaveRoom { [_client leaveRoom: _roomID block: ^ (id exception) { if (exception != nil) { of_log(@"Failed to leave room %@: %@", exception); [OFApplication terminateWithStatus: 1]; } of_log(@"Left room %@", _roomID); [self logOut]; }]; } - (void)logOut { |
︙ | ︙ |