Show network requests in debug build using alice

This commit is contained in:
Neeraj Gupta 2021-10-08 12:14:35 +05:30
parent 66da65446d
commit ba16a6a887
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
7 changed files with 135 additions and 14 deletions

View file

@ -1,6 +1,10 @@
PODS:
- background_fetch (1.0.1):
- Flutter
- better_player (0.0.1):
- Flutter
- KTVHTTPCache (~> 2.0.0)
- CocoaAsyncSocket (7.6.5)
- connectivity (0.0.1):
- Flutter
- Reachability
@ -42,6 +46,10 @@ PODS:
- Flutter
- in_app_purchase (0.0.1):
- Flutter
- KTVCocoaHTTPServer (1.0.0):
- CocoaAsyncSocket
- KTVHTTPCache (2.0.1):
- KTVCocoaHTTPServer
- libwebp (1.1.0):
- libwebp/demux (= 1.1.0)
- libwebp/mux (= 1.1.0)
@ -67,6 +75,8 @@ PODS:
- Flutter
- path_provider (0.0.1):
- Flutter
- "permission_handler (5.1.0+2)":
- Flutter
- photo_manager (1.0.0):
- Flutter
- FlutterMacOS
@ -77,6 +87,8 @@ PODS:
- SDWebImageWebPCoder (0.6.1):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.7)
- sensors (0.0.1):
- Flutter
- Sentry (7.1.3):
- Sentry/Core (= 7.1.3)
- Sentry/Core (7.1.3)
@ -84,6 +96,8 @@ PODS:
- Flutter
- FlutterMacOS
- Sentry (~> 7.1.3)
- share (0.0.1):
- Flutter
- share_plus (0.0.1):
- Flutter
- shared_preferences (0.0.1):
@ -106,6 +120,7 @@ PODS:
DEPENDENCIES:
- background_fetch (from `.symlinks/plugins/background_fetch/ios`)
- better_player (from `.symlinks/plugins/better_player/ios`)
- connectivity (from `.symlinks/plugins/connectivity/ios`)
- device_info (from `.symlinks/plugins/device_info/ios`)
- fk_user_agent (from `.symlinks/plugins/fk_user_agent/ios`)
@ -127,9 +142,12 @@ DEPENDENCIES:
- open_file (from `.symlinks/plugins/open_file/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- photo_manager (from `.symlinks/plugins/photo_manager/ios`)
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
- sensors (from `.symlinks/plugins/sensors/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- share (from `.symlinks/plugins/share/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
@ -141,7 +159,10 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- CocoaAsyncSocket
- FMDB
- KTVCocoaHTTPServer
- KTVHTTPCache
- libwebp
- Mantle
- OrderedSet
@ -154,6 +175,8 @@ SPEC REPOS:
EXTERNAL SOURCES:
background_fetch:
:path: ".symlinks/plugins/background_fetch/ios"
better_player:
:path: ".symlinks/plugins/better_player/ios"
connectivity:
:path: ".symlinks/plugins/connectivity/ios"
device_info:
@ -196,12 +219,18 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
permission_handler:
:path: ".symlinks/plugins/permission_handler/ios"
photo_manager:
:path: ".symlinks/plugins/photo_manager/ios"
receive_sharing_intent:
:path: ".symlinks/plugins/receive_sharing_intent/ios"
sensors:
:path: ".symlinks/plugins/sensors/ios"
sentry_flutter:
:path: ".symlinks/plugins/sentry_flutter/ios"
share:
:path: ".symlinks/plugins/share/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences:
@ -221,6 +250,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
background_fetch: 2edffc19a5a465c47f073efa35db57f7910738fa
better_player: a4383402f457e53720525888c0fc5d337ef6ba11
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
fk_user_agent: 1f47ec39291e8372b1d692b50084b0d54103c545
@ -237,6 +268,8 @@ SPEC CHECKSUMS:
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_editor: c1d038630eedea60d2dee9c14f36aa66c7f9cfab
in_app_purchase: 3e2155afa9d03d4fa32d9e62d567885080ce97d6
KTVCocoaHTTPServer: df8d7b861e603ff8037e9b2138aca2563a6b768d
KTVHTTPCache: 588c3eb16f6bd1e6fde1e230dabfb7bd4e490a4d
libwebp: 946cb3063cea9236285f7e9a8505d806d30e07f3
local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd
Mantle: 35238ae6f2e2b2d474fa7b67fee82a59fea71915
@ -246,13 +279,16 @@ SPEC CHECKSUMS:
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
photo_manager: 84fa94fbeb82e607333ea9a13c43b58e0903a463
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1
SDWebImage: 97351f6582ceca541ea294ba66a1fcb342a331c2
SDWebImageWebPCoder: d0dac55073088d24b2ac1b191a71a8f8d0adac21
sensors: 84eb7a30e47a649e4172b71d6e81be614c280336
Sentry: 6d963d64804dd06d96e778be729613f481394312
sentry_flutter: f20d4f199442900fbdab2b8496f1d2091d8b94d9
share: 0b2c3e82132f5888bccca3351c504d0003b3b410
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904

View file

@ -248,7 +248,10 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/CocoaAsyncSocket/CocoaAsyncSocket.framework",
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
"${BUILT_PRODUCTS_DIR}/KTVCocoaHTTPServer/KTVCocoaHTTPServer.framework",
"${BUILT_PRODUCTS_DIR}/KTVHTTPCache/KTVHTTPCache.framework",
"${BUILT_PRODUCTS_DIR}/Mantle/Mantle.framework",
"${BUILT_PRODUCTS_DIR}/OrderedSet/OrderedSet.framework",
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
@ -257,6 +260,7 @@
"${BUILT_PRODUCTS_DIR}/Sentry/Sentry.framework",
"${BUILT_PRODUCTS_DIR}/Toast/Toast.framework",
"${BUILT_PRODUCTS_DIR}/background_fetch/background_fetch.framework",
"${BUILT_PRODUCTS_DIR}/better_player/better_player.framework",
"${BUILT_PRODUCTS_DIR}/connectivity/connectivity.framework",
"${BUILT_PRODUCTS_DIR}/device_info/device_info.framework",
"${BUILT_PRODUCTS_DIR}/fk_user_agent/fk_user_agent.framework",
@ -280,7 +284,9 @@
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
"${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework",
"${BUILT_PRODUCTS_DIR}/receive_sharing_intent/receive_sharing_intent.framework",
"${BUILT_PRODUCTS_DIR}/sensors/sensors.framework",
"${BUILT_PRODUCTS_DIR}/sentry_flutter/sentry_flutter.framework",
"${BUILT_PRODUCTS_DIR}/share/share.framework",
"${BUILT_PRODUCTS_DIR}/share_plus/share_plus.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
@ -292,7 +298,10 @@
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaAsyncSocket.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KTVCocoaHTTPServer.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KTVHTTPCache.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mantle.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OrderedSet.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework",
@ -301,6 +310,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sentry.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Toast.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/background_fetch.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/better_player.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fk_user_agent.framework",
@ -324,7 +334,9 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/receive_sharing_intent.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sensors.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sentry_flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share_plus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",

View file

@ -1,15 +1,18 @@
import 'dart:io';
import 'package:alice/alice.dart';
import 'package:dio/dio.dart';
import 'package:fk_user_agent/fk_user_agent.dart';
import 'package:flutter/foundation.dart';
import 'package:package_info_plus/package_info_plus.dart';
int kConnectTimeout = 15000;
class Network {
Dio _dio;
Alice _alice;
Future<void> init() async {
_alice = Alice(darkTheme: true, showInspectorOnShake: true);
await FkUserAgent.init();
final packageInfo = await PackageInfo.fromPlatform();
_dio = Dio(BaseOptions(connectTimeout: kConnectTimeout, headers: {
@ -17,6 +20,7 @@ class Network {
'X-Client-Version': packageInfo.version,
'X-Client-Package': packageInfo.packageName,
}));
_dio.interceptors.add(_alice.getDioInterceptor());
}
Network._privateConstructor();
@ -24,4 +28,5 @@ class Network {
static Network instance = Network._privateConstructor();
Dio getDio() => _dio;
Alice getAlice() => _alice;
}

View file

@ -246,6 +246,7 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {
theme: themeData,
home: EnteApp._homeWidget,
debugShowCheckedModeBanner: false,
navigatorKey: Network.instance.getAlice().getNavigatorKey(),
builder: EasyLoading.init(),
supportedLocales: L10n.all,
localizationsDelegates: [

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_sodium/flutter_sodium.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/core/network.dart';
import 'package:photos/ui/settings/settings_section_title.dart';
import 'package:photos/ui/settings/settings_text_item.dart';
@ -21,6 +22,14 @@ class DebugSectionWidget extends StatelessWidget {
child: SettingsTextItem(
text: "key attributes", icon: Icons.navigate_next),
),
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () async {
Network.instance.getAlice().showInspector();
},
child: SettingsTextItem(
text: "network requests", icon: Icons.navigate_next),
)
]),
);
}

View file

@ -1,6 +1,13 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
alice:
dependency: "direct main"
description:
name: alice
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4"
animate_do:
dependency: "direct main"
description:
@ -36,6 +43,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
better_player:
dependency: transitive
description:
name: better_player
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.73"
boolean_selector:
dependency: transitive
description:
@ -71,6 +85,13 @@ packages:
relative: true
source: path
version: "1.2.2"
chopper:
dependency: transitive
description:
name: chopper
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.1"
clock:
dependency: transitive
description:
@ -357,14 +378,14 @@ packages:
name: flutter_local_notifications
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0+4"
version: "8.2.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.1"
flutter_localizations:
dependency: "direct main"
description: flutter
@ -429,6 +450,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_widget_from_html_core:
dependency: transitive
description:
name: flutter_widget_from_html_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.2"
flutter_windowmanager:
dependency: "direct main"
description:
@ -633,42 +661,42 @@ packages:
name: package_info_plus
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.3.0"
package_info_plus_linux:
dependency: transitive
description:
name: package_info_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
version: "1.0.3"
package_info_plus_macos:
dependency: transitive
description:
name: package_info_plus_macos
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.2.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.2"
package_info_plus_web:
dependency: transitive
description:
name: package_info_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.4"
package_info_plus_windows:
dependency: transitive
description:
name: package_info_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.4"
page_transition:
dependency: "direct main"
description:
@ -724,14 +752,28 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
version: "1.11.1"
permission_handler:
dependency: transitive
description:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "8.2.2"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.7.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
version: "4.3.0"
photo_manager:
dependency: "direct main"
description:
@ -812,7 +854,7 @@ packages:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.27.0"
version: "0.27.2"
scrollable_positioned_list:
dependency: "direct main"
description:
@ -820,6 +862,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.10"
sensors:
dependency: transitive
description:
name: sensors
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
sentry:
dependency: "direct main"
description:
@ -834,6 +883,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
share:
dependency: transitive
description:
name: share
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
share_plus:
dependency: "direct main"
description:
@ -1027,7 +1083,7 @@ packages:
name: timezone
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.0"
version: "0.8.0"
typed_data:
dependency: transitive
description:
@ -1216,7 +1272,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.1"
version: "5.3.0"
yaml:
dependency: transitive
description:

View file

@ -17,6 +17,7 @@ environment:
sdk: ">=2.10.0 <3.0.0"
dependencies:
alice: ^0.2.4
animate_do: ^2.0.0
archive: ^3.1.2
background_fetch: ^1.0.1
@ -105,6 +106,7 @@ dependencies:
dependency_overrides:
provider: ^6.0.1 # for chewie 1.2.2 https://github.com/brianegan/chewie/issues/530
flutter_local_notifications: ^8.1.1
dev_dependencies:
flutter_launcher_icons: "0.9.0"