系统通知跳转 android 各种协议 地址

This commit is contained in:
YangYuhao 2023-08-18 18:10:04 +08:00
parent 7bf8a26e6e
commit 40a0eea463
4 changed files with 68 additions and 24 deletions

View File

@ -10,6 +10,7 @@ import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
import '../../home/logic.dart';
import 'logic.dart';
class Sys_notify_listPage extends StatelessWidget {
@ -102,9 +103,39 @@ class Sys_notify_listPage extends StatelessWidget {
}
widgets.add(GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.WebViewActivity,
arguments: jsonDecode(data.note!));
onTap: () async{
switch(data.scene){
case 'url':
Map<String, dynamic> bean = json.decode(data.note!);
String url = bean['url'];
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
'title': "",
"url": url
});
// Get.toNamed(AppRoutes.WebViewActivity,
// arguments: {"url":jsonDecode(url)} );
break;
case "my_main":
final homeLogic = Get.put(HomeLogic());
homeLogic.pageController.jumpToPage(2);
homeLogic.updateIndex(2);
Get.back();
break;
case "user_home":
Get.toNamed(AppRoutes.UserInfoActivity);
break;
case "none":
break;
}
},
child: Container(
margin: EdgeInsets.only(bottom: 8.sp, left: 16.sp),

View File

@ -5,6 +5,6 @@ import 'state.dart';
class WebviewLogic extends GetxController {
final WebviewState state = WebviewState();
final title = Get.arguments['title'] ?? '';
var title = Get.arguments['title'] ?? '';
}

View File

@ -15,11 +15,14 @@ class _WebViewContainerState extends State<WebviewPage> {
// Get.toNamed(AppRoutes.WebViewActivity,arguments: {'title':"百度","url":"https://www.baidu.com"});
_WebViewContainerState();
var controller;
final logic = Get.find<WebviewLogic>();
@override
Widget build(BuildContext context) {
final url = Get.arguments['url'];
var controller = WebViewController()
controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(Colors.white)
..setNavigationDelegate(
@ -28,7 +31,19 @@ class _WebViewContainerState extends State<WebviewPage> {
// Update loading bar.
},
onPageStarted: (String url) {},
onPageFinished: (String url) {},
onPageFinished: (String url) async {
if(logic.title==''){
String title = await controller.getTitle(); //
if (title.length > 8) {
title = title.substring(0, 8) + '...';
}
logic.title = title;
logic.update();
print('Page title: $title'); //
}
},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) {
if (request.url.startsWith('')) {

View File

@ -276,21 +276,7 @@ Future<String> getLibraryDirectoryPath() async {
return directory.path;
}
//
void navigateToUserAgreement() {
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
'title': "用户协议",
"url":"https://docs.qq.com/doc/DZVV1SkttZGlPUW1H"
});
}
//
void navigateToPrivacyPolicy() {
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
'title': "隐私协议",
"url": "https://docs.qq.com/doc/DZXhvcXV6b1RNTUx1"
});
}
//
void navigateToCodeOfConduct() {
@ -300,13 +286,26 @@ void navigateToCodeOfConduct() {
});
}
//
void navigateToUserAgreement() {
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
'title': "用户协议",
"url": Platform.isIOS?"https://docs.qq.com/doc/DZVV1SkttZGlPUW1H":"https://iquanpai.com/app-h5/4_163.html"
});
}
//
void navigateToPrivacyPolicy() {
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
'title': "隐私协议",
"url": Platform.isIOS?"https://docs.qq.com/doc/DZXhvcXV6b1RNTUx1":"https://iquanpai.com/app-h5/4_164.html"
});
}
//
void navigateToContentGuidelines() {
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
'title': "发布内容规范",
"url": "https://docs.qq.com/doc/DZVhLamZDQnJ0eHds"
"url": Platform.isIOS?"https://docs.qq.com/doc/DZVhLamZDQnJ0eHds":"https://iquanpai.com/app-h5/4_165.html"
});
}
@ -314,9 +313,8 @@ void navigateToContentGuidelines() {
void navigateToPartnerAgreement() {
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
'title': "合伙人协议",
"url": "https://docs.qq.com/doc/DZUpwWFdNcGlsYld4"
"url": Platform.isIOS?"https://docs.qq.com/doc/DZUpwWFdNcGlsYld4":"https://iquanpai.com/app-h5/4_166.html"
});
}