Public Sub ConsentStateAvailable(user As Boolean)
Dim consent As ConsentManager = Starter.consent
If (consent.ConsentState = consent.STATE_UNKNOWN And consent.IsRequestLocationInEeaOrUnknown) Or user Then
'Set last parameter to False if you don't want to show the "pay for ad-free" option.
'Change privacy policy URL.
consent.ShowConsentForm("https://www.facebook.com/notes/computersmith/computersmith-data-consent-policy/2049613211975625/", True, True, True)
Wait For Consent_FormResult (Success As Boolean, UserPrefersAdFreeOption As Boolean)
If Success Then
Log($"Consent form result: ${consent.ConsentState}, AdFree: ${UserPrefersAdFreeOption}"$)
If consent.ConsentState = consent.STATE_PERSONALIZED Or consent.ConsentState = consent.STATE_NON_PERSONALIZED Then
If Starter.analytics.IsInitialized Then Starter.analytics.SendEvent(consent.ConsentState, Null)
MsgboxAsync("Thank you! We will not ask you for your consent again. If you wish to change or cancel your consent, please use the Privacy option on the game menu.", "Consent Saved")
Else if UserPrefersAdFreeOption Then
Starter.wantsAdFree = True
If Starter.analytics.IsInitialized Then Starter.analytics.SendEvent("AdFree", Null)
MsgboxAsync("Thank you! You will be redirected to the purchase screen where you can buy the No Ads upgrade.", "Ad Free Option")
Wait For MsgBox_Result(res As Int)
StartActivity(Purchase)
End If
Else
Log($"Error: ${LastException}"$)
End If
End If
End Sub