Skip to content

Commit ba94887

Browse files
committed
Change managed-native transfer to have latitude/longitude
1 parent 027a79d commit ba94887

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

com.unity.mobile.notifications/Runtime/iOS/Plugins/UnityNotificationData.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ typedef struct iOSNotificationData
6464

6565
struct
6666
{
67-
float centerX;
68-
float centerY;
67+
double latitude;
68+
double longitude;
6969
float radius;
7070
unsigned char notifyOnEntry;
7171
unsigned char notifyOnExit;

com.unity.mobile.notifications/Runtime/iOS/Plugins/UnityNotificationData.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ iOSNotificationData UNNotificationRequestToiOSNotificationData(UNNotificationReq
164164
UNLocationNotificationTrigger* locationTrigger = (UNLocationNotificationTrigger*)request.trigger;
165165
CLCircularRegion *region = (CLCircularRegion*)locationTrigger.region;
166166

167-
notificationData.trigger.location.centerX = region.center.latitude;
168-
notificationData.trigger.location.centerY = region.center.longitude;
167+
notificationData.trigger.location.latitude = region.center.latitude;
168+
notificationData.trigger.location.longitude = region.center.longitude;
169169
notificationData.trigger.location.radius = region.radius;
170170
notificationData.trigger.location.notifyOnExit = region.notifyOnEntry;
171171
notificationData.trigger.location.notifyOnEntry = region.notifyOnExit;

com.unity.mobile.notifications/Runtime/iOS/Plugins/UnityNotificationManager.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ - (void)scheduleLocalNotification:(iOSNotificationData*)data
335335
else if (data->triggerType == LOCATION_TRIGGER)
336336
{
337337
#if UNITY_USES_LOCATION
338-
CLLocationCoordinate2D center = CLLocationCoordinate2DMake(data->trigger.location.centerX, data->trigger.location.centerY);
338+
CLLocationCoordinate2D center = CLLocationCoordinate2DMake(data->trigger.location.latitude, data->trigger.location.longitude);
339339

340340
CLCircularRegion* region = [[CLCircularRegion alloc] initWithCenter: center
341341
radius: data->trigger.location.radius identifier: identifier];

com.unity.mobile.notifications/Runtime/iOS/iOSNotification.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ internal struct CalendarTriggerData
8282
[StructLayout(LayoutKind.Sequential)]
8383
internal struct LocationTriggerData
8484
{
85-
public float centerX;
86-
public float centerY;
85+
public double latitude;
86+
public double longitude;
8787
public float radius;
8888
public Byte notifyOnEntry;
8989
public Byte notifyOnExit;
@@ -348,8 +348,8 @@ public iOSNotificationTrigger Trigger
348348
case iOSNotificationTriggerType.Location:
349349
{
350350
var trigger = (iOSNotificationLocationTrigger)value;
351-
data.trigger.location.centerX = trigger.Center.x;
352-
data.trigger.location.centerY = trigger.Center.y;
351+
data.trigger.location.latitude = trigger.Latitude;
352+
data.trigger.location.longitude = trigger.Longitude;
353353
data.trigger.location.notifyOnEntry = (byte)(trigger.NotifyOnEntry ? 1 : 0);
354354
data.trigger.location.notifyOnExit = (byte)(trigger.NotifyOnExit ? 1 : 0);
355355
data.trigger.location.radius = trigger.Radius;
@@ -394,7 +394,8 @@ public iOSNotificationTrigger Trigger
394394
case iOSNotificationTriggerType.Location:
395395
return new iOSNotificationLocationTrigger()
396396
{
397-
Center = new Vector2(data.trigger.location.centerX, data.trigger.location.centerY),
397+
Latitude = data.trigger.location.latitude,
398+
Longitude = data.trigger.location.longitude,
398399
Radius = data.trigger.location.radius,
399400
NotifyOnEntry = data.trigger.location.notifyOnEntry != 0,
400401
NotifyOnExit = data.trigger.location.notifyOnExit != 0

0 commit comments

Comments
 (0)