Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- To learn more about how to best use this new feature see our guide
here: [Verify shift presence before starting work](https://developer.hypertrack.com/docs/clock-in-out-tagging#verify-shift-presence-before-starting-work)

```dart
// check worker presence synchronously
var activeOrders = await HyperTrack.orders;
Order? currentOrder = activeOrders["current_order"];
if (currentOrder != null) {
handlePresence(currentOrder.isInsideGeofence);
} else {
print("'current_order' not found");
}

// or subscribe to the changes in orders to get the status updates
HyperTrack.ordersSubscription.listen((orders) {
Order? currentOrder = orders["current_order"];
if (currentOrder != null) {
handlePresence(currentOrder.isInsideGeofence);
} else {
print("'current_order' not found");
}
});

// handle worker presence inside the order destination geofence
void handlePresence(Result<bool, LocationError> isInsideGeofence) {
switch (isInsideGeofence.runtimeType) {
case Success:
if ((isInsideGeofence as Success).value) {
// allow worker to clock in for the shift
} else {
// "to clock in you must be at order destination"
}
break;
case Failure:
// resolve errors to check for presence
break;
}
}
```

### Changed

- Updated HyperTrack SDK iOS to [5.7.0](https://github.com/hypertrack/sdk-ios/releases/tag/5.7.0)
Expand Down
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,18 @@ release type="dry-run": setup

echo "Are you sure you want to publish version $VERSION? (y/N)"
just _ask-confirm
# removing docs to avoid doc/ folder warning
rm -rf docs
flutter pub publish
@echo "Generating the docs back (removed to avoid doc/ folder warning)"
just docs
open https://pub.dev/packages/hypertrack_plugin/versions/$VERSION
else
# removing docs to avoid doc/ folder warning
rm -rf docs
echo "Dry run for version $VERSION"
flutter pub publish --dry-run
# generating the docs back
just docs
fi

Expand Down