关注通知 和喜欢上线通知

This commit is contained in:
yangyuhao 2023-08-25 09:58:21 +07:00
parent 261c19ddfc
commit 56bd9f6163
7 changed files with 146 additions and 19 deletions

View File

@ -9,15 +9,12 @@ buildscript {
maven{url 'https://maven.aliyun.com/repository/jcenter' }
maven {url 'https://developer.huawei.com/repo/'}
maven { url 'https://developer.hihonor.com/repo/' }
maven { url "https://mvn.mob.com/android"}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.mob.sdk:MobSDK:+'
}
}

View File

@ -729,15 +729,57 @@ class _CirclePageState extends State<CirclePage>
Positioned(
right: 0,
child: logic.isShowCircle
? GestureDetector(
?
GestureDetector(
onTap: (){
Get.toNamed(AppRoutes.MyCircle, arguments: '');
Get.toNamed(AppRoutes.Invite);
},
child: Image.asset(
getCircleImage('my_circle'),
width: 64.sp,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17.0),
gradient: const LinearGradient(
colors: [
Color(0xFF06F9FA),
Color(0xFFDC5BFD),
],
),
color: const Color(0xFF392D53),
),
child: Container(
margin: EdgeInsets.all(0.6.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(17.0),
color: const Color(0xFF392D53),
),
child: Padding(
padding: EdgeInsets.only(
top: 5.sp,
bottom: 4.sp,
left: 15.sp,
right: 15.sp,
),
child: const Center(
child: Text(
"邀请得会员",
style: TextStyle(
fontSize: 11,
color: Colors.white,
),
),
),
),
),
),
)
// GestureDetector(
// onTap: () {
// Get.toNamed(AppRoutes.MyCircle, arguments: '');
// },
// child: Image.asset(
// getCircleImage('my_circle'),
// width: 64.sp,
// ),
// )
: GestureDetector(
onTap: () {
_showBottomSheet(context);

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:ffi';
@ -18,6 +19,7 @@ import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart';
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
import '../../util/eventBus.dart';
import '../../view/notice.dart';
import '../circle/view.dart';
import '../dialog/UpdateDialog.dart';
import '../minefragment/view.dart';
@ -58,7 +60,53 @@ class HomeLogic extends GetxController {
print("收到新消息" + text);
unreadSIze.value = (int.parse(unreadSIze.value) + 1).toString();
//getUnreadSize();
}, onRecvC2CCustomMessage: (
String msgID,
V2TimUserInfo sender,
String customData,
) {
if (sender.userID == "qpqz_dev_10_10000000000" ||
sender.userID == "qpqz_prod_10_10000000000") {
print("123123123123"+customData);
Map<String, dynamic> jsonData = json.decode(customData);
int event = jsonData['event'];
Map<String, dynamic> content = jsonData['content'];
switch(event){
case 1://
String ageMsg = "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}";
if(content['isFollow']==1){//
showFloatingButtonOverlay(Get.context!,content['nickname'],ageMsg,content['avatarThumb'],3,(){
pushChatPage(content['id'].toString(), content['imId'],
content['nickname']);
});
}else{
showFloatingButtonOverlay(Get.context!,content['nickname'],ageMsg,content['avatarThumb'],1,(){
setLike(content['id'].toString());
});
}
break;
case 2://线
String ageMsg = "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}";
showFloatingButtonOverlay(Get.context!,content['nickname'],ageMsg,content['avatarThumb'],2,(){
pushChatPage(content['id'].toString(), content['imId'],
content['nickname']);
});
break;
}
}
});
_messageService.addSimpleMsgListener(listener: msgListener);
var data = await DioManager.instance.get(url: Api.APP_VERSION);
@ -68,7 +116,19 @@ class HomeLogic extends GetxController {
showReportDialog(Get.context!, bean.data.constraint == 0, bean.data);
}
}
setLike(String userId) async {
var data = await DioManager.instance.post(
url: "${Api.setLike + userId}/follow",
params: {'status': "1"});
var bean = BaseResponse<dynamic>.fromJson(
data,
(jsonData) => jsonData,
);
if (bean.isSuccess()) {
update();
}
showOKToast(bean.msg);
}
getUnreadSize() async {
V2TimValueCallback<int> getTotalUnreadMessageCountRes =
await TencentImSDKPlugin.v2TIMManager

View File

@ -211,6 +211,16 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
.where(
(element) => (element?.groupID != null || element?.userID != null))
.toList();
// userID
String devtTargetUserID = "qpqz_dev_10_10000000000";
String prodTargetUserID = "qpqz_dev_10_10000000000";
filteredConversationList = filteredConversationList
.where((conversation) =>
conversation?.userID != devtTargetUserID ||conversation?.userID != prodTargetUserID)
.toList();
if (widget.conversationCollector != null) {
filteredConversationList = filteredConversationList
.where(widget.conversationCollector!)

View File

@ -156,7 +156,7 @@ class UserinfoLogic extends GetxController {
if (countdown > 0) {
countdown--;
} else {
showFloatingButtonOverlay(Get.context!,userInfoBean!.nickname!,ageMsg,userInfoBean!.avatarThumb,(){
showFloatingButtonOverlay(Get.context!,userInfoBean!.nickname!,ageMsg,userInfoBean!.avatarThumb,0,(){
setLike();
});

View File

@ -51,6 +51,15 @@ loginIM(String userId, String sig) async {
);
if (info.code == 0) {
uploadBuzIDAndToken();
V2TimCallback setC2CReceiveMessageOptRes = await TencentImSDKPlugin
.v2TIMManager
.getMessageManager()
.setC2CReceiveMessageOpt(
userIDList: ['qpqz_dev_10_10000000000','qpqz_prod_10_10000000000'], // id列表
opt: ReceiveMsgOptEnum.V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE); //
if (setC2CReceiveMessageOptRes.code == 0) {
//
}
}
}
@ -415,8 +424,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
listener: V2TimSDKListener(onConnectSuccess: () {
print('IM登录成功');
// loginIM();
},onUserStatusChanged:(List<V2TimUserStatus> userStatusList){
}));
}

View File

@ -9,7 +9,7 @@ typedef void NoticeCallback();
void showFloatingButtonOverlay(
BuildContext context, String nickname, String ageMsg, String avatar,NoticeCallback noticeCallback) {
BuildContext context, String nickname, String ageMsg, String avatar,int event,NoticeCallback noticeCallback) {
OverlayState? overlayState = Overlay.of(context);
late OverlayEntry overlayEntry;
bool showMessage = false;
@ -97,8 +97,13 @@ void showFloatingButtonOverlay(
],
),
const SizedBox(height: 8),
Text(
"看了这么久,给我点个喜欢呗~",
Text( event == 0
? "看了这么久,给我点个喜欢呗~"
: event == 1
? "我喜欢了你,可以喜欢我一下吗?"
: event == 2
? "你喜欢的人上线啦,赶紧找他聊天吧!"
: "我也喜欢了你,一起聊聊呗~",
style: TextStyle(
color: Colors.grey,
fontSize: 12.sp,
@ -136,7 +141,13 @@ void showFloatingButtonOverlay(
padding: EdgeInsets.symmetric(
horizontal: 16.sp, vertical: 6.sp),
child: Text(
"喜欢",
event == 0
? "喜欢"
: event == 1
? "回关"
: event == 2
? "私聊"
: "私聊",
style: TextStyle(
color: Colors.white,
fontSize: 14.sp,