Send UA with request
This commit is contained in:
parent
497662a530
commit
99df462dea
6 changed files with 26 additions and 2 deletions
|
@ -23,6 +23,8 @@ PODS:
|
||||||
- Flutter
|
- Flutter
|
||||||
- flutter_sodium (0.0.1):
|
- flutter_sodium (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- flutter_user_agent (1.2.2):
|
||||||
|
- Flutter
|
||||||
- flutter_webview_plugin (0.0.1):
|
- flutter_webview_plugin (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- fluttercontactpicker (3.1.1):
|
- fluttercontactpicker (3.1.1):
|
||||||
|
@ -89,6 +91,7 @@ DEPENDENCIES:
|
||||||
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
||||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||||
- flutter_sodium (from `.symlinks/plugins/flutter_sodium/ios`)
|
- flutter_sodium (from `.symlinks/plugins/flutter_sodium/ios`)
|
||||||
|
- flutter_user_agent (from `.symlinks/plugins/flutter_user_agent/ios`)
|
||||||
- flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`)
|
- flutter_webview_plugin (from `.symlinks/plugins/flutter_webview_plugin/ios`)
|
||||||
- fluttercontactpicker (from `.symlinks/plugins/fluttercontactpicker/ios`)
|
- fluttercontactpicker (from `.symlinks/plugins/fluttercontactpicker/ios`)
|
||||||
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||||
|
@ -138,6 +141,8 @@ EXTERNAL SOURCES:
|
||||||
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
||||||
flutter_sodium:
|
flutter_sodium:
|
||||||
:path: ".symlinks/plugins/flutter_sodium/ios"
|
:path: ".symlinks/plugins/flutter_sodium/ios"
|
||||||
|
flutter_user_agent:
|
||||||
|
:path: ".symlinks/plugins/flutter_user_agent/ios"
|
||||||
flutter_webview_plugin:
|
flutter_webview_plugin:
|
||||||
:path: ".symlinks/plugins/flutter_webview_plugin/ios"
|
:path: ".symlinks/plugins/flutter_webview_plugin/ios"
|
||||||
fluttercontactpicker:
|
fluttercontactpicker:
|
||||||
|
@ -181,6 +186,7 @@ SPEC CHECKSUMS:
|
||||||
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
||||||
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
|
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
|
||||||
flutter_sodium: c84426b4de738514b5b66cfdeb8a06634e72fe0b
|
flutter_sodium: c84426b4de738514b5b66cfdeb8a06634e72fe0b
|
||||||
|
flutter_user_agent: 27c45d034dc31b80948d29998cea52cd3a7bf936
|
||||||
flutter_webview_plugin: ed9e8a6a96baf0c867e90e1bce2673913eeac694
|
flutter_webview_plugin: ed9e8a6a96baf0c867e90e1bce2673913eeac694
|
||||||
fluttercontactpicker: ff27c428495f982a1b04a6c3015052bfff25bb05
|
fluttercontactpicker: ff27c428495f982a1b04a6c3015052bfff25bb05
|
||||||
fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58
|
fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58
|
||||||
|
|
|
@ -268,6 +268,7 @@
|
||||||
"${BUILT_PRODUCTS_DIR}/flutter_keyboard_visibility/flutter_keyboard_visibility.framework",
|
"${BUILT_PRODUCTS_DIR}/flutter_keyboard_visibility/flutter_keyboard_visibility.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/flutter_secure_storage/flutter_secure_storage.framework",
|
"${BUILT_PRODUCTS_DIR}/flutter_secure_storage/flutter_secure_storage.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/flutter_sodium/flutter_sodium.framework",
|
"${BUILT_PRODUCTS_DIR}/flutter_sodium/flutter_sodium.framework",
|
||||||
|
"${BUILT_PRODUCTS_DIR}/flutter_user_agent/flutter_user_agent.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/flutter_webview_plugin/flutter_webview_plugin.framework",
|
"${BUILT_PRODUCTS_DIR}/flutter_webview_plugin/flutter_webview_plugin.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/fluttercontactpicker/fluttercontactpicker.framework",
|
"${BUILT_PRODUCTS_DIR}/fluttercontactpicker/fluttercontactpicker.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/fluttertoast/fluttertoast.framework",
|
"${BUILT_PRODUCTS_DIR}/fluttertoast/fluttertoast.framework",
|
||||||
|
@ -303,6 +304,7 @@
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_keyboard_visibility.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_keyboard_visibility.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_secure_storage.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_secure_storage.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_sodium.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_sodium.framework",
|
||||||
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_user_agent.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_webview_plugin.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_webview_plugin.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fluttercontactpicker.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fluttercontactpicker.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fluttertoast.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fluttertoast.framework",
|
||||||
|
|
|
@ -3,13 +3,17 @@ import 'dart:developer';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter_user_agent/flutter_user_agent.dart';
|
||||||
import 'package:pretty_dio_logger/pretty_dio_logger.dart';
|
import 'package:pretty_dio_logger/pretty_dio_logger.dart';
|
||||||
import 'package:super_logging/super_logging.dart';
|
import 'package:super_logging/super_logging.dart';
|
||||||
|
|
||||||
class Network {
|
class Network {
|
||||||
final _dio = Dio();
|
Dio _dio;
|
||||||
|
|
||||||
Network._privateConstructor() {
|
Future<void> init() async {
|
||||||
|
await FlutterUserAgent.init();
|
||||||
|
_dio = Dio(BaseOptions(
|
||||||
|
headers: {HttpHeaders.userAgentHeader: FlutterUserAgent.userAgent}));
|
||||||
_dio.interceptors.add(PrettyDioLogger(
|
_dio.interceptors.add(PrettyDioLogger(
|
||||||
requestHeader: false,
|
requestHeader: false,
|
||||||
responseHeader: false,
|
responseHeader: false,
|
||||||
|
@ -27,6 +31,8 @@ class Network {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Network._privateConstructor();
|
||||||
static Network instance = Network._privateConstructor();
|
static Network instance = Network._privateConstructor();
|
||||||
|
|
||||||
Dio getDio() => _dio;
|
Dio getDio() => _dio;
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'package:in_app_purchase/in_app_purchase.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:photos/core/constants.dart';
|
import 'package:photos/core/constants.dart';
|
||||||
import 'package:photos/core/configuration.dart';
|
import 'package:photos/core/configuration.dart';
|
||||||
|
import 'package:photos/core/network.dart';
|
||||||
import 'package:photos/services/billing_service.dart';
|
import 'package:photos/services/billing_service.dart';
|
||||||
import 'package:photos/services/collections_service.dart';
|
import 'package:photos/services/collections_service.dart';
|
||||||
import 'package:photos/services/memories_service.dart';
|
import 'package:photos/services/memories_service.dart';
|
||||||
|
@ -96,6 +97,7 @@ Future<void> _init(bool isBackground) async {
|
||||||
_logger.info("Initializing...");
|
_logger.info("Initializing...");
|
||||||
InAppPurchaseConnection.enablePendingPurchases();
|
InAppPurchaseConnection.enablePendingPurchases();
|
||||||
CryptoUtil.init();
|
CryptoUtil.init();
|
||||||
|
await Network.instance.init();
|
||||||
await Configuration.instance.init();
|
await Configuration.instance.init();
|
||||||
await BillingService.instance.init();
|
await BillingService.instance.init();
|
||||||
await CollectionsService.instance.init();
|
await CollectionsService.instance.init();
|
||||||
|
|
|
@ -326,6 +326,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.3"
|
version: "1.9.3"
|
||||||
|
flutter_user_agent:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_user_agent
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.2.2"
|
||||||
flutter_web_plugins:
|
flutter_web_plugins:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
|
|
@ -77,6 +77,7 @@ dependencies:
|
||||||
package_info_plus: ^0.6.4
|
package_info_plus: ^0.6.4
|
||||||
local_auth: ^1.1.0
|
local_auth: ^1.1.0
|
||||||
flutter_windowmanager: ^0.0.2
|
flutter_windowmanager: ^0.0.2
|
||||||
|
flutter_user_agent: ^1.2.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
Loading…
Add table
Reference in a new issue