Skip to content

Commit

Permalink
Staging oddish (#235)
Browse files Browse the repository at this point in the history
* feat: Filter deleted user from user related api

* chore: Increase sample app version number

* chore: Update code snippets for channel/community members query and search api
  • Loading branch information
kornsitti authored Aug 16, 2024
1 parent 2034d97 commit 0e78358
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 11 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
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
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
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
10 changes: 5 additions & 5 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
28 changes: 28 additions & 0 deletions lib/presentation/screen/channel_member/channel_member_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class ChannelMemberScreenState extends State<ChannelMemberScreen> {

String _keyboard = '';

bool _includeDeleted = false;

final _debouncer = Debouncer(milliseconds: 500);

@override
Expand All @@ -35,6 +37,7 @@ class ChannelMemberScreenState extends State<ChannelMemberScreen> {
pageFuture: (token) => AmityChatClient.newChannelRepository()
.membership(widget.channelId)
.searchMembers(_keyboard)
.includeDeleted(_includeDeleted)
.getPagingData(token: token, limit: GlobalConstant.pageSize),
pageSize: GlobalConstant.pageSize,
)..addListener(
Expand Down Expand Up @@ -108,6 +111,31 @@ class ChannelMemberScreenState extends State<ChannelMemberScreen> {
decoration: const InputDecoration(hintText: 'Enter Keybaord'),
),
),
Container(
child: Row(
children: [
Container(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Checkbox(
value: _includeDeleted,
onChanged: (value) {
setState(() {
_includeDeleted = (value ?? false);
_controller.reset();
_controller.fetchNextPage();
});
},
),
const Text('Include Deleted')
],
),
)
],
),
),
Expanded(
child: amityChannelMembers.isNotEmpty
? RefreshIndicator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CommunityMemberScreenState extends State<CommunityMemberScreen> {

AmityCommunityMembershipFilter _filter = AmityCommunityMembershipFilter.MEMBER;
AmityCommunityMembershipSortOption _sort = AmityCommunityMembershipSortOption.LAST_CREATED;
bool _includeDeleted = false;
@override
void initState() {
_controller = PagingController(
Expand All @@ -35,6 +36,7 @@ class CommunityMemberScreenState extends State<CommunityMemberScreen> {
.searchMembers(_keyboard)
.filter(_filter)
.sortBy(_sort)
.includeDeleted(_includeDeleted)
.getPagingData(token: token, limit: GlobalConstant.pageSize),
pageSize: GlobalConstant.pageSize,
)..addListener(
Expand Down Expand Up @@ -181,6 +183,25 @@ class CommunityMemberScreenState extends State<CommunityMemberScreen> {
},
),
),
Container(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Checkbox(
value: _includeDeleted,
onChanged: (value) {
setState(() {
_includeDeleted = (value ?? false);
_controller.reset();
_controller.fetchNextPage();
});
},
),
const Text('Include Deleted')
],
),
)
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_social_sample_app
description: Demonstrates how to use the flutter_application_1 plugin.
version: 1.1.47+62
version: 1.1.48+63



Expand Down

0 comments on commit 0e78358

Please sign in to comment.