public void loginWeme(string clientId,string clientSecret,WemeManager.WmOauthDisplayOrientation orientation,WmInterfaceBroker.WmInterfaceBrokerDelegate callback){ if(WemeManager.isEmpty(clientId)==true||WemeManager.isEmpty(clientSecret)==true){ Debug.Log("must not null clientId or clientSecret"); return; } JSONObject jsonObject = new JSONObject(); jsonObject.Add(JSON_KEY_URI,JSON_VALUE_PREFIX_URI+WM_HOST_WEME); JSONObject paramsObject = new JSONObject(); paramsObject.Add("clientId",clientId); paramsObject.Add("clientSecret",clientSecret); string orientationString = null; if(WemeManager.WmOauthDisplayOrientation.WM_OAUTH_DISPLAY_ORIENTATION_LANDSCAPE == orientation){ orientationString = "landscape"; }else if(WemeManager.WmOauthDisplayOrientation.WM_OAUTH_DISPLAY_ORIENTATION_PORTRAIT == orientation){ orientationString = "portrait"; } if(orientationString!=null) paramsObject.Add("orientation",orientationString); jsonObject.Add(JSON_KEY_PARAMS,paramsObject); WmInterfaceBroker.getInstance.requestAsync(jsonObject.ToString(),callback); }
public void loginFacebook(string appId,string redirectUri,string[] permissions,WemeManager.WmOauthDisplayOrientation orientation,WmInterfaceBroker.WmInterfaceBrokerDelegate callback){ if(WemeManager.isEmpty(appId)==true||WemeManager.isEmpty(redirectUri)==true){ Debug.Log("must not null appId or redirectUri"); return; } JSONObject jsonObject = new JSONObject(); jsonObject.Add(JSON_KEY_URI,JSON_VALUE_PREFIX_URI+WM_HOST_FACEBOOK); JSONObject paramsObject = new JSONObject(); paramsObject.Add("appId",appId); paramsObject.Add("redirectUri",redirectUri); string permissionsString = ConvertStringArrayToString(permissions); paramsObject.Add("permissions",JSONArray.Parse(permissionsString)); string orientationString = null; if(WemeManager.WmOauthDisplayOrientation.WM_OAUTH_DISPLAY_ORIENTATION_LANDSCAPE == orientation){ orientationString = "landscape"; }else if(WemeManager.WmOauthDisplayOrientation.WM_OAUTH_DISPLAY_ORIENTATION_PORTRAIT == orientation){ orientationString = "portrait"; } if(orientationString!=null) paramsObject.Add("orientation",orientationString); jsonObject.Add(JSON_KEY_PARAMS,paramsObject); WmInterfaceBroker.getInstance.requestAsync(jsonObject.ToString(),callback); }