Example #1
0
    public void SetFirebaseProfile()
    {
        Dictionary <string, object> requests = new Dictionary <string, object>()
        {
        };
        Dictionary <string, object> coinsInfo = new Dictionary <string, object>()
        {
            { "LastRequest", "none" },
            { "ConsecutiveDays", "0" }
        };

        Dictionary <string, object> user = new Dictionary <string, object>
        {
            { "id", PlayerPrefs.GetString("myRoomID").ToLower() },
            { "requests", requests },
            { "coins", "0" },
            { "coinsInfo", coinsInfo }
        };
        DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;

        reference.Child("users").Child(username.ToLower()).SetValueAsync(user);
        OSPermissionSubscriptionState status = OneSignal.GetPermissionSubscriptionState();
        string oneSignalID = (status.subscriptionStatus.userId != null) ? status.subscriptionStatus.userId : "1";
        Dictionary <string, object> usernameList = new Dictionary <string, object> {
            { username.ToLower(), oneSignalID }
        };

        reference.Child("usernameList").UpdateChildrenAsync(usernameList);
    }
    public OSPermissionSubscriptionState GetPermissionSubscriptionState()
    {
        var state = new OSPermissionSubscriptionState();

        state.permissionStatus   = new OSPermissionState();
        state.subscriptionStatus = new OSSubscriptionState();
        return(state);
    }
Example #3
0
        public void SetFirebaseProfile()
        {
            DatabaseReference             reference = FirebaseDatabase.DefaultInstance.RootReference;
            OSPermissionSubscriptionState status    = OneSignal.GetPermissionSubscriptionState();
            string oneSignalID = (status.subscriptionStatus.userId != null) ? status.subscriptionStatus.userId : "1";
            Dictionary <string, object> usernameList = new Dictionary <string, object> {
                { username.ToLower(), oneSignalID }
            };

            reference.Child("usernameList").UpdateChildrenAsync(usernameList);
        }
    internal static OSPermissionSubscriptionState parsePermissionSubscriptionState(OneSignalPlatform platform, string jsonStr)
    {
        var stateDict = Json.Deserialize(jsonStr) as Dictionary <string, object>;

        var state = new OSPermissionSubscriptionState();

        state.permissionStatus   = platform.parseOSPermissionState(stateDict["permissionStatus"]);
        state.subscriptionStatus = platform.parseOSSubscriptionState(stateDict["subscriptionStatus"]);

        return(state);
    }
Example #5
0
 public static OSPermissionSubscriptionState GetPermissionSubscriptionState()
 {
     #if ONESIGNAL_PLATFORM
     return(oneSignalPlatform.GetPermissionSubscriptionState());
     #else
     var state = new OSPermissionSubscriptionState();
     state.permissionStatus   = new OSPermissionState();
     state.subscriptionStatus = new OSSubscriptionState();
     return(state);
     #endif
 }
    internal static OSPermissionSubscriptionState ParsePermissionSubscriptionState(OneSignalPlatform platform, string jsonStr)
    {
        var stateDict = Json.Deserialize(jsonStr) as Dictionary <string, object>;

        var state = new OSPermissionSubscriptionState();

        state.permissionStatus   = platform.ParseOSPermissionState(stateDict["permissionStatus"]);
        state.subscriptionStatus = platform.ParseOSSubscriptionState(stateDict["subscriptionStatus"]);

        if (stateDict.ContainsKey("emailSubscriptionStatus"))
        {
            state.emailSubscriptionStatus = platform.ParseOSEmailSubscriptionState(stateDict["emailSubscriptionStatus"]);
        }

        return(state);
    }