Notifications
Clear all

Online status

32 Posts
3 Users
0 Reactions
4,601 Views
(@tommih)
Posts: 44
Trusted Member
Topic starter
 

OK, so in that case it should work but somehow it still doesn't. Is there any way for us to check the lastSeen on a friend we've loaded, to see if it's getting properly updated? And do we still have to worry about time zones? I'm afraid it's still not clear to me how exactly this works. Where is the online status determined - on the server or on each client? I'd dig into your code myself to figure it out but it's in a .dll.

 
Posted : 03/02/2017 2:23 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

Enable the check Debug Log in CombuManager inspector and see what is returned from server when you call LoadFriends. About the timezone we should have got rid of it since now we're assuming that the dates/times are stored in UTC (line 48 in /lib/api.php and line 70 in Profile.cs).

This is a test script that you can run to see if it's working, we didn't find any issue:

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SocialPlatforms;
using System.Collections;
using Combu;
public class Test : MonoBehaviour {
   int login = 1;

   IEnumerator Start () {
      while (!CombuManager.isInitialized)
         yield return null;
      StartCoroutine(LoginLogout());
   }

   IEnumerator LoginLogout()
   {
      string username = (login > 0 ? "bb" : "aa");
      string password = (login > 0 ? "bb" : "aa");
      if (CombuManager.localUser.authenticated) {
         bool logout = false;
         CombuManager.platform.Logout (() => {
            logout = true;
         });
         while (!logout)
            yield return new WaitForSeconds (2f);
      }
      CombuManager.platform.Authenticate (username, password, (bool loginSuccess, string loginError) => {
         if (loginSuccess)
         {
            if (login > 0)
            {
               login *= -1;
               StartCoroutine(LoginLogout());
            }
            else
               DebugFriends();
         }
      });
   }

   void DebugFriends()
   {
      CombuManager.localUser.LoadFriends ((bool success) => {
         if (success && CombuManager.localUser.friends.Length > 0)
         {
            Debug.Log(CombuManager.localUser.friends[0].userName + " > " + (CombuManager.localUser.friends[0] as User).lastSeen);
         }
         login *= -1;
         StartCoroutine(LoginLogout());
      });
   }
}

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 03/02/2017 3:15 pm
Page 3 / 3
Share: