Skip to content

Commit

Permalink
Merge pull request #235 from syphon-org/fix-batch-0.1.6+4
Browse files Browse the repository at this point in the history
[0.1.7] Touch Up Release
  • Loading branch information
ereio authored Feb 25, 2021
2 parents 2c83b00 + 499bce6 commit 4079387
Show file tree
Hide file tree
Showing 50 changed files with 1,310 additions and 877 deletions.
2 changes: 1 addition & 1 deletion ios/Flutter/.last_build_id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1174475fef3d534343e40f4cc82e834d
19b273c5c76043b5d019fcb9269015be
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 127d285aa3bfad2bbd68630172869bd951e40542

COCOAPODS: 1.10.0
COCOAPODS: 1.10.1
3 changes: 2 additions & 1 deletion lib/cache/serializer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ class CacheSerializer implements StateSerializer<AppState> {
state.authStore,
state.syncStore,
state.cryptoStore,
state.roomStore,
];

// Queue up a cache saving will wait
// if the previously schedule task has not finished
Future.microtask(() async {
// // create a new IV for the encrypted cache
// create a new IV for the encrypted cache
Cache.ivKey = generateIV();

// backup the IV in case the app is force closed before caching finishes
Expand Down
2 changes: 2 additions & 0 deletions lib/cache/storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:syphon/cache/threadables.dart';
import 'package:syphon/global/print.dart';
import 'package:syphon/store/auth/state.dart';
import 'package:syphon/store/crypto/state.dart';
import 'package:syphon/store/rooms/state.dart';
import 'package:syphon/store/sync/state.dart';

class CacheStorage implements StorageEngine {
Expand All @@ -21,6 +22,7 @@ class CacheStorage implements StorageEngine {
AuthStore(),
SyncStore(),
CryptoStore(),
RoomStore(),
];

await Future.wait(stores.map((store) async {
Expand Down
4 changes: 0 additions & 4 deletions lib/global/dimensions.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// decoration: BoxDecoration( // DEBUG ONLY
// color: Colors.red,
// ),

// Flutter imports:
import 'package:flutter/material.dart';

Expand Down
40 changes: 30 additions & 10 deletions lib/global/libs/matrix/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'dart:math';

// Package imports:
import 'package:http/http.dart' as http;
import 'package:syphon/global/algos.dart';
import 'package:syphon/global/values.dart';

/**
* https://matrix.org/docs/spec/client_server/latest#id183
Expand Down Expand Up @@ -38,15 +38,15 @@ abstract class Auth {
return await json.decode(response.body);
}

/**
* https://matrix.org/docs/spec/client_server/latest#id198
*
* Login User
*
* Gets the homeserver's supported login types to authenticate
* users. Clients should pick one of these and supply it as
* the type when logging in.
*/
///
/// Login User
///
/// Gets the homeserver's supported login types to authenticate
/// users. Clients should pick one of these and supply it as
/// the type when logging in.
///
/// https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-login
///
static FutureOr<dynamic> loginUser({
String protocol,
String homeserver,
Expand Down Expand Up @@ -74,6 +74,7 @@ abstract class Auth {

final response = await http.post(
url,
headers: {'Content-type': 'application/json'},
body: json.encode(body),
);

Expand Down Expand Up @@ -117,6 +118,7 @@ abstract class Auth {

final response = await http.post(
url,
headers: {'Content-type': 'application/json'},
body: json.encode(body),
);

Expand Down Expand Up @@ -146,6 +148,7 @@ abstract class Auth {

final response = await http.post(
url,
headers: {'Content-type': 'application/json'},
body: json.encode(body),
);

Expand Down Expand Up @@ -228,6 +231,7 @@ abstract class Auth {

final response = await http.post(
url,
headers: {'Content-type': 'application/json'},
body: json.encode(body),
);

Expand All @@ -243,6 +247,7 @@ abstract class Auth {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

final response = await http.post(
Expand All @@ -265,6 +270,7 @@ abstract class Auth {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

final response = await http.post(
Expand Down Expand Up @@ -314,6 +320,17 @@ abstract class Auth {
return await json.decode(response.body);
}

static Future<dynamic> checkVersion({
String protocol = 'https://',
String homeserver = 'matrix.org',
}) async {
String url = '$protocol$homeserver/_matrix/client/versions';

final response = await http.get(url);

return await json.decode(response.body);
}

/**
* Update User Password
*
Expand All @@ -334,6 +351,7 @@ abstract class Auth {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

Map body = {
Expand Down Expand Up @@ -392,6 +410,7 @@ abstract class Auth {

final response = await http.post(
url,
headers: {'Content-type': 'application/json'},
body: json.encode(body),
);

Expand Down Expand Up @@ -421,6 +440,7 @@ abstract class Auth {

final response = await http.post(
url,
headers: {'Content-type': 'application/json'},
body: json.encode(body),
);

Expand Down
2 changes: 2 additions & 0 deletions lib/global/libs/matrix/devices.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:convert';

// Package imports:
import 'package:http/http.dart' as http;
import 'package:syphon/global/values.dart';

abstract class Devices {
/**
Expand Down Expand Up @@ -134,6 +135,7 @@ abstract class Devices {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

Map body = {
Expand Down
4 changes: 4 additions & 0 deletions lib/global/libs/matrix/encryption.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:convert';

// Package imports:
import 'package:http/http.dart' as http;
import 'package:syphon/global/values.dart';

class Algorithms {
static const signedcurve25519 = 'signed_curve25519';
Expand Down Expand Up @@ -38,6 +39,7 @@ abstract class Encryption {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

Map body = {
Expand Down Expand Up @@ -137,6 +139,7 @@ abstract class Encryption {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

Map body = {
Expand All @@ -162,6 +165,7 @@ abstract class Encryption {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

final response = await http.post(
Expand Down
2 changes: 2 additions & 0 deletions lib/global/libs/matrix/events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:http/http.dart' as http;

// Project imports:
import 'package:syphon/global/libs/matrix/encryption.dart';
import 'package:syphon/global/values.dart';
import 'package:syphon/store/events/model.dart';
import 'package:syphon/global/libs/matrix/constants.dart';

Expand Down Expand Up @@ -401,6 +402,7 @@ abstract class Events {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

Map body = {
Expand Down
1 change: 1 addition & 0 deletions lib/global/libs/matrix/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ abstract class MatrixApi {
static final checkUsernameAvailability = Auth.checkUsernameAvailability;
static final sendPasswordResetEmail = Auth.sendPasswordResetEmail;
static final checkHomeserver = Auth.checkHomeserver;
static final checkVersion = Auth.checkVersion;

// Search
static final searchRooms = Search.searchRooms;
Expand Down
4 changes: 2 additions & 2 deletions lib/global/libs/matrix/notifications.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:convert';

// Package imports:
import 'package:http/http.dart' as http;
import 'package:syphon/global/values.dart';

abstract class Notifications {
/**
Expand Down Expand Up @@ -111,6 +112,7 @@ abstract class Notifications {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

Map body = {
Expand All @@ -131,8 +133,6 @@ abstract class Notifications {
body['profile_tag'] = profileTag;
}

// return {'errcode': 'ya done'};

final response = await http.post(
url,
headers: headers,
Expand Down
21 changes: 11 additions & 10 deletions lib/global/libs/matrix/rooms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:convert';

// Package imports:
import 'package:http/http.dart' as http;
import 'package:syphon/global/values.dart';

abstract class Rooms {
/**
Expand Down Expand Up @@ -164,6 +165,7 @@ abstract class Rooms {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

final response = await http.post(
Expand All @@ -172,9 +174,7 @@ abstract class Rooms {
body: json.encode({}),
);

return await json.decode(
response.body,
);
return await json.decode(response.body);
}

/**
Expand Down Expand Up @@ -204,6 +204,7 @@ abstract class Rooms {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

Map body = {
Expand Down Expand Up @@ -231,9 +232,7 @@ abstract class Rooms {
body: json.encode(body),
);

return await json.decode(
response.body,
);
return await json.decode(response.body);
}

/**
Expand All @@ -259,6 +258,7 @@ abstract class Rooms {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

final reponse = await http.post(
Expand Down Expand Up @@ -296,16 +296,15 @@ abstract class Rooms {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

final reponse = await http.post(
final response = await http.post(
url,
headers: headers,
);

return await json.decode(
reponse.body,
);
return await json.decode(response.body);
}

/**
Expand Down Expand Up @@ -364,6 +363,7 @@ abstract class Rooms {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

Map body = filters;
Expand Down Expand Up @@ -405,6 +405,7 @@ abstract class Rooms {

Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

final reponse = await http.post(
Expand Down
11 changes: 9 additions & 2 deletions lib/global/libs/matrix/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:convert';

// Package imports:
import 'package:http/http.dart' as http;
import 'package:syphon/global/values.dart';

/**
* https://matrix.org/docs/spec/client_server/latest#id295
Expand All @@ -28,7 +29,10 @@ class Search {
String since,
}) async {
String url = '$protocol$homeserver/_matrix/client/r0/user_directory/search';
Map<String, String> headers = {'Authorization': 'Bearer $accessToken'};
Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

Map body = {
"limit": 10,
Expand All @@ -54,7 +58,10 @@ class Search {
String since,
}) async {
String url = '$protocol$homeserver/_matrix/client/r0/publicRooms';
Map<String, String> headers = {'Authorization': 'Bearer $accessToken'};
Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
...Values.defaultHeaders,
};

Map body = {
"limit": 20,
Expand Down
Loading

0 comments on commit 4079387

Please sign in to comment.