退出登录

This commit is contained in:
yangyakun
2022-08-18 18:26:24 +08:00
parent b27ebd9c79
commit 5aa9257c13
15 changed files with 152 additions and 37 deletions

View File

@@ -9,4 +9,6 @@ public interface ITaxiCarStatusCallback {
void onCarStatusChanged(boolean inOperation,String role);
void onServiceDataUpdate(long dailyTimeDuration, long dailyOrderNum);
void onCarLoginStatusChange(boolean isLogin);
}

View File

@@ -125,7 +125,7 @@ public class TaxiLoginModel {
}
public void release() {
this.iTaxiLoginCallback = null;
}
/**

View File

@@ -1524,4 +1524,31 @@ public class TaxiModel {
mOrderStatusCallback.onCurrentOrderStatusChanged(mCurrentOCHOrder);
}
}
// 取消待服务中订单
public void logout() {
TaxiServiceManager.getInstance().logout(mContext,
new TaxiServiceCallback<BaseData>() {
@Override
public void onSuccess(BaseData data) {
if (null != data && 0 == data.code) {
mCarStatusCallback.onCarLoginStatusChange(false);
}
}
@Override
public void onError() {
if (!NetworkUtils.isConnected(mContext)) {
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
} else {
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
}
}
@Override
public void onFail(int code, String msg) {
ToastUtils.showShort(code + "," + msg);
}
});
}
}

View File

@@ -312,7 +312,7 @@ interface TaxiServiceApiNew {
/**
* 收车/出车状态查询
* 获取手机验证码
* @param sn
* @return
*/
@@ -322,7 +322,7 @@ interface TaxiServiceApiNew {
Observable<DriverStatusQueryRespBean> getPhoneCode(@Header ("appId") String appId
,@Header("ticket") String ticket,@Query("sn") String sn,@Query("phone") String phone);
/**
* 订单完成
* 通过验证码登录
* @param appId
* @param ticket
* @param data
@@ -332,5 +332,12 @@ interface TaxiServiceApiNew {
@POST( "/autopilot-car-hailing/cab/flow/v1/driver/taxi/orderCompleted" )
Observable<TaxiLoginRespBean> gotoLoginBycode(@Header ("appId") String appId
, @Header("ticket") String ticket, @Body TaxiLoginReqBean data);
/**
* 登出接口
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
@GET("/autopilot-car-hailing/car/v2/driver/taxi/serviceStatus/query")
Observable<BaseData> logout(@Header ("appId") String appId,@Header("ticket") String ticket,
@Query("sn") String sn);
}

View File

@@ -466,9 +466,23 @@ public class TaxiServiceManager {
, new TaxiLoginReqBean(phone,code,sn))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getSubscribeImpl(context, callback, "getPhoneCode"));
.subscribe(getSubscribeImpl(context, callback, "gotoLoginBycode"));
}
/**
* 登出
*/
public void logout(Context context, TaxiServiceCallback<BaseData> callback) {
mOCHTaxiServiceApi.logout(
MoGoAiCloudClientConfig.getInstance().getServiceAppId(),
MoGoAiCloudClientConfig.getInstance().getToken(),
MoGoAiCloudClientConfig.getInstance().getSn())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getSubscribeImpl(context, callback, "logout"));
}
private <T extends BaseData> SubscribeImpl getSubscribeImpl(
Context context, TaxiServiceCallback<T> callback, String apiName) {

View File

@@ -55,6 +55,7 @@ class TaxiLoginPresenter(view: TaxiLoginDialogFragment?) :
override fun onDestroy(owner: LifecycleOwner) {
super.onDestroy(owner)
TaxiLoginModel.getInstance().release()
countDownDisposable?.let {
if (!it.isDisposed) {
it.dispose()

View File

@@ -158,6 +158,11 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
TaxiModel.getInstance().orderCompleted();
}
// 登出
public void logout() {
TaxiModel.getInstance().logout();
}
@Override
public void onAutopilotArriveEnd() {
@@ -197,6 +202,11 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
runOnUIThread(() -> mView.onServiceDataUpdate(dailyTimeDuration,dailyOrderNum));
}
@Override
public void onCarLoginStatusChange(boolean isLogin) {
mView.showLoginDialogFragment();
}
@Override
public void onOrdersInServiceChanged(@NonNull @NotNull List<OrderQueryRespBean.Result> inServiceList) {

View File

@@ -202,12 +202,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
}
}
});
mPersonalBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onGoToTaxiOrders();
}
});
mPersonalBtn.setOnClickListener(v -> onGoToTaxiOrders());
mSettingBtn = findViewById(R.id.module_och_taxi_setting_layout);
mSettingBtn.setOnClickListener(v -> {

View File

@@ -5,14 +5,19 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAX
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.fragment.app.FragmentTransaction;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.temp.EventLogout;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.taxi.R;
@@ -23,6 +28,10 @@ import com.mogo.och.taxi.model.TaxiModel;
import com.mogo.och.taxi.presenter.TaxiPresenter;
import com.mogo.och.taxi.utils.TPRouteDataTestUtils;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.lang.ref.WeakReference;
import java.util.List;
@@ -52,6 +61,13 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
protected double mCurLatitude = 0.0;
protected double mCurLongitude = 0.0;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
EventBus.getDefault().register(this);
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public int getStationPanelViewId() {
return R.layout.taxi_panel;
@@ -78,7 +94,7 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
@Override
protected void initViews() {
super.initViews();
mPersonalBtn.setVisibility(View.GONE);
//mPersonalBtn.setVisibility(View.GONE);
initFragment();
hidPanel();
if (MogoApisHandler.getInstance()
@@ -149,8 +165,14 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
@Override
public void onDestroyView() {
super.onDestroyView();
EventBus.getDefault().unregister(this);
}
/**
* 状态变更
* @param inOperation true 可以接单 false 暂停接单
* @param role 测试车辆:测试 演示车辆V 运营车辆: ""空
*/
public void updateOperationStatus(boolean inOperation,String role) {
CallerLogger.INSTANCE.e(M_TAXI + TAG, "onOperationChanged:" + inOperation);
isOperationStatus = inOperation;
@@ -161,16 +183,14 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
}else {
mDriverRole.setVisibility(View.GONE);
}
tvOperationStatus.setText("收车");
mPersonalBtn.setVisibility(View.VISIBLE);
tvOperationStatus.setText("暂停接单");
tvOperationStatus.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.taxi_back_btn), null, null, null);
showPanel();
} else {
mDriverRole.setVisibility(View.GONE);
// AIAssist.getInstance(getContext()).speakTTSVoice("已收车");
tvOperationStatus.setText("出车");
tvOperationStatus.setText("接单");
tvOperationStatus.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.taxi_out_btn), null, null, null);
mPersonalBtn.setVisibility(View.GONE);
hidPanel();
}
}
@@ -368,13 +388,19 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
}
TaxiModel.getInstance().setOnTheWayToEndStation();
});
findViewById(R.id.test_bar_show_login).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
taxiLoginDialogFragment = new WeakReference<>(TaxiLoginDialogFragment.newInstance());
taxiLoginDialogFragment.get().show(getParentFragmentManager(),taxiLoginDialogFragment.get().getTag());
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void changeOverview(EventLogout eventLogout){
CallerLogger.INSTANCE.d(M_TAXI + TAG,"changeOverview 开始登出成功");
mPresenter.logout();
}
public void showLoginDialogFragment(){
CallerLogger.INSTANCE.d(M_TAXI + TAG,"showLoginDialogFragment 登出成功");
CallerHmiManager.INSTANCE.hideToolsView();
taxiLoginDialogFragment = new WeakReference<>(TaxiLoginDialogFragment.newInstance());
taxiLoginDialogFragment.get().show(getParentFragmentManager(),taxiLoginDialogFragment.get().getTag());
}
private void testRouteInfoUpload() {

View File

@@ -92,7 +92,7 @@
<CheckedTextView
android:id="@+id/module_mogo_och_operation_status"
android:layout_width="250px"
android:layout_width="wrap_content"
android:layout_height="102px"
android:layout_marginLeft="48px"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
@@ -132,7 +132,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_operation_status"
android:gravity="center"
android:visibility="gone"
app:layout_goneMarginLeft="48px">
<ImageView
android:layout_width="wrap_content"

View File

@@ -89,13 +89,5 @@
android:text="到达目的地"
android:textSize="12sp" />
<Button
android:id="@+id/test_bar_show_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="testToEnd"
android:text="打开登录"
android:textSize="12sp" />
</LinearLayout>
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>

View File

@@ -9,25 +9,24 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.bindingcar.IPCUpgradeStateInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.temp.EventLogout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.utils.KeyBoardUtil
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.view_auto_pilot_check.view.*
import mogo.telematics.pad.MessagePad
import org.greenrobot.eventbus.EventBus
/**
* @author ChenFufeng
@@ -142,6 +141,7 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
if (speedLimit > 0) {
etInputSpeed.setText((speedLimit * 3.6).toInt().toString())
}
initOchView()
// // 比如需要设置默认速度
// val speed = "30"
// etInputSpeed.setText(speed)
@@ -149,6 +149,20 @@ class AutoPilotAndCheckView @JvmOverloads constructor(
}
private fun initOchView() {
actvLoginout.onClick {
EventBus.getDefault().post(EventLogout())
}
when (DebugConfig.getProductFlavor()) {
"fPadLenovoOchTaxi" -> {
actvLoginout.visibility = View.VISIBLE
}
else -> {
}
}
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="24px"/>
<gradient android:startColor="#029DFF" android:endColor="#0056FF"/>
</shape>

View File

@@ -252,10 +252,25 @@
android:layout_height="wrap_content"
android:layout_marginTop="40px"
android:layout_marginBottom="40px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewSystemVersion" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actvLoginout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/systemVersionView"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="center"
android:background="@drawable/taxi_loginout_bg"
android:layout_marginBottom="40px"
android:text="退出登录"
android:visibility="gone"
android:textColor="@android:color/white"
android:textSize="42px"
android:layout_width="790px"
android:layout_height="126px"/>
<com.mogo.eagle.core.function.hmi.ui.tools.SpeedKeyboardView
android:id="@+id/sKeyBoardView"
android:layout_width="match_parent"

View File

@@ -0,0 +1,5 @@
package com.mogo.eagle.core.data.temp;
//临时使用 后期需要封装
public class EventLogout {
}