Parcourir la source

1.注销账户接口接入
2.用户协议和隐私协议引入
3.修复4000 不弹窗问题

zhangxinyu il y a 5 ans
Parent
commit
9f3b584403

+ 2 - 2
app/build.gradle

@@ -24,8 +24,8 @@ android {
         targetSdkVersion rootProject.ext.targetSdkVersion
         multiDexEnabled true
         multiDexKeepProguard file("multidexKeep.pro")//腾讯bugly的类放到主Dex
-        versionCode 333
-        versionName "3.3.3"
+        versionCode 339
+        versionName "3.3.9"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
         flavorDimensions "versionCode"
         ndk {

+ 4 - 0
app/src/main/java/com/tongyu/luck/happywork/http/Api.java

@@ -109,6 +109,10 @@ public class Api {
         //获取用户信息
         @POST("f/api/login/getUserInfo_new")
         Observable<ApiResultBean<ApiLoginBean>> getUserInfoNew(@Body Map<String, Object> args);
+
+        //注销登录
+        @POST("f/api/login/logout_new")
+        Observable<ApiResultBean<ApiNormalBean>> logoutNew(@Body Map<String, Object> args);
     }
 
     public interface PositionInterface {

+ 11 - 1
app/src/main/java/com/tongyu/luck/happywork/http/subscribe/LoginSubscribe.java

@@ -4,6 +4,7 @@ import android.content.Context;
 
 import com.tongyu.luck.happywork.bean.AuthCodeBean;
 import com.tongyu.luck.happywork.bean.api.ApiLoginBean;
+import com.tongyu.luck.happywork.bean.api.ApiNormalBean;
 import com.tongyu.luck.happywork.bean.api.ApiResultBean;
 import com.tongyu.luck.happywork.http.Api;
 import com.tongyu.luck.happywork.http.ApiObserver;
@@ -133,5 +134,14 @@ public class LoginSubscribe extends BaseSubscribe {
         Observable<ApiResultBean<ApiLoginBean>> observable = apiService.getUserInfoNew(params);
         subscribe(observable, mObservable);
     }
-
+    /**
+     * 注销登录
+     *
+     * @param mObservable
+     */
+    public void requestLogoutNew(Map<String, Object> params, ApiObserver<ApiNormalBean> mObservable) {
+        Api.LoginInterface apiService = ServiceGenerator.createService(Api.LoginInterface.class);
+        Observable<ApiResultBean<ApiNormalBean>> observable = apiService.logoutNew(params);
+        subscribe(observable, mObservable);
+    }
 }

Fichier diff supprimé car celui-ci est trop grand
+ 6 - 171
app/src/main/java/com/tongyu/luck/happywork/ui/activity/PrivacyTipsActivity.java


Fichier diff supprimé car celui-ci est trop grand
+ 11 - 177
app/src/main/java/com/tongyu/luck/happywork/ui/activity/UserTipsActivity.java


+ 1 - 6
app/src/main/java/com/tongyu/luck/happywork/ui/activity/cclient/mine/SettingActivity.java

@@ -99,12 +99,7 @@ public class SettingActivity extends BaseActivity<SettingPresenter> implements S
                     @Override
                     public void onClick(boolean isSure) {
                         if (!isSure) {
-                            //TODO 执行注销接口
-                            MyApplication.getInstance().logout();
-                            Intent intent = new Intent(mContext, CMainActivity.class);
-                            intent.putExtra(IntentConstant.BOOLEAN, true);//表示直接打开登录页面
-                            startActivity(intent);
-                            finish();
+                            mvpPresenter.logoutNew();
                         }
                     }
                 }).show();

+ 4 - 0
app/src/main/java/com/tongyu/luck/happywork/ui/mvp/cclient/contacts/SettingContacts.java

@@ -12,10 +12,14 @@ public class SettingContacts {
 
     public interface ISettingPresenter extends IPresenter {
         void checkUpdate();
+
+        void logoutNew();
     }
 
     public interface ISettingModel {
 
         void httpCheckUpdate(MvpDataCallBack<VersionBean> callBack);
+
+        void httpLogoutNew(MvpDataCallBack<Boolean> callBack);
     }
 }

+ 4 - 2
app/src/main/java/com/tongyu/luck/happywork/ui/mvp/cclient/model/BindingPhoneModel.java

@@ -77,8 +77,10 @@ public class BindingPhoneModel extends BaseModel implements BindingPhoneContacts
             @Override
             public void onError(ApiLoginBean data, ApiException exception) {
                 super.onError(data, exception);
-                if (data != null && exception != null) {
-                    mApiLoginBean = data;
+                if (exception != null) {
+                    if (data != null) {
+                        mApiLoginBean = data;
+                    }
                     mvpDataCallBack.onError(exception);
                 }
                 isRequest = false;

+ 4 - 2
app/src/main/java/com/tongyu/luck/happywork/ui/mvp/cclient/model/LoginModel.java

@@ -85,8 +85,10 @@ public class LoginModel extends BaseModel implements LoginContacts.ILoginModel {
             @Override
             public void onError(ApiLoginBean data, ApiException exception) {
                 super.onError(data, exception);
-                if (data != null && exception != null) {
-                    mApiLoginBean = data;
+                if (exception != null) {
+                    if (data != null) {
+                        mApiLoginBean = data;
+                    }
                     mvpDataCallBack.onError(exception);
                 }
                 isRequest = false;

+ 7 - 6
app/src/main/java/com/tongyu/luck/happywork/ui/mvp/cclient/model/MsgVerifyModel.java

@@ -64,7 +64,6 @@ public class MsgVerifyModel extends BaseModel implements MsgVerifyContacts.IMsgV
     }
 
 
-
     /**
      * 登录
      *
@@ -73,12 +72,12 @@ public class MsgVerifyModel extends BaseModel implements MsgVerifyContacts.IMsgV
      * @param mvpDataCallBack
      */
     @Override
-    public void httpLogin( String code, String clientId, final MvpDataCallBack<Boolean> mvpDataCallBack) {
+    public void httpLogin(String code, String clientId, final MvpDataCallBack<Boolean> mvpDataCallBack) {
         RetrofitHttpParams params = new RetrofitHttpParams(mContext);
         params.put("phone", getPhoneNum());
         params.put("code", code);
         params.put("client_id", clientId);
-        new LoginSubscribe(mContext).requestLoginNew(params.getRequestParams(), new ApiObserver<ApiLoginBean>(mContext, true,false) {
+        new LoginSubscribe(mContext).requestLoginNew(params.getRequestParams(), new ApiObserver<ApiLoginBean>(mContext, true, false) {
             @Override
             public void onSuccess(ApiLoginBean data) {
                 if (data != null) {
@@ -104,8 +103,10 @@ public class MsgVerifyModel extends BaseModel implements MsgVerifyContacts.IMsgV
             @Override
             public void onError(ApiLoginBean data, ApiException exception) {
                 super.onError(data, exception);
-                if (data != null && exception != null) {
-                    mApiLoginBean = data;
+                if (exception != null) {
+                    if (data != null) {
+                        mApiLoginBean = data;
+                    }
                     mvpDataCallBack.onError(exception);
                 }
             }
@@ -164,7 +165,7 @@ public class MsgVerifyModel extends BaseModel implements MsgVerifyContacts.IMsgV
      */
     @Override
     public String getPhoneNum() {
-        if(TextUtils.isEmpty(phoneNum)) {
+        if (TextUtils.isEmpty(phoneNum)) {
             if (getType() == AppConstant.MSG_VERIFY_LOGIN) {//如果是登录界面过来的则使用传递的电话号码
                 phoneNum = ((MsgVerifyActivity) mContext).getIntent().getStringExtra(IntentConstant.CONTENT);
             } else if (AppCacheManager.getInstance().getMemberModel() != null && !TextUtils.isEmpty(AppCacheManager.getInstance().getMemberModel().getPhone())) {

+ 23 - 0
app/src/main/java/com/tongyu/luck/happywork/ui/mvp/cclient/model/SettingModel.java

@@ -5,9 +5,11 @@ import android.content.Context;
 import com.tongyu.luck.happywork.baselibrary.utils.AppUtils;
 import com.tongyu.luck.happywork.bean.VersionBean;
 import com.tongyu.luck.happywork.bean.api.ApiCheckVersion;
+import com.tongyu.luck.happywork.bean.api.ApiNormalBean;
 import com.tongyu.luck.happywork.callback.MvpDataCallBack;
 import com.tongyu.luck.happywork.http.ApiObserver;
 import com.tongyu.luck.happywork.http.RetrofitHttpParams;
+import com.tongyu.luck.happywork.http.subscribe.LoginSubscribe;
 import com.tongyu.luck.happywork.http.subscribe.MessageSubscribe;
 import com.tongyu.luck.happywork.ui.base.BaseModel;
 import com.tongyu.luck.happywork.ui.mvp.cclient.contacts.SettingContacts;
@@ -42,4 +44,25 @@ public class SettingModel extends BaseModel implements SettingContacts.ISettingM
             }
         });
     }
+
+    /**
+     * 注销
+     *
+     * @param callBack
+     */
+    @Override
+    public void httpLogoutNew(final MvpDataCallBack<Boolean> callBack) {
+        RetrofitHttpParams params = new RetrofitHttpParams(mContext);
+        new LoginSubscribe(mContext).requestLogoutNew(params.getRequestParams(), new ApiObserver<ApiNormalBean>(mContext, true) {
+            @Override
+            public void onSuccess(ApiNormalBean data) {
+                callBack.onData(true);
+
+            }
+
+            @Override
+            public void onFinish() {
+            }
+        });
+    }
 }

+ 26 - 0
app/src/main/java/com/tongyu/luck/happywork/ui/mvp/cclient/presenter/SettingPresenter.java

@@ -1,9 +1,14 @@
 package com.tongyu.luck.happywork.ui.mvp.cclient.presenter;
 
+import android.content.Intent;
+
+import com.tongyu.luck.happywork.MyApplication;
 import com.tongyu.luck.happywork.R;
+import com.tongyu.luck.happywork.baselibrary.IntentConstant;
 import com.tongyu.luck.happywork.baselibrary.utils.ToastUtils;
 import com.tongyu.luck.happywork.bean.VersionBean;
 import com.tongyu.luck.happywork.callback.MvpDataCallBack;
+import com.tongyu.luck.happywork.ui.activity.cclient.CMainActivity;
 import com.tongyu.luck.happywork.ui.activity.cclient.mine.SettingActivity;
 import com.tongyu.luck.happywork.ui.base.BasePresenter;
 import com.tongyu.luck.happywork.ui.mvp.cclient.contacts.SettingContacts;
@@ -36,4 +41,25 @@ public class SettingPresenter extends BasePresenter<SettingActivity> implements
             });
         }
     }
+
+    /**
+     * 注销登录
+     */
+    @Override
+    public void logoutNew() {
+        if (isViewAttach()) {
+            mSettingModel.httpLogoutNew(new MvpDataCallBack<Boolean>() {
+                @Override
+                public void onData(Boolean data) {
+                    if (isViewAttach()) {
+                        MyApplication.getInstance().logout();
+                        Intent intent = new Intent(mvpReference.get(), CMainActivity.class);
+                        intent.putExtra(IntentConstant.BOOLEAN, true);//表示直接打开登录页面
+                        mvpReference.get().startActivity(intent);
+                        mvpReference.get().finish();
+                    }
+                }
+            });
+        }
+    }
 }

+ 3 - 16
app/src/main/res/layout/activity_tips.xml

@@ -4,22 +4,9 @@
     android:layout_height="match_parent"
     android:orientation="vertical">
 
-
-    <ScrollView
+    <WebView
+        android:id="@+id/wv"
         android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1">
-
-        <TextView
-            android:id="@+id/tv_tips"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:lineSpacingExtra="8dp"
-            android:paddingLeft="15dp"
-            android:paddingRight="15dp"
-            android:textColor="@color/text_black_66"
-            android:textSize="@dimen/px39_13sp" />
-    </ScrollView>
-
+        android:layout_height="match_parent" />
 
 </LinearLayout>

+ 1 - 1
app/src/main/res/values/strings.xml

@@ -129,7 +129,7 @@
     <string name="save_pictures">保存图片</string>
     <string name="read_agree">阅读并同意</string>
     <string name="user_tips">开心工作用户协议</string>
-    <string name="privacy_tips">开心工作隐私协议</string>
+    <string name="privacy_tips">开心工作隐私政策</string>
     <string name="integral_tips">积分规则</string>
     <string name="sign_tips">签到规则</string>
     <string name="pictures_save_success">图片已保存至相册</string>