[Flutter] fix dependency

This commit is contained in:
Christian Pauly 2019-10-04 09:44:32 +00:00
parent 97d3f1ece3
commit 846cc4b0fa
16 changed files with 97 additions and 154 deletions

View file

@ -14,10 +14,8 @@ coverage:
coverage: '/^\s+lines.+: (\d+.\d*%)/' coverage: '/^\s+lines.+: (\d+.\d*%)/'
dependencies: [] dependencies: []
script: script:
- sudo apt-get update -qq && sudo apt-get install -qq apt-transport-https curl gnupg lcov git - flutter pub get
- ./scripts/test.sh - flutter pub run test
- ./scripts/coverage.sh
- flutter pub pub publish --dry-run
code_analyze: code_analyze:
image: cirrusci/flutter image: cirrusci/flutter

View file

@ -33,7 +33,6 @@ The Detail part of the pattern should be a short description of what the branch
## Commit Messages ## Commit Messages
Commit Messages should get written in this pattern: `[[Module Name]] [Commit Message]`. Commit Messages should get written in this pattern: `[[Module Name]] [Commit Message]`.
That means for example: "[users] add fetch users endpoint". That means for example: "[users] add fetch users endpoint".

View file

@ -28,7 +28,6 @@ import 'dart:core';
import 'package:famedlysdk/src/Room.dart'; import 'package:famedlysdk/src/Room.dart';
import 'package:famedlysdk/src/RoomList.dart'; import 'package:famedlysdk/src/RoomList.dart';
import 'package:famedlysdk/src/utils/MatrixFile.dart'; import 'package:famedlysdk/src/utils/MatrixFile.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:mime_type/mime_type.dart'; import 'package:mime_type/mime_type.dart';
@ -46,13 +45,7 @@ enum HTTPType { GET, POST, PUT, DELETE }
class Connection { class Connection {
final Client client; final Client client;
Connection(this.client) { Connection(this.client);
WidgetsBinding.instance
?.addObserver(_LifecycleEventHandler(resumeCallBack: () {
_sync();
return;
}));
}
static String syncFilters = '{"room":{"state":{"lazy_load_members":true}}}'; static String syncFilters = '{"room":{"state":{"lazy_load_members":true}}}';
@ -134,11 +127,11 @@ class Connection {
/// ///
/// Sends [LoginState.logged] to [onLoginStateChanged]. /// Sends [LoginState.logged] to [onLoginStateChanged].
void connect( void connect(
{@required String newToken, {String newToken,
@required String newHomeserver, String newHomeserver,
@required String newUserID, String newUserID,
@required String newDeviceName, String newDeviceName,
@required String newDeviceID, String newDeviceID,
List<String> newMatrixVersions, List<String> newMatrixVersions,
bool newLazyLoadMembers, bool newLazyLoadMembers,
String newPrevBatch}) async { String newPrevBatch}) async {
@ -505,27 +498,4 @@ class Connection {
} }
} }
typedef _FutureVoidCallback = Future<void> Function();
class _LifecycleEventHandler extends WidgetsBindingObserver {
_LifecycleEventHandler({this.resumeCallBack, this.suspendingCallBack});
final _FutureVoidCallback resumeCallBack;
final _FutureVoidCallback suspendingCallBack;
@override
Future<Null> 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 } enum LoginState { logged, loggedOut }

View file

@ -20,7 +20,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with famedly. If not, see <http://www.gnu.org/licenses/>. * along with famedly. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:flutter/widgets.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
part 'SetPushersRequest.g.dart'; part 'SetPushersRequest.g.dart';
@ -48,13 +47,13 @@ class SetPushersRequest {
bool append; bool append;
SetPushersRequest({ SetPushersRequest({
@required this.lang, this.lang,
@required this.device_display_name, this.device_display_name,
@required this.app_display_name, this.app_display_name,
@required this.app_id, this.app_id,
@required this.kind, this.kind,
@required this.pushkey, this.pushkey,
@required this.data, this.data,
this.profile_tag, this.profile_tag,
this.append, this.append,
}); });

View file

@ -8,13 +8,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.36.3" version: "0.36.3"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.10"
args: args:
dependency: transitive dependency: transitive
description: description:
@ -148,16 +141,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.10.9" 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: front_end:
dependency: transitive dependency: transitive
description: description:
@ -207,13 +190,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.3" version: "3.1.3"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
io: io:
dependency: transitive dependency: transitive
description: description:
@ -284,6 +260,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.4" 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: package_config:
dependency: transitive dependency: transitive
description: description:
@ -312,13 +302,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0+1" version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
pool: pool:
dependency: transitive dependency: transitive
description: description:
@ -354,6 +337,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.7.5" 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: shelf_web_socket:
dependency: transitive dependency: transitive
description: description:
@ -361,11 +358,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.3" version: "0.2.3"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_gen: source_gen:
dependency: transitive dependency: transitive
description: description:
@ -373,6 +365,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.9.4+2" 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: source_span:
dependency: transitive dependency: transitive
description: description:
@ -415,13 +421,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
test:
dependency: "direct dev"
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted 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: timing:
dependency: transitive dependency: transitive
description: description:
@ -436,13 +456,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.6" version: "1.1.6"
vector_math: vm_service:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vm_service
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.1.1"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:
@ -457,13 +477,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.13" version: "1.0.13"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
yaml: yaml:
dependency: transitive dependency: transitive
description: description:
@ -472,4 +485,4 @@ packages:
source: hosted source: hosted
version: "2.1.16" version: "2.1.16"
sdks: sdks:
dart: ">=2.4.0 <3.0.0" dart: ">=2.3.0-dev.0.1 <3.0.0"

View file

@ -8,21 +8,12 @@ environment:
sdk: ">=2.1.0 <3.0.0" sdk: ">=2.1.0 <3.0.0"
dependencies: dependencies:
flutter:
sdk: flutter
http: ^0.12.0+2 http: ^0.12.0+2
mime_type: ^0.2.4 mime_type: ^0.2.4
#intl: ^0.16.0
json_annotation: ^2.4.0 json_annotation: ^2.4.0
dev_dependencies: dev_dependencies:
flutter_test: test: ^1.0.0
sdk: flutter
build_runner: ^1.5.2 build_runner: ^1.5.2
json_serializable: ^3.0.0 json_serializable: ^3.0.0
pedantic: ^1.5.0 # DO NOT UPDATE AS THIS WOULD CAUSE FLUTTER TO FAIL
pedantic: ^1.5.0 # DO NOT UPDATE AS THIS WOULD CAUSE FLUTTER TO FAIL
flutter:

View file

@ -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

View file

@ -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

View file

@ -21,7 +21,7 @@
* along with famedlysdk. If not, see <http://www.gnu.org/licenses/>. * along with famedlysdk. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:flutter_test/flutter_test.dart'; import 'package:test/test.dart';
import 'package:famedlysdk/src/utils/ChatTime.dart'; import 'package:famedlysdk/src/utils/ChatTime.dart';
void main() { void main() {

View file

@ -35,7 +35,7 @@ import 'package:famedlysdk/src/sync/EventUpdate.dart';
import 'package:famedlysdk/src/sync/RoomUpdate.dart'; import 'package:famedlysdk/src/sync/RoomUpdate.dart';
import 'package:famedlysdk/src/sync/UserUpdate.dart'; import 'package:famedlysdk/src/sync/UserUpdate.dart';
import 'package:famedlysdk/src/utils/MatrixFile.dart'; import 'package:famedlysdk/src/utils/MatrixFile.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:test/test.dart';
import 'FakeMatrixApi.dart'; import 'FakeMatrixApi.dart';
@ -50,15 +50,12 @@ void main() {
group("FluffyMatrix", () { group("FluffyMatrix", () {
/// Check if all Elements get created /// Check if all Elements get created
final create = (WidgetTester tester) { matrix = Client("testclient", debug: true);
matrix = Client("testclient", debug: true); matrix.connection.httpClient = FakeMatrixApi();
matrix.connection.httpClient = FakeMatrixApi();
roomUpdateListFuture = matrix.connection.onRoomUpdate.stream.toList(); roomUpdateListFuture = matrix.connection.onRoomUpdate.stream.toList();
eventUpdateListFuture = matrix.connection.onEvent.stream.toList(); eventUpdateListFuture = matrix.connection.onEvent.stream.toList();
userUpdateListFuture = matrix.connection.onUserEvent.stream.toList(); userUpdateListFuture = matrix.connection.onUserEvent.stream.toList();
};
testWidgets('should get created', create);
test('Login', () async { test('Login', () async {
Future<ErrorResponse> errorFuture = Future<ErrorResponse> errorFuture =
@ -250,9 +247,13 @@ void main() {
expect(eventUpdateList[1].type == "account_data", true); expect(eventUpdateList[1].type == "account_data", true);
}); });
testWidgets('should get created', create);
test('Login', () async { 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 = final bool checkResp =
await matrix.checkServer("https://fakeServer.notExisting"); await matrix.checkServer("https://fakeServer.notExisting");

View file

@ -25,7 +25,7 @@ import 'dart:convert';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:famedlysdk/src/RoomState.dart'; import 'package:famedlysdk/src/RoomState.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:test/test.dart';
import 'FakeMatrixApi.dart'; import 'FakeMatrixApi.dart';

View file

@ -21,7 +21,7 @@
* along with famedlysdk. If not, see <http://www.gnu.org/licenses/>. * along with famedlysdk. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:flutter_test/flutter_test.dart'; import 'package:test/test.dart';
import 'package:famedlysdk/src/Client.dart'; import 'package:famedlysdk/src/Client.dart';
import 'package:famedlysdk/src/utils/MxContent.dart'; import 'package:famedlysdk/src/utils/MxContent.dart';

View file

@ -27,7 +27,7 @@ import 'package:famedlysdk/src/User.dart';
import 'package:famedlysdk/src/sync/EventUpdate.dart'; import 'package:famedlysdk/src/sync/EventUpdate.dart';
import 'package:famedlysdk/src/sync/RoomUpdate.dart'; import 'package:famedlysdk/src/sync/RoomUpdate.dart';
import 'package:famedlysdk/src/utils/ChatTime.dart'; import 'package:famedlysdk/src/utils/ChatTime.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:test/test.dart';
void main() { void main() {
/// All Tests related to the MxContent /// All Tests related to the MxContent

View file

@ -29,7 +29,7 @@ import 'package:famedlysdk/src/Timeline.dart';
import 'package:famedlysdk/src/User.dart'; import 'package:famedlysdk/src/User.dart';
import 'package:famedlysdk/src/utils/ChatTime.dart'; import 'package:famedlysdk/src/utils/ChatTime.dart';
import 'package:famedlysdk/src/utils/MatrixFile.dart'; import 'package:famedlysdk/src/utils/MatrixFile.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:test/test.dart';
import 'FakeMatrixApi.dart'; import 'FakeMatrixApi.dart';

View file

@ -21,7 +21,7 @@
* along with famedlysdk. If not, see <http://www.gnu.org/licenses/>. * along with famedlysdk. If not, see <http://www.gnu.org/licenses/>.
*/ */
import 'package:flutter_test/flutter_test.dart'; import 'package:test/test.dart';
import 'package:famedlysdk/src/Client.dart'; import 'package:famedlysdk/src/Client.dart';
import 'package:famedlysdk/src/Room.dart'; import 'package:famedlysdk/src/Room.dart';
import 'package:famedlysdk/src/Timeline.dart'; import 'package:famedlysdk/src/Timeline.dart';

View file

@ -23,7 +23,7 @@
import 'package:famedlysdk/src/RoomState.dart'; import 'package:famedlysdk/src/RoomState.dart';
import 'package:famedlysdk/src/User.dart'; import 'package:famedlysdk/src/User.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:test/test.dart';
void main() { void main() {
/// All Tests related to the Event /// All Tests related to the Event