Skip to content

Commit

Permalink
Update datetime is nulled regarding vpn status
Browse files Browse the repository at this point in the history
  • Loading branch information
nizwar committed Jul 21, 2024
1 parent 4bafad4 commit 933040d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/src/vpn_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ class OpenVPN {
var data = jsonDecode(value);
var connectedOn =
DateTime.tryParse(data["connected_on"].toString()) ??
_tempDateTime;
_tempDateTime ??
DateTime.now();
String byteIn =
data["byte_in"] != null ? data["byte_in"].toString() : "0";
String byteOut =
Expand All @@ -205,8 +206,7 @@ class OpenVPN {
if (byteOut.trim().isEmpty) byteOut = "0";
return VpnStatus(
connectedOn: connectedOn,
duration:
_duration(DateTime.now().difference(connectedOn!).abs()),
duration: _duration(DateTime.now().difference(connectedOn).abs()),
byteIn: byteIn,
byteOut: byteOut,
packetsIn: byteIn,
Expand Down

0 comments on commit 933040d

Please sign in to comment.