Skip to content

Commit

Permalink
Updated dependencies, changed default sort filter settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jhomlala committed Jul 6, 2021
1 parent 5ecc4d3 commit 986dc62
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 71 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.2
* Updated dependencies
* Changed default sort filter of create time from ascending to descending. This will show latest HTTP calls on top of the list.

## 0.2.1
* Added directionality support (by Abdol Hussain Mozaffari https://github.com/mozaffari)
* Updated dependencies (by https://github.com/Nyan274)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Alice is an HTTP Inspector tool for Flutter which helps debugging http requests.

```yaml
dependencies:
alice: ^0.2.1
alice: ^0.2.2
```
2. Install it
Expand Down
67 changes: 44 additions & 23 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.13"
version: "0.2.2"
analyzer:
dependency: transitive
description:
Expand Down Expand Up @@ -42,7 +42,7 @@ packages:
name: better_player
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.63"
version: "0.0.70"
build:
dependency: transitive
description:
Expand Down Expand Up @@ -126,7 +126,7 @@ packages:
name: chopper
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0-nullsafety.0"
version: "4.0.1"
chopper_generator:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -196,7 +196,7 @@ packages:
name: dio
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0-prev3"
version: "4.0.0"
ffi:
dependency: transitive
description:
Expand Down Expand Up @@ -229,14 +229,14 @@ packages:
name: flutter_local_notifications
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
version: "6.0.0"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
name: flutter_local_notifications_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "4.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
Expand All @@ -248,7 +248,7 @@ packages:
name: flutter_widget_from_html_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.0-rc.2021031201"
version: "0.6.1+3"
glob:
dependency: transitive
description:
Expand Down Expand Up @@ -276,7 +276,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.1"
version: "0.13.3"
http_multi_server:
dependency: transitive
description:
Expand Down Expand Up @@ -346,7 +346,7 @@ packages:
name: open_file
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
version: "3.2.1"
package_config:
dependency: transitive
description:
Expand All @@ -360,7 +360,7 @@ packages:
name: package_info
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
path:
dependency: transitive
description:
Expand All @@ -374,7 +374,7 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.2"
path_provider_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -416,14 +416,21 @@ packages:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.1"
version: "8.1.2"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
version: "3.6.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -472,21 +479,21 @@ packages:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.26.0"
version: "0.27.1"
sensors:
dependency: transitive
description:
name: sensors
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.3"
share:
dependency: transitive
description:
name: share
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.4"
shelf:
dependency: transitive
description:
Expand Down Expand Up @@ -561,7 +568,7 @@ packages:
name: timezone
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.0-nullsafety.0"
version: "0.7.0"
timing:
dependency: transitive
description:
Expand Down Expand Up @@ -589,35 +596,42 @@ packages:
name: visibility_detector
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0-nullsafety.1"
version: "0.2.0"
wakelock:
dependency: transitive
description:
name: wakelock
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
version: "0.5.2"
wakelock_macos:
dependency: transitive
description:
name: wakelock_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
version: "0.1.0+1"
wakelock_platform_interface:
dependency: transitive
description:
name: wakelock_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
version: "0.2.1+1"
wakelock_web:
dependency: transitive
description:
name: wakelock_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
version: "0.2.0+1"
wakelock_windows:
dependency: transitive
description:
name: wakelock_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
watcher:
dependency: transitive
description:
Expand Down Expand Up @@ -646,6 +660,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.2"
yaml:
dependency: transitive
description:
Expand All @@ -655,4 +676,4 @@ packages:
version: "3.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0"
flutter: ">=2.2.0"
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ environment:
dependencies:
flutter:
sdk: flutter
chopper: ^4.0.0-nullsafety.0
chopper: ^4.0.1
path_provider:

dev_dependencies:
Expand Down
22 changes: 11 additions & 11 deletions lib/core/alice_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class AliceCore {
}

void _onCallsChanged() async {
if (callsSubject.value!.isNotEmpty) {
if (callsSubject.value.isNotEmpty) {
_notificationMessage = _getNotificationMessage();
if (_notificationMessage != _notificationMessageShown &&
!_notificationProcessing) {
Expand Down Expand Up @@ -135,7 +135,7 @@ class AliceCore {
BuildContext? getContext() => navigatorKey?.currentState?.overlay?.context;

String _getNotificationMessage() {
final List<AliceHttpCall> calls = callsSubject.value!;
final List<AliceHttpCall> calls = callsSubject.value;
final int successCalls = calls
.where((call) =>
call.response != null &&
Expand Down Expand Up @@ -206,7 +206,7 @@ class AliceCore {
final String? message = _notificationMessage;
await _flutterLocalNotificationsPlugin.show(
0,
"Alice (total: ${callsSubject.value!.length} requests)",
"Alice (total: ${callsSubject.value.length} requests)",
message,
platformChannelSpecifics,
payload: "");
Expand All @@ -217,9 +217,9 @@ class AliceCore {

/// Add alice http call to calls subject
void addCall(AliceHttpCall call) {
final callsCount = callsSubject.value?.length ?? 0;
final callsCount = callsSubject.value.length;
if (callsCount >= maxCallsCount) {
final originalCalls = callsSubject.value!;
final originalCalls = callsSubject.value;
final calls = List<AliceHttpCall>.from(originalCalls);
calls.sort(
(call1, call2) => call1.createdTime.compareTo(call2.createdTime));
Expand All @@ -228,7 +228,7 @@ class AliceCore {

callsSubject.add(originalCalls);
} else {
callsSubject.add([...callsSubject.value!, call]);
callsSubject.add([...callsSubject.value, call]);
}
}

Expand All @@ -242,7 +242,7 @@ class AliceCore {
}

selectedCall.error = error;
callsSubject.add([...callsSubject.value!]);
callsSubject.add([...callsSubject.value]);
}

/// Add response to existing alice http call
Expand All @@ -258,14 +258,14 @@ class AliceCore {
selectedCall.duration = response.time.millisecondsSinceEpoch -
selectedCall.request!.time.millisecondsSinceEpoch;

callsSubject.add([...callsSubject.value!]);
callsSubject.add([...callsSubject.value]);
}

/// Add alice http call to calls subject
void addHttpCall(AliceHttpCall aliceHttpCall) {
assert(aliceHttpCall.request != null, "Http call request can't be null");
assert(aliceHttpCall.response != null, "Http call response can't be null");
callsSubject.add([...callsSubject.value!, aliceHttpCall]);
callsSubject.add([...callsSubject.value, aliceHttpCall]);
}

/// Remove all calls from calls subject
Expand All @@ -274,10 +274,10 @@ class AliceCore {
}

AliceHttpCall? _selectCall(int requestId) =>
callsSubject.value!.firstWhereOrNull((call) => call.id == requestId);
callsSubject.value.firstWhereOrNull((call) => call.id == requestId);

/// Save all calls to file
void saveHttpRequests(BuildContext context) {
AliceSaveHelper.saveCalls(context, callsSubject.value!, _brightness);
AliceSaveHelper.saveCalls(context, callsSubject.value, _brightness);
}
}
4 changes: 2 additions & 2 deletions lib/ui/page/alice_calls_list_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class _AliceCallsListScreenState extends State<AliceCallsListScreen> {
final TextEditingController _queryTextEditingController =
TextEditingController();
final List<AliceMenuItem> _menuItems = [];
AliceSortOption? _sortOption;
bool _sortAscending = true;
AliceSortOption? _sortOption = AliceSortOption.time;
bool _sortAscending = false;

_AliceCallsListScreenState() {
_menuItems.add(AliceMenuItem("Sort", Icons.sort));
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/page/alice_stats_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,5 @@ class AliceStatsScreen extends StatelessWidget {
int _getUnsecuredRequests() =>
calls.where((call) => !call.secure).toList().length;

List<AliceHttpCall> get calls => aliceCore.callsSubject.valueWrapper!.value;
List<AliceHttpCall> get calls => aliceCore.callsSubject.value;
}
Loading

0 comments on commit 986dc62

Please sign in to comment.