feat: 对齐常驻商城与七鱼客服交互
- 同步商城 H5 登录态与原生 token - 完善商城/原生 tab 切换、动画及返回交互 - 修复七鱼客服键盘避让和状态栏恢复 - 调整开屏跳过按钮与登录入口交互
This commit is contained in:
1 parent
b4343ea528
commit
3b089e2205
37 files changed
+2970
-375
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
@@ -145,6 +146,62 @@ final mallTabConfigProvider =
|
||||
(ref) => MallTabConfigController(ref.watch(dioProvider)),
|
||||
);
|
||||
|
||||
class MallClickAttribution {
|
||||
const MallClickAttribution({
|
||||
required this.adId,
|
||||
required this.trackingId,
|
||||
required this.clickId,
|
||||
});
|
||||
|
||||
final String adId;
|
||||
final String trackingId;
|
||||
final String clickId;
|
||||
}
|
||||
|
||||
final mallClickAttributionProvider = StateProvider<MallClickAttribution?>(
|
||||
(ref) => null,
|
||||
);
|
||||
|
||||
Map<String, dynamic> buildEnterWebMallBridgeArguments({
|
||||
required Uri currentUri,
|
||||
required bool logged,
|
||||
required bool isDark,
|
||||
String? authToken,
|
||||
String? scene,
|
||||
String? sourceApp,
|
||||
MallClickAttribution? attribution,
|
||||
}) {
|
||||
final query = currentUri.queryParameters;
|
||||
final resolvedSourceApp = sourceApp?.trim().isNotEmpty == true
|
||||
? sourceApp!.trim()
|
||||
: mallSourceApp;
|
||||
final arguments = <String, dynamic>{
|
||||
...query,
|
||||
'from': resolvedSourceApp,
|
||||
'source_app': resolvedSourceApp,
|
||||
'source_entry': query['source_entry'] ?? 'mall_tab',
|
||||
'placement': query['placement'] ?? 'mall_tab',
|
||||
'hook_type': query['hook_type'] ?? 'mall_tab',
|
||||
'target_app': query['target_app'] ?? 'mall',
|
||||
'logged': logged,
|
||||
'isNight': isDark ? '1' : '0',
|
||||
};
|
||||
final adId = attribution?.adId.trim() ?? '';
|
||||
if (adId.isNotEmpty) arguments['ad_id'] = adId;
|
||||
final trackingId = attribution?.trackingId.trim() ?? '';
|
||||
if (trackingId.isNotEmpty) arguments['tracking_id'] = trackingId;
|
||||
final clickId = attribution?.clickId.trim() ?? '';
|
||||
if (clickId.isNotEmpty) arguments['click_id'] = clickId;
|
||||
final token = authToken?.trim() ?? '';
|
||||
if (token.isNotEmpty) {
|
||||
arguments['auth_token'] = token;
|
||||
arguments['authToken'] = token;
|
||||
}
|
||||
final resolvedScene = scene?.trim() ?? '';
|
||||
if (resolvedScene.isNotEmpty) arguments['scene'] = resolvedScene;
|
||||
return arguments;
|
||||
}
|
||||
|
||||
String _nonEmpty(String value, String fallback) =>
|
||||
value.trim().isEmpty ? fallback : value.trim();
|
||||
|
||||
@@ -166,7 +223,7 @@ class _ProtoMessage {
|
||||
int integer(int wanted) =>
|
||||
_fields()[wanted] is int ? _fields()[wanted]! as int : 0;
|
||||
String string(int wanted) => _fields()[wanted] is List<int>
|
||||
? String.fromCharCodes(_fields()[wanted]! as List<int>)
|
||||
? utf8.decode(_fields()[wanted]! as List<int>, allowMalformed: true)
|
||||
: '';
|
||||
_ProtoMessage message(int wanted) => _ProtoMessage(
|
||||
_fields()[wanted] is List<int> ? _fields()[wanted]! as List<int> : const [],
|
||||
|
||||
Reference in new issue
Block a user