redesign app phase 2
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:android_id/android_id.dart';
|
||||
import 'package:chopper/chopper.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:finamp/services/http_aggregate_logging_interceptor.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
@@ -422,19 +423,28 @@ Future<String> getAuthHeader() async {
|
||||
}
|
||||
|
||||
authHeader = '${authHeader}Client="Finamp", ';
|
||||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||
if (Platform.isAndroid) {
|
||||
if (kIsWeb) {
|
||||
authHeader = '${authHeader}Device="Web Browser", ';
|
||||
authHeader = '${authHeader}DeviceId="finamp-web", ';
|
||||
} else if (Platform.isAndroid) {
|
||||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||
AndroidDeviceInfo androidDeviceInfo = await deviceInfo.androidInfo;
|
||||
authHeader = '${authHeader}Device="${androidDeviceInfo.model}", ';
|
||||
final androidId = await const AndroidId().getId();
|
||||
authHeader = '${authHeader}DeviceId="$androidId", ';
|
||||
} else if (Platform.isIOS) {
|
||||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||
IosDeviceInfo iosDeviceInfo = await deviceInfo.iosInfo;
|
||||
authHeader = '${authHeader}Device="${iosDeviceInfo.name}", ';
|
||||
authHeader =
|
||||
'${authHeader}DeviceId="${iosDeviceInfo.identifierForVendor}", ';
|
||||
} else {
|
||||
throw "getAuthHeader() only supports Android and iOS";
|
||||
final deviceName = "Finamp ${Platform.operatingSystem}";
|
||||
final deviceId =
|
||||
"finamp-${Platform.operatingSystem}-${Platform.localHostname}";
|
||||
|
||||
authHeader = '${authHeader}Device="$deviceName", ';
|
||||
authHeader = '${authHeader}DeviceId="$deviceId", ';
|
||||
}
|
||||
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
|
||||
Reference in New Issue
Block a user