forked from Ivasoft/mattermost-mobile
MM-43584 - Gekidou Mute Channel SnackBar (#6241)
* add remote action updateChannelNotifyProps * Squashed commit of the following: commitf093cd3409Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Mon May 2 12:12:43 2022 +0400 revert changes made to the ephemeral store commitaabe8bd17eMerge:18df47210ee01febbbAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Mon May 2 12:09:50 2022 +0400 Merge branch 'gekidou' into gekidou-snack-bars commit18df472108Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Mon May 2 12:04:53 2022 +0400 fix timer not stopping commit5910238aaaAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 18:19:18 2022 +0400 style fix commitdef4ad4cfdAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 14:36:36 2022 +0400 eslint fix commit99fa65e780Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 14:18:03 2022 +0400 fix styling commitcf335e28b0Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 13:54:05 2022 +0400 fix layoutAnimation commitd1dacbba73Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 13:43:04 2022 +0400 add exitingg layoutAnimation commitbb1156c3daAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 13:26:37 2022 +0400 add entering layoutAnimation commit36d7286acdMerge:177281fbe22a173ec9Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 11:41:30 2022 +0400 Merge branch 'gekidou' into gekidou-snack-bars commit177281fbebAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 11:41:06 2022 +0400 cancelled timers on panning start commit6925cf59aaMerge:e294a3a19dad63b87bAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 17:36:11 2022 +0400 rebasing commite294a3a199Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 17:14:33 2022 +0400 dismiss overlay on tabPress commit9a57a0866fAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 16:59:07 2022 +0400 dismiss overlay on tabPress commitc7eef4b304Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 15:55:33 2022 +0400 dismiss overlay on navigating away commit58a364171eAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 15:25:27 2022 +0400 dismiss overlay on navigating away commit3c53e7d6a7Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 13:42:10 2022 +0400 checks for ongoing animation commite62a4ee2a2Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 13:14:39 2022 +0400 removed toast keyword commitbc014b86e9Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 12:54:55 2022 +0400 PanGesture- fine tuning the animation PanGesture- wip commit8f675566e7Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 12:09:35 2022 +0400 PanGesture- wip commiteb2a63c75fAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Wed Apr 27 11:17:13 2022 -0400 snack positioning and touches commit6db7f0e0e7Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 27 16:43:47 2022 +0400 using EphemeralStore and listeners to discard overlays commit99a9a52789Merge:5237401f5776f56efbAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 27 14:51:32 2022 +0400 Merge branch 'gekidou' into gekidou-snack-bars commit5237401f52Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 27 13:16:47 2022 +0400 able to touch through on iOS commit7dc5c5c39eAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Tue Apr 26 15:17:53 2022 +0400 adding PanGesture adding PanGesture- wip PanGesture- wip commit772654f7e5Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 21 13:57:42 2022 +0400 update message to text commit53c7ca68baAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 21 13:40:30 2022 +0400 adjust width commit0c20bd7e73Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 18:05:44 2022 +0400 changed location to sourceScreen in post.tsx commitefbccbb710Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 18:04:19 2022 +0400 removed space commitcc400482bdAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 18:01:23 2022 +0400 corrections from reviews commit4204b6c656Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 14:47:52 2022 +0400 Update en.json commit80f6d675f5Merge:c59a2cfc0c1e71b09cAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 14:27:33 2022 +0400 Merge branch 'gekidou' into gekidou-snack-bars commitc59a2cfc05Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 13:58:22 2022 +0400 removed offSetY commita65af7057bAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 12:24:02 2022 +0400 styling tablet wip tablet portrait commit3ef280c80cAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Tue Apr 19 16:10:37 2022 +0400 styling mobile wip * Squashed commit of the following: commitab09b39c77Merge:038476c01362db9d98Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu May 5 15:06:12 2022 +0400 Merge branch 'gekidou' into gekidou-snack-bars commit038476c01aAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu May 5 15:05:24 2022 +0400 bumping the toast vertically by 4px commit362db9d98dAuthor: Shaz MJ <shaz.amjad@mattermost.com> Date: Thu May 5 11:17:33 2022 +1000 Moves collapse animation to FlatList, updates timings (#6220) * Moves collapse animation to FlatList, updates timings * dev review * filters unreads from other categories & removes duplicate Co-authored-by: Elias Nahum <nahumhbl@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> commit14abe4d2acAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 17:26:32 2022 -0400 Remove jcenter (#6226) commitc8e46607b7Author: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 13:13:23 2022 -0400 upgrade exoplayer commit32fd8e3cdaAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 12:15:13 2022 -0400 Add ellipsis to server displayName & url (#6223) commitabc5dc4bc3Author: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 09:55:51 2022 -0400 Fix GM display name (#6215) commitecfbb934a8Author: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 09:51:14 2022 -0400 [Gekidou] Exclude muted channels from unread badges (#6208) * Exclude muted channels from unread badges * Gekidou unreads mention fix (#6221) * Removes muted channels without mentions from grouped unreads * show channel if unread and have no mentions when unread up top Co-authored-by: Elias Nahum <nahumhbl@gmail.com> Co-authored-by: Shaz MJ <shaz.amjad@mattermost.com> commit588491f582Author: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 09:32:43 2022 -0400 Fix alignment of custom status (#6211) commit4fc077caefAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 09:13:17 2022 -0400 Fetch missing custom emojis (#6216) commit3aa0425fddAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 09:12:37 2022 -0400 Preserve notifications when tapping or clearing notifications from a channel (#6209) commitbd50422167Author: Elias Nahum <nahumhbl@gmail.com> Date: Tue May 3 17:26:35 2022 -0400 Hide archive channels in channel list (#6214) commit43c43e50d4Author: Elias Nahum <nahumhbl@gmail.com> Date: Tue May 3 14:43:55 2022 -0400 Do not set new line message indicator on own posts (#6206) commitf973ac8016Author: Elias Nahum <nahumhbl@gmail.com> Date: Tue May 3 14:29:37 2022 -0400 [Gekidou] Find channels (remote) (#6203) * Display local results * Fix queryPreferencesByCategoryAndName to observeWithColumns value * Find channels (remote) * ux feedback review * dev review * dev review 2 * Fetch deleted channels from other teams commitbb42339c42Author: Elias Nahum <nahumhbl@gmail.com> Date: Tue May 3 11:58:47 2022 -0400 Increase tap area of the + button on home screen (#6207) commit02b4295464Author: Daniel Espino García <larkox@gmail.com> Date: Tue May 3 17:22:21 2022 +0200 [Gekidou] [MM-39936] Add Select Team Screen (#6180) * Add Select Team Screen * Fixes for iPhone and iPad * Fix tests * Address feedback * Fix tests * Theme illustration * Address feedback and fixes * Remove database warnings by avoiding recalculations on repeated events. * Address feedback * Remove unneeded catch Co-authored-by: Daniel Espino <danielespino@MacBook-Pro-de-Daniel.local> commit2376dc934cAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Tue May 3 08:54:13 2022 -0400 Fix Back button position in Navigation Header (#6204) commitf093cd3409Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Mon May 2 12:12:43 2022 +0400 revert changes made to the ephemeral store commitaabe8bd17eMerge:18df47210ee01febbbAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Mon May 2 12:09:50 2022 +0400 Merge branch 'gekidou' into gekidou-snack-bars commit18df472108Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Mon May 2 12:04:53 2022 +0400 fix timer not stopping commit5910238aaaAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 18:19:18 2022 +0400 style fix commitdef4ad4cfdAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 14:36:36 2022 +0400 eslint fix commit99fa65e780Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 14:18:03 2022 +0400 fix styling commitcf335e28b0Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 13:54:05 2022 +0400 fix layoutAnimation commitd1dacbba73Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 13:43:04 2022 +0400 add exitingg layoutAnimation commitbb1156c3daAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 13:26:37 2022 +0400 add entering layoutAnimation commit36d7286acdMerge:177281fbe22a173ec9Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 11:41:30 2022 +0400 Merge branch 'gekidou' into gekidou-snack-bars commit177281fbebAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Fri Apr 29 11:41:06 2022 +0400 cancelled timers on panning start commit6925cf59aaMerge:e294a3a19dad63b87bAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 17:36:11 2022 +0400 rebasing commite294a3a199Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 17:14:33 2022 +0400 dismiss overlay on tabPress commit9a57a0866fAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 16:59:07 2022 +0400 dismiss overlay on tabPress commitc7eef4b304Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 15:55:33 2022 +0400 dismiss overlay on navigating away commit58a364171eAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 15:25:27 2022 +0400 dismiss overlay on navigating away commit3c53e7d6a7Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 13:42:10 2022 +0400 checks for ongoing animation commite62a4ee2a2Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 13:14:39 2022 +0400 removed toast keyword commitbc014b86e9Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 12:54:55 2022 +0400 PanGesture- fine tuning the animation PanGesture- wip commit8f675566e7Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 28 12:09:35 2022 +0400 PanGesture- wip commiteb2a63c75fAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Wed Apr 27 11:17:13 2022 -0400 snack positioning and touches commit6db7f0e0e7Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 27 16:43:47 2022 +0400 using EphemeralStore and listeners to discard overlays commit99a9a52789Merge:5237401f5776f56efbAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 27 14:51:32 2022 +0400 Merge branch 'gekidou' into gekidou-snack-bars commit5237401f52Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 27 13:16:47 2022 +0400 able to touch through on iOS commit7dc5c5c39eAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Tue Apr 26 15:17:53 2022 +0400 adding PanGesture adding PanGesture- wip PanGesture- wip commit772654f7e5Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 21 13:57:42 2022 +0400 update message to text commit53c7ca68baAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu Apr 21 13:40:30 2022 +0400 adjust width commit0c20bd7e73Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 18:05:44 2022 +0400 changed location to sourceScreen in post.tsx commitefbccbb710Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 18:04:19 2022 +0400 removed space commitcc400482bdAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 18:01:23 2022 +0400 corrections from reviews commit4204b6c656Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 14:47:52 2022 +0400 Update en.json commit80f6d675f5Merge:c59a2cfc0c1e71b09cAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 14:27:33 2022 +0400 Merge branch 'gekidou' into gekidou-snack-bars commitc59a2cfc05Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 13:58:22 2022 +0400 removed offSetY commita65af7057bAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Wed Apr 20 12:24:02 2022 +0400 styling tablet wip tablet portrait commit3ef280c80cAuthor: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Tue Apr 19 16:10:37 2022 +0400 styling mobile wip * minor clean up * Squashed commit of the following: commitc7c00b8316Author: Elias Nahum <nahumhbl@gmail.com> Date: Thu May 5 18:25:46 2022 -0400 Ensure posts are not covered by the post draft on channel switch commit58719c82dcAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Thu May 5 14:09:30 2022 -0400 fix flip of post list (#6234) commit9d3c7c9496Author: Joseph Baylon <joseph.baylon@mattermost.com> Date: Thu May 5 10:04:33 2022 -0700 Detox/E2E: Messaging e2e tests in Gekidou (#6228) commit1760b75dbfAuthor: Anurag Shivarathri <anurag6713@gmail.com> Date: Thu May 5 21:03:09 2022 +0530 [Gekidou] [MM-43973] Thread footer for recent mentions (#6225) * Displaying thread footer * Participants can be empty * Update thread.ts commit83c2cfff97Author: Avinash Lingaloo <avinashlng1080@gmail.com> Date: Thu May 5 18:00:32 2022 +0400 MM-41532 Gekidou Snack Bars (#6181) * styling mobile wip * styling tablet wip tablet portrait * removed offSetY * Update en.json * corrections from reviews * removed space * changed location to sourceScreen in post.tsx * adjust width * update message to text * adding PanGesture adding PanGesture- wip PanGesture- wip * able to touch through on iOS * using EphemeralStore and listeners to discard overlays * snack positioning and touches * PanGesture- wip * PanGesture- fine tuning the animation PanGesture- wip * removed toast keyword * checks for ongoing animation * dismiss overlay on navigating away * dismiss overlay on navigating away * dismiss overlay on tabPress * dismiss overlay on tabPress * cancelled timers on panning start * add entering layoutAnimation * add exitingg layoutAnimation * fix layoutAnimation * fix styling * eslint fix * style fix * fix timer not stopping * revert changes made to the ephemeral store * bumping the toast vertically by 4px Co-authored-by: Elias Nahum <nahumhbl@gmail.com> commit2deb2e01e0Author: Anurag Shivarathri <anurag6713@gmail.com> Date: Thu May 5 18:36:18 2022 +0530 [Gekidou][MM-43870, MM-43896, MM-43898, MM-43902, MM-43903] CRT related bug fixes (#6205) * Fixes * Updated snapshot * Excluding current user from getting updated * Doesn't handle users if it's empty Co-authored-by: Elias Nahum <nahumhbl@gmail.com> commit251ef0992bAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Thu May 5 08:53:27 2022 -0400 Fix create direct message styles (#6224) commit5620a50975Author: Elias Nahum <nahumhbl@gmail.com> Date: Thu May 5 08:53:02 2022 -0400 Fix channel item with long name and badge (#6222) commita0d2f33b2fAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Thu May 5 08:47:09 2022 -0400 Dismiss post options before executing action (#6227) commitc4e1b4ad3eAuthor: Shaz MJ <shaz.amjad@mattermost.com> Date: Thu May 5 22:45:50 2022 +1000 Fixes grouped unread sorting (#6230) * Fixes grouped unread sorting * Type fix commit362db9d98dAuthor: Shaz MJ <shaz.amjad@mattermost.com> Date: Thu May 5 11:17:33 2022 +1000 Moves collapse animation to FlatList, updates timings (#6220) * Moves collapse animation to FlatList, updates timings * dev review * filters unreads from other categories & removes duplicate Co-authored-by: Elias Nahum <nahumhbl@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> commit14abe4d2acAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 17:26:32 2022 -0400 Remove jcenter (#6226) commitc8e46607b7Author: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 13:13:23 2022 -0400 upgrade exoplayer commit32fd8e3cdaAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 12:15:13 2022 -0400 Add ellipsis to server displayName & url (#6223) commitabc5dc4bc3Author: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 09:55:51 2022 -0400 Fix GM display name (#6215) commitecfbb934a8Author: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 09:51:14 2022 -0400 [Gekidou] Exclude muted channels from unread badges (#6208) * Exclude muted channels from unread badges * Gekidou unreads mention fix (#6221) * Removes muted channels without mentions from grouped unreads * show channel if unread and have no mentions when unread up top Co-authored-by: Elias Nahum <nahumhbl@gmail.com> Co-authored-by: Shaz MJ <shaz.amjad@mattermost.com> commit588491f582Author: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 09:32:43 2022 -0400 Fix alignment of custom status (#6211) commit4fc077caefAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 09:13:17 2022 -0400 Fetch missing custom emojis (#6216) commit3aa0425fddAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Wed May 4 09:12:37 2022 -0400 Preserve notifications when tapping or clearing notifications from a channel (#6209) commitbd50422167Author: Elias Nahum <nahumhbl@gmail.com> Date: Tue May 3 17:26:35 2022 -0400 Hide archive channels in channel list (#6214) commit43c43e50d4Author: Elias Nahum <nahumhbl@gmail.com> Date: Tue May 3 14:43:55 2022 -0400 Do not set new line message indicator on own posts (#6206) commitf973ac8016Author: Elias Nahum <nahumhbl@gmail.com> Date: Tue May 3 14:29:37 2022 -0400 [Gekidou] Find channels (remote) (#6203) * Display local results * Fix queryPreferencesByCategoryAndName to observeWithColumns value * Find channels (remote) * ux feedback review * dev review * dev review 2 * Fetch deleted channels from other teams commitbb42339c42Author: Elias Nahum <nahumhbl@gmail.com> Date: Tue May 3 11:58:47 2022 -0400 Increase tap area of the + button on home screen (#6207) commit02b4295464Author: Daniel Espino García <larkox@gmail.com> Date: Tue May 3 17:22:21 2022 +0200 [Gekidou] [MM-39936] Add Select Team Screen (#6180) * Add Select Team Screen * Fixes for iPhone and iPad * Fix tests * Address feedback * Fix tests * Theme illustration * Address feedback and fixes * Remove database warnings by avoiding recalculations on repeated events. * Address feedback * Remove unneeded catch Co-authored-by: Daniel Espino <danielespino@MacBook-Pro-de-Daniel.local> commit2376dc934cAuthor: Elias Nahum <nahumhbl@gmail.com> Date: Tue May 3 08:54:13 2022 -0400 Fix Back button position in Navigation Header (#6204) * snack bar with undo option * fix react error * implement onAction correctly * implemented pessimistic approach * fix ts issue * Move toggleMuteChannel to remote actions Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
@@ -11,7 +11,10 @@ import DatabaseManager from '@database/manager';
|
||||
import {getTeammateNameDisplaySetting} from '@helpers/api/preference';
|
||||
import {extractChannelDisplayName} from '@helpers/database';
|
||||
import PushNotifications from '@init/push_notifications';
|
||||
import {prepareDeleteChannel, prepareMyChannelsForTeam, queryAllMyChannel, getMyChannel, getChannelById, queryUsersOnChannel, queryUserChannelsByTypes} from '@queries/servers/channel';
|
||||
import {
|
||||
prepareDeleteChannel, prepareMyChannelsForTeam, queryAllMyChannel,
|
||||
getMyChannel, getChannelById, queryUsersOnChannel, queryUserChannelsByTypes,
|
||||
} from '@queries/servers/channel';
|
||||
import {queryPreferencesByCategoryAndName} from '@queries/servers/preference';
|
||||
import {prepareCommonSystemValues, PrepareCommonSystemValuesArgs, getCommonSystemValues, getCurrentTeamId, setCurrentChannelId, getCurrentUserId} from '@queries/servers/system';
|
||||
import {addChannelToTeamHistory, addTeamToTeamHistory, getTeamById, queryMyTeams, removeChannelFromTeamHistory} from '@queries/servers/team';
|
||||
|
||||
@@ -13,13 +13,14 @@ import DatabaseManager from '@database/manager';
|
||||
import {privateChannelJoinPrompt} from '@helpers/api/channel';
|
||||
import {getTeammateNameDisplaySetting} from '@helpers/api/preference';
|
||||
import NetworkManager from '@managers/network_manager';
|
||||
import {prepareMyChannelsForTeam, getChannelById, getChannelByName, getMyChannel, getChannelInfo} from '@queries/servers/channel';
|
||||
import {prepareMyChannelsForTeam, getChannelById, getChannelByName, getMyChannel, getChannelInfo, queryMyChannelSettingsByIds} from '@queries/servers/channel';
|
||||
import {queryPreferencesByCategoryAndName} from '@queries/servers/preference';
|
||||
import {getCommonSystemValues, getCurrentTeamId, getCurrentUserId} from '@queries/servers/system';
|
||||
import {prepareMyTeams, getNthLastChannelFromTeam, getMyTeamById, getTeamById, getTeamByName, queryMyTeams} from '@queries/servers/team';
|
||||
import {getCurrentUser} from '@queries/servers/user';
|
||||
import EphemeralStore from '@store/ephemeral_store';
|
||||
import {generateChannelNameFromDisplayName, getDirectChannelName, isDMorGM} from '@utils/channel';
|
||||
import {showMuteChannelSnackbar} from '@utils/snack_bar';
|
||||
import {PERMALINK_GENERIC_TEAM_NAME_REDIRECT} from '@utils/url';
|
||||
import {displayGroupMessageName, displayUsername} from '@utils/user';
|
||||
|
||||
@@ -1055,3 +1056,64 @@ export async function searchAllChannels(serverUrl: string, term: string, archive
|
||||
return {error};
|
||||
}
|
||||
}
|
||||
|
||||
export const updateChannelNotifyProps = async (serverUrl: string, channelId: string, props: Partial<ChannelNotifyProps>) => {
|
||||
let client: Client;
|
||||
try {
|
||||
client = NetworkManager.getClient(serverUrl);
|
||||
} catch (error) {
|
||||
return {error};
|
||||
}
|
||||
|
||||
const database = DatabaseManager.serverDatabases[serverUrl]?.database;
|
||||
if (!database) {
|
||||
return {error: `${serverUrl} database not found`};
|
||||
}
|
||||
|
||||
try {
|
||||
const userId = await getCurrentUserId(database);
|
||||
const notifyProps = {...props, channel_id: channelId, user_id: userId} as ChannelNotifyProps & {channel_id: string; user_id: string};
|
||||
|
||||
await client.updateChannelNotifyProps(notifyProps);
|
||||
|
||||
return {
|
||||
notifyProps,
|
||||
};
|
||||
} catch (error) {
|
||||
forceLogoutIfNecessary(serverUrl, error as ClientErrorProps);
|
||||
return {error};
|
||||
}
|
||||
};
|
||||
|
||||
export const toggleMuteChannel = async (serverUrl: string, channelId: string, showSnackBar = false) => {
|
||||
const database = DatabaseManager.serverDatabases[serverUrl]?.database;
|
||||
if (!database) {
|
||||
return {error: `${serverUrl} database not found`};
|
||||
}
|
||||
|
||||
try {
|
||||
const channelSettings = await queryMyChannelSettingsByIds(database, [channelId]).fetch();
|
||||
const myChannelSetting = channelSettings?.[0];
|
||||
const mark_unread = myChannelSetting.notifyProps?.mark_unread === 'mention' ? 'all' : 'mention';
|
||||
|
||||
const notifyProps: Partial<ChannelNotifyProps> = {...myChannelSetting.notifyProps, mark_unread};
|
||||
await updateChannelNotifyProps(serverUrl, channelId, notifyProps);
|
||||
|
||||
await database.write(async () => {
|
||||
await myChannelSetting.update((c) => {
|
||||
c.notifyProps = notifyProps;
|
||||
});
|
||||
});
|
||||
|
||||
if (showSnackBar) {
|
||||
const onUndo = () => toggleMuteChannel(serverUrl, channelId, false);
|
||||
showMuteChannelSnackbar(onUndo);
|
||||
}
|
||||
|
||||
return {
|
||||
notifyProps,
|
||||
};
|
||||
} catch (error) {
|
||||
return {error};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,9 +7,7 @@ import keyMirror from '@utils/key_mirror';
|
||||
export const SNACK_BAR_TYPE = keyMirror({
|
||||
LINK_COPIED: null,
|
||||
MESSAGE_COPIED: null,
|
||||
FOLLOW_THREAD: null,
|
||||
MUTE_CHANNEL: null,
|
||||
FAILED_TO_SAVE_MESSAGE: null,
|
||||
});
|
||||
|
||||
type SnackBarConfig = {
|
||||
@@ -17,7 +15,7 @@ type SnackBarConfig = {
|
||||
defaultMessage: string;
|
||||
iconName: string;
|
||||
canUndo: boolean;
|
||||
}
|
||||
};
|
||||
export const SNACK_BAR_CONFIG: Record<string, SnackBarConfig> = {
|
||||
LINK_COPIED: {
|
||||
id: t('snack.bar.link.copied'),
|
||||
@@ -31,12 +29,6 @@ export const SNACK_BAR_CONFIG: Record<string, SnackBarConfig> = {
|
||||
iconName: 'content-copy',
|
||||
canUndo: false,
|
||||
},
|
||||
FOLLOW_THREAD: {
|
||||
id: t('snack.bar.follow.thread'),
|
||||
defaultMessage: 'You\'re now following this thread',
|
||||
iconName: 'message-check-outline',
|
||||
canUndo: true,
|
||||
},
|
||||
MUTE_CHANNEL: {
|
||||
id: t('snack.bar.mute.channel'),
|
||||
defaultMessage: 'This channel was muted',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
||||
import React, {useEffect, useMemo, useRef, useState} from 'react';
|
||||
import {useIntl} from 'react-intl';
|
||||
import {DeviceEventEmitter, Text, TouchableOpacity, useWindowDimensions, ViewStyle} from 'react-native';
|
||||
import {Gesture, GestureDetector, GestureHandlerRootView} from 'react-native-gesture-handler';
|
||||
@@ -71,12 +71,12 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
|
||||
|
||||
type SnackBarProps = {
|
||||
componentId: string;
|
||||
onUndoPress?: () => void;
|
||||
onAction?: () => void;
|
||||
barType: keyof typeof SNACK_BAR_TYPE;
|
||||
sourceScreen: typeof Screens[keyof typeof Screens];
|
||||
}
|
||||
|
||||
const SnackBar = ({barType, componentId, onUndoPress, sourceScreen}: SnackBarProps) => {
|
||||
const SnackBar = ({barType, componentId, onAction, sourceScreen}: SnackBarProps) => {
|
||||
const [showSnackBar, setShowSnackBar] = useState<boolean | undefined>();
|
||||
const intl = useIntl();
|
||||
const theme = useTheme();
|
||||
@@ -85,15 +85,12 @@ const SnackBar = ({barType, componentId, onUndoPress, sourceScreen}: SnackBarPro
|
||||
const offset = useSharedValue(0);
|
||||
const isPanned = useSharedValue(false);
|
||||
const baseTimer = useRef<NodeJS.Timeout>();
|
||||
const mounted = useRef(false);
|
||||
const userHasUndo = useRef(false);
|
||||
|
||||
const config = SNACK_BAR_CONFIG[barType];
|
||||
const styles = getStyleSheet(theme);
|
||||
|
||||
const onPressHandler = useCallback(() => {
|
||||
dismissOverlay(componentId);
|
||||
onUndoPress?.();
|
||||
}, [onUndoPress, componentId]);
|
||||
|
||||
const snackBarStyle = useMemo(() => {
|
||||
const diffWidth = windowWidth - TABLET_SIDEBAR_WIDTH;
|
||||
|
||||
@@ -147,11 +144,13 @@ const SnackBar = ({barType, componentId, onUndoPress, sourceScreen}: SnackBarPro
|
||||
}, [offset.value, isPanned.value]);
|
||||
|
||||
const hideSnackBar = () => {
|
||||
setShowSnackBar(false);
|
||||
if (mounted?.current) {
|
||||
setShowSnackBar(false);
|
||||
}
|
||||
};
|
||||
|
||||
const stopTimers = () => {
|
||||
if (baseTimer.current) {
|
||||
if (baseTimer?.current) {
|
||||
clearTimeout(baseTimer.current);
|
||||
}
|
||||
};
|
||||
@@ -174,8 +173,14 @@ const SnackBar = ({barType, componentId, onUndoPress, sourceScreen}: SnackBarPro
|
||||
offset.value = withTiming(200, {duration}, () => runOnJS(hideSnackBar)());
|
||||
};
|
||||
|
||||
const onUndoPressHandler = () => {
|
||||
userHasUndo.current = true;
|
||||
animateHiding(false);
|
||||
};
|
||||
|
||||
// This effect hides the snack bar after 3 seconds
|
||||
useEffect(() => {
|
||||
mounted.current = true;
|
||||
baseTimer.current = setTimeout(() => {
|
||||
if (!isPanned.value) {
|
||||
animateHiding(false);
|
||||
@@ -183,18 +188,20 @@ const SnackBar = ({barType, componentId, onUndoPress, sourceScreen}: SnackBarPro
|
||||
}, 3000);
|
||||
|
||||
return () => {
|
||||
if (baseTimer.current) {
|
||||
clearTimeout(baseTimer.current);
|
||||
}
|
||||
stopTimers();
|
||||
mounted.current = false;
|
||||
};
|
||||
}, [isPanned.value]);
|
||||
|
||||
// This effect dismisses the Navigation Overlay after we have hidden the snack bar
|
||||
useEffect(() => {
|
||||
if (showSnackBar === false) {
|
||||
if (userHasUndo?.current) {
|
||||
onAction?.();
|
||||
}
|
||||
dismissOverlay(componentId);
|
||||
}
|
||||
}, [showSnackBar]);
|
||||
}, [showSnackBar, onAction]);
|
||||
|
||||
// This effect checks if we are navigating away and if so, it dismisses the snack bar
|
||||
useEffect(() => {
|
||||
@@ -226,8 +233,8 @@ const SnackBar = ({barType, componentId, onUndoPress, sourceScreen}: SnackBarPro
|
||||
textStyle={styles.text}
|
||||
style={styles.toast}
|
||||
>
|
||||
{config.canUndo && onUndoPress && (
|
||||
<TouchableOpacity onPress={onPressHandler}>
|
||||
{config.canUndo && onAction && (
|
||||
<TouchableOpacity onPress={onUndoPressHandler}>
|
||||
<Text style={styles.undo}>
|
||||
{intl.formatMessage({
|
||||
id: 'snack.bar.undo',
|
||||
|
||||
@@ -118,3 +118,17 @@ export function generateChannelNameFromDisplayName(displayName: string) {
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
export function compareNotifyProps(propsA: Partial<ChannelNotifyProps>, propsB: Partial<ChannelNotifyProps>): boolean {
|
||||
if (
|
||||
propsA.desktop !== propsB.desktop ||
|
||||
propsA.email !== propsB.email ||
|
||||
propsA.mark_unread !== propsB.mark_unread ||
|
||||
propsA.push !== propsB.push ||
|
||||
propsA.ignore_channel_mentions !== propsB.ignore_channel_mentions
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {showOverlay} from '@screens/navigation';
|
||||
|
||||
type ShowSnackBarArgs = {
|
||||
barType: keyof typeof SNACK_BAR_TYPE;
|
||||
onPress?: () => void;
|
||||
onAction?: () => void;
|
||||
sourceScreen?: typeof Screens[keyof typeof Screens];
|
||||
};
|
||||
|
||||
@@ -14,3 +14,10 @@ export const showSnackBar = (passProps: ShowSnackBarArgs) => {
|
||||
const screen = Screens.SNACK_BAR;
|
||||
showOverlay(screen, passProps);
|
||||
};
|
||||
|
||||
export const showMuteChannelSnackbar = (onAction: () => void) => {
|
||||
return showSnackBar({
|
||||
onAction,
|
||||
barType: SNACK_BAR_TYPE.MUTE_CHANNEL,
|
||||
});
|
||||
};
|
||||
|
||||
1
types/api/channels.d.ts
vendored
1
types/api/channels.d.ts
vendored
@@ -8,6 +8,7 @@ type ChannelStats = {
|
||||
guest_count: number;
|
||||
pinnedpost_count: number;
|
||||
};
|
||||
|
||||
type ChannelNotifyProps = {
|
||||
desktop: 'default' | 'all' | 'mention' | 'none';
|
||||
email: 'default' | 'all' | 'mention' | 'none';
|
||||
|
||||
Reference in New Issue
Block a user