feat: 对齐常驻商城与七鱼客服交互
- 同步商城 H5 登录态与原生 token - 完善商城/原生 tab 切换、动画及返回交互 - 修复七鱼客服键盘避让和状态栏恢复 - 调整开屏跳过按钮与登录入口交互
This commit is contained in:
1 parent
b4343ea528
commit
3b089e2205
37 files changed
+2970
-375
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
import '../../../common/network/dio_provider.dart';
|
||||
import '../../ads/data/ads_api_client.dart';
|
||||
|
||||
class AppMallAuthToken {
|
||||
const AppMallAuthToken({
|
||||
required this.authToken,
|
||||
required this.expiresIn,
|
||||
required this.sourceApp,
|
||||
required this.scene,
|
||||
});
|
||||
|
||||
final String authToken;
|
||||
final int expiresIn;
|
||||
final String sourceApp;
|
||||
final String scene;
|
||||
}
|
||||
|
||||
class MallAuthApi {
|
||||
const MallAuthApi(this._dio);
|
||||
final Dio _dio;
|
||||
|
||||
Future<AppMallAuthToken> issueAppMallAuthToken() async {
|
||||
final response = await _dio.post<List<int>>(
|
||||
'/api/v1/auth/mall/app-token',
|
||||
data: const <int>[],
|
||||
options: protobufOptions(),
|
||||
);
|
||||
final reply = ProtoMessage(response.data ?? const <int>[]);
|
||||
final token = reply.string(1).trim();
|
||||
if (token.isEmpty) throw const FormatException('Missing mall auth token');
|
||||
return AppMallAuthToken(
|
||||
authToken: token,
|
||||
expiresIn: reply.integer(2),
|
||||
sourceApp: reply.string(3),
|
||||
scene: reply.string(4),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final mallAuthApiProvider = Provider(
|
||||
(ref) => MallAuthApi(ref.watch(dioProvider)),
|
||||
);
|
||||
Reference in new issue
Block a user