-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* EWM-352. user agent * EWM-352. Add check url with http and without www * EWM-352. after analyze
- Loading branch information
1 parent
85ec4a1
commit 57654c1
Showing
6 changed files
with
127 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:device_info_plus/device_info_plus.dart'; | ||
|
||
Future<String> platformUserAgent = (() async => | ||
Platform.isIOS ? await _iOSUserAgent : await _androidUserAgent)(); | ||
|
||
Future<String> get _androidUserAgent async { | ||
String? androidVersion; | ||
String? deviceModel; | ||
String? buildId; | ||
|
||
try { | ||
final deviceInfo = DeviceInfoPlugin(); | ||
final androidInfo = await deviceInfo.androidInfo; | ||
androidVersion = androidInfo.version.release; | ||
deviceModel = '; ${androidInfo.model}'; | ||
buildId = ' Build/${androidInfo.id}'; | ||
} catch (_) { | ||
androidVersion = '12'; | ||
} | ||
|
||
return 'Mozilla/5.0 ' | ||
'(Linux; ' | ||
'Android $androidVersion$deviceModel$buildId) ' | ||
'AppleWebKit/537.36 (KHTML, like Gecko) ' | ||
'Chrome/117.0.0.0 Mobile Safari/537.36'; | ||
} | ||
|
||
Future<String> get _iOSUserAgent async { | ||
String? iosVersion; | ||
String? deviceModel; | ||
|
||
try { | ||
final deviceInfo = DeviceInfoPlugin(); | ||
final iosInfo = await deviceInfo.iosInfo; | ||
iosVersion = iosInfo.systemVersion; | ||
deviceModel = iosInfo.utsname.machine; | ||
} catch (_) { | ||
deviceModel = 'iPhone'; | ||
iosVersion = '15_0'; | ||
} | ||
|
||
return 'Mozilla/5.0 ($deviceModel; ' | ||
'CPU iPhone OS $iosVersion like Mac OS X) ' | ||
'AppleWebKit/605.1.15 (KHTML, like Gecko) ' | ||
'Version/$iosVersion Mobile/15E148 Safari/604.1'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters