Skip to content

Commit 491fb92

Browse files
committed
Updating the privacy consent property names
requiresPrivacyConsent -> consentRequired privacyConsent -> consentGiven
1 parent 3706902 commit 491fb92

File tree

9 files changed

+34
-34
lines changed

9 files changed

+34
-34
lines changed

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/activity/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void onBackPressed() {
4141
protected void onResume() {
4242
super.onResume();
4343

44-
boolean hasConsent = OneSignal.getRequiresPrivacyConsent();
44+
boolean hasConsent = OneSignal.getConsentGiven();
4545
if (hasConsent)
4646
viewModel.setupLayout();
4747
}

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ private String getOneSignalAppId() {
884884
}
885885

886886
private void togglePrivacyConsent(boolean hasConsent) {
887-
OneSignal.setPrivacyConsent(hasConsent);
887+
OneSignal.setConsentGiven(hasConsent);
888888
SharedPreferenceUtil.cacheUserPrivacyConsent(context, hasConsent);
889889

890890
shouldScrollTop = hasConsent;

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/SplashActivityViewModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void networkDisconnected() {
6363
private void setupOneSignalSDK() {
6464
boolean privacyConsent = true;
6565

66-
OneSignal.setRequiresPrivacyConsent(privacyConsent);
66+
OneSignal.setConsentRequired(privacyConsent);
6767

6868
boolean isLocationShared = SharedPreferenceUtil.getCachedLocationSharedStatus(context);
6969
OneSignal.getLocation().setShared(isLocationShared);

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/IOneSignal.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ interface IOneSignal {
6262
* should be set to `true` prior to the invocation of
6363
* [initWithContext] to ensure compliance.
6464
*/
65-
var requiresPrivacyConsent: Boolean
65+
var consentRequired: Boolean
6666

6767
/**
6868
* Indicates whether privacy consent has been granted. This field is only relevant when
69-
* the application has opted into data privacy protections. See [requiresPrivacyConsent].
69+
* the application has opted into data privacy protections. See [consentRequired].
7070
*/
71-
var privacyConsent: Boolean
71+
var consentGiven: Boolean
7272

7373
/**
7474
* Whether to disable the "GMS is missing" prompt to the user.

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/OneSignal.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,18 @@ object OneSignal {
9494
* [initWithContext] to ensure compliance.
9595
*/
9696
@JvmStatic
97-
var requiresPrivacyConsent: Boolean
98-
get() = oneSignal.requiresPrivacyConsent
99-
set(value) { oneSignal.requiresPrivacyConsent = value }
97+
var consentRequired: Boolean
98+
get() = oneSignal.consentRequired
99+
set(value) { oneSignal.consentRequired = value }
100100

101101
/**
102102
* Indicates whether privacy consent has been granted. This field is only relevant when
103103
* the application has opted into data privacy protections. See [requiresPrivacyConsent].
104104
*/
105105
@JvmStatic
106-
var privacyConsent: Boolean
107-
get() = oneSignal.privacyConsent
108-
set(value) { oneSignal.privacyConsent = value }
106+
var consentGiven: Boolean
107+
get() = oneSignal.consentGiven
108+
set(value) { oneSignal.consentGiven = value }
109109

110110
/**
111111
* Whether to disable the "GMS is missing" prompt to the user.

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/config/ConfigModel.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ class ConfigModel : Model() {
3636
/**
3737
* Whether the SDK requires privacy consent to send data to backend.
3838
*/
39-
var requiresPrivacyConsent: Boolean?
40-
get() = getOptBooleanProperty(::requiresPrivacyConsent.name)
41-
set(value) { setOptBooleanProperty(::requiresPrivacyConsent.name, value) }
39+
var consentRequired: Boolean?
40+
get() = getOptBooleanProperty(::consentRequired.name)
41+
set(value) { setOptBooleanProperty(::consentRequired.name, value) }
4242

4343
/**
4444
* Whether the SDK has been given consent to privacy.
4545
*/
46-
var givenPrivacyConsent: Boolean?
47-
get() = getOptBooleanProperty(::givenPrivacyConsent.name)
48-
set(value) { setOptBooleanProperty(::givenPrivacyConsent.name, value) }
46+
var consentGiven: Boolean?
47+
get() = getOptBooleanProperty(::consentGiven.name)
48+
set(value) { setOptBooleanProperty(::consentGiven.name, value) }
4949

5050
/**
5151
* Whether location is shared.

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/config/impl/ConfigModelStoreListener.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ internal class ConfigModelStoreListener(
8888
params.disableGMSMissingPrompt?.let { config.disableGMSMissingPrompt = it }
8989
params.unsubscribeWhenNotificationsDisabled?.let { config.unsubscribeWhenNotificationsDisabled = it }
9090
params.locationShared?.let { config.locationShared = it }
91-
params.requiresUserPrivacyConsent?.let { config.requiresPrivacyConsent = it }
91+
params.requiresUserPrivacyConsent?.let { config.consentRequired = it }
9292
params.opRepoExecutionInterval?.let { config.opRepoExecutionInterval = it }
9393
params.influenceParams.notificationLimit?.let { config.influenceParams.notificationLimit = it }
9494
params.influenceParams.indirectNotificationAttributionWindow?.let { config.influenceParams.indirectNotificationAttributionWindow = it }

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/http/impl/HttpClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ internal class HttpClient(
5858
cacheKey: String?,
5959
): HttpResponse {
6060
// If privacy consent is required but not yet given, any non-GET request should be blocked.
61-
if (method != null && _configModelStore.model.requiresPrivacyConsent == true && _configModelStore.model.givenPrivacyConsent != true) {
61+
if (method != null && _configModelStore.model.consentRequired == true && _configModelStore.model.consentGiven != true) {
6262
Logging.warn("$method `$url` was called before the user provided privacy consent. Your application is set to require the user's privacy consent before the OneSignal SDK can be initialized. Please ensure the user has provided consent before calling this method. You can check the latest OneSignal consent status by calling OneSignal.privacyConsent")
6363
return HttpResponse(0, null, null)
6464
}

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/internal/OneSignalImp.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ internal class OneSignalImp : IOneSignal, IServiceProvider {
5353
override val sdkVersion: String = OneSignalUtils.sdkVersion
5454
override var isInitialized: Boolean = false
5555

56-
override var requiresPrivacyConsent: Boolean
57-
get() = _configModel?.requiresPrivacyConsent ?: (_requiresPrivacyConsent == true)
56+
override var consentRequired: Boolean
57+
get() = _configModel?.consentRequired ?: (_consentRequired == true)
5858
set(value) {
59-
_requiresPrivacyConsent = value
60-
_configModel?.requiresPrivacyConsent = value
59+
_consentRequired = value
60+
_configModel?.consentRequired = value
6161
}
6262

63-
override var privacyConsent: Boolean
64-
get() = _configModel?.givenPrivacyConsent ?: (_givenPrivacyConsent == true)
63+
override var consentGiven: Boolean
64+
get() = _configModel?.consentGiven ?: (_consentGiven == true)
6565
set(value) {
66-
_givenPrivacyConsent = value
67-
_configModel?.givenPrivacyConsent = value
66+
_consentGiven = value
67+
_configModel?.consentGiven = value
6868
}
6969

7070
override var disableGMSMissingPrompt: Boolean
@@ -99,8 +99,8 @@ internal class OneSignalImp : IOneSignal, IServiceProvider {
9999
private val _services: ServiceProvider
100100
private var _configModel: ConfigModel? = null
101101
private var _sessionModel: SessionModel? = null
102-
private var _requiresPrivacyConsent: Boolean? = null
103-
private var _givenPrivacyConsent: Boolean? = null
102+
private var _consentRequired: Boolean? = null
103+
private var _consentGiven: Boolean? = null
104104
private var _disableGMSMissingPrompt: Boolean? = null
105105
private val _loginLock: Any = Any()
106106

@@ -174,13 +174,13 @@ internal class OneSignalImp : IOneSignal, IServiceProvider {
174174
}
175175

176176
// if requires privacy consent was set prior to init, set it in the model now
177-
if (_requiresPrivacyConsent != null) {
178-
_configModel!!.requiresPrivacyConsent = _requiresPrivacyConsent!!
177+
if (_consentRequired != null) {
178+
_configModel!!.consentRequired = _consentRequired!!
179179
}
180180

181181
// if privacy consent was set prior to init, set it in the model now
182-
if (_givenPrivacyConsent != null) {
183-
_configModel!!.givenPrivacyConsent = _givenPrivacyConsent!!
182+
if (_consentGiven != null) {
183+
_configModel!!.consentGiven = _consentGiven!!
184184
}
185185

186186
if (_disableGMSMissingPrompt != null) {

0 commit comments

Comments
 (0)