private void OnUserAvatarClicked(User publicUser)
 {
     if (GetSocial.GetCurrentUser().Id.Equals(publicUser.Id))
     {
         var popup = new MNPopup("Action", "Choose Action");
         popup.AddAction("Show My Feed", () => OpenUserGlobalFeed(publicUser));
         popup.AddAction("Cancel", () => { });
         popup.Show();
     }
     else
     {
         Communities.IsFriend(UserId.Create(publicUser.Id), isFriend =>
         {
             if (isFriend)
             {
                 var popup = new MNPopup("Action", "Choose Action");
                 popup.AddAction("Show " + publicUser.DisplayName + " Feed", () => OpenUserGlobalFeed(publicUser));
                 popup.AddAction("Remove from Friends", () => RemoveFriend(publicUser));
                 popup.AddAction("Cancel", () => { });
                 popup.Show();
             }
             else
             {
                 var popup = new MNPopup("Action", "Choose Action");
                 popup.AddAction("Show " + publicUser.DisplayName + " Feed", () => OpenUserGlobalFeed(publicUser));
                 popup.AddAction("Add to Friends", () => AddFriend(publicUser));
                 popup.AddAction("Cancel", () => { });
                 popup.Show();
             }
         }, error => _console.LogE("Failed to check if friends with " + publicUser.DisplayName + ", error:" + error.Message));
     }
 }
    private void ShowActions(Activity activity)
    {
        var popup = Dialog().WithTitle("Actions");

        popup.AddAction("Info", () => _console.LogD(activity.ToString()));
        popup.AddAction("Author", () => ShowActions(activity.Author));
        popup.AddAction("Details View", () => Details(activity));
        popup.AddAction("React", () => React(activity));
        popup.AddAction("Reactions", () => ListReactions(activity));
        if (!Comments)
        {
            popup.AddAction("Comments", () => ShowComments(activity));
            popup.AddAction("Post Comment", () => PostComment(activity));
        }
        if (activity.Author.Id.Equals(GetSocial.GetCurrentUser().Id))
        {
            popup.AddAction("Edit", () => Edit(activity));
        }
        else
        {
            popup.AddAction("Report as Spam", () => Report(activity, ReportingReason.Spam, "This activity is spam!"));
            popup.AddAction("Report as Inappropriate", () => Report(activity, ReportingReason.InappropriateContent, "This activity is inappropriate!"));
        }
        popup.AddAction("Cancel", () => { });
        popup.Show();
    }
Ejemplo n.º 3
0
    private new void ShowActions(User user)
    {
        var popup = Dialog().WithTitle("Actions");

        // Follow and friend functions are not available if `user` is current user
        if (!user.Id.Equals(GetSocial.GetCurrentUser().Id))
        {
            if (_follows.ContainsKey(user.Id) && _follows[user.Id])
            {
                popup.AddAction("Unfollow", () => Unfollow(user));
            }
            else
            {
                popup.AddAction("Follow", () => Follow(user));
            }
            if (_areFriends.ContainsKey(user.Id) && _areFriends[user.Id])
            {
                popup.AddAction("Remove Friend", () => RemoveFriend(user));
            }
            else
            {
                popup.AddAction("Add Friend", () => AddFriend(user));
            }
        }
        popup.AddAction("Info", () => Print(user));
        popup.AddAction("Followers", () => Followers(user));
        popup.AddAction("Friends", () => Friends(user));
        popup.AddAction("Feed", () => Feed(user));
        popup.AddAction("All posts by", () => AllPosts(user));
        popup.AddAction("Followed Topics", () => Topics(user));
        popup.AddAction("Cancel", () => { });
        popup.Show();
    }
Ejemplo n.º 4
0
 public void FetchCurrentUserData()
 {
     _currentUser = GetSocial.GetCurrentUser();
     _avatar      = Resources.Load <Texture2D> ("GUI/default_demo_avatar");
     if (!string.IsNullOrEmpty(_currentUser?.AvatarUrl))
     {
         StartCoroutine(DownloadAvatar(_currentUser.AvatarUrl));
     }
 }
Ejemplo n.º 5
0
 void RemoveFacebookUserIdentityInternal()
 {
     GetSocial.GetCurrentUser().RemoveIdentity(AuthIdentityProvider.Facebook,
                                               () =>
     {
         _console.LogD("Successfully removed Facebook user identity");
         demoController.FetchCurrentUserData();
     },
                                               error => _console.LogE("Removing Facebook identity failed, reason: " + error));
 }
Ejemplo n.º 6
0
 void RemoveCustomUserIdentity()
 {
     GetSocial.GetCurrentUser().RemoveIdentity(CustomProviderId,
                                               () =>
     {
         _console.LogD(string.Format("Successfully removed user identity '{0}'", CustomProviderId));
         demoController.FetchCurrentUserData();
     },
                                               error => _console.LogE(string.Format("Failed to remove user identity '{0}', reason: {1}", CustomProviderId,
                                                                                    error))
                                               );
 }
Ejemplo n.º 7
0
 void AddFacebookUserIdentityInternal()
 {
     _console.LogD(string.Format("Adding FB identity, token: {0}", AccessToken.CurrentAccessToken.TokenString));
     GetSocial.GetCurrentUser().AddIdentity(Identity.Facebook(AccessToken.CurrentAccessToken.TokenString),
                                            () =>
     {
         _console.LogD("Successfully added Facebook Identity");
         demoController.FetchCurrentUserData();
         SetFacebookUserDetails();
     }, OnAddUserIdentityConflict,
                                            error => _console.LogE("Adding Facebook identity failed, reason: " + error)
                                            );
 }
Ejemplo n.º 8
0
 void AddCustomUserIdentity()
 {
     GetSocial.GetCurrentUser().AddIdentity(
         Identity.Custom(CustomProviderId, _customUserId, _customProviderToken),
         () =>
     {
         _console.LogD("Successfully added custom identity");
         demoController.FetchCurrentUserData();
     }, OnAddUserIdentityConflict,
         error => _console.LogE(string.Format("Failed to add user identity '{0}', reason: {1}", CustomProviderId,
                                              error))
         );
 }
Ejemplo n.º 9
0
 private static Action DrawMessage(Activity message)
 {
     return(() =>
     {
         if (message.Author.Id.Equals(GetSocial.GetCurrentUser().Id))
         {
             GUILayout.Label(message.Text, GSStyles.RightAlignedChatText);
         }
         else
         {
             GUILayout.Label(message.Text, GSStyles.LeftAlignedChatText);
         }
     });
 }
 private void ShowMyPromoCode()
 {
     if (GetSocial.GetCurrentUser().PrivateProperties.ContainsKey(MyPromoCodeKey))
     {
         ShowPromoCode(GetSocial.GetCurrentUser().PrivateProperties[MyPromoCodeKey]);
     }
     else
     {
         PromoCodes.Create(PromoCodeContent.CreateRandomCode().AddProperty(MyPromoCodeKey, "true"), promoCode => {
             var userUpdate = new UserUpdate().AddPrivateProperty(MyPromoCodeKey, promoCode.Code);
             GetSocial.GetCurrentUser().UpdateDetails(userUpdate, ShowMyPromoCode,
                                                      error => _console.LogE(string.Format("Failed to set private property: {0}", error.Message), showImmediately: false));
         }, error => _console.LogE(string.Format("Failed to create promo code: {0}", error.Message), showImmediately: false));
     }
 }
    private void OnUiAction(UiAction action, Action pendingAction)
    {
        var forbiddenForAnonymous = new List <UiAction>()
        {
            UiAction.LikeActivity, UiAction.LikeComment, UiAction.PostActivity, UiAction.PostComment
        };

        if (forbiddenForAnonymous.Contains(action) && GetSocial.GetCurrentUser().IsAnonymous)
        {
            var message = "Action " + action + " is not allowed for anonymous.";
            _console.LogD(message);
        }
        else
        {
            pendingAction();
        }
    }
Ejemplo n.º 12
0
    private void DrawBatchUpdateSection()
    {
        DemoGuiUtils.Space();
        GUILayout.BeginVertical("Box");

        DemoGuiUtils.DrawToggle(ref _useAvatarUrl, "Use Avatar URL");

        DrawBatchSection("Public", _batchUpdatePublicProperties);
        DrawBatchSection("Private", _batchUpdatePrivateProperties);

        DemoGuiUtils.DrawButton("Update User", () => GetSocial.GetCurrentUser().UpdateDetails(GetUpdateForUser(),
                                                                                              () =>
        {
            _console.LogD("User updated");
            demoController.FetchCurrentUserData();
        }, error => { _console.LogE("Failed to update user SetUserDetails: " + error); }), true, GSStyles.Button);

        GUILayout.EndVertical();
    }
Ejemplo n.º 13
0
 private void SetFacebookUserDetails()
 {
     FB.API("me?fields=first_name,last_name,picture", HttpMethod.GET, result =>
     {
         var dictionary        = result.ResultDictionary;
         var displayName       = dictionary["first_name"] + " " + dictionary["last_name"];
         var pictureDictionary = (IDictionary <string, object>)dictionary["picture"];
         var dataDictionary    = (IDictionary <string, object>)pictureDictionary["data"];
         var pictureUrl        = dataDictionary["url"].ToString();
         var update            = new UserUpdate
         {
             DisplayName = displayName, AvatarUrl = pictureUrl
         };
         GetSocial.GetCurrentUser().UpdateDetails(update, () =>
         {
             _console.LogD("Display name is set to:" + displayName + ", avatar set to " + pictureUrl);
             demoController.FetchCurrentUserData();
         }, error =>
         {
             _console.LogE("Failed to set Facebook details");
         });
     });
 }
Ejemplo n.º 14
0
    public void SetupGetSocial()
    {
        Notifications.SetOnTokenReceivedListener(deviceToken => {
            _console.LogD(string.Format("DeviceToken: {0}", deviceToken), false);
        });
        Notifications.SetOnNotificationReceivedListener(notification => {
            // handle chat message
            if (notification.Action.Type.Equals("open_chat_message"))
            {
                _latestChatId = notification.Action.Data["open_messages_for_id"];
                if (GetSocial.IsInitialized)
                {
                    ShowChat();
                }
            }
            if (notification.Action.Type.Equals(GetSocialActionType.AddFriend))
            {
                ShowPopup(notification);
            }
            _console.LogD(string.Format("Notification received : {0}", notification));
        });
        Notifications.SetOnNotificationClickedListener((notification, context) => {
            _console.LogD(string.Format("Notification wasClicked : {0}", notification));
            HandleAction(notification.Action);
        });

        _console.LogD("Setting up GetSocial...");
        _getSocialUnitySdkVersion            = GetSocial.UnitySdkVersion;
        _getSocialUnderlyingNativeSdkVersion = GetSocial.NativeSdkVersion;

        GetSocialFBMessengerPluginHelper.RegisterFBMessengerPlugin();
        if (GetSocial.IsInitialized)
        {
            _console.LogD("GetSocial is initialized and user is retrieved");
            _currentUser  = GetSocial.GetCurrentUser();
            _isTestDevice = GetSocial.Device.IsTestDevice;
            FetchCurrentUserData();
        }
        else
        {
            GetSocial.AddOnCurrentUserChangedListener(user => {
                _console.LogD("GetSocial is initialized and user is retrieved");
                _currentUser  = user;
                _isTestDevice = GetSocial.Device.IsTestDevice;
                FetchCurrentUserData();
            });
        }

        Invites.SetOnReferralDataReceivedListener((referralData) => {
            var logMessage = string.Empty;

            if (referralData != null)
            {
                logMessage += string.Format("Token: {0}\n", referralData.Token);
                logMessage += string.Format("Referrer user id: {0}\n", referralData.ReferrerUserId);
                logMessage += string.Format("Referrer channel: {0}\n", referralData.ReferrerChannelId);
                logMessage += string.Format("Is first match: {0}\n", referralData.IsFirstMatch);
                logMessage += string.Format("Is guarateed match: {0}\n", referralData.IsGuaranteedMatch);
                logMessage += "Referral Link params:\n" + referralData.LinkParams.ToDebugString();
            }
            _console.LogD("Referral data: \n" + logMessage);
        });

        GetSocial.Init();
    }
        protected override void DrawSectionBody()
        {
            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Notification Title: ", GSStyles.NormalLabelText);
                _title = GUILayout.TextField(_title, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Notification Text: ", GSStyles.NormalLabelText);
                _text = GUILayout.TextField(_text, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Image url: ", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _imageUrl = GUILayout.TextField(_imageUrl, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Video url: ", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _videoUrl = GUILayout.TextField(_videoUrl, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                _useCustomImage = GUILayout.Toggle(_useCustomImage, "", GSStyles.Toggle);
                GUILayout.Label("Send Custom Image", GSStyles.NormalLabelText, GUILayout.Width(Screen.width * 0.25f));
            });

            DemoGuiUtils.DrawRow(() =>
            {
                _useCustomVideo = GUILayout.Toggle(_useCustomVideo, "", GSStyles.Toggle);
                GUILayout.Label("Send Custom Video", GSStyles.NormalLabelText, GUILayout.Width(Screen.width * 0.25f));
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Background image: ", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _backgroundImageConfiguration = GUILayout.TextField(_backgroundImageConfiguration, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Title color: ", GSStyles.NormalLabelText);
                _titleColor = GUILayout.TextField(_titleColor, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Text color: ", GSStyles.NormalLabelText);
                _textColor = GUILayout.TextField(_textColor, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                Placeholders.Keys.ToList().ForEach(key =>
                {
                    if (GUILayout.Button(key, GSStyles.Button))
                    {
                        _text += Placeholders[key];
                    }
                });
            });

            GUILayout.Label("Action: " + (_action ?? "Default"), GSStyles.NormalLabelText);
            DemoGuiUtils.DrawRow(() =>
            {
                if (GUILayout.Button("Default", GSStyles.ShortButton))
                {
                    _action = null;
                }

                var actions = new[] { GetSocialActionType.Custom, GetSocialActionType.OpenProfile, GetSocialActionType.OpenActivity, GetSocialActionType.OpenInvites, GetSocialActionType.OpenUrl, GetSocialActionType.AddFriend };
                actions.ToList().ForEach(action =>
                {
                    if (GUILayout.Button(action, GSStyles.ShortButton))
                    {
                        _action = action;
                    }
                });
            });

            DemoGuiUtils.DynamicRowFor(_actionData, "Action Data");
            DemoGuiUtils.DynamicRowFor(_actionButtons, "Action Buttons");

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Template Name: ", GSStyles.NormalLabelText);
                _templateName = GUILayout.TextField(_templateName, GSStyles.TextField);
            });

            DemoGuiUtils.DynamicRowFor(_templatePlaceholders, "Template Placeholders");

            GUILayout.Label("Recipients:", GSStyles.NormalLabelText);

            DemoGuiUtils.DrawRow(() =>
            {
                _referrer = GUILayout.Toggle(_referrer, "", GSStyles.Toggle);
                GUILayout.Label("Referrer", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _referredUsers = GUILayout.Toggle(_referredUsers, "Referred Users", GSStyles.Toggle);
                GUILayout.Label("Referred Users", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _friends = GUILayout.Toggle(_friends, "Friends", GSStyles.Toggle);
                GUILayout.Label("Friends", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _me = GUILayout.Toggle(_me, "Me", GSStyles.Toggle);
                GUILayout.Label("Me", GSStyles.NormalLabelText);
            });

            DemoGuiUtils.DynamicRowFor(_userIds, "Custom Users ID");

            DemoGuiUtils.DrawRow(() =>
            {
                _sendBadgeValue = GUILayout.Toggle(_sendBadgeValue, "", GSStyles.Toggle);
                if (_sendBadgeValue)
                {
                    _sendBadgeIncrease = false;
                    _badgeIncrease     = "";
                }
                GUILayout.Label("Badge Count", GSStyles.NormalLabelText);
            });

            if (_sendBadgeValue)
            {
                _badgeValue = GUILayout.TextField(_badgeValue, GSStyles.TextField);
            }

            DemoGuiUtils.DrawRow(() =>
            {
                _sendBadgeIncrease = GUILayout.Toggle(_sendBadgeIncrease, "", GSStyles.Toggle);
                if (_sendBadgeIncrease)
                {
                    _sendBadgeValue = false;
                    _badgeValue     = "";
                }
                GUILayout.Label("Badge Increase", GSStyles.NormalLabelText);
            });

            if (_sendBadgeIncrease)
            {
                _badgeIncrease = GUILayout.TextField(_badgeIncrease, GSStyles.TextField);
            }

            if (GUILayout.Button("Send", GSStyles.Button))
            {
                var userIds = _userIds.ConvertAll(user => user.UserIdString);
                if (_me)
                {
                    userIds.Add(GetSocial.GetCurrentUser().Id);
                }
                var notificationTarget = new SendNotificationTarget(UserIdList.Create(userIds));
                if (_referrer)
                {
                    notificationTarget.AddPlaceholder(NotificationReceiverPlaceholders.Referrer);
                }
                if (_referredUsers)
                {
                    notificationTarget.AddPlaceholder(NotificationReceiverPlaceholders.ReferredUsers);
                }
                if (_friends)
                {
                    notificationTarget.AddPlaceholder(NotificationReceiverPlaceholders.Friends);
                }

                if (GetSocialActionType.AddFriend.Equals(_action) && string.IsNullOrEmpty(_text) && string.IsNullOrEmpty(_templateName))
                {
                    var addFriend = NotificationContent.CreateWithText(
                        NotificationContentPlaceholders.SenderDisplayName + " wants to become friends.")
                                    .WithTitle("Friend request")
                                    .WithAction(GetSocialAction.Create(_action, new Dictionary <string, string>()
                    {
                        { GetSocialActionKeys.AddFriend.UserId, GetSocial.GetCurrentUser().Id },
                        { "user_name", GetSocial.GetCurrentUser().DisplayName }
                    }));


                    Notifications.Send(addFriend,
                                       notificationTarget,
                                       () => _console.LogD("Notification sending started"),
                                       error => _console.LogE("Error: " + error.Message)
                                       );
                    return;
                }
                var mediaAttachment = _imageUrl.Length > 0 ? MediaAttachment.WithImageUrl(_imageUrl)
                    : _videoUrl.Length > 0 ? MediaAttachment.WithVideoUrl(_videoUrl)
                    : _useCustomImage?MediaAttachment.WithImage(Resources.Load <Texture2D>("activityImage"))
                                          : _useCustomVideo?MediaAttachment.WithVideo(DemoUtils.LoadSampleVideoBytes())
                                              : null;

                var customization = NotificationCustomization
                                    .WithBackgroundImageConfiguration(_backgroundImageConfiguration.ToNullIfEmpty())
                                    .WithTitleColor(_titleColor.ToNullIfEmpty())
                                    .WithTextColor(_textColor.ToNullIfEmpty());
                var content = NotificationContent.CreateWithText(_text)
                              .WithTitle(_title)
                              .WithTemplateName(_templateName)
                              .AddTemplatePlaceholders(_templatePlaceholders.ToDictionary(data => data.Key, data => data.Val))
                              .WithMediaAttachment(mediaAttachment)
                              .WithCustomization(customization)
                              .AddActionButtons(_actionButtons.ConvertAll(item => NotificationButton.Create(item.Key, item.Val))
                                                );

                if (_sendBadgeValue)
                {
                    content.WithBadge(Badge.SetTo(int.Parse(_badgeValue)));
                }
                else if (_sendBadgeIncrease)
                {
                    content.WithBadge(Badge.IncreaseBy(int.Parse(_badgeIncrease)));
                }

                if (_action != null)
                {
                    var action = GetSocialAction.Create(_action, _actionData.ToDictionary(data => data.Key, data => data.Val));
                    content.WithAction(action);
                }

                Notifications.Send(content,
                                   notificationTarget,
                                   () => _console.LogD("Notifications sending started"),
                                   error => _console.LogE("Error: " + error.Message)
                                   );
            }
        }
Ejemplo n.º 16
0
    private void DrawAddRemoveProperty()
    {
        DemoGuiUtils.Space();
        GUILayout.BeginVertical("Box");
        GUILayout.Label("Custom Properties", GSStyles.NormalLabelText);
        GUILayout.BeginHorizontal();
        GUILayout.Label("Public property: ", GSStyles.NormalLabelText);
        _key = GUILayout.TextField(_key, GSStyles.TextField);
        _val = GUILayout.TextField(_val, GSStyles.TextField);

        DemoGuiUtils.DrawButton("Add", () =>
        {
            if (GetSocial.GetCurrentUser().PublicProperties.ContainsKey(_key))
            {
                _console.LogW("Property already exists " + _key + "=" + GetSocial.GetCurrentUser().PublicProperties[_key] +
                              ", remove old one if you're really want to override it.");
            }
            else
            {
                var update = new UserUpdate().AddPublicProperty(_key, _val);
                GetSocial.GetCurrentUser().UpdateDetails(update,
                                                         () => _console.LogD(
                                                             "Property added for key: " + _key + "=" + GetSocial.GetCurrentUser().PublicProperties[_key]),
                                                         error => _console.LogE("Failed to add property for key: " + _key + ", error: " + error)
                                                         );
            }
        }, true, GSStyles.Button);
        DemoGuiUtils.DrawButton("Remove", () =>
        {
            var update = new UserUpdate().RemovePublicProperty(_key);
            GetSocial.GetCurrentUser().UpdateDetails(update,
                                                     () => _console.LogD("Property removed for key: " + _key),
                                                     error => _console.LogE("Failed to remove property for key: " + _key + ", error: " + error)
                                                     );
        }, true, GSStyles.Button);
        GUILayout.EndHorizontal();


        GUILayout.BeginHorizontal();
        GUILayout.Label("Private property: ", GSStyles.NormalLabelText);
        _keyPrivate = GUILayout.TextField(_keyPrivate, GSStyles.TextField);
        _valPrivate = GUILayout.TextField(_valPrivate, GSStyles.TextField);

        DemoGuiUtils.DrawButton("Add", () =>
        {
            if (GetSocial.GetCurrentUser().PrivateProperties.ContainsKey(_keyPrivate))
            {
                _console.LogW("Property already exists " + _keyPrivate + "=" +
                              GetSocial.GetCurrentUser().PrivateProperties[_keyPrivate] +
                              ", remove old one if you're really want to override it.");
            }
            else
            {
                var update = new UserUpdate().AddPrivateProperty(_key, _val);
                GetSocial.GetCurrentUser().UpdateDetails(update,
                                                         () => _console.LogD("Property added for key: " + _keyPrivate + "=" +
                                                                             GetSocial.GetCurrentUser().PrivateProperties[_keyPrivate]),
                                                         error => _console.LogE("Failed to add property for key: " + _keyPrivate + ", error: " + error)
                                                         );
            }
        }, true, GSStyles.Button);
        DemoGuiUtils.DrawButton("Remove", () =>
        {
            var update = new UserUpdate().RemovePrivateProperty(_key);
            GetSocial.GetCurrentUser().UpdateDetails(update,
                                                     () => _console.LogD("Property removed for key: " + _keyPrivate),
                                                     error => _console.LogE("Failed to remove property for key: " + _keyPrivate + ", error: " + error)
                                                     );
        }, true, GSStyles.Button);

        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
    }
Ejemplo n.º 17
0
    void DrawAddRemoveCustomProvider()
    {
        DemoGuiUtils.Space();
        GUILayout.BeginVertical("Box");
        GUILayout.Label("Custom Provider Identity", GSStyles.NormalLabelText);

        // user id
        GUILayout.BeginHorizontal();
        GUILayout.Label("UserID: ", GSStyles.NormalLabelText, GUILayout.Width(100f));
        _customUserId = GUILayout.TextField(_customUserId, GSStyles.TextField);
        GUILayout.EndHorizontal();

        if (string.IsNullOrEmpty(_customUserId))
        {
            GUILayout.Label("Custom Provider User ID cannot be empty", GSStyles.NormalLabelTextRed);
        }

        // user display name
        GUILayout.BeginHorizontal();
        GUILayout.Label("User DisplayName: ", GSStyles.NormalLabelText, GUILayout.Width(300f));
        DemoGuiUtils.DrawButton("Change Display Name", () => GetSocial.GetCurrentUser().UpdateDetails(new UserUpdate {
            DisplayName = GetDisplayNameForUser()
        },
                                                                                                      () =>
        {
            _console.LogD("User display name has been changed");
            demoController.FetchCurrentUserData();
        }, error => { _console.LogE("Failed to change user DisplayName: " + error); }), true, GSStyles.Button);
        GUILayout.EndHorizontal();

        //user avatar
        GUILayout.BeginHorizontal();
        GUILayout.Label("User Avatar: ", GSStyles.NormalLabelText, GUILayout.Width(100f));
        DemoGuiUtils.DrawButton("Change Avatar URL", () => GetSocial.GetCurrentUser().UpdateDetails(new UserUpdate {
            AvatarUrl = GetAvatarUrlForUser()
        }, () =>
        {
            _console.LogD("User avatar url has been changed");
            demoController.FetchCurrentUserData();
        }, error => { _console.LogE("Failed to change user AvatarURL: " + error); }), true, GSStyles.Button);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        DemoGuiUtils.DrawButton("Change Avatar", () => GetSocial.GetCurrentUser().UpdateDetails(new UserUpdate {
            Avatar = GetAvatarForUser()
        }, () =>
        {
            _console.LogD("User avatar has been changed");
            demoController.FetchCurrentUserData();
        }, error => { _console.LogE("Failed to change user Avatar: " + error); }), true, GSStyles.Button);
        GUILayout.EndHorizontal();


        // token
        GUILayout.BeginHorizontal();
        GUILayout.Label("Token: ", GSStyles.NormalLabelText, GUILayout.Width(100f));
        _customProviderToken = GUILayout.TextField(_customProviderToken, GSStyles.TextField);
        GUILayout.EndHorizontal();

        if (string.IsNullOrEmpty(_customProviderToken))
        {
            GUILayout.Label("Custom Provider token cannot be empty", GSStyles.NormalLabelTextRed);
        }

        GUILayout.BeginHorizontal();
        GUI.enabled = !string.IsNullOrEmpty(_customProviderToken) && !string.IsNullOrEmpty(_customUserId);
        DemoGuiUtils.DrawButton("Add", AddCustomUserIdentity, !UserHasCustomIdentity(), GSStyles.Button);
        GUI.enabled = true;
        DemoGuiUtils.DrawButton("Remove", RemoveCustomUserIdentity, UserHasCustomIdentity(), GSStyles.Button);
        DemoGuiUtils.DrawButton("Switch User", SwitchToCustomIdentityUser, true, GSStyles.Button);
        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
        DemoGuiUtils.Space();
    }