Skip to content

Commit 99bfaae

Browse files
1.0.0
1 parent f14a923 commit 99bfaae

36 files changed

+3872
-1
lines changed

.gitignore

Lines changed: 406 additions & 0 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
6+
## [Unreleased]
7+
8+
## [1.0.0] - 2025-03-21
9+
10+
### Added
11+
12+
- Initial release

CONTRIBUTING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Contributing
2+
3+
## File structure
4+
5+
We have main C# library and binding libraries merged to have only one dependency artifact.
6+
7+
### Main library
8+
9+
- `Common/`
10+
- `Platforms/`
11+
12+
### Android Binding files
13+
14+
- `Additions/`
15+
- `Transforms/`
16+
17+
### iOS Binding files
18+
19+
- `ApiDefinition.cs`
20+
- `StructsAndEnums.cs`
21+
- `sdk-maui-obj-wrapper/`
22+
23+
## sdk-maui-obj-wrapper
24+
25+
We are using a wrapper Xcode project to build .xcframework for MAUI because original
26+
HyperTrack SDK iOS API doesn't support calling it from Objective-C.
27+
28+
So in the project we generate Objective-C/Swift headers and then use them to proxy calls
29+
to the Swift code of the SDK.
30+
31+
Important project params for correct header generation:
32+
33+
`Project Settings -> Build Settings`
34+
- `Swift Compiler`
35+
- `Generated Header Name`
36+
- `Install Bridging Header` - Yes
37+
- `Precompile Bridging Header` - Yes
38+
- `Deployment`
39+
- `Skip Install` - No

HyperTrackSdkMaui.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31903.59
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HyperTrackSdkMaui", "HyperTrackSdkMaui\HyperTrackSdkMaui.csproj", "{B63A9CF8-DC2B-4659-9DFE-FADA0067CE31}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(SolutionProperties) = preSolution
14+
HideSolutionNode = FALSE
15+
EndGlobalSection
16+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
17+
{B63A9CF8-DC2B-4659-9DFE-FADA0067CE31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+
{B63A9CF8-DC2B-4659-9DFE-FADA0067CE31}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+
{B63A9CF8-DC2B-4659-9DFE-FADA0067CE31}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+
{B63A9CF8-DC2B-4659-9DFE-FADA0067CE31}.Release|Any CPU.Build.0 = Release|Any CPU
21+
EndGlobalSection
22+
EndGlobal

HyperTrackSdkMaui/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
archives
2+
generated/
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# if ANDROID
2+
3+
namespace Com.Hypertrack.Sdk.Android
4+
{
5+
partial class HyperTrack
6+
{
7+
public partial class OrdersMap
8+
{
9+
10+
public Java.Lang.Object Get(Java.Lang.Object? p0)
11+
{
12+
return GetJava((string?)p0);
13+
}
14+
15+
public void PutAll(System.Collections.IDictionary p0)
16+
{
17+
PutAllJava((IDictionary<string, Order>?)p0);
18+
}
19+
20+
public Java.Lang.Object Put(Java.Lang.Object key, Java.Lang.Object value)
21+
{
22+
return PutJava((string?)key, (Order?)value);
23+
}
24+
25+
public Java.Lang.Object Remove(Java.Lang.Object key)
26+
{
27+
return RemoveJava((string?)key);
28+
}
29+
public System.Collections.ICollection EntrySet()
30+
{
31+
return (System.Collections.ICollection)EntrySetJava();
32+
}
33+
34+
public System.Collections.ICollection KeySet()
35+
{
36+
return (System.Collections.ICollection)KeySetJava();
37+
}
38+
39+
System.Collections.ICollection Java.Util.IMap.Values()
40+
{
41+
return (System.Collections.ICollection)ValuesJava();
42+
}
43+
}
44+
}
45+
}
46+
47+
# endif

HyperTrackSdkMaui/ApiDefinition.cs

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
using System;
2+
using Foundation;
3+
4+
namespace binding_ios
5+
{
6+
7+
// @interface HyperTrackCancellable : NSObject
8+
[BaseType(typeof(NSObject))]
9+
interface HyperTrackCancellable
10+
{
11+
// -(void)cancel;
12+
[Export("cancel")]
13+
void Cancel();
14+
}
15+
16+
// @interface HyperTrackMauiWrapper : NSObject
17+
[BaseType(typeof(NSObject))]
18+
interface HyperTrackMauiWrapper
19+
{
20+
// +(NSString * _Nonnull)addGeotag:(NSString * _Nonnull)geotagJson __attribute__((warn_unused_result("")));
21+
[Static]
22+
[Export("addGeotag:")]
23+
string AddGeotag(string geotagJson);
24+
25+
// +(NSString * _Nonnull)getAllowMockLocation __attribute__((warn_unused_result("")));
26+
[Static]
27+
[Export("getAllowMockLocation")]
28+
string GetAllowMockLocation();
29+
30+
// +(NSString * _Nonnull)getDeviceId __attribute__((warn_unused_result("")));
31+
[Static]
32+
[Export("getDeviceId")]
33+
string GetDeviceId();
34+
35+
// +(NSString * _Nonnull)getDynamicPublishableKey __attribute__((warn_unused_result("")));
36+
[Static]
37+
[Export("getDynamicPublishableKey")]
38+
string GetDynamicPublishableKey();
39+
40+
// +(NSString * _Nonnull)getErrors __attribute__((warn_unused_result("")));
41+
[Static]
42+
[Export("getErrors")]
43+
string GetErrors();
44+
45+
// +(NSString * _Nonnull)getIsAvailable __attribute__((warn_unused_result("")));
46+
[Static]
47+
[Export("getIsAvailable")]
48+
string GetIsAvailable();
49+
50+
// +(NSString * _Nonnull)getIsTracking __attribute__((warn_unused_result("")));
51+
[Static]
52+
[Export("getIsTracking")]
53+
string GetIsTracking();
54+
55+
// +(NSString * _Nonnull)getLocation __attribute__((warn_unused_result("")));
56+
[Static]
57+
[Export("getLocation")]
58+
string GetLocation();
59+
60+
// +(NSString * _Nonnull)getMetadata __attribute__((warn_unused_result("")));
61+
[Static]
62+
[Export("getMetadata")]
63+
string GetMetadata();
64+
65+
// +(NSString * _Nonnull)getName __attribute__((warn_unused_result("")));
66+
[Static]
67+
[Export("getName")]
68+
string GetName();
69+
70+
// +(NSString * _Nonnull)getOrders __attribute__((warn_unused_result("")));
71+
[Static]
72+
[Export("getOrders")]
73+
string GetOrders();
74+
75+
// +(NSString * _Nonnull)getWorkerHandle __attribute__((warn_unused_result("")));
76+
[Static]
77+
[Export("getWorkerHandle")]
78+
string GetWorkerHandle();
79+
80+
// +(HyperTrackCancellable *)locate:(void (^)(NSString *))callback;
81+
[Static]
82+
[Export("locate:")]
83+
HyperTrackCancellable Locate(Action<NSString> callback);
84+
85+
// +(void)setAllowMockLocation:(NSString * _Nonnull)valueJson;
86+
[Static]
87+
[Export("setAllowMockLocation:")]
88+
void SetAllowMockLocation(string valueJson);
89+
90+
// +(void)setDynamicPublishableKey:(NSString * _Nonnull)valueJson;
91+
[Static]
92+
[Export("setDynamicPublishableKey:")]
93+
void SetDynamicPublishableKey(string valueJson);
94+
95+
// +(void)setIsAvailable:(NSString * _Nonnull)valueJson;
96+
[Static]
97+
[Export("setIsAvailable:")]
98+
void SetIsAvailable(string valueJson);
99+
100+
// +(void)setIsTracking:(NSString * _Nonnull)valueJson;
101+
[Static]
102+
[Export("setIsTracking:")]
103+
void SetIsTracking(string valueJson);
104+
105+
// +(void)setMetadata:(NSString * _Nonnull)metadataJson;
106+
[Static]
107+
[Export("setMetadata:")]
108+
void SetMetadata(string metadataJson);
109+
110+
// +(void)setName:(NSString * _Nonnull)valueJson;
111+
[Static]
112+
[Export("setName:")]
113+
void SetName(string valueJson);
114+
115+
// +(void)setWorkerHandle:(NSString * _Nonnull)workerHandleJson;
116+
[Static]
117+
[Export("setWorkerHandle:")]
118+
void SetWorkerHandle(string workerHandleJson);
119+
120+
// +(HyperTrackCancellable *)subscribeToErrors:(void (^)(NSString *))callback;
121+
[Static]
122+
[Export("subscribeToErrors:")]
123+
HyperTrackCancellable SubscribeToErrors(Action<NSString> callback);
124+
125+
// +(HyperTrackCancellable *)subscribeToIsAvailable:(void (^)(NSString *))callback;
126+
[Static]
127+
[Export("subscribeToIsAvailable:")]
128+
HyperTrackCancellable SubscribeToIsAvailable(Action<NSString> callback);
129+
130+
// +(HyperTrackCancellable *)subscribeToIsTracking:(void (^)(NSString *))callback;
131+
[Static]
132+
[Export("subscribeToIsTracking:")]
133+
HyperTrackCancellable SubscribeToIsTracking(Action<NSString> callback);
134+
135+
// +(HyperTrackCancellable *)subscribeToLocation:(void (^)(NSString *))callback;
136+
[Static]
137+
[Export("subscribeToLocation:")]
138+
HyperTrackCancellable SubscribeToLocation(Action<NSString> callback);
139+
140+
// +(HyperTrackCancellable *)subscribeToOrders:(void (^)(NSString *))callback;
141+
[Static]
142+
[Export("subscribeToOrders:")]
143+
HyperTrackCancellable SubscribeToOrders(Action<NSString> callback);
144+
145+
// +(NSString * _Nonnull)orderIsInsideGeofence:(NSString * _Nonnull)orderHandle __attribute__((warn_unused_result("")));
146+
[Static]
147+
[Export("orderIsInsideGeofence:")]
148+
string OrderIsInsideGeofence(string orderHandle);
149+
150+
}
151+
}
152+
// #endif

HyperTrackSdkMaui/Common/Error.cs

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// ReSharper disable CheckNamespace
2+
3+
namespace HyperTrack
4+
{
5+
static partial class HyperTrack
6+
{
7+
public abstract class Error : IEquatable<Error>, IComparable, IComparable<Error>
8+
{
9+
public virtual bool Equals(Error? other) => other?.GetType() == GetType();
10+
public override bool Equals(object? obj) => Equals(obj as Error);
11+
public override int GetHashCode() => GetType().GetHashCode();
12+
public static bool operator ==(Error? left, Error? right) => left?.Equals(right) ?? right is null;
13+
public static bool operator !=(Error? left, Error? right) => !(left == right);
14+
15+
public override string ToString() => GetType().Name;
16+
17+
public int CompareTo(Error? other)
18+
{
19+
if (other is null) return 1;
20+
return string.Compare(ToString(), other.ToString(), StringComparison.Ordinal);
21+
}
22+
23+
public int CompareTo(object? obj)
24+
{
25+
if (obj is null) return 1;
26+
if (obj is Error other) return CompareTo(other);
27+
throw new ArgumentException("Object is not an Error");
28+
}
29+
30+
public class BlockedFromRunning : Error { }
31+
32+
public class InvalidPublishableKey : Error { }
33+
34+
public abstract class Location : Error
35+
{
36+
public class Mocked : Location { }
37+
38+
public class ServicesDisabled : Location { }
39+
40+
public class ServicesUnavailable : Location { }
41+
42+
public class SignalLost : Location { }
43+
}
44+
45+
public class NoExemptionFromBackgroundStartRestrictions : Error { }
46+
47+
public abstract class Permissions : Error
48+
{
49+
public abstract class Location : Permissions
50+
{
51+
public class Denied : Location { }
52+
53+
public class InsufficientForBackground : Location { }
54+
55+
public class ReducedAccuracy : Location { }
56+
57+
public class NotDetermined : Location { }
58+
59+
public class Provisional : Location { }
60+
61+
public class Restricted : Location { }
62+
}
63+
64+
[Obsolete("Notifications permission is not required anymore")]
65+
public abstract class Notifications : Permissions
66+
{
67+
[Obsolete("Notifications permission is not required anymore")]
68+
public class Denied : Notifications { }
69+
}
70+
}
71+
}
72+
}
73+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// ReSharper disable CheckNamespace
2+
3+
namespace HyperTrack
4+
{
5+
partial class HyperTrack
6+
{
7+
public class GeotagData(
8+
Dictionary<string, object> data,
9+
Location? expectedLocation,
10+
string? orderHandle,
11+
HyperTrack.OrderStatus? orderStatus)
12+
{
13+
public Dictionary<string, object> Data { get; } = data;
14+
public Location? ExpectedLocation { get; } = expectedLocation;
15+
public string? OrderHandle { get; } = orderHandle;
16+
public HyperTrack.OrderStatus? OrderStatus { get; } = orderStatus;
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)