Skip to content

Commit

Permalink
Refresh SDK samples from example project
Browse files Browse the repository at this point in the history
  • Loading branch information
brismithers committed Jun 4, 2024
1 parent 4b4951b commit 899398e
Show file tree
Hide file tree
Showing 2 changed files with 2,549 additions and 282 deletions.
25 changes: 23 additions & 2 deletions com.onesignal.unity.core/Samples~/OneSignalExampleBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
using OneSignalSDK;
using OneSignalSDK.Notifications;
using OneSignalSDK.InAppMessages;
using OneSignalSDK.User;
using OneSignalSDK.User.Models;
using OneSignalSDK.Debug.Models;
using OneSignalSDK.Debug.Utilities;
Expand Down Expand Up @@ -226,8 +227,8 @@ private void _pushSubscriptionChanged(object sender, PushSubscriptionChangedEven
}

private void _userStateChanged(object sender, UserStateChangedEventArgs e) {
_log($"OneSignalId changed : {JsonUtility.ToJson(e.State.Current.OneSignalId)}");
_log($"ExternalId changed : {JsonUtility.ToJson(e.State.Current.ExternalId)}");
_log($"OneSignalId changed : {e.State.Current.OneSignalId}");
_log($"ExternalId changed : {e.State.Current.ExternalId}");
}

/*
Expand Down Expand Up @@ -317,6 +318,16 @@ public void RemoveAlias() {
OneSignal.User.RemoveAlias(aliasKey);
}

public void GetOneSignalId() {
string onesignalId = OneSignal.User.OneSignalId ?? "null";
_log($"Get OneSignalId <b>{onesignalId}</b>");
}

public void GetExternalId() {
string externalId = OneSignal.User.ExternalId ?? "null";
_log($"Get ExternalId <b>{externalId}</b>");
}

/*
* Push
*/
Expand Down Expand Up @@ -390,6 +401,16 @@ public void AddTag() {
public void RemoveTag() {
_log($"Removing tag for key <b>{tagKey}</b>");
OneSignal.User.RemoveTag(tagKey);

}

public void GetTags() {
Dictionary<string, string> dict = OneSignal.User.GetTags();
string dictionaryString = "{";
foreach(KeyValuePair <string, string> keyValues in dict) {
dictionaryString += keyValues.Key + " : " + keyValues.Value + ", ";
}
_log($"Get all user tags " + dictionaryString.TrimEnd(',', ' ') + "}");
}

/*
Expand Down
Loading

0 comments on commit 899398e

Please sign in to comment.