From 846cc4b0fa62be29b9f46c0df17bbd18e8323e1b Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 4 Oct 2019 09:44:32 +0000 Subject: [PATCH] [Flutter] fix dependency --- .gitlab-ci.yml | 6 +- CONTRIBUTING.md | 1 - lib/src/Connection.dart | 42 ++------- lib/src/requests/SetPushersRequest.dart | 15 ++-- pubspec.lock | 109 +++++++++++++----------- pubspec.yaml | 13 +-- scripts/coverage.sh | 17 ---- scripts/test.sh | 11 --- test/ChatTime_test.dart | 2 +- test/Client_test.dart | 23 ++--- test/Event_test.dart | 2 +- test/MxContent_test.dart | 2 +- test/RoomList_test.dart | 2 +- test/Room_test.dart | 2 +- test/Timeline_test.dart | 2 +- test/User_test.dart | 2 +- 16 files changed, 97 insertions(+), 154 deletions(-) delete mode 100755 scripts/coverage.sh delete mode 100755 scripts/test.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bf3c1bb..2dfeb6c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,10 +14,8 @@ coverage: coverage: '/^\s+lines.+: (\d+.\d*%)/' dependencies: [] script: - - sudo apt-get update -qq && sudo apt-get install -qq apt-transport-https curl gnupg lcov git - - ./scripts/test.sh - - ./scripts/coverage.sh - - flutter pub pub publish --dry-run + - flutter pub get + - flutter pub run test code_analyze: image: cirrusci/flutter diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 75f9e14..23afbbc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,7 +33,6 @@ The Detail part of the pattern should be a short description of what the branch ## Commit Messages Commit Messages should get written in this pattern: `[[Module Name]] [Commit Message]`. - That means for example: "[users] add fetch users endpoint". diff --git a/lib/src/Connection.dart b/lib/src/Connection.dart index 4742e32..538786e 100644 --- a/lib/src/Connection.dart +++ b/lib/src/Connection.dart @@ -28,7 +28,6 @@ import 'dart:core'; import 'package:famedlysdk/src/Room.dart'; import 'package:famedlysdk/src/RoomList.dart'; import 'package:famedlysdk/src/utils/MatrixFile.dart'; -import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'package:mime_type/mime_type.dart'; @@ -46,13 +45,7 @@ enum HTTPType { GET, POST, PUT, DELETE } class Connection { final Client client; - Connection(this.client) { - WidgetsBinding.instance - ?.addObserver(_LifecycleEventHandler(resumeCallBack: () { - _sync(); - return; - })); - } + Connection(this.client); static String syncFilters = '{"room":{"state":{"lazy_load_members":true}}}'; @@ -134,11 +127,11 @@ class Connection { /// /// Sends [LoginState.logged] to [onLoginStateChanged]. void connect( - {@required String newToken, - @required String newHomeserver, - @required String newUserID, - @required String newDeviceName, - @required String newDeviceID, + {String newToken, + String newHomeserver, + String newUserID, + String newDeviceName, + String newDeviceID, List newMatrixVersions, bool newLazyLoadMembers, String newPrevBatch}) async { @@ -505,27 +498,4 @@ class Connection { } } -typedef _FutureVoidCallback = Future Function(); - -class _LifecycleEventHandler extends WidgetsBindingObserver { - _LifecycleEventHandler({this.resumeCallBack, this.suspendingCallBack}); - - final _FutureVoidCallback resumeCallBack; - final _FutureVoidCallback suspendingCallBack; - - @override - Future didChangeAppLifecycleState(AppLifecycleState state) async { - switch (state) { - case AppLifecycleState.inactive: - case AppLifecycleState.paused: - case AppLifecycleState.suspending: - if (suspendingCallBack != null) await suspendingCallBack(); - break; - case AppLifecycleState.resumed: - if (resumeCallBack != null) await resumeCallBack(); - break; - } - } -} - enum LoginState { logged, loggedOut } diff --git a/lib/src/requests/SetPushersRequest.dart b/lib/src/requests/SetPushersRequest.dart index a839ae5..240ea21 100644 --- a/lib/src/requests/SetPushersRequest.dart +++ b/lib/src/requests/SetPushersRequest.dart @@ -20,7 +20,6 @@ * You should have received a copy of the GNU General Public License * along with famedly. If not, see . */ -import 'package:flutter/widgets.dart'; import 'package:json_annotation/json_annotation.dart'; part 'SetPushersRequest.g.dart'; @@ -48,13 +47,13 @@ class SetPushersRequest { bool append; SetPushersRequest({ - @required this.lang, - @required this.device_display_name, - @required this.app_display_name, - @required this.app_id, - @required this.kind, - @required this.pushkey, - @required this.data, + this.lang, + this.device_display_name, + this.app_display_name, + this.app_id, + this.kind, + this.pushkey, + this.data, this.profile_tag, this.append, }); diff --git a/pubspec.lock b/pubspec.lock index 2db5376..effcc1e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -8,13 +8,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.36.3" - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.10" args: dependency: transitive description: @@ -148,16 +141,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.10.9" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" front_end: dependency: transitive description: @@ -207,13 +190,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.3" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" io: dependency: transitive description: @@ -284,6 +260,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.2.4" + multi_server_socket: + dependency: transitive + description: + name: multi_server_socket + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + node_preamble: + dependency: transitive + description: + name: node_preamble + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.8" package_config: dependency: transitive description: @@ -312,13 +302,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0+1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" pool: dependency: transitive description: @@ -354,6 +337,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.7.5" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + shelf_static: + dependency: transitive + description: + name: shelf_static + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.8" shelf_web_socket: dependency: transitive description: @@ -361,11 +358,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.2.3" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" source_gen: dependency: transitive description: @@ -373,6 +365,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.9.4+2" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.5" + source_maps: + dependency: transitive + description: + name: source_maps + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.8" source_span: dependency: transitive description: @@ -415,13 +421,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + test: + dependency: "direct dev" + description: + name: test + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.2.8" + test_core: + dependency: transitive + description: + name: test_core + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.10" timing: dependency: transitive description: @@ -436,13 +456,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.6" - vector_math: + vm_service: dependency: transitive description: - name: vector_math + name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.1" watcher: dependency: transitive description: @@ -457,13 +477,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.13" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.5.0" yaml: dependency: transitive description: @@ -472,4 +485,4 @@ packages: source: hosted version: "2.1.16" sdks: - dart: ">=2.4.0 <3.0.0" + dart: ">=2.3.0-dev.0.1 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0b86e36..c408297 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,21 +8,12 @@ environment: sdk: ">=2.1.0 <3.0.0" dependencies: - flutter: - sdk: flutter - http: ^0.12.0+2 mime_type: ^0.2.4 - #intl: ^0.16.0 - json_annotation: ^2.4.0 dev_dependencies: - flutter_test: - sdk: flutter - + test: ^1.0.0 build_runner: ^1.5.2 json_serializable: ^3.0.0 - - pedantic: ^1.5.0 # DO NOT UPDATE AS THIS WOULD CAUSE FLUTTER TO FAIL -flutter: \ No newline at end of file + pedantic: ^1.5.0 # DO NOT UPDATE AS THIS WOULD CAUSE FLUTTER TO FAIL \ No newline at end of file diff --git a/scripts/coverage.sh b/scripts/coverage.sh deleted file mode 100755 index ff8014d..0000000 --- a/scripts/coverage.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -if [ -d "coverage" ] -then - ls -A ./coverage - if [ -z "$(ls -A ./coverage)" ]; then - exit 0 - else - if [ -f "coverage/lcov.info" ] - then - genhtml -o coverage coverage/lcov.info || exit 0 - else - exit 0 - fi - fi -else - exit 0 -fi \ No newline at end of file diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index c50f42f..0000000 --- a/scripts/test.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -if [ -d test ] -then - if [ -z "$(ls -A test)" ]; then - exit 0 - else - flutter test --coverage - fi -else - exit 0 -fi diff --git a/test/ChatTime_test.dart b/test/ChatTime_test.dart index cdfd512..e6e9ff4 100644 --- a/test/ChatTime_test.dart +++ b/test/ChatTime_test.dart @@ -21,7 +21,7 @@ * along with famedlysdk. If not, see . */ -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; import 'package:famedlysdk/src/utils/ChatTime.dart'; void main() { diff --git a/test/Client_test.dart b/test/Client_test.dart index 285d1a5..fd0ed4f 100644 --- a/test/Client_test.dart +++ b/test/Client_test.dart @@ -35,7 +35,7 @@ import 'package:famedlysdk/src/sync/EventUpdate.dart'; import 'package:famedlysdk/src/sync/RoomUpdate.dart'; import 'package:famedlysdk/src/sync/UserUpdate.dart'; import 'package:famedlysdk/src/utils/MatrixFile.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; import 'FakeMatrixApi.dart'; @@ -50,15 +50,12 @@ void main() { group("FluffyMatrix", () { /// Check if all Elements get created - final create = (WidgetTester tester) { - matrix = Client("testclient", debug: true); - matrix.connection.httpClient = FakeMatrixApi(); + matrix = Client("testclient", debug: true); + matrix.connection.httpClient = FakeMatrixApi(); - roomUpdateListFuture = matrix.connection.onRoomUpdate.stream.toList(); - eventUpdateListFuture = matrix.connection.onEvent.stream.toList(); - userUpdateListFuture = matrix.connection.onUserEvent.stream.toList(); - }; - testWidgets('should get created', create); + roomUpdateListFuture = matrix.connection.onRoomUpdate.stream.toList(); + eventUpdateListFuture = matrix.connection.onEvent.stream.toList(); + userUpdateListFuture = matrix.connection.onUserEvent.stream.toList(); test('Login', () async { Future errorFuture = @@ -250,9 +247,13 @@ void main() { expect(eventUpdateList[1].type == "account_data", true); }); - testWidgets('should get created', create); - test('Login', () async { + matrix = Client("testclient", debug: true); + matrix.connection.httpClient = FakeMatrixApi(); + + roomUpdateListFuture = matrix.connection.onRoomUpdate.stream.toList(); + eventUpdateListFuture = matrix.connection.onEvent.stream.toList(); + userUpdateListFuture = matrix.connection.onUserEvent.stream.toList(); final bool checkResp = await matrix.checkServer("https://fakeServer.notExisting"); diff --git a/test/Event_test.dart b/test/Event_test.dart index 3d32bf4..c74ac44 100644 --- a/test/Event_test.dart +++ b/test/Event_test.dart @@ -25,7 +25,7 @@ import 'dart:convert'; import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/src/RoomState.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; import 'FakeMatrixApi.dart'; diff --git a/test/MxContent_test.dart b/test/MxContent_test.dart index 8f4905a..9b2d5af 100644 --- a/test/MxContent_test.dart +++ b/test/MxContent_test.dart @@ -21,7 +21,7 @@ * along with famedlysdk. If not, see . */ -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; import 'package:famedlysdk/src/Client.dart'; import 'package:famedlysdk/src/utils/MxContent.dart'; diff --git a/test/RoomList_test.dart b/test/RoomList_test.dart index 2ebecfc..aa7fe11 100644 --- a/test/RoomList_test.dart +++ b/test/RoomList_test.dart @@ -27,7 +27,7 @@ import 'package:famedlysdk/src/User.dart'; import 'package:famedlysdk/src/sync/EventUpdate.dart'; import 'package:famedlysdk/src/sync/RoomUpdate.dart'; import 'package:famedlysdk/src/utils/ChatTime.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; void main() { /// All Tests related to the MxContent diff --git a/test/Room_test.dart b/test/Room_test.dart index 5d87181..3440eb0 100644 --- a/test/Room_test.dart +++ b/test/Room_test.dart @@ -29,7 +29,7 @@ import 'package:famedlysdk/src/Timeline.dart'; import 'package:famedlysdk/src/User.dart'; import 'package:famedlysdk/src/utils/ChatTime.dart'; import 'package:famedlysdk/src/utils/MatrixFile.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; import 'FakeMatrixApi.dart'; diff --git a/test/Timeline_test.dart b/test/Timeline_test.dart index 956f152..9d061c7 100644 --- a/test/Timeline_test.dart +++ b/test/Timeline_test.dart @@ -21,7 +21,7 @@ * along with famedlysdk. If not, see . */ -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; import 'package:famedlysdk/src/Client.dart'; import 'package:famedlysdk/src/Room.dart'; import 'package:famedlysdk/src/Timeline.dart'; diff --git a/test/User_test.dart b/test/User_test.dart index dcb6c22..4075e30 100644 --- a/test/User_test.dart +++ b/test/User_test.dart @@ -23,7 +23,7 @@ import 'package:famedlysdk/src/RoomState.dart'; import 'package:famedlysdk/src/User.dart'; -import 'package:flutter_test/flutter_test.dart'; +import 'package:test/test.dart'; void main() { /// All Tests related to the Event