|
1 | 1 | import 'dart:io';
|
2 | 2 | import 'dart:math';
|
3 | 3 | import 'package:http/http.dart' as http;
|
4 |
| -import 'package:package_info_plus/package_info_plus.dart'; |
5 |
| -import 'package:device_info_plus/device_info_plus.dart'; |
6 | 4 | import 'package:http/io_client.dart';
|
7 | 5 | import 'client_mixin.dart';
|
8 | 6 | import 'client_base.dart';
|
@@ -90,59 +88,6 @@ class ClientIO extends ClientBase with ClientMixin {
|
90 | 88 | _headers![key] = value;
|
91 | 89 | return this;
|
92 | 90 | }
|
93 |
| - |
94 |
| - Future init() async { |
95 |
| - if (_initProgress) return; |
96 |
| - _initProgress = true; |
97 |
| - final Directory cookieDir = await _getCookiePath(); |
98 |
| - _cookieJar = PersistCookieJar(storage: FileStorage(cookieDir.path)); |
99 |
| - _interceptors.add(CookieManager(_cookieJar)); |
100 |
| - |
101 |
| - var device = ''; |
102 |
| - try { |
103 |
| - PackageInfo packageInfo = await PackageInfo.fromPlatform(); |
104 |
| - addHeader( |
105 |
| - 'Origin', |
106 |
| - '{{spec.title | caseLower}}-${Platform.operatingSystem}://${packageInfo.packageName}', |
107 |
| - ); |
108 |
| - |
109 |
| - //creating custom user agent |
110 |
| - DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); |
111 |
| - if (Platform.isAndroid) { |
112 |
| - final andinfo = await deviceInfoPlugin.androidInfo; |
113 |
| - device = |
114 |
| - '(Linux; U; Android ${andinfo.version.release}; ${andinfo.brand} ${andinfo.model})'; |
115 |
| - } |
116 |
| - if (Platform.isIOS) { |
117 |
| - final iosinfo = await deviceInfoPlugin.iosInfo; |
118 |
| - device = '${iosinfo.utsname.machine} iOS/${iosinfo.systemVersion}'; |
119 |
| - } |
120 |
| - if (Platform.isLinux) { |
121 |
| - final lininfo = await deviceInfoPlugin.linuxInfo; |
122 |
| - device = '(Linux; U; ${lininfo.id} ${lininfo.version})'; |
123 |
| - } |
124 |
| - if (Platform.isWindows) { |
125 |
| - final wininfo = await deviceInfoPlugin.windowsInfo; |
126 |
| - device = |
127 |
| - '(Windows NT; ${wininfo.computerName})'; //can't seem to get much info here |
128 |
| - } |
129 |
| - if (Platform.isMacOS) { |
130 |
| - final macinfo = await deviceInfoPlugin.macOsInfo; |
131 |
| - device = '(Macintosh; ${macinfo.model})'; |
132 |
| - } |
133 |
| - addHeader( |
134 |
| - 'user-agent', |
135 |
| - '${packageInfo.packageName}/${packageInfo.version} $device', |
136 |
| - ); |
137 |
| - } catch (e) { |
138 |
| - debugPrint('Error getting device info: $e'); |
139 |
| - device = Platform.operatingSystem; |
140 |
| - addHeader('user-agent', '$device'); |
141 |
| - } |
142 |
| - |
143 |
| - _initialized = true; |
144 |
| - _initProgress = false; |
145 |
| - } |
146 | 91 |
|
147 | 92 | @override
|
148 | 93 | Future<Response> chunkedUpload({
|
|
0 commit comments