Skip to content

Commit

Permalink
reverted unused changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TimHoogstrate committed Nov 13, 2023
1 parent 868bf85 commit be3e53f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,20 @@ import 'event_channel_mock.dart';
import 'method_channel_mock.dart';

Position get mockPosition => Position(
latitude: 52.561270,
longitude: 5.639382,
timestamp: DateTime.fromMillisecondsSinceEpoch(
500,
isUtc: true,
),
altitude: 3000.0,
altitudeAccuracy: 2.0,
accuracy: 0.0,
heading: 0.0,
headingAccuracy: 0.0,
speed: 0.0,
speedAccuracy: 0.0,
isMocked: false,
);
latitude: 52.561270,
longitude: 5.639382,
timestamp: DateTime.fromMillisecondsSinceEpoch(
500,
isUtc: true,
),
altitude: 3000.0,
altitudeAccuracy: 2.0,
accuracy: 0.0,
heading: 0.0,
headingAccuracy: 0.0,
speed: 0.0,
speedAccuracy: 0.0,
isMocked: false);

void main() {
TestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: prefer_const_constructors

import 'package:flutter_test/flutter_test.dart';
import 'package:geolocator_platform_interface/geolocator_platform_interface.dart';

Expand Down Expand Up @@ -532,6 +530,7 @@ void main() {
speedAccuracy: 0,
isMocked: false,
);

// Act
final readablePosition = position.toString();

Expand Down
29 changes: 15 additions & 14 deletions geolocator_web/lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ Position toPosition(html.Geoposition webPosition) {
}

return Position(
latitude: coords.latitude as double,
longitude: coords.longitude as double,
timestamp: webPosition.timestamp != null
? DateTime.fromMillisecondsSinceEpoch(webPosition.timestamp!)
: DateTime.now(),
altitude: coords.altitude as double? ?? 0.0,
altitudeAccuracy: coords.altitudeAccuracy as double? ?? 0.0,
accuracy: coords.accuracy as double? ?? 0.0,
heading: coords.heading as double? ?? 0.0,
headingAccuracy: 0.0,
floor: null,
speed: coords.speed as double? ?? 0.0,
speedAccuracy: 0.0,
isMocked: false);
latitude: coords.latitude as double,
longitude: coords.longitude as double,
timestamp: webPosition.timestamp != null
? DateTime.fromMillisecondsSinceEpoch(webPosition.timestamp!)
: DateTime.now(),
altitude: coords.altitude as double? ?? 0.0,
altitudeAccuracy: coords.altitudeAccuracy as double? ?? 0.0,
accuracy: coords.accuracy as double? ?? 0.0,
heading: coords.heading as double? ?? 0.0,
headingAccuracy: 0.0,
floor: null,
speed: coords.speed as double? ?? 0.0,
speedAccuracy: 0.0,
isMocked: false,
);
}

/// Converts the permission result received from the browser into a
Expand Down

0 comments on commit be3e53f

Please sign in to comment.