Skip to content

Commit 8922877

Browse files
authored
Set Location Shared (#108)
• Adds a method to set whether GPS location data is collected by the SDK
1 parent 23ab415 commit 8922877

File tree

7 files changed

+23
-0
lines changed

7 files changed

+23
-0
lines changed
Binary file not shown.

OneSignalExample/Assets/OneSignal/Platforms/iOS/OneSignalUnityRuntime.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ bool _userProvidedConsent() {
345345

346346
void _setRequiresUserPrivacyConsent(bool required) {
347347
[OneSignal setRequiresUserPrivacyConsent:required];
348+
}
349+
350+
void _setLocationShared(bool shared) {
351+
[OneSignal setLocationShared:shared];
348352
}
349353

350354
@end
Binary file not shown.

OneSignalExample/Assets/OneSignal/src/OneSignal.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ public static void SetLogLevel(LOG_LEVEL inLogLevel, LOG_LEVEL inVisualLevel) {
429429
#endif
430430
}
431431

432+
public static void SetLocationShared(bool shared) {
433+
Debug.Log ("Called OneSignal.cs SetLocationShared");
434+
#if ONESIGNAL_PLATFORM
435+
oneSignalPlatform.SetLocationShared(shared);
436+
#endif
437+
}
438+
432439
// Tag player with a key value pair to later create segments on them at onesignal.com.
433440
public static void SendTag(string tagName, string tagValue) {
434441
#if ONESIGNAL_PLATFORM

OneSignalExample/Assets/OneSignal/src/OneSignalAndroid.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visual
4343
mOneSignal.Call("setLogLevel", (int)logLevel, (int)visualLevel);
4444
}
4545

46+
public void SetLocationShared(bool shared) {
47+
mOneSignal.Call("setLocationShared", shared);
48+
}
49+
4650
public void SendTag(string tagName, string tagValue) {
4751
mOneSignal.Call("sendTag", tagName, tagValue);
4852
}

OneSignalExample/Assets/OneSignal/src/OneSignalIOS.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,18 @@ public class OneSignalIOS : OneSignalPlatform {
118118
[System.Runtime.InteropServices.DllImport("__Internal")]
119119
extern static public void _setRequiresUserPrivacyConsent(bool required);
120120

121+
[System.Runtime.InteropServices.DllImport("__Internal")]
122+
extern static public void _setLocationShared(bool enable);
123+
121124

122125
public OneSignalIOS(string gameObjectName, string appId, bool autoPrompt, bool inAppLaunchURLs, OneSignal.OSInFocusDisplayOption displayOption, OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel, bool requiresUserPrivacyConsent) {
123126
_init(gameObjectName, appId, autoPrompt, inAppLaunchURLs, (int)displayOption, (int)logLevel, (int)visualLevel, requiresUserPrivacyConsent);
124127
}
125128

129+
public void SetLocationShared(bool shared) {
130+
_setLocationShared(shared);
131+
}
132+
126133
public void RegisterForPushNotifications() {
127134
_registerForPushNotifications();
128135
}

OneSignalExample/Assets/OneSignal/src/OneSignalPlatform.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public interface OneSignalPlatform {
4242
void PostNotification(Dictionary<string, object> data);
4343
void SyncHashedEmail(string email);
4444
void PromptLocation();
45+
void SetLocationShared(bool shared);
4546

4647
void SetEmail (string email);
4748
void SetEmail(string email, string emailAuthToken);

0 commit comments

Comments
 (0)