Browse Source

socketclient heartbeat

wr_202303
zsw 4 months ago
parent
commit
c93335b3fc
  1. 1
      lib/community/community_view/community_dynamic.dart
  2. 33
      lib/im/chat_details_page.dart
  3. 12
      lib/im/im_view/friend_groip_list.dart
  4. 4
      lib/im/im_view/im_page.dart
  5. 6
      lib/main.dart
  6. 9
      lib/mine/personal_page.dart

1
lib/community/community_view/community_dynamic.dart

@ -560,6 +560,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
arguments: {"articleId": widget.article.id,"shareUrl":buildShareUrl()}); arguments: {"articleId": widget.article.id,"shareUrl":buildShareUrl()});
return; return;
} else if (platform == ShareSDKPlatforms.facebook) { } else if (platform == ShareSDKPlatforms.facebook) {
Navigator.of(context).popAndPushNamed('/router/chat_details_page', Navigator.of(context).popAndPushNamed('/router/chat_details_page',
arguments: {"articleId": widget.article.id, arguments: {"articleId": widget.article.id,
"shareUrl":buildShareUrl(),}); "shareUrl":buildShareUrl(),});

33
lib/im/chat_details_page.dart

@ -303,7 +303,19 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
// setState(() {}); // setState(() {});
} }
} }
return Scaffold(
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
setState(() {
emojiShowing = false;
isKeyBoardShow = emojiShowing;
moreShow = false;
isKeyBoardShow = moreShow;
});
},
child: Scaffold(
// resizeToAvoidBottomInset: false, // resizeToAvoidBottomInset: false,
backgroundColor: Color(0xFFF6F6F6), backgroundColor: Color(0xFFF6F6F6),
appBar: MyAppBar( appBar: MyAppBar(
@ -357,23 +369,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
child: SingleChildScrollView( child: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
controller: scrollController, controller: scrollController,
child: Column( child: chatDetailsList()
children: [
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
setState(() {
emojiShowing = false;
isKeyBoardShow = emojiShowing;
moreShow = false;
isKeyBoardShow = moreShow;
FocusScope.of(context).requestFocus(FocusNode());
});
},
child: chatDetailsList(),
),
],
),
), ),
), ),
flex: 1, flex: 1,
@ -382,6 +378,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
], ],
), ),
), ),
)
); );
} }

12
lib/im/im_view/friend_groip_list.dart

@ -2,6 +2,8 @@ import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/im_user.dart'; import 'package:huixiang/retrofit/data/im_user.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -151,20 +153,26 @@ class _FriendGroupList extends State<FriendGroupList> {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if (list[position].mid == sharedPreferences.getString("userId")) {
SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center);
return;
}
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/chat_details_page', '/router/chat_details_page',
arguments: { arguments: {
"toUser": ImUser( "toUser": ImUser(
avatar: list[position].avatar, avatar: list[position].avatar,
mid: list[position].mid, mid: list[position].mid,
nickname: list[position].nickname), nickname: list[position].nickname,
),
}, },
); );
}, },
child: friendGroupItem(list[position]), child: friendGroupItem(list[position]),
); );
}, },
)), ),
),
], ],
), ),
); );

4
lib/im/im_view/im_page.dart

@ -431,6 +431,10 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if (userIds[position] == sharedPreferences.getString("userId")) {
SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center);
return;
}
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/chat_details_page', '/router/chat_details_page',
arguments: { arguments: {

6
lib/main.dart

@ -208,6 +208,7 @@ void main() async {
ImgCachePath(); ImgCachePath();
// initSdk(); // initSdk();
bool isFirst = sharedPreferences.getBool("isFirst"); bool isFirst = sharedPreferences.getBool("isFirst");
initShared();
runApp(MyApp(locale, isFirst)); runApp(MyApp(locale, isFirst));
// FlutterBugly.postCatchedException((){ // FlutterBugly.postCatchedException((){
@ -218,6 +219,11 @@ void main() async {
// final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); // final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin();
HxDatabase hxDatabase; HxDatabase hxDatabase;
SharedPreferences sharedPreferences;
initShared() async {
sharedPreferences = await SharedPreferences.getInstance();
}
initDatabase(String userId) async { initDatabase(String userId) async {
hxDatabase = HxDatabase(); hxDatabase = HxDatabase();

9
lib/mine/personal_page.dart

@ -8,6 +8,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/community/community_view/community_dynamic.dart'; import 'package:huixiang/community/community_view/community_dynamic.dart';
import 'package:huixiang/community/photo_view_gallery_screen.dart'; import 'package:huixiang/community/photo_view_gallery_screen.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart';
@ -862,6 +863,10 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver,Sing
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if (memberInfor?.id == sharedPreferences.getString("userId")) {
SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center);
return;
}
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/chat_details_page',arguments:{ .pushNamed('/router/chat_details_page',arguments:{
"toUser": ImUser( "toUser": ImUser(
@ -1298,6 +1303,10 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver,Sing
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if (memberInfor?.id == sharedPreferences.getString("userId")) {
SmartDialog.showToast("不能跟自己聊天", alignment: Alignment.center);
return;
}
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/chat_details_page', arguments: { .pushNamed('/router/chat_details_page', arguments: {
"toUser": ImUser( "toUser": ImUser(

Loading…
Cancel
Save