|
@@ -18,7 +18,7 @@ import 'package:widgets/dialog/app_default_dialog.dart';
|
|
|
part 'setting_view_model.g.dart';
|
|
|
|
|
|
@riverpod
|
|
|
-class SettingViewModel extends _$SettingViewModel with DioCancelableMixin{
|
|
|
+class SettingViewModel extends _$SettingViewModel with DioCancelableMixin {
|
|
|
late final AuthRepository _authRepository;
|
|
|
|
|
|
@override
|
|
@@ -51,42 +51,51 @@ class SettingViewModel extends _$SettingViewModel with DioCancelableMixin{
|
|
|
));
|
|
|
}
|
|
|
|
|
|
- /// 调用接口注册FCM
|
|
|
+ /// 调用接口注退出登录
|
|
|
void _requestLogout() async {
|
|
|
final result = await _authRepository.authLogout(cancelToken: cancelToken);
|
|
|
-
|
|
|
//请求成功去首页
|
|
|
if (result.isSuccess) {
|
|
|
//清除用户登录信息
|
|
|
- UserConfigService.getInstance().handleLogoutParams();
|
|
|
- // 清除 garagesale category 缓存
|
|
|
- SPUtil.remove(AppConstant.storageGarageCategoryList);
|
|
|
- // 清除 servives category 缓存
|
|
|
- SPUtil.remove(AppConstant.storagePaidServiceCategoryList);
|
|
|
- SPUtil.remove(AppConstant.storageRepairServiceCategoryList);
|
|
|
- //清除全部页面栈去登录页面
|
|
|
- ComponentServiceManager().authService.startAndPopAllLoginPage();
|
|
|
+ _gotoLoginPage();
|
|
|
} else {
|
|
|
ToastEngine.show(result.errorMsg ?? "UnKnow Error");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ void _gotoLoginPage() {
|
|
|
+ UserConfigService.getInstance().handleLogoutParams();
|
|
|
+ // 清除 garagesale category 缓存
|
|
|
+ SPUtil.remove(AppConstant.storageGarageCategoryList);
|
|
|
+ // 清除 servives category 缓存
|
|
|
+ SPUtil.remove(AppConstant.storagePaidServiceCategoryList);
|
|
|
+ SPUtil.remove(AppConstant.storageRepairServiceCategoryList);
|
|
|
+ //清除全部页面栈去登录页面
|
|
|
+ ComponentServiceManager().authService.startAndPopAllLoginPage();
|
|
|
+ }
|
|
|
+
|
|
|
//删除账号的提示弹窗
|
|
|
void doDeleteAccount() {
|
|
|
DialogEngine.show(widget: AccountDeactivationDialog(
|
|
|
confirmAction: () {
|
|
|
//请求接口删除账号
|
|
|
-
|
|
|
- //清除用户登录信息
|
|
|
- UserConfigService.getInstance().handleLogoutParams();
|
|
|
- //清除全部页面栈去登录页面
|
|
|
- ComponentServiceManager().authService.startAndPopAllLoginPage();
|
|
|
+ _requestAccountDeactivate();
|
|
|
},
|
|
|
));
|
|
|
}
|
|
|
|
|
|
- //评价我们,跳转到各平台的应用商城
|
|
|
- void rateUs() {
|
|
|
-
|
|
|
+ //请求删除账号
|
|
|
+ void _requestAccountDeactivate() async {
|
|
|
+ final result = await _authRepository.accountDeactivate(cancelToken: cancelToken);
|
|
|
+ //请求成功去首页
|
|
|
+ if (result.isSuccess) {
|
|
|
+ //清除用户登录信息
|
|
|
+ _gotoLoginPage();
|
|
|
+ } else {
|
|
|
+ ToastEngine.show(result.errorMsg ?? "UnKnow Error");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ //评价我们,跳转到各平台的应用商城
|
|
|
+ void rateUs() {}
|
|
|
}
|