Example #1
0
        /// <summary>
        /// Handles an <c>onInviteFinished</c> event
        /// </summary>
        /// <param name="message">
        /// Will contain a numeric representation of <c>Provider</c>
        /// numeric representation of <c>SocialActionType</c>
        /// id of given request, list of invite recipients
        /// and payload</param>
        public void onInviteFinished(String message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onInviteFinished");

            JSONObject eventJson = new JSONObject(message);

            Provider provider = Provider.fromInt((int)eventJson["provider"].n);

            String        requestId      = eventJson["requestId"].str;
            JSONObject    recipientsJson = eventJson ["invitedIds"];
            List <String> recipients     = new List <String>();

            foreach (JSONObject recipientVal in recipientsJson.list)
            {
                //iterate "feed" keys
                recipients.Add(recipientVal.str);
            }

            JSONObject payloadJSON = new JSONObject(eventJson ["payload"].str);

            //give a reward
            Reward reward = Reward.GetReward(ProfilePayload.GetRewardId(payloadJSON));

            if (reward != null)
            {
                reward.Give();
            }

            ProfileEvents.OnInviteFinished(provider, requestId, recipients, ProfilePayload.GetUserPayload(payloadJSON));
        }
Example #2
0
        /// <summary>
        /// Handles an <c>onLoginFinished</c> event
        /// </summary>
        /// <param name="message">Will contain a JSON representation of a <c>UserProfile</c> and payload</param>
        public void onLoginFinished(String message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onLoginFinished");

            JSONObject eventJson = new JSONObject(message);

            UserProfile userProfile = new UserProfile(eventJson ["userProfile"]);

            JSONObject payloadJSON = new JSONObject(eventJson ["payload"].str);

            //give a reward
            Reward reward = Reward.GetReward(ProfilePayload.GetRewardId(payloadJSON));

            if (reward != null)
            {
                reward.Give();
            }

            ProfileEvents.OnLoginFinished(userProfile, ProfilePayload.GetUserPayload(payloadJSON));
        }
Example #3
0
        /// <summary>
        /// Handles an <c>onSocialActionFinished</c> event
        /// </summary>
        /// <param name="message">
        /// Will contain a numeric representation of <c>Provider</c>
        /// numeric representation of <c>SocialActionType</c> and payload</param>
        public void onSocialActionFinished(String message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onSocialActionFinished");

            JSONObject eventJson = new JSONObject(message);

            Provider         provider     = Provider.fromInt((int)eventJson["provider"].n);
            SocialActionType socialAction = SocialActionType.fromInt((int)eventJson["socialActionType"].n);

            JSONObject payloadJSON = new JSONObject(eventJson ["payload"].str);

            //give a reward
            Reward reward = Reward.GetReward(ProfilePayload.GetRewardId(payloadJSON));

            if (reward != null)
            {
                reward.Give();
            }

            ProfileEvents.OnSocialActionFinished(provider, socialAction, ProfilePayload.GetUserPayload(payloadJSON));
        }