Merge branch 'mark-as-unread' into release-1.26

This commit is contained in:
Harrison Healey 2019-11-19 16:07:42 -05:00
commit 3ba989f521
17 changed files with 436 additions and 265 deletions

View file

@ -1,5 +1,37 @@
# Mattermost Mobile Apps Changelog
## 1.25.0 Release
- Release Date: November 16, 2019
- Server Versions Supported: Server v5.9+ is required, Self-Signed SSL Certificates are not supported unless the user installs the CA certificate on their device
### Compatibility
- Android operating system 7+ [is required by Google](https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html).
- iPhone 5s devices and later with iOS 11+ is required.
### Bug Fixes
- Fixed an issue where Mattermost monokai theme no longer worked properly on mobile apps.
- Fixed an issue on Android where the notification badge count didn't update when using multiple channels.
- Fixed an issue on Android where test notifications did not work properly.
- Fixed an issue where "In-app" notifications caused the app badge count to get out of sync.
- Fixed an issue on Android where email notification setting displayed was not updated when the setting was changed.
- Fixed an issue where Favorite channels list didn't update if the app was running in the background.
- Fixed an issue where the timezone setting did not update when changing it back to set automatically.
- Fixed an issue on iOS where clicking on a hashtag from "recent mentions" (or flagged posts) returned the user to the channel instead of displaying hashtag search results.
- Fixed an issue where tapping on a hashtag engaged a keyboard for a moment before displaying search results.
- Fixed an issue where posts of the same thread appeared to be from different threads if separated by a new message line.
- Fixed styling issues on iOS for Name, Purpose and Header information on the channel info screen.
- Fixed styling issues with bot posts timestamps in search results and pinned posts.
- Fixed styling issues on single sign-on screen in landscape view on iOS iPhone X and later.
- Fixed styling issues on iOS for the Helper text on Settings screens.
- Fixed an issue where the thread view header theme was inconsistent during transition back to main channel view.
- Fixed an issue on iOS where the navigation bar tucked under the phone's status bar when switching orientation.
- Fixed an issue on iOS where the keyboard flashed darker when Automatic Replies had been previously enabled.
- Fixed an issue on Android where uploading pictures from storage or camera required unwanted permissions.
- Fixed an issue where ``mobile.message_length.message`` did not match webapp's ``create_post.error_message``.
### Known Issues
- App slows down when opening a channel with large number of animated emoji. [MM-15792](https://mattermost.atlassian.net/browse/MM-15792)
## 1.24.0 Release
- Release Date: October 16, 2019
- Server Versions Supported: Server v5.9+ is required, Self-Signed SSL Certificates are not supported unless the user installs the CA certificate on their device

View file

@ -26,8 +26,9 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.wix.reactnativenotifications.core.notification.PushNotification;
import com.wix.reactnativenotifications.core.NotificationIntentAdapter;
@ -47,13 +48,16 @@ public class CustomPushNotification extends PushNotification {
public static final String KEY_TEXT_REPLY = "CAN_REPLY";
public static final String NOTIFICATION_REPLIED_EVENT_NAME = "notificationReplied";
private static final String PUSH_TYPE_MESSAGE = "message";
private static final String PUSH_TYPE_CLEAR = "clear";
private static final String PUSH_TYPE_ID_LOADED = "id_loaded";
private static final String PUSH_TYPE_UPDATE_BADGE = "update_badge";
private NotificationChannel mHighImportanceChannel;
private NotificationChannel mMinImportanceChannel;
private static LinkedHashMap<String,Integer> channelIdToNotificationCount = new LinkedHashMap<String,Integer>();
private static LinkedHashMap<String,List<Bundle>> channelIdToNotification = new LinkedHashMap<String,List<Bundle>>();
private static Map<String, Integer> channelIdToNotificationCount = new HashMap<String, Integer>();
private static Map<String, List<Bundle>> channelIdToNotification = new HashMap<String, List<Bundle>>();
private static AppLifecycleFacade lifecycleFacade;
private static Context context;
private static int badgeCount = 0;
@ -66,11 +70,9 @@ public class CustomPushNotification extends PushNotification {
public static void clearNotification(Context mContext, int notificationId, String channelId) {
if (notificationId != -1) {
Object objCount = channelIdToNotificationCount.get(channelId);
Integer count = -1;
if (objCount != null) {
count = (Integer)objCount;
Integer count = channelIdToNotificationCount.get(channelId);
if (count == null) {
count = -1;
}
channelIdToNotificationCount.remove(channelId);
@ -130,22 +132,25 @@ public class CustomPushNotification extends PushNotification {
if (channelId != null) {
notificationId = channelId.hashCode();
Object objCount = channelIdToNotificationCount.get(channelId);
Integer count = 1;
if (objCount != null) {
count = (Integer)objCount + 1;
}
channelIdToNotificationCount.put(channelId, count);
Object bundleArray = channelIdToNotification.get(channelId);
List list = null;
if (bundleArray == null) {
list = Collections.synchronizedList(new ArrayList(0));
} else {
list = Collections.synchronizedList((List)bundleArray);
synchronized (channelIdToNotificationCount) {
Integer count = channelIdToNotificationCount.get(channelId);
if (count == null) {
count = 0;
}
count += 1;
channelIdToNotificationCount.put(channelId, count);
}
synchronized (list) {
if (!"clear".equals(type)) {
synchronized (channelIdToNotification) {
List<Bundle> list = channelIdToNotification.get(channelId);
if (list == null) {
list = Collections.synchronizedList(new ArrayList(0));
}
if (PUSH_TYPE_MESSAGE.equals(type)) {
String senderName = getSenderName(data);
data.putLong("time", new Date().getTime());
data.putString("sender_name", senderName);
@ -156,10 +161,13 @@ public class CustomPushNotification extends PushNotification {
}
}
if ("clear".equals(type)) {
cancelNotification(data, notificationId);
} else {
switch(type) {
case PUSH_TYPE_MESSAGE:
super.postNotification(notificationId);
break;
case PUSH_TYPE_CLEAR:
cancelNotification(data, notificationId);
break;
}
notifyReceivedToJS();
@ -270,10 +278,9 @@ public class CustomPushNotification extends PushNotification {
}
private void setNotificationNumber(Notification.Builder notification, String channelId) {
Integer number = 1;
Object objCount = channelIdToNotificationCount.get(channelId);
if (objCount != null) {
number = (Integer)objCount;
Integer number = channelIdToNotificationCount.get(channelId);
if (number != null) {
number = 0;
}
notification.setNumber(number);
}

View file

@ -348,6 +348,11 @@ function lastChannelViewTime(state = {}, action) {
return state;
}
case ChannelTypes.POST_UNREAD_SUCCESS: {
const data = action.data;
return {...state, [data.channelId]: data.lastViewedAt};
}
default:
return state;
}

View file

@ -1,197 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PostOptions should match snapshot, no option for system message to user who doesn't have the permission to delete 1`] = `
<View
style={
Object {
"flex": 1,
}
}
>
<ForwardRef(forwardConnectRef)
allowStayMiddle={false}
initialPosition={250}
marginFromTop={350}
onRequestClose={[Function]}
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
>
<PostOption
destructive={false}
icon="edit"
isLandscape={false}
onPress={[Function]}
text="Edit"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
<PostOption
destructive={false}
icon="reply"
isLandscape={false}
onPress={[Function]}
text="Reply"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
<PostOption
destructive={false}
icon="pin"
isLandscape={false}
onPress={[Function]}
text="Pin to Channel"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
<PostOption
destructive={false}
icon="emoji"
isLandscape={false}
onPress={[Function]}
text="Add Reaction"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
</ForwardRef(forwardConnectRef)>
</View>
`;
exports[`PostOptions should match snapshot, showing Delete option only for system message to user who has permission to delete 1`] = `
<View
style={
Object {
@ -236,10 +45,10 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
>
<PostOption
destructive={false}
icon="edit"
icon="reply"
isLandscape={false}
onPress={[Function]}
text="Edit"
text="Reply"
theme={
Object {
"awayIndicator": "#ffbc42",
@ -272,10 +81,45 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
/>
<PostOption
destructive={false}
icon="reply"
icon="emoji"
isLandscape={false}
onPress={[Function]}
text="Reply"
text="Add Reaction"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
<PostOption
icon="bookmark"
isLandscape={false}
onPress={[Function]}
text="Mark post as unread"
theme={
Object {
"awayIndicator": "#ffbc42",
@ -342,6 +186,125 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
}
}
/>
<PostOption
destructive={false}
icon="edit"
isLandscape={false}
onPress={[Function]}
text="Edit"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
</ForwardRef(forwardConnectRef)>
</View>
`;
exports[`PostOptions should match snapshot, showing Delete option only for system message to user who has permission to delete 1`] = `
<View
style={
Object {
"flex": 1,
}
}
>
<ForwardRef(forwardConnectRef)
allowStayMiddle={false}
initialPosition={350}
marginFromTop={250}
onRequestClose={[Function]}
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
>
<PostOption
destructive={false}
icon="reply"
isLandscape={false}
onPress={[Function]}
text="Reply"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
<PostOption
destructive={false}
icon="emoji"
@ -378,6 +341,113 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
}
}
/>
<PostOption
icon="bookmark"
isLandscape={false}
onPress={[Function]}
text="Mark post as unread"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
<PostOption
destructive={false}
icon="pin"
isLandscape={false}
onPress={[Function]}
text="Pin to Channel"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
<PostOption
destructive={false}
icon="edit"
isLandscape={false}
onPress={[Function]}
text="Edit"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
<PostOption
destructive={true}
icon="trash"
@ -428,8 +498,8 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
>
<ForwardRef(forwardConnectRef)
allowStayMiddle={false}
initialPosition={300}
marginFromTop={300}
initialPosition={350}
marginFromTop={250}
onRequestClose={[Function]}
theme={
Object {
@ -463,10 +533,10 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
>
<PostOption
destructive={false}
icon="edit"
icon="reply"
isLandscape={false}
onPress={[Function]}
text="Edit"
text="Reply"
theme={
Object {
"awayIndicator": "#ffbc42",
@ -499,10 +569,45 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
/>
<PostOption
destructive={false}
icon="reply"
icon="emoji"
isLandscape={false}
onPress={[Function]}
text="Reply"
text="Add Reaction"
theme={
Object {
"awayIndicator": "#ffbc42",
"buttonBg": "#166de0",
"buttonColor": "#ffffff",
"centerChannelBg": "#ffffff",
"centerChannelColor": "#3d3c40",
"codeTheme": "github",
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
"mentionHighlightLink": "#166de0",
"newMessageSeparator": "#ff8800",
"onlineIndicator": "#06d6a0",
"sidebarBg": "#145dbf",
"sidebarHeaderBg": "#1153ab",
"sidebarHeaderTextColor": "#ffffff",
"sidebarText": "#ffffff",
"sidebarTextActiveBorder": "#579eff",
"sidebarTextActiveColor": "#ffffff",
"sidebarTextHoverBg": "#4578bf",
"sidebarUnreadText": "#ffffff",
"type": "Mattermost",
}
}
/>
<PostOption
icon="bookmark"
isLandscape={false}
onPress={[Function]}
text="Mark post as unread"
theme={
Object {
"awayIndicator": "#ffbc42",
@ -571,10 +676,10 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
/>
<PostOption
destructive={false}
icon="emoji"
icon="edit"
isLandscape={false}
onPress={[Function]}
text="Add Reaction"
text="Edit"
theme={
Object {
"awayIndicator": "#ffbc42",

View file

@ -11,6 +11,7 @@ import {
unflagPost,
unpinPost,
removePost,
setUnreadPost,
} from 'mattermost-redux/actions/posts';
import {General, Permissions} from 'mattermost-redux/constants';
import {makeGetReactionsForPost} from 'mattermost-redux/selectors/entities/posts';
@ -115,6 +116,7 @@ export function makeMapStateToProps() {
canFlag,
canPin,
currentTeamUrl: getCurrentTeamUrl(state),
currentUserId,
isMyPost: currentUserId === post.user_id,
theme: getTheme(state),
isLandscape: isLandscape(state),
@ -132,6 +134,7 @@ function mapDispatchToProps(dispatch) {
removePost,
unflagPost,
unpinPost,
setUnreadPost,
}, dispatch),
};
}

View file

@ -23,6 +23,7 @@ import link from 'assets/images/post_menu/link.png';
import pin from 'assets/images/post_menu/pin.png';
import trash from 'assets/images/post_menu/trash.png';
import reply from 'assets/images/post_menu/reply.png';
import bookmark from 'assets/images/post_menu/bookmark.png';
const icons = {
copy,
@ -33,6 +34,7 @@ const icons = {
pin,
trash,
reply,
bookmark,
};
export default class PostOption extends PureComponent {

View file

@ -14,6 +14,7 @@ import {BOTTOM_MARGIN} from 'app/components/slide_up_panel/slide_up_panel';
import {t} from 'app/utils/i18n';
import {showModal, dismissModal} from 'app/actions/navigation';
import {isSystemMessage} from 'mattermost-redux/utils/post_utils';
import {OPTION_HEIGHT, getInitialPosition} from './post_options_utils';
import PostOption from './post_option';
@ -27,6 +28,7 @@ export default class PostOptions extends PureComponent {
removePost: PropTypes.func.isRequired,
unflagPost: PropTypes.func.isRequired,
unpinPost: PropTypes.func.isRequired,
setUnreadPost: PropTypes.func.isRequired,
}).isRequired,
canAddReaction: PropTypes.bool,
canReply: PropTypes.bool,
@ -38,6 +40,7 @@ export default class PostOptions extends PureComponent {
canEdit: PropTypes.bool,
canEditUntil: PropTypes.number.isRequired,
currentTeamUrl: PropTypes.string.isRequired,
currentUserId: PropTypes.string.isRequired,
deviceHeight: PropTypes.number.isRequired,
isFlagged: PropTypes.bool,
isMyPost: PropTypes.bool,
@ -224,40 +227,39 @@ export default class PostOptions extends PureComponent {
return this.getOption(key, icon, message, onPress);
};
getMyPostOptions = () => {
const actions = [
this.getEditOption(),
this.getReplyOption(),
this.getFlagOption(),
this.getPinOption(),
this.getAddReactionOption(),
this.getCopyPermalink(),
this.getCopyText(),
this.getDeleteOption(),
];
getMarkAsUnreadOption = () => {
const {post, isLandscape, theme} = this.props;
const {formatMessage} = this.context.intl;
return actions.filter((a) => a !== null);
};
getOthersPostOptions = () => {
const actions = [
this.getReplyOption(),
this.getFlagOption(),
this.getAddReactionOption(),
this.getPinOption(),
this.getCopyPermalink(),
this.getCopyText(),
this.getEditOption(),
this.getDeleteOption(),
];
return actions.filter((a) => a !== null);
if (!isSystemMessage(post)) {
return (
<PostOption
key='markUnread'
icon='bookmark'
text={formatMessage({id: 'mobile.post_info.mark_unread', defaultMessage: 'Mark post as unread'})}
onPress={this.handleMarkUnread}
isLandscape={isLandscape}
theme={theme}
/>
);
}
return null;
};
getPostOptions = () => {
const {isMyPost} = this.props;
const actions = [
this.getReplyOption(),
this.getAddReactionOption(),
this.getMarkAsUnreadOption(),
this.getCopyPermalink(),
this.getFlagOption(),
this.getCopyText(),
this.getPinOption(),
this.getEditOption(),
this.getDeleteOption(),
];
return isMyPost ? this.getMyPostOptions() : this.getOthersPostOptions();
return actions.filter((a) => a !== null);
};
handleAddReaction = () => {
@ -324,6 +326,15 @@ export default class PostOptions extends PureComponent {
});
};
handleMarkUnread = () => {
const {actions, post, currentUserId} = this.props;
this.closeWithAnimation();
requestAnimationFrame(() => {
actions.setUnreadPost(currentUserId, post.id);
});
}
handlePostDelete = () => {
const {formatMessage} = this.context.intl;
const {actions, post} = this.props;

View file

@ -20,6 +20,7 @@ describe('PostOptions', () => {
removePost: jest.fn(),
unflagPost: jest.fn(),
unpinPost: jest.fn(),
setUnreadPost: jest.fn(),
};
const post = {
@ -40,6 +41,7 @@ describe('PostOptions', () => {
canEditUntil: -1,
channelIsReadOnly: false,
currentTeamUrl: 'http://localhost:8065/team-name',
currentUserId: 'user1',
deviceHeight: 600,
hasBeenDeleted: false,
isFlagged: false,

View file

@ -75,7 +75,7 @@ class PushNotificationUtils {
if (data.type === 'clear') {
dispatch(markChannelViewedAndRead(data.channel_id, null, false));
} else {
} else if (data.type === 'message') {
// get the posts for the channel as soon as possible
retryGetPostsAction(getPosts(data.channel_id), dispatch, getState);

View file

@ -360,6 +360,7 @@
"mobile.post_info.add_reaction": "Add Reaction",
"mobile.post_info.copy_text": "Copy Text",
"mobile.post_info.flag": "Flag",
"mobile.post_info.mark_unread": "Mark post as unread",
"mobile.post_info.pin": "Pin to Channel",
"mobile.post_info.reply": "Reply",
"mobile.post_info.unflag": "Unflag",

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 840 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,023 B

View file

@ -21,7 +21,9 @@
@implementation AppDelegate
NSString* const NOTIFICATION_MESSAGE_ACTION = @"message";
NSString* const NOTIFICATION_CLEAR_ACTION = @"clear";
NSString* const NOTIFICATION_UPDATE_BADGE_ACTION = @"update_badge";
-(void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)(void))completionHandler {
os_log(OS_LOG_DEFAULT, "Mattermost will attach session from handleEventsForBackgroundURLSession!! identifier=%{public}@", identifier);

4
package-lock.json generated
View file

@ -7821,8 +7821,8 @@
}
},
"mattermost-redux": {
"version": "github:mattermost/mattermost-redux#ebd4fd361e982bf2f9b5737642dc5fcf6e1fa3f7",
"from": "github:mattermost/mattermost-redux#ebd4fd361e982bf2f9b5737642dc5fcf6e1fa3f7",
"version": "github:mattermost/mattermost-redux#1976433179ba69765623ce12194c4ec9fc93e580",
"from": "github:mattermost/mattermost-redux#1976433179ba69765623ce12194c4ec9fc93e580",
"requires": {
"form-data": "2.5.1",
"gfycat-sdk": "1.4.18",

View file

@ -24,7 +24,7 @@
"intl": "1.2.5",
"jail-monkey": "2.3.0",
"jsc-android": "241213.1.0",
"mattermost-redux": "github:mattermost/mattermost-redux#ebd4fd361e982bf2f9b5737642dc5fcf6e1fa3f7",
"mattermost-redux": "github:mattermost/mattermost-redux#1976433179ba69765623ce12194c4ec9fc93e580",
"mime-db": "1.42.0",
"moment-timezone": "0.5.27",
"prop-types": "15.7.2",

View file

@ -269,6 +269,7 @@ module.exports = [
'dist/assets/images/icons/word.png',
'dist/assets/images/post_header/flag.png',
'dist/assets/images/post_header/pin.png',
'dist/assets/images/post_header/bookmark.png',
'dist/assets/images/profile.jpg',
'dist/assets/images/thumb.png',
'dist/assets/mattermost-fonts.json',