Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
auto_track_plugin
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Dubhe
2024-05-06 22:51:28 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
69d3bd9060da84f48dd6983d2cf50bbd198945a3
69d3bd90
1 parent
af74392f
fix: add device id
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
13 deletions
lib/auto_track/config/manager.dart
lib/auto_track/config/queue.dart
pubspec.yaml
lib/auto_track/config/manager.dart
View file @
69d3bd9
...
...
@@ -16,6 +16,7 @@ class AutoTrackConfigManager {
DeviceInfoPlugin
().
deviceInfo
.
then
((
value
)
{
_deviceInfo
=
value
.
data
;
_baseDeviceInfo
=
value
;
_updateDeviceId
();
});
}
...
...
@@ -23,8 +24,8 @@ class AutoTrackConfigManager {
String
get
appVersion
=>
_appVersion
;
BaseDeviceInfo
?
_baseDeviceInfo
;
String
_deviceId
=
''
;
String
get
deviceId
=>
_deviceId
;
String
?
_deviceId
;
String
?
get
deviceId
=>
_deviceId
;
Map
<
String
,
dynamic
>
_deviceInfo
=
{};
Map
<
String
,
dynamic
>
get
deviceInfo
=>
_deviceInfo
;
...
...
@@ -37,6 +38,15 @@ class AutoTrackConfigManager {
void
updateConfig
(
AutoTrackConfig
config
)
{
_config
=
config
;
_updateDeviceId
();
if
(
config
.
enableUpload
)
{
AutoTrackQueue
.
instance
.
start
();
}
else
{
AutoTrackQueue
.
instance
.
stop
();
}
}
void
_updateDeviceId
()
{
if
(
_baseDeviceInfo
is
IosDeviceInfo
)
{
_deviceId
=
md5
.
convert
(
utf8
.
encode
(
'
${(_baseDeviceInfo as IosDeviceInfo).identifierForVendor}
#
${config.appKey}
'
)).
toString
();
}
else
if
(
_baseDeviceInfo
is
AndroidDeviceInfo
)
{
...
...
@@ -44,12 +54,7 @@ class AutoTrackConfigManager {
}
else
if
(
_baseDeviceInfo
is
MacOsDeviceInfo
)
{
_deviceId
=
'
${(_baseDeviceInfo as MacOsDeviceInfo).hostName}
-
${(_baseDeviceInfo as MacOsDeviceInfo).computerName}
'
;
}
else
{
_deviceId
=
''
;
}
if
(
config
.
enableUpload
)
{
AutoTrackQueue
.
instance
.
start
();
}
else
{
AutoTrackQueue
.
instance
.
stop
();
_deviceId
=
null
;
}
}
...
...
@@ -108,7 +113,7 @@ class AutoTrackConfigManager {
AutoTrackPageConfig
getPageConfig
(
Widget
pageWidget
)
{
return
_config
.
pageConfigs
.
firstWhere
(
(
pageConfig
)
=>
pageConfig
.
isPageWidget
!(
pageWidget
),
(
pageConfig
)
=>
pageConfig
.
isPageWidget
!(
pageWidget
),
orElse:
()
=>
AutoTrackPageConfig
());
}
...
...
@@ -144,4 +149,4 @@ class AutoTrackConfigManager {
bool
get
dragEnable
=>
_config
.
enableDrag
;
bool
get
ignoreNullKeyEnable
=>
_config
.
enableIgnoreNullKey
;
}
}
\ No newline at end of file
...
...
lib/auto_track/config/queue.dart
View file @
69d3bd9
...
...
@@ -40,7 +40,7 @@ class AutoTrackQueue {
final
config
=
AutoTrackConfigManager
.
instance
.
config
;
final
host
=
config
.
host
;
if
(
host
!=
null
)
{
final
t
=
DateTime
.
now
().
millisecond
;
final
t
=
DateTime
.
now
().
millisecond
sSinceEpoch
;
dio
.
post
(
host
,
data:
{
'app_key'
:
config
.
appKey
??
''
,
'signature'
:
config
.
signature
!(
t
),
...
...
@@ -57,4 +57,4 @@ class AutoTrackQueue {
});
}
}
}
}
\ No newline at end of file
...
...
pubspec.yaml
View file @
69d3bd9
name
:
auto_track
description
:
"
Auto
Track
Plugin"
version
:
0.0.
1
version
:
0.0.
2
homepage
:
https://github.com/epoll-j/auto_track_plugin
environment
:
...
...
Please
register
or
login
to post a comment