注销账号功能添加

This commit is contained in:
18401019693 2023-04-20 16:46:10 +08:00
parent 79a709a76f
commit 381ca84525
11 changed files with 119 additions and 11 deletions

View File

@ -1,5 +1,6 @@
package com.yunbao.common.activity;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
@ -22,25 +23,31 @@ import android.widget.ProgressBar;
import androidx.annotation.RequiresApi;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.R;
import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.AndroidBug5497Workaround;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DeviceUtils;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.JavascriptInterfaceUtils;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.HintCustomPopup;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.Locale;
import java.util.Stack;
/**
* Created by cxf on 2018/9/25.
@ -240,7 +247,7 @@ public class WebViewActivity extends AbsActivity {
}
}
Intent intent = new Intent(context, WebViewActivity.class);
intent.putExtra(Constants.URL, url+ "&isZh=" + ((IMLoginManager.get(CommonAppContext.sInstance.getBaseContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
intent.putExtra(Constants.URL, url + "&isZh=" + ((IMLoginManager.get(CommonAppContext.sInstance.getBaseContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
context.startActivity(intent);
}
@ -326,6 +333,46 @@ public class WebViewActivity extends AbsActivity {
} catch (Exception e) {
throw new RuntimeException(e);
}
} else if (TextUtils.equals(event.getMethod(), "clickLogOffAccount")) {
new XPopup.Builder(mContext)
.asCustom(new HintCustomPopup(mContext,
mContext.getString(R.string.delete_account1),
mContext.getString(R.string.delete_account2))
.setLiveOpenOk(mContext.getString(R.string.delete_account3))
.setLiveOpenCancel(mContext.getString(R.string.cancel))
.setCallBack(new HintCustomPopup.HintCustomCallBack() {
@Override
public void onSure() {
LiveNetManager.get(mContext).
setLogOff(new HttpCallback<String>() {
@Override
public void onSuccess(String data) {
Stack<Activity> allActivityStacks = AppManager.getInstance().getAllActivityStacks();
for (int i = 0; i < allActivityStacks.size(); i++) {
if (!(allActivityStacks.get(i) instanceof WebViewActivity)) {
allActivityStacks.get(i).finish();
}
}
IMLoginManager.get(mContext).logout(mContext);
CommonAppConfig.getInstance().clearLoginInfo();
mContext.finish();
RouteUtil.forwardLoginActivity();
}
@Override
public void onError(String error) {
}
});
}
@Override
public void onCancel() {
}
}))
.show();
}
}
}

View File

@ -41,7 +41,6 @@ import com.yunbao.common.bean.UserAreaBean;
import com.yunbao.common.bean.VipModel;
import com.yunbao.common.bean.WishListGiftConfModel;
import com.yunbao.common.bean.WishListModel;
import com.yunbao.common.bean.WishListModel2;
import java.util.List;
import java.util.Map;
@ -584,6 +583,7 @@ public interface PDLiveApi {
Observable<ResponseModel<List<ListInfoMessageModel>>> getAnchorMsg(
@Query("liveuid") String liveUid, @Query("page") int page, @Query("limit") int limit
);
/**
* 获取女神说数据
*/
@ -595,17 +595,16 @@ public interface PDLiveApi {
/**
* 设置女神说
*
* @param isShow 是否显示
* @param content 内容
* @param isShow 是否显示
* @param content 内容
* @param styleImage 女神说底图地址
*
*/
@GET("/api/public/?service=Live.setLivePreview")
Observable<ResponseModel<String>> setLivePreviewInfo(
@Query("liveuid") String liveUid,
@Query("isShow") int isShow,
@Query("content") String content,
@Query("styleImage")String styleImage
@Query("styleImage") String styleImage
);
/**
@ -629,11 +628,13 @@ public interface PDLiveApi {
Observable<ResponseModel<LiveAnchorCallMeModel>> getContactInfo(
@Query("liveuid") String liveUid
);
/**
* 获取收件箱信息
*/
@GET("/api/public/?service=Live.getContactMsg")
Observable<ResponseModel<List<LiveUserMailBoxModel>>> getContactMsg();
/**
* 删除联系方式信件
*/
@ -648,7 +649,7 @@ public interface PDLiveApi {
* @return
*/
@GET("/api/public/?service=Guide.getWishlistV2")
Observable<ResponseModel<List<WishListModel>>> getWishlistV2( @Query("type") int type);
Observable<ResponseModel<List<WishListModel>>> getWishlistV2(@Query("type") int type);
/**
* 获取礼物配置
@ -673,6 +674,7 @@ public interface PDLiveApi {
@Query("type") int type,
@Query("list") String list
);
/**
* 获取折扣卷信息
*/
@ -680,10 +682,16 @@ public interface PDLiveApi {
Observable<ResponseModel<List<DiscountsModel>>> getDiscountInfo(
@Query("type") int type
);
/**
* 获取地区
*/
@GET("/api/public/?service=User.getUserArea")
Observable<ResponseModel<UserAreaBean>> getUserArea();
/**
* 注销账号
*/
@GET("/api/public/?service=User.setLogOff")
Observable<ResponseModel<List<Object>>> setLogOff();
}

View File

@ -371,7 +371,7 @@ public class LiveNetManager {
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Log.e("异常", "checkLive: ",throwable);
Log.e("异常", "checkLive: ", throwable);
if (callBack != null) {
callBack.onError(throwable.getMessage());
}
@ -1360,7 +1360,8 @@ public class LiveNetManager {
}
}).isDisposed();
}
public void getDiscountInfo(int type,HttpCallback<List<DiscountsModel>> callback) {
public void getDiscountInfo(int type, HttpCallback<List<DiscountsModel>> callback) {
API.get().pdLiveApi(mContext)
.getDiscountInfo(type)
.subscribeOn(Schedulers.io())
@ -1381,6 +1382,7 @@ public class LiveNetManager {
}
}).isDisposed();
}
public void getUserArea(HttpCallback<UserAreaBean> callback) {
API.get().pdLiveApi(mContext)
.getUserArea()
@ -1403,6 +1405,28 @@ public class LiveNetManager {
}).isDisposed();
}
public void setLogOff(HttpCallback<String> callback) {
API.get().pdLiveApi(mContext)
.setLogOff()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<Object>>>() {
@Override
public void accept(ResponseModel<List<Object>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess("");
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(throwable.getMessage());
}
}
}).isDisposed();
}
/**
* 直播间取消网络请求
*/

View File

@ -542,4 +542,9 @@ public class JavascriptInterfaceUtils {
Bus.get().post(new JavascriptInterfaceEvent()
.setMethod("closeLiveRoom"));
}
@JavascriptInterface
public void clickLogOffAccount() {
Bus.get().post(new JavascriptInterfaceEvent()
.setMethod("clickLogOffAccount"));
}
}

View File

@ -37,6 +37,7 @@ public class RouteUtil {
public static final String PATH_SETTING = "/main/SettingActivity";
public static final String PATH_FANSACTIVITY = "/main/FansActivity";
public static final String PATH_MYWEBVIEWACTIVTITY2 = "/main/MyWebViewActivity2";
public static final String PATH_LOGIN = "/main/LoginActivity";
public static void forwardFansActivity(String uid) {
ARouter.getInstance().build(PATH_FANSACTIVITY)
@ -186,6 +187,13 @@ public class RouteUtil {
ARouter.getInstance().build(PATH_EDITPROFILE)
.navigation();
}
/**
* 修改个人资料
*/
public static void forwardLoginActivity() {
ARouter.getInstance().build(PATH_LOGIN)
.navigation();
}
/**
* 修改个人资料

View File

@ -1140,4 +1140,7 @@ Limited ride And limited avatar frame</string>
<string name="PK_Ladder_Race">PK Ladder Race</string>
<string name="party_studio">Confirm whether to go to the other party\'s studio</string>
<string name="not_received">Not received?</string>
<string name="delete_account1">Do you want to delete the account</string>
<string name="delete_account2">After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue?</string>
<string name="delete_account3">Confirm deletion</string>
</resources>

View File

@ -1141,4 +1141,7 @@
<string name="PK_Ladder_Race">PK天梯赛</string>
<string name="party_studio">是否確認前往對方直播間?</string>
<string name="not_received">充值未到账?</string>
<string name="delete_account1">是否刪除賬號</string>
<string name="delete_account2">點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?</string>
<string name="delete_account3">確認刪除</string>
</resources>

View File

@ -1140,4 +1140,7 @@
<string name="chat_prompt11">開啟後獲得直播通知</string>
<string name="PK_Ladder_Race">PK天梯赛</string>
<string name="not_received">充值未到账?</string>
<string name="delete_account1">是否刪除賬號</string>
<string name="delete_account2">點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?</string>
<string name="delete_account3">確認刪除</string>
</resources>

View File

@ -1141,4 +1141,7 @@
<string name="PK_Ladder_Race">PK天梯赛</string>
<string name="party_studio">是否確認前往對方直播間?</string>
<string name="not_received">充值未到账?</string>
<string name="delete_account1">是否刪除賬號</string>
<string name="delete_account2">點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎?</string>
<string name="delete_account3">確認刪除</string>
</resources>

View File

@ -1147,4 +1147,7 @@ Limited ride And limited avatar frame</string>
<string name="chat_prompt11">Get live notification after opening</string>
<string name="party_studio">Confirm whether to go to the other party\'s studio</string>
<string name="not_received">Not received?</string>
<string name="delete_account1">Do you want to delete the account</string>
<string name="delete_account2">After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue?</string>
<string name="delete_account3">Confirm deletion</string>
</resources>

View File

@ -17,6 +17,7 @@ import android.widget.EditText;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.DeviceUtils;
@ -65,7 +66,7 @@ import org.greenrobot.eventbus.ThreadMode;
/**
* Created by cxf on 2018/9/17.
*/
@Route(path = RouteUtil.PATH_LOGIN)
public class LoginActivity extends AbsActivity {
private View mRoot;