diff --git a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java index 246071e0f..15521510a 100644 --- a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java @@ -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() { + @Override + public void onSuccess(String data) { + Stack 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(); } } } diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index f0bb3c90e..555f0108a 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -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>> 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> 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> getContactInfo( @Query("liveuid") String liveUid ); + /** * 获取收件箱信息 */ @GET("/api/public/?service=Live.getContactMsg") Observable>> getContactMsg(); + /** * 删除联系方式信件 */ @@ -648,7 +649,7 @@ public interface PDLiveApi { * @return */ @GET("/api/public/?service=Guide.getWishlistV2") - Observable>> getWishlistV2( @Query("type") int type); + Observable>> 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>> getDiscountInfo( @Query("type") int type ); + /** * 获取地区 */ @GET("/api/public/?service=User.getUserArea") Observable> getUserArea(); + /** + * 注销账号 + */ + @GET("/api/public/?service=User.setLogOff") + Observable>> setLogOff(); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index fa80df2a6..41bfecaaf 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -371,7 +371,7 @@ public class LiveNetManager { }, new Consumer() { @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> callback) { + + public void getDiscountInfo(int type, HttpCallback> callback) { API.get().pdLiveApi(mContext) .getDiscountInfo(type) .subscribeOn(Schedulers.io()) @@ -1381,6 +1382,7 @@ public class LiveNetManager { } }).isDisposed(); } + public void getUserArea(HttpCallback callback) { API.get().pdLiveApi(mContext) .getUserArea() @@ -1403,6 +1405,28 @@ public class LiveNetManager { }).isDisposed(); } + public void setLogOff(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .setLogOff() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(""); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java index 9101071ae..99d965be4 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -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")); + } } diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index e4231fe8b..625c1b0fd 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -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(); + } /** * 修改个人资料 diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index 0e1fb97ec..240b00fa7 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1140,4 +1140,7 @@ Limited ride And limited avatar frame PK Ladder Race Confirm whether to go to the other party\'s studio? Not received? + Do you want to delete the account + After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue? + Confirm deletion diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index dc76ee77b..aac081a1b 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1141,4 +1141,7 @@ PK天梯赛 是否確認前往對方直播間? 充值未到账? + 是否刪除賬號 + 點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎? + 確認刪除 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index df309f357..d46e5a539 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1140,4 +1140,7 @@ 開啟後獲得直播通知 PK天梯赛 充值未到账? + 是否刪除賬號 + 點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎? + 確認刪除 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index dc76ee77b..aac081a1b 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1141,4 +1141,7 @@ PK天梯赛 是否確認前往對方直播間? 充值未到账? + 是否刪除賬號 + 點擊刪除後即刻生效,且不可恢復,您確認要繼續嗎? + 確認刪除 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index bb1f0ca22..ea893a064 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1147,4 +1147,7 @@ Limited ride And limited avatar frame Get live notification after opening Confirm whether to go to the other party\'s studio? Not received? + Do you want to delete the account + After clicking delete, it will take effect immediately and cannot be restored. Are you sure you want to continue? + Confirm deletion diff --git a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java index 4af6fd53f..9bc42717f 100644 --- a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java @@ -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;