public void FetchProfileForCurrentAccessToken(Action <TDSLoginProfile> profileCallback, Action <string> errorCallback) { Command command = new Command(TDSLoginConstants.TDS_LOGIN_SERVICE, "fetchProfileForCurrentAccessToken", true, null); EngineBridge.GetInstance().CallHandler(command, (result) => { if (result.code != Result.RESULT_SUCCESS) { errorCallback(result.message); return; } if (string.IsNullOrEmpty(result.content)) { errorCallback(result.message); return; } LoginWrapperBean <string> wrapperBean = new LoginWrapperBean <string>(result.content); if (wrapperBean.loginCallbackCode == 0) { TDSLoginProfile profile = new TDSLoginProfile(wrapperBean.wrapper); profileCallback(profile); return; } errorCallback(wrapperBean.wrapper); }); }
public void GetCurrentProfile(Action <TDSLoginProfile> callback) { Command command = new Command(TDSLoginConstants.TDS_LOGIN_SERVICE, "currentProfile", true, null); EngineBridge.GetInstance().CallHandler(command, (result) => { Debug.Log("currentProfile:" + result.toJSON()); if (result.code != Result.RESULT_SUCCESS) { callback(null); return; } if (string.IsNullOrEmpty(result.content)) { callback(null); return; } TDSLoginProfile profile = new TDSLoginProfile(result.content); callback(profile); }); }