diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index d2bba5818..b30a37fed 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 - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - diego.mello - - - - 10:00 AM - - - - - - How are you? - - - - - + + +  + + + 1 + + + + +  + + + 0 + + + + + + -  - - - +999 replies - - - - November 10, 2017 - - - - -  - + "opacity": 1, + } + } + > + +  + + + @@ -35583,33 +35342,6 @@ exports[`Storyshots Message list message 1`] = ` } testID="message-thread-button-How are you?" > - -  - - 1 reply + Reply - - November 10, 2017 - - - -  - + + +  + + + 1 + + + + +  + + + 0 + + + + + + + +  + + + @@ -61221,6 +61066,1157 @@ exports[`Storyshots RoomItem list roomitem 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/ + + + + , + + + + + + + + Rocket.Chat + + + https://open.rocket.chat/ + + + + , + + + + + + + + Rocket.Chat + + + https://open.rocket.chat/ + + + + , +] +`; + exports[`Storyshots Thread Messages.Item badge 1`] = ` @@ -61238,144 +62234,85 @@ exports[`Storyshots Thread Messages.Item badge 1`] = ` } /> - - - - - - - rocket.cat - - - November 10, 2020 - - - - Message content - + + + + @@ -61384,80 +62321,29 @@ exports[`Storyshots Thread Messages.Item badge 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + rocket.cat - 1 - - - - -  - - + + + Message content + + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - - - - Message content - + + + + @@ -61715,80 +62686,29 @@ exports[`Storyshots Thread Messages.Item badge 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + rocket.cat - 1 - - - - -  - - + + + Message content + + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - - - - Message content - + + + + @@ -62046,80 +63051,29 @@ exports[`Storyshots Thread Messages.Item badge 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + rocket.cat - 1 - - - - -  - - + + + Message content + + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - + + + + @@ -62364,80 +63403,29 @@ exports[`Storyshots Thread Messages.Item badge 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + rocket.cat - 1 - - - - -  - - + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - - - - Message content - + + + + @@ -62715,80 +63788,29 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + rocket.cat - 1 - - - - -  - - + + + Message content + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + @@ -62877,144 +64050,85 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` } /> - - - - - - - rocket.cat - - - November 10, 2020 - - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - + + + + @@ -63023,80 +64137,29 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + rocket.cat - 1 - - - - -  - - + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + @@ -63185,144 +64399,85 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` } /> - - - - - - - rocket.cat - - - November 10, 2020 - - - - Message content - + + + + @@ -63331,80 +64486,29 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1000 - - - - -  + rocket.cat - 1000 - - - - -  - - + + + Message content + + + + + + +  + + + +999 + + + + +  + + + +999 + + + + + + +  + + + + @@ -63493,144 +64748,85 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` } /> - - - - - - - rocket.cat - - - November 10, 2020 - - - - Attachment title - + + + + @@ -63639,80 +64835,29 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + rocket.cat - 1 - - - - -  - - + + + Attachment title + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + @@ -63801,144 +65097,85 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` } /> - - - - - - - Rocket Cat - - - November 10, 2020 - - - - Message content - + + + + @@ -63947,80 +65184,29 @@ exports[`Storyshots Thread Messages.Item content 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + Rocket Cat - 1 - - - - -  - - + + + Message content + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + @@ -64129,144 +65466,85 @@ exports[`Storyshots Thread Messages.Item themes 1`] = ` } /> - - - - - - - rocket.cat - - - November 10, 2020 - - - - Message content - + + + + @@ -64275,80 +65553,29 @@ exports[`Storyshots Thread Messages.Item themes 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + rocket.cat - 1 - - - - -  - - + + + Message content + + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - - - - Message content - + + + + @@ -64593,80 +65905,29 @@ exports[`Storyshots Thread Messages.Item themes 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + rocket.cat - 1 - - - - -  - - + + + Message content + + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + - - - - - - - - - - rocket.cat - - - November 10, 2020 - - - - Message content - + + + + @@ -64911,80 +66257,29 @@ exports[`Storyshots Thread Messages.Item themes 1`] = ` Object { "alignItems": "center", "flexDirection": "row", - "justifyContent": "center", - "marginRight": 8, + "marginBottom": 2, } } > -  - - - 1 - - - - -  + rocket.cat - 1 - - - - -  - - + + + Message content + + + + + + + +  + + + 1 + + + + +  + + + 1 + + + + + + +  + + + + - - - 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 5eefab57a..e93eb3f96 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.facebook.react.ReactFragmentActivity; 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 @@ public class MainActivity extends ReactFragmentActivity { // 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 b4d275593..000000000 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 9b3c622a0..000000000 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 b1d639a32..000000000 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 86ef8a102..000000000 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 c08988975..000000000 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 23179fd60..9311f7ebd 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 @@ public class CustomPushNotification extends PushNotification { 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 @@ public class CustomPushNotification extends PushNotification { 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 4023635f7..9ec17ad43 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