ObjMatrix  Check-in [2682b2dc32]

Overview
Comment:Include "since" in sync
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2682b2dc32f3396d458e29df26ee65d9a75354c3b28cf4c13eca087cfcf61c38
User & Date: js on 2020-10-04 01:18:14
Other Links: manifest | tags
Context
2020-10-04
01:33
MTXStorage: Add transactions check-in: 5d9f93730c user: js tags: trunk
01:18
Include "since" in sync check-in: 2682b2dc32 user: js tags: trunk
2020-10-03
22:32
Store next batch check-in: 6ab44895eb user: js tags: trunk
Changes

Modified src/MTXClient.m from [00b0c5338a] to [ebe5b898bb].

199
200
201
202
203
204
205




206

207
208
209
210
211
212
213
199
200
201
202
203
204
205
206
207
208
209

210
211
212
213
214
215
216
217







+
+
+
+
-
+







- (void)syncWithTimeout: (of_time_interval_t)timeout
		  block: (mtx_client_response_block_t)block
{
	void *pool = objc_autoreleasePoolPush();
	MTXRequest *request = [self
	    requestWithPath: @"/_matrix/client/r0/sync"];
	unsigned long long timeoutMs = timeout * 1000;
	OFMutableDictionary<OFString *, OFString *> *query =
	    [OFMutableDictionary dictionaryWithObject: @(timeoutMs).stringValue
					       forKey: @"timeout"];
	query[@"since"] = [_storage nextBatchForDeviceID: _deviceID];
	request.query = [OFString stringWithFormat: @"timeout=%llu", timeoutMs];
	request.query = query;
	[request performWithBlock: ^ (mtx_response_t response, int statusCode,
				       id exception) {
		if (exception != nil) {
			block(exception);
			return;
		}

Modified src/MTXRequest.h from [9c39efc51b] to [a3c3ccbf3a].

69
70
71
72
73
74
75
76


77
78
79
80
81
82
83
69
70
71
72
73
74
75

76
77
78
79
80
81
82
83
84







-
+
+







 * @brief The path of the request.
 */
@property (copy, nonatomic) OFString *path;

/**
 * @brief The query for the request.
 */
@property (copy, nullable, nonatomic) OFString *query;
@property (copy, nullable, nonatomic)
    OFDictionary<OFString *, OFString *> *query;

/**
 * @brief An optional body to send along with the request.
 *
 * This is a dictionary that gets serialized to JSON when the request is sent.
 */
@property (copy, nullable, nonatomic) OFDictionary<OFString *, id> *body;

Modified src/MTXRequest.m from [88ddaafdca] to [6c0156e037].

93
94
95
96
97
98
99
100

101
102
103
104
105
106
107
93
94
95
96
97
98
99

100
101
102
103
104
105
106
107







-
+








	if (_block != nil)
		/* Not the best exception to indicate it's already in-flight. */
		@throw [OFAlreadyConnectedException exception];

	OFMutableURL *requestURL = [[_homeserver mutableCopy] autorelease];
	requestURL.path = _path;
	requestURL.query = _query;
	requestURL.queryDictionary = _query;

	OFMutableDictionary *headers = [OFMutableDictionary dictionary];
	headers[@"User-Agent"] = @"ObjMatrix";
	if (_accessToken != nil)
		headers[@"Authorization"] =
		    [OFString stringWithFormat: @"Bearer %@", _accessToken];
	if (_body != nil)