根据接口返回选择 跳转 原生/H5 充值页

This commit is contained in:
wzq
2023-09-25 16:23:01 +08:00
parent 6e11cfb30d
commit 8bf25ad378
8 changed files with 62 additions and 16 deletions

View File

@@ -396,6 +396,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
when (v.id) {
R.id.iv_user_head, R.id.rl_user_info ->
mUserInfo?.let { UIHelper.showUserInfoAct(mContext, it.uid) }
R.id.iv_edit ->
mUserInfo?.let { UIHelper.showUserInfoModifyAct(mContext, it.uid) }
@@ -405,12 +406,14 @@ class MeFragment : BaseFragment(), View.OnClickListener {
AttentionListActivity::class.java
)
)
R.id.ll_user_fans -> startActivity(
Intent(
mContext,
FansListActivity::class.java
)
)
R.id.me_item_wallet -> {
//进入充值页面埋点
val goldWalletInfo = PayModel.get().currentWalletInfo
@@ -421,17 +424,10 @@ class MeFragment : BaseFragment(), View.OnClickListener {
}
map[IReportConstants.MODULE] = IReportConstants.PEKO_PAY
ReportManager.get().reportEvent(IReportConstants.PAYPAGE_SHOW, map)
if (AppMetaDataUtil.getChannelID().equals(Constants.GOOGLE)) {
ChargeActivity.start(mContext)
} else {
CommonWebViewActivity.start(
context, UriProvider.getOfficialPay(
4,
DeviceUtil.getDeviceId(context)
)
)
}
jumpChargePage()
}
R.id.me_item_vip -> {
VipMainActivity.start(mContext)
//进入贵族中心埋点
@@ -444,17 +440,42 @@ class MeFragment : BaseFragment(), View.OnClickListener {
map[IReportConstants.MODULE] = IReportConstants.PEKO_PAY
ReportManager.get().reportEvent(IReportConstants.PAYPAGE_SHOW, map)
}
R.id.ll_room -> {
OpenRoomHelper.openRoom(context as BaseActivity?)
}
R.id.ll_gain -> {
context?.let { EarnRecordActivity.start(it) }
}
R.id.ll_clean_diamonds -> {
GiveGoldActivity.start(mContext)
}
else -> {}
}
}
@SuppressLint("CheckResult")
private fun jumpChargePage() {
PayModel.get().chargeChannel
.compose(bindToLifecycle())
.subscribe({
if (it.isNative) {
ChargeActivity.start(mContext)
return@subscribe
}
CommonWebViewActivity.start(
context,
UriProvider.getOfficialPay(4, DeviceUtil.getDeviceId(context))
)
}, {
toast(it.message)
ChargeActivity.start(mContext)
})
}
}

View File

@@ -6,8 +6,7 @@ import com.hjq.toast.ToastUtils;
import com.yizhuan.erban.pay.view.IChargeView;
import com.yizhuan.xchat_android_core.pay.PayModel;
import com.yizhuan.xchat_android_library.base.PresenterEvent;
import io.reactivex.schedulers.Schedulers;
import com.yizhuan.xchat_android_library.utils.ListUtils;
/**
* Created by MadisonRong on 05/01/2018.
@@ -31,7 +30,12 @@ public class ChargePresenter extends PayPresenter<IChargeView> {
public void loadBanner() {
payModel.loadChargeBanner()
.compose(bindUntilEvent(PresenterEvent.DESTROY))
.subscribe( list -> getMvpView().onLoadedBanners(list),
.subscribe(list -> {
if (ListUtils.isListEmpty(list)) {
return;
}
getMvpView().onLoadedBanners(list);
},
error -> ToastUtils.show(error.getMessage()));
}
}

View File

@@ -391,6 +391,7 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
@Override
public void onLoadedBanners(List<Banner> banners) {
mVpBanner.setVisibility(View.VISIBLE);
mVpBanner.setLifecycleRegistry(getLifecycle())
.setAdapter(new BaseBannerAdapter<>() {
@Override

View File

@@ -90,9 +90,10 @@
android:id="@+id/vp_banner"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_16"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16" />
android:layout_marginTop="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"

View File

@@ -7,6 +7,7 @@ import com.yizhuan.xchat_android_core.base.IModel;
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
import com.yizhuan.xchat_android_core.bean.response.result.ChargeListResult;
import com.yizhuan.xchat_android_core.pay.bean.Banner;
import com.yizhuan.xchat_android_core.pay.bean.ChargeChannelInfo;
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeGoods;
import com.yizhuan.xchat_android_core.pay.bean.NewUserChargeInfo;
import com.yizhuan.xchat_android_core.pay.bean.PayRecordId;
@@ -118,4 +119,6 @@ public interface IPayModel extends IModel {
Single<String> getChargeContact();
Single<ChargeChannelInfo> getChargeChannel();
}

View File

@@ -17,6 +17,7 @@ import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.manager.RoomEvent;
import com.yizhuan.xchat_android_core.pay.bean.Banner;
import com.yizhuan.xchat_android_core.pay.bean.ChargeBannerInfo;
import com.yizhuan.xchat_android_core.pay.bean.ChargeChannelInfo;
import com.yizhuan.xchat_android_core.pay.bean.FirstChargeGoods;
import com.yizhuan.xchat_android_core.pay.bean.NewUserChargeInfo;
import com.yizhuan.xchat_android_core.pay.bean.PayRecordId;
@@ -492,6 +493,13 @@ public class PayModel extends BaseModel implements IPayModel {
.compose(RxHelper.handleSchedulers());
}
@Override
public Single<ChargeChannelInfo> getChargeChannel() {
return api.getChargeChannel()
.compose(RxHelper.handleBeanData())
.compose(RxHelper.handleSchedulers());
}
public interface Api {
@@ -656,6 +664,9 @@ public class PayModel extends BaseModel implements IPayModel {
@GET("/first/charge/limit/list")
Single<ServiceResult<NewUserChargeInfo>> getNewUserChargeInfo();
@GET("/charge/guide/channel")
Single<ServiceResult<ChargeChannelInfo>> getChargeChannel();
@GET("/charge/guide/banner")
Single<ServiceResult<ChargeBannerInfo>> getChargeBanner();

View File

@@ -0,0 +1,5 @@
package com.yizhuan.xchat_android_core.pay.bean
data class ChargeChannelInfo(
val isNative: Boolean
)

View File

@@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m
org.gradle.daemon=true
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit