Skip to content

Commit d30ed69

Browse files
authored
Merge pull request #38 from jcardus/wuizi-m
main
2 parents ce9fda5 + 6cb1e11 commit d30ed69

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

lib/models/position.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Position {
4747
course: (json['course'] as num?)?.toDouble() ?? 0.0,
4848
address: json['address'] as String?,
4949
accuracy: (json['accuracy'] as num?)?.toDouble(),
50-
batteryLevel: json['attributes']?['batteryLevel'] as int?,
50+
batteryLevel: (json['attributes']?['batteryLevel'] as num?)?.toInt(),
5151
attributes: json['attributes'] as Map<String, dynamic>?,
5252
);
5353
}

lib/services/socket_service.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ class SocketService {
2626
Future<bool> connect() async {
2727
if (_disposed || kIsWeb) return false;
2828

29-
final base = traccarBaseUrl;
30-
if (base.isEmpty) return false;
31-
32-
final wsScheme = base.startsWith('https') ? 'wss' : 'ws';
33-
final wsUrl = '${base.replaceFirst(RegExp('^https?'), wsScheme)}/api/socket';
29+
var wsUrl = String.fromEnvironment('WEBSOCKET_URL');
30+
if (wsUrl.isEmpty) {
31+
final base = traccarBaseUrl;
32+
if (base.isEmpty) return false;
33+
final wsScheme = base.startsWith('https') ? 'wss' : 'ws';
34+
wsUrl = '${base.replaceFirst(RegExp('^https?'), wsScheme)}/api/socket';
35+
}
3436

3537
try {
3638
final cookie = await AuthService().getCookie();

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: manager
22
description: "Wuizy"
33
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
44

5-
version: 3.3.8+1
5+
version: 3.3.12+1
66

77
environment:
88
sdk: ^3.9.2

0 commit comments

Comments
 (0)