diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index d2bba5818b1..b30a37fed22 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -6796,7 +6796,7 @@ exports[`Storyshots List with black theme 1`] = ` `; -exports[`Storyshots List with custom color 1`] = ` +exports[`Storyshots List with custom colors 1`] = ` + + + + Press me! + + + + `; @@ -33112,33 +33171,6 @@ exports[`Storyshots Message list message 1`] = ` } testID="message-thread-button-How are you?" > - -  - - 1 reply + Reply - - November 10, 2017 - - - + + +  + + + 1 + + + + +  + + + 0 + + + + -  - + + + +  + + + @@ -33267,6 +33412,103 @@ exports[`Storyshots Message list message 1`] = ` ] } > + + +  + + + How are you? + + + +  + + + - - - - diego.mello - - - - 10:00 AM - - - - How are you? - - - - - - -  - - - +999 replies - - - - November 10, 2017 + I'm fine! - - - -  - - @@ -33662,7 +33661,7 @@ exports[`Storyshots Message list message 1`] = ` "marginTop": 6, } } - testID="message-thread-replied-on-How are you?" + testID="message-thread-replied-on-Thread with emoji :) :joy:" > - How are you? + Thread with emoji🙂 😂 - Thread with emoji🙂 😂 + Markdown: link block code - -  - - - Markdown: link block code - - - -  - - - - - - - - - - - - - - - I'm fine! - - - - - - - - - - - - -  - - 1 reply + Reply - - November 10, 2017 - - - + + +  + + + 1 + + + + +  + + + 0 + + + + -  - + + + +  + + + @@ -61221,27 +61066,948 @@ exports[`Storyshots RoomItem list roomitem 1`] = ` `; -exports[`Storyshots Thread Messages.Item badge 1`] = ` - - +exports[`Storyshots ServerItem content 1`] = ` +Array [ + + + + + + + Rocket.Chat + + + https://open.rocket.chat/ + + + +  + + + , + + + + + + + + Super Long Server Name in Rocket.Chat + + + https://superlongservername.tologintoasuperlongservername/ + + + + , + + + + + + + + https://stable.rocket.chat/ + + + https://stable.rocket.chat/ + + + + , +] +`; + +exports[`Storyshots ServerItem themes 1`] = ` +Array [ + + + + + + + + Rocket.Chat + + + https://open.rocket.chat/ + + + +  + + + , + + + + + + + + Rocket.Chat + + + https://open.rocket.chat/ + + + +  + + + , + + + + + + + + Rocket.Chat + + + https://open.rocket.chat/ + + + +  + + + , +] +`; + +exports[`Storyshots ServerItem touchable 1`] = ` +Array [ + + + + + + + + Rocket.Chat + + + https://open.rocket.chat/ + + + + , + + } + testID="rooms-list-header-server-https://open.rocket.chat/" + > @@ -61249,111 +62015,185 @@ exports[`Storyshots Thread Messages.Item badge 1`] = ` style={ Array [ Object { - "borderRadius": 4, - "height": 36, - "width": 36, + "overflow": "hidden", }, Object { - "marginRight": 8, + "borderRadius": 4, + "height": 44, + "margin": 12, + "resizeMode": "contain", + "width": 44, }, ] } > - + + + - + + https://open.rocket.chat/ + + + + , + + + + - + } + style={ + Object { + "bottom": 0, + "left": 0, + "position": "absolute", + "right": 0, + "top": 0, + } + } + /> - - - rocket.cat - - - November 10, 2020 - - + Rocket.Chat + - Message content + https://open.rocket.chat/ + + + , +] +`; + +exports[`Storyshots Thread Messages.Item badge 1`] = ` + + + + + + + + + + @@ -61384,30 +62321,29 @@ exports[`Storyshots Thread Messages.Item badge 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + rocket.cat - 1 + November 10, 2020 -  + Message content - - 1 - + /> - -  - - + +  + + + 1 + + + + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - + "bottom": 0, + "left": 0, + "position": "absolute", + "right": 0, + "top": 0, + } + } + /> + - - Message content - @@ -61715,30 +62686,29 @@ exports[`Storyshots Thread Messages.Item badge 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + rocket.cat - 1 + November 10, 2020 -  + Message content - - 1 - + /> - -  - - + +  + + + 1 + + + + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - - - - Message content - + ] + } + > + + + @@ -62046,30 +63051,29 @@ exports[`Storyshots Thread Messages.Item badge 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + rocket.cat - 1 + November 10, 2020 -  + Message content - - 1 - + /> - -  - - + +  + + + 1 + + + + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - + "bottom": 0, + "left": 0, + "position": "absolute", + "right": 0, + "top": 0, + } + } + /> + - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - @@ -62364,30 +63403,29 @@ exports[`Storyshots Thread Messages.Item badge 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + rocket.cat - 1 + November 10, 2020 -  + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - - 1 - + /> - + + +  + + + 1 + + + -  - - + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - + "bottom": 0, + "left": 0, + "position": "absolute", + "right": 0, + "top": 0, + } + } + /> + - - Message content - @@ -62715,30 +63788,29 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + rocket.cat - 1 + November 10, 2020 -  - - - 1 + Message content - -  - - + +  + + + 1 + + + + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + @@ -62877,144 +64050,85 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` } /> - - - - - - - rocket.cat - - - November 10, 2020 - + "bottom": 0, + "left": 0, + "position": "absolute", + "right": 0, + "top": 0, + } + } + /> + - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - @@ -63023,30 +64137,29 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + rocket.cat - 1 + November 10, 2020 -  - - - 1 + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - -  - - + +  + + + 1 + + + + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + @@ -63185,226 +64399,116 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` } /> - - - - - - - rocket.cat - - - November 10, 2020 - + "bottom": 0, + "left": 0, + "position": "absolute", + "right": 0, + "top": 0, + } + } + /> + - - Message content - - - -  - - - 1000 - - + "flex": 1, + "flexDirection": "column", + } + } + > -  + rocket.cat - 1000 + November 10, 2020 -  + Message content - + + + + +  + + + +999 + + + + +  + + + +999 + + + + - November 10, 2020 - + + +  + + + @@ -63493,144 +64748,85 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` } /> - - - - - - - rocket.cat - - - November 10, 2020 - + "bottom": 0, + "left": 0, + "position": "absolute", + "right": 0, + "top": 0, + } + } + /> + - - Attachment title - @@ -63639,30 +64835,29 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + rocket.cat - 1 + November 10, 2020 -  - - - 1 + Attachment title - -  - - + +  + + + 1 + + + + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + @@ -63801,144 +65097,85 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` } /> - - - - - - - Rocket Cat - - - November 10, 2020 - + "bottom": 0, + "left": 0, + "position": "absolute", + "right": 0, + "top": 0, + } + } + /> + - - Message content - @@ -63947,30 +65184,29 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + Rocket Cat - 1 + November 10, 2020 -  - - - 1 + Message content - -  - - + +  + + + 1 + + + + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + @@ -64129,144 +65466,85 @@ exports[`Storyshots Thread Messages.Item themes 1`] = ` } /> - - - - - - - rocket.cat - - - November 10, 2020 - - - - Message content - + + + + @@ -64275,30 +65553,29 @@ exports[`Storyshots Thread Messages.Item themes 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + rocket.cat - 1 + November 10, 2020 -  + Message content - - 1 - + /> - -  - - + +  + + + 1 + + + + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - + "bottom": 0, + "left": 0, + "position": "absolute", + "right": 0, + "top": 0, + } + } + /> + - - Message content - @@ -64593,30 +65905,29 @@ exports[`Storyshots Thread Messages.Item themes 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + rocket.cat - 1 + November 10, 2020 -  + Message content - - 1 - + /> - + + +  + + + 1 + + + -  - - + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - + "bottom": 0, + "left": 0, + "position": "absolute", + "right": 0, + "top": 0, + } + } + /> + - - Message content - @@ -64911,30 +66257,29 @@ exports[`Storyshots Thread Messages.Item themes 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  + rocket.cat - 1 + November 10, 2020 -  + Message content - - 1 - + /> - -  - - + +  + + + 1 + + + + +  + + + 1 + + + + - November 10, 2020 - + + +  + + + - - - diff --git a/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java b/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java index 5eefab57aa3..e93eb3f9684 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java +++ b/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java @@ -14,7 +14,6 @@ import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; import com.zoontek.rnbootsplash.RNBootSplash; -import com.tencent.mmkv.MMKV; import com.google.gson.Gson; class ThemePreferences { @@ -36,61 +35,11 @@ protected void onCreate(Bundle savedInstanceState) { // https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704067 super.onCreate(null); RNBootSplash.init(R.drawable.launch_screen, MainActivity.this); + } - MMKV.initialize(MainActivity.this); - - // Start the MMKV container - MMKV defaultMMKV = MMKV.defaultMMKV(); - boolean alreadyMigrated = defaultMMKV.decodeBool("alreadyMigrated"); - - if (!alreadyMigrated) { - // MMKV Instance that will be used by JS - MMKV mmkv = MMKV.mmkvWithID("default"); - - // SharedPreferences -> MMKV (Migration) - SharedPreferences sharedPreferences = getSharedPreferences("react-native", Context.MODE_PRIVATE); - mmkv.importFromSharedPreferences(sharedPreferences); - - // SharedPreferences only save strings, so we saved this value as a String and now we'll need to cast into a MMKV object - - // Theme preferences object - String THEME_PREFERENCES_KEY = "RC_THEME_PREFERENCES_KEY"; - String themeJson = sharedPreferences.getString(THEME_PREFERENCES_KEY, ""); - if (!themeJson.isEmpty()) { - ThemePreferences themePreferences = new Gson().fromJson(themeJson, ThemePreferences.class); - WritableMap themeMap = new Arguments().createMap(); - themeMap.putString("currentTheme", themePreferences.currentTheme); - themeMap.putString("darkLevel", themePreferences.darkLevel); - Bundle bundle = Arguments.toBundle(themeMap); - mmkv.encode(THEME_PREFERENCES_KEY, bundle); - } - - // Sort preferences object - String SORT_PREFS_KEY = "RC_SORT_PREFS_KEY"; - String sortJson = sharedPreferences.getString(SORT_PREFS_KEY, ""); - if (!sortJson.isEmpty()) { - SortPreferences sortPreferences = new Gson().fromJson(sortJson, SortPreferences.class); - WritableMap sortMap = new Arguments().createMap(); - sortMap.putString("sortBy", sortPreferences.sortBy); - if (sortPreferences.groupByType != null) { - sortMap.putBoolean("groupByType", sortPreferences.groupByType); - } - if (sortPreferences.showFavorites != null) { - sortMap.putBoolean("showFavorites", sortPreferences.showFavorites); - } - if (sortPreferences.showUnread != null) { - sortMap.putBoolean("showUnread", sortPreferences.showUnread); - } - Bundle bundle = Arguments.toBundle(sortMap); - mmkv.encode(SORT_PREFS_KEY, bundle); - } - - // Remove all our keys of SharedPreferences - sharedPreferences.edit().clear().commit(); - - // Mark migration complete - defaultMMKV.encode("alreadyMigrated", true); - } + @Override + public void invokeDefaultOnBackPressed() { + moveTaskToBack(true); } /** diff --git a/android/app/src/main/res/drawable-hdpi/logo.png b/android/app/src/main/res/drawable-hdpi/logo.png deleted file mode 100755 index b4d275593b6..00000000000 Binary files a/android/app/src/main/res/drawable-hdpi/logo.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-mdpi/logo.png b/android/app/src/main/res/drawable-mdpi/logo.png deleted file mode 100755 index 9b3c622a032..00000000000 Binary files a/android/app/src/main/res/drawable-mdpi/logo.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xhdpi/logo.png b/android/app/src/main/res/drawable-xhdpi/logo.png deleted file mode 100755 index b1d639a32f6..00000000000 Binary files a/android/app/src/main/res/drawable-xhdpi/logo.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxhdpi/logo.png b/android/app/src/main/res/drawable-xxhdpi/logo.png deleted file mode 100755 index 86ef8a10267..00000000000 Binary files a/android/app/src/main/res/drawable-xxhdpi/logo.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/logo.png b/android/app/src/main/res/drawable-xxxhdpi/logo.png deleted file mode 100755 index c08988975f8..00000000000 Binary files a/android/app/src/main/res/drawable-xxxhdpi/logo.png and /dev/null differ diff --git a/android/app/src/play/java/chat/rocket/reactnative/CustomPushNotification.java b/android/app/src/play/java/chat/rocket/reactnative/CustomPushNotification.java index 23179fd6076..9311f7ebd97 100644 --- a/android/app/src/play/java/chat/rocket/reactnative/CustomPushNotification.java +++ b/android/app/src/play/java/chat/rocket/reactnative/CustomPushNotification.java @@ -257,7 +257,6 @@ private void notificationStyle(Notification.Builder notification, int notId, Bun Notification.MessagingStyle messageStyle; Gson gson = new Gson(); - Ejson ejson = gson.fromJson(bundle.getString("ejson", "{}"), Ejson.class); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { messageStyle = new Notification.MessagingStyle(""); @@ -278,25 +277,19 @@ private void notificationStyle(Notification.Builder notification, int notId, Bun long timestamp = data.getLong("time"); String message = data.getString("message"); - String username = data.getString("username"); String senderId = data.getString("senderId"); String avatarUri = data.getString("avatarUri"); - + Ejson ejson = gson.fromJson(data.getString("ejson", "{}"), Ejson.class); String m = extractMessage(message, ejson); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { - messageStyle.addMessage(m, timestamp, username); + messageStyle.addMessage(m, timestamp, ejson.senderName); } else { Bitmap avatar = getAvatar(avatarUri); - String name = username; - if (ejson.senderName != null) { - name = ejson.senderName; - } - Person.Builder sender = new Person.Builder() .setKey(senderId) - .setName(name); + .setName(ejson.senderName); if (avatar != null) { sender.setIcon(Icon.createWithBitmap(avatar)); diff --git a/app/AppContainer.js b/app/AppContainer.js index 4023635f737..9ec17ad433c 100644 --- a/app/AppContainer.js +++ b/app/AppContainer.js @@ -7,7 +7,7 @@ import { connect } from 'react-redux'; import Navigation from './lib/Navigation'; import { defaultHeader, getActiveRouteName, navigationTheme } from './utils/navigation'; import { - ROOT_LOADING, ROOT_OUTSIDE, ROOT_NEW_SERVER, ROOT_INSIDE, ROOT_SET_USERNAME, ROOT_BACKGROUND + ROOT_LOADING, ROOT_OUTSIDE, ROOT_NEW_SERVER, ROOT_INSIDE, ROOT_SET_USERNAME } from './actions/app'; // Stacks @@ -65,7 +65,7 @@ const App = React.memo(({ root, isMasterDetail }) => { > <> - {root === ROOT_LOADING || root === ROOT_BACKGROUND ? ( + {root === ROOT_LOADING ? ( ( onPress(props.title)} - style={{ backgroundColor: themes[props.theme].backgroundColor }} + style={{ backgroundColor: backgroundColor || themes[props.theme].backgroundColor }} + underlayColor={underlayColor} enabled={!props.disabled} theme={props.theme} > @@ -99,7 +97,7 @@ const ListItem = React.memo(({ ...props }) => { return