Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ud-SDK-Flutter-Sample-App into tr/feat-ad-query
  • Loading branch information
kornsitti committed Aug 26, 2024
2 parents 79d6a92 + b09258f commit 3b664bd
Show file tree
Hide file tree
Showing 25 changed files with 1,068 additions and 270 deletions.
1 change: 1 addition & 0 deletions code_snippet/channel/amity_channel_member_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class AmityChannelMemberQuery {
pageFuture: (token) => AmityChatClient.newChannelRepository()
.membership(channelId)
.getMembers()
.includeDeleted(false) // optional to filter deleted users from the result
.getPagingData(token: token, limit: 20),
pageSize: 20,
)..addListener(
Expand Down
1 change: 1 addition & 0 deletions code_snippet/channel/amity_channel_member_search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class AmityChannelMemberSearch {
pageFuture: (token) => AmityChatClient.newChannelRepository()
.membership(channelId)
.searchMembers(keyword)
.includeDeleted(false) // optional to filter deleted users from the result
.getPagingData(token: token, limit: 20),
pageSize: 20,
)..addListener(
Expand Down
1 change: 1 addition & 0 deletions code_snippet/community/amity_community_member_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class AmityCommunityMemberQuery {
.getMembers()
.filter(filter)
.sortBy(sortOption)
.includeDeleted(false) // optional to filter deleted users from the result
.roles([
'community-moderator'
]) //optional to query specific members by roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class AmityCommunityMemberSearchByKeyword {
.searchMembers(keyword)
.filter(filter)
.sortBy(sortOption)
.includeDeleted(false) // optional to filter deleted users from the result
.roles([
'community-moderator'
]) //optional to query specific members by roles
Expand Down
3 changes: 3 additions & 0 deletions lib/core/route/app_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class AppRoute {
static const createPollPost = 'createPollPost';
static const createPollPostRoute = 'createPollPost';

static const createCustomPost = 'createCustomPost';
static const createCustomPostRoute = 'createCustomPost';

static const chat = 'chat';
static const chatRoute = 'chatRoute/:channelId';

Expand Down
18 changes: 14 additions & 4 deletions lib/core/route/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:flutter_social_sample_app/presentation/screen/channel_list/chann
import 'package:flutter_social_sample_app/presentation/screen/channel_profile/channel_profile_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/channel_update/channel_update_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/chat/chat_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/comment_query/comment_query_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/comment_query_pagination/comment_query_pagination_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/comment_query_reply/comment_query_reply_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/community_category/community_category_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/community_create/community_create_screen.dart';
Expand All @@ -24,6 +24,7 @@ import 'package:flutter_social_sample_app/presentation/screen/community_notifica
import 'package:flutter_social_sample_app/presentation/screen/community_pending_post/community_pending_post_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/community_profile/community_profile_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/community_update/community_update_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/create_custom_post/create_custom_post_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/create_livestream_post/create_livestream_post.dart';
import 'package:flutter_social_sample_app/presentation/screen/create_poll_post/create_poll_post_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/create_post/create_post_screen.dart';
Expand Down Expand Up @@ -318,6 +319,13 @@ class AppRouter {
path: AppRoute.createPollPostRoute,
builder: (context, state) => const CreatePollPostScreen(),
),

GoRoute(
name: AppRoute.createCustomPost,
path: AppRoute.createCustomPostRoute,
builder: (context, state) => const CreateCustomPostScreen(),
),

GoRoute(
name: AppRoute.chat,
path: AppRoute.chatRoute,
Expand Down Expand Up @@ -406,7 +414,7 @@ class AppRouter {
name: AppRoute.commentList,
path: AppRoute.commentListRoute,
builder: (context, state) {
return CommentQueryScreen(
return CommentQueryPaginationScreen(
referenceType: state.queryParams['referenceType']!,
referenceId: state.queryParams['referenceId']!,
communityId: state.queryParams['communityId'],
Expand Down Expand Up @@ -514,12 +522,14 @@ class AppRouter {
log('redirecting to /login');
return AppRoute.loginRoute;
} else {
// var user = await AmityCoreClient.getLoggedInUser();
var userId = await PreferenceInterfaceImpl().loggedInUserId();
var userName = await PreferenceInterfaceImpl().loggedInUserDisplayName();
await AmityCoreClient.login(userId!)
// Delaying the login for 5 seconds to simulate the login process
Future.delayed(const Duration(seconds: 5), () {
AmityCoreClient.login(userId!)
.displayName(userName!)
.submit();
});
return AppRoute.homeRoute;
}
}
Expand Down
5 changes: 5 additions & 0 deletions lib/core/widget/channel_member_info_row_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ class ChannelMemberInfoRowWidget extends StatelessWidget {
style: themeData.textTheme.bodySmall,
textAlign: TextAlign.start,
),
Text(
'isDeleted - ${value.isDeleted ?? false}',
style: themeData.textTheme.bodySmall,
textAlign: TextAlign.start,
),
Text(
'Flag Count - ${value.user?.flagCount ?? 0}',
style: themeData.textTheme.bodySmall,
Expand Down
20 changes: 7 additions & 13 deletions lib/core/widget/channel_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,24 @@ class ChannelWidget extends StatelessWidget {
child: Text('Channel Deleted - ${amityChannel.channelId}'),
);
}
return StreamBuilder<AmityChannel>(
stream: amityChannel.listen.stream,
initialData: amityChannel,
builder: (context, snapshot) {
if (snapshot.hasData) {
final value = snapshot.data!;
return Container(
return Container(
decoration: BoxDecoration(color: Colors.grey.withOpacity(.2)),
child: InkWell(
onTap: () {
GoRouter.of(context).pushNamed(AppRoute.channelProfile,
params: {'channelId': value.channelId!});
params: {'channelId': amityChannel.channelId!});
// params: {'communityId': 'f5a99abc1f275df3f4259b6ca0e3cb15'});
},
child: Column(
children: [
_ChannelInfoWidget(
amityChannel: value,
amityChannel: amityChannel,
),
const Divider(),
],
),
),
);
}
return Container();
},
);
}
}

Expand Down Expand Up @@ -97,6 +87,10 @@ class _ChannelInfoWidget extends StatelessWidget {
'last Activity: ${amityChannel.lastActivity?.toIso8601String() ?? 'NaN'}',
style: themeData.textTheme.bodySmall,
),
Text(
'isDeleted: ${amityChannel.isDeleted ?? 'NaN'}',
style: themeData.textTheme.bodySmall,
),
SelectableText(
'Channel ID : ${amityChannel.channelId ?? 'NaN'}',
style: themeData.textTheme.bodySmall,
Expand Down
2 changes: 1 addition & 1 deletion lib/core/widget/comment_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ class _CommentWidgetState extends State<CommentWidget> {
queryParams: {
'referenceType': widget.referenceType,
'referenceId': widget.referenceId,
'parentId': value.commentId,
'parentCommentId': value.commentId,
'communityId': widget.communityId,
'isPublic': widget.isPublic.toString()
},
Expand Down
5 changes: 5 additions & 0 deletions lib/core/widget/community_member_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ class _CommunityMemberInfoRowWidget extends StatelessWidget {
style: themeData.textTheme.bodySmall,
textAlign: TextAlign.start,
),
Text(
'isDeleted - ${value.isDeleted ?? false}',
style: themeData.textTheme.bodySmall,
textAlign: TextAlign.start,
),
],
),
),
Expand Down
11 changes: 4 additions & 7 deletions lib/core/widget/community_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ class CommunityWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
if (amityCommunity.isDeleted ?? false) {
return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(color: Colors.grey.withOpacity(.05)),
child: Text('Community Deleted - ${amityCommunity.communityId}'),
);
}
return StreamBuilder<AmityCommunity>(
stream: amityCommunity.listen.stream,
initialData: amityCommunity,
Expand Down Expand Up @@ -114,6 +107,10 @@ class _CommunityInfoWidget extends StatelessWidget {
'Public: ${amityCommunity.isPublic}',
style: themeData.textTheme.bodySmall,
),
Text(
'isDeleted: ${amityCommunity.isDeleted}',
style: themeData.textTheme.bodySmall,
),
],
),
),
Expand Down
10 changes: 5 additions & 5 deletions lib/core/widget/dialog/amity_user_info_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,27 @@ class AmityUserInfoWidget extends StatelessWidget {
),
// Text(
// 'roles - $rolesText',
// style: _themeData.textTheme.caption,
// style: _themeData.textTheme.bodySmall,
// textAlign: TextAlign.start,
// ),
// Text(
// 'permissions - $permissionText',
// style: _themeData.textTheme.caption,
// style: _themeData.textTheme.bodySmall,
// textAlign: TextAlign.start,
// ),
// Text(
// 'isBanned - ${value.isBanned ?? false}',
// style: _themeData.textTheme.caption,
// style: _themeData.textTheme.bodySmall,
// textAlign: TextAlign.start,
// ),
// Text(
// 'isMuted - ${value.isMuted ?? false}',
// style: _themeData.textTheme.caption,
// style: _themeData.textTheme.bodySmall,
// textAlign: TextAlign.start,
// ),
// Text(
// 'Flag Count - ${value.flagCount ?? 0}',
// style: _themeData.textTheme.caption,
// style: _themeData.textTheme.bodySmall,
// textAlign: TextAlign.start,
// ),
],
Expand Down
40 changes: 31 additions & 9 deletions lib/core/widget/feed_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import 'package:flutter/material.dart';
import 'package:flutter_social_sample_app/core/route/app_route.dart';
import 'package:flutter_social_sample_app/core/utils/extension/date_extension.dart';
import 'package:flutter_social_sample_app/core/widget/add_comment_widget.dart';
import 'package:flutter_social_sample_app/core/widget/common_snackbar.dart';
import 'package:flutter_social_sample_app/core/widget/dynamic_text_highlighting.dart';
import 'package:flutter_social_sample_app/core/widget/poll_widget.dart';
import 'package:flutter_social_sample_app/core/widget/reaction_action_widget.dart';
import 'package:flutter_social_sample_app/core/widget/shadow_container_widget.dart';
import 'package:flutter_social_sample_app/core/widget/user_profile_info_row_widget.dart';
import 'package:flutter_social_sample_app/presentation/screen/update_post/update_custom_post_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/update_post/update_post_screen.dart';
import 'package:flutter_social_sample_app/presentation/screen/video_player/full_screen_video_player.dart';
import 'package:go_router/go_router.dart';
Expand Down Expand Up @@ -94,15 +94,28 @@ class FeedWidget extends StatelessWidget {
),
onSelected: (index) {
if (index == 1) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => UpdatePostScreen(
amityPost: value,
communityId: communityId,
isPublic: isPublic,
if (value.data is CustomData) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
UpdateCustomPostScreen(
amityPost: value),
),
),
);
);

} else {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
UpdatePostScreen(
amityPost: value,
communityId: communityId,
isPublic: isPublic,
),
),
);
}
}
if (index == 2) {
value.delete();
Expand Down Expand Up @@ -482,6 +495,15 @@ class FeedContentWidget extends StatelessWidget {
);
}

if (amityPostData is CustomData) {
final data = amityPostData as CustomData;
return Container(
// color: Colors.green,
child:
Text('Custom post content -->>>> ${data.rawData}'),
);
}

return Container(
color: Colors.red,
child: Text('>>>>> $amityPostData <<<<<<'),
Expand Down
12 changes: 6 additions & 6 deletions lib/core/widget/message_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class MessageWidget extends StatelessWidget {
Text(

value.createdAt?.toLocal().toIso8601String() ?? DateTime.now().toLocal().toIso8601String(),
style: themeData.textTheme.caption!.copyWith(),
style: themeData.textTheme.bodySmall!.copyWith(),

),
const SizedBox(width: 12),
Expand Down Expand Up @@ -394,7 +394,7 @@ class MessageWidget extends StatelessWidget {
child: Text(

value.reactions!.getCount('like').toString(),
style: themeData.textTheme.caption!.copyWith(fontSize: 14),
style: themeData.textTheme.bodySmall!.copyWith(fontSize: 14),

),
),
Expand Down Expand Up @@ -442,7 +442,7 @@ class MessageWidget extends StatelessWidget {
child: Text(

value.reactions!.getCount('like').toString(),
style: themeData.textTheme.caption!.copyWith(fontSize: 14),
style: themeData.textTheme.bodySmall!.copyWith(fontSize: 14),

),
),
Expand Down Expand Up @@ -488,7 +488,7 @@ class MessageWidget extends StatelessWidget {
children: [
Text(
value.reactions!.getCount('love').toString(),
style: themeData.textTheme.caption!.copyWith(fontSize: 14),
style: themeData.textTheme.bodySmall!.copyWith(fontSize: 14),
),
const SizedBox(width: 2),
Image.asset(
Expand Down Expand Up @@ -532,7 +532,7 @@ class MessageWidget extends StatelessWidget {
children: [
Text(
value.reactions!.getCount('love').toString(),
style: themeData.textTheme.caption!.copyWith(fontSize: 14),
style: themeData.textTheme.bodySmall!.copyWith(fontSize: 14),
),
const SizedBox(width: 2),
Image.asset(
Expand Down Expand Up @@ -766,7 +766,7 @@ class AmityMessageContentWidget extends StatelessWidget {
onPressed: () {},
icon: const Icon(Icons.attach_file_rounded),
label: Text(
data.file!.getFilePath!.split('/').last,
data.file?.getFilePath?.split('/').last ?? data.file?.getUrl ?? "",
),
)
: Container(
Expand Down
Loading

0 comments on commit 3b664bd

Please sign in to comment.