From 63aed661446656b85b85c80585506b2a58fcd266 Mon Sep 17 00:00:00 2001 From: Pavel Kuznetsov Date: Thu, 29 Aug 2024 18:20:45 +0300 Subject: [PATCH 1/2] Fix docs warning on release --- justfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/justfile b/justfile index 928cdea6..a86fdacb 100644 --- a/justfile +++ b/justfile @@ -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 From 49b461dc75947c09648c4c48b9a05d88119978e4 Mon Sep 17 00:00:00 2001 From: Pavel Kuznetsov Date: Tue, 3 Sep 2024 20:20:35 +0300 Subject: [PATCH 2/2] Add sample code --- CHANGELOG.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73dd8c83..cbf283f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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)