Skip to content

Commit 249b4ec

Browse files
committed
Location trigger also has repeat capability
1 parent ba94887 commit 249b4ec

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ typedef struct iOSNotificationData
6969
float radius;
7070
unsigned char notifyOnEntry;
7171
unsigned char notifyOnExit;
72+
unsigned char repeats;
7273
} location;
7374
} trigger;
7475
} iOSNotificationData;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ iOSNotificationData UNNotificationRequestToiOSNotificationData(UNNotificationReq
169169
notificationData.trigger.location.radius = region.radius;
170170
notificationData.trigger.location.notifyOnExit = region.notifyOnEntry;
171171
notificationData.trigger.location.notifyOnEntry = region.notifyOnExit;
172+
notificationData.trigger.location.repeats = locationTrigger.repeats;
172173
#endif
173174
}
174175
else if ([request.trigger isKindOfClass: [UNPushNotificationTrigger class]])

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ - (void)scheduleLocalNotification:(iOSNotificationData*)data
342342
region.notifyOnEntry = data->trigger.location.notifyOnEntry;
343343
region.notifyOnExit = data->trigger.location.notifyOnExit;
344344

345-
trigger = [UNLocationNotificationTrigger triggerWithRegion: region repeats: NO];
345+
trigger = [UNLocationNotificationTrigger triggerWithRegion: region repeats: data->trigger.location.repeats];
346346
#else
347347
return;
348348
#endif

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ internal struct LocationTriggerData
8787
public float radius;
8888
public Byte notifyOnEntry;
8989
public Byte notifyOnExit;
90+
public Byte repeats;
9091
}
9192

9293
[StructLayout(LayoutKind.Explicit)]
@@ -353,6 +354,7 @@ public iOSNotificationTrigger Trigger
353354
data.trigger.location.notifyOnEntry = (byte)(trigger.NotifyOnEntry ? 1 : 0);
354355
data.trigger.location.notifyOnExit = (byte)(trigger.NotifyOnExit ? 1 : 0);
355356
data.trigger.location.radius = trigger.Radius;
357+
data.trigger.location.repeats = (byte)(trigger.Repeats ? 1 : 0);
356358
break;
357359
}
358360
case iOSNotificationTriggerType.Push:
@@ -398,7 +400,8 @@ public iOSNotificationTrigger Trigger
398400
Longitude = data.trigger.location.longitude,
399401
Radius = data.trigger.location.radius,
400402
NotifyOnEntry = data.trigger.location.notifyOnEntry != 0,
401-
NotifyOnExit = data.trigger.location.notifyOnExit != 0
403+
NotifyOnExit = data.trigger.location.notifyOnExit != 0,
404+
Repeats = data.trigger.location.repeats != 0,
402405
};
403406
case iOSNotificationTriggerType.Push:
404407
return new iOSNotificationPushTrigger();

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ public Vector2 Center
9999
/// When this property is enabled, a device crossing from inside the region to outside the region triggers the delivery of a notification
100100
/// </summary>
101101
public bool NotifyOnExit { get; set; }
102+
103+
/// <summary>
104+
/// Whether the notification should repeat.
105+
/// </summary>
106+
public bool Repeats { get; set; }
102107
}
103108

104109
/// <summary>

0 commit comments

Comments
 (0)