private void applyToken(String token) { HashMap<String, String> map = new HashMap(); JSONObject json = new JSONObject(); try { json.put("token", token); json.put("type", "android"); json.put("version", Utils.getAppVersionCode() + ""); } catch (JSONException e) { e.printStackTrace(); } map.put("token", json.toString()); RequestManager.getInstance().setHeader(map); Utils.Log("setToken:" + json.toString()); }
/** * 绑定手机 * * @param * @param code */ public void boundTel( String oldTel, String newTel, String oldPassword, String newPassword, String code, StatusCallback callback) { RequestMap params = new RequestMap(); params.put("oldTel", oldTel); params.put("newTel", newTel); params.put("oldPassword", Utils.MD5(oldPassword.getBytes())); params.put("newPassword", Utils.MD5(newPassword.getBytes())); params.put("code", code); RequestManager.getInstance().post(API.URL.BindTel, params, callback); }
/** * 修改密码 * * @param tel * @param password * @param verify * @param callback */ public void modifyPassword(String tel, String password, String verify, StatusCallback callback) { RequestMap params = new RequestMap(); params.put("tel", tel); params.put("newP", Utils.MD5(password.getBytes())); params.put("code", verify); RequestManager.getInstance().post(API.URL.ModifyPassword, params, callback); }
public void setUserAccountData(UserAccountData userAccountData) { isUser = true; this.userAccountData = userAccountData; saveAccount(); applyToken(userAccountData.getTokenApp()); userAccountDataBehaviorSubject.onNext(userAccountData); Utils.Log("f**k"); }
public void saveAccount() { if (isUser) { Utils.writeObjectToFile( userAccountData, FileManager.getInstance().getChild(FileManager.Dir.Object, ACCOUNTFILE)); } else { } }
public void userRegister( String name, String tel, String password, String verify, StatusCallback callback) { RequestMap params = new RequestMap(); params.put("name", name); params.put("tel", tel); params.put("pass", Utils.MD5(password.getBytes())); params.put("code", verify); RequestManager.getInstance().post(API.URL.Register, params, callback); }
@Override protected void onAppCreate(Context ctx) { super.onAppCreate(ctx); Activity a = new Activity(); Window.Callback callback = a; View.OnCreateContextMenuListener menuListener = a; ComponentCallbacks2 componentCallbacks = a; userAccountData = (UserAccountData) Utils.readObjectFromFile( FileManager.getInstance().getChild(FileManager.Dir.Object, ACCOUNTFILE)); if (userAccountData != null) { applyToken(userAccountData.getTokenApp()); } else { applyToken(""); } updateAccountData(); }
public void userLogin(String tel, String password, StatusCallback callback) { RequestMap params = new RequestMap(); params.put("tel", tel); params.put("pass", Utils.MD5(password.getBytes())); RequestManager.getInstance() .post( API.URL.Login, params, callback.add( new DataCallback<UserAccountData>() { @Override public void success(String info, UserAccountData data) { setUserAccountData(data); } @Override public void error(String errorInfo) {} })); }