Add message parser to profile view and db

This commit is contained in:
Gerzon Z 2021-07-29 15:28:42 -04:00
parent 49f936bf1c
commit 1cd297c9ad
8 changed files with 176 additions and 19 deletions

View File

@ -202,5 +202,8 @@ export default {
},
Jitsi_Enable_Channels: {
type: 'valuesAsBoolean'
},
Accounts_Default_User_Preferences_enableMessageParserEarlyAdoption: {
type: 'valueAsBoolean'
}
};

View File

@ -220,6 +220,7 @@
"email": "e-mail",
"Empty_title": "Empty title",
"Enable_Auto_Translate": "Enable Auto-Translate",
"Enable_Message_Parser_Early_Adoption": "Enable message parser early adoption",
"Enable_notifications": "Enable notifications",
"Encrypted": "Encrypted",
"Encrypted_message": "Encrypted message",

View File

@ -83,4 +83,6 @@ export default class Message extends Model {
@field('e2e') e2e;
@field('tshow') tshow;
@field('md') md;
}

View File

@ -31,6 +31,7 @@ import { themes } from '../../constants/colors';
import { withTheme } from '../../theme';
import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView';
import SwitchContainer from '../RoomInfoEditView/SwitchContainer';
class ProfileView extends React.Component {
static navigationOptions = ({ navigation, isMasterDetail }) => {
@ -54,12 +55,16 @@ class ProfileView extends React.Component {
Accounts_AllowRealNameChange: PropTypes.bool,
Accounts_AllowUserAvatarChange: PropTypes.bool,
Accounts_AllowUsernameChange: PropTypes.bool,
Accounts_enableMessageParserEarlyAdoption: PropTypes.bool,
Accounts_CustomFields: PropTypes.string,
setUser: PropTypes.func,
theme: PropTypes.string
}
state = {
constructor(props) {
super(props);
const { Accounts_enableMessageParserEarlyAdoption } = this.props;
this.state = {
saving: false,
name: null,
username: null,
@ -69,7 +74,9 @@ class ProfileView extends React.Component {
avatarUrl: null,
avatar: {},
avatarSuggestions: {},
customFields: {}
customFields: {},
enableMessageParser: Accounts_enableMessageParserEarlyAdoption
};
}
async componentDidMount() {
@ -166,7 +173,7 @@ class ProfileView extends React.Component {
this.setState({ saving: true });
const {
name, username, email, newPassword, currentPassword, avatar, customFields
name, username, email, newPassword, currentPassword, avatar, customFields, enableMessageParser
} = this.state;
const { user, setUser } = this.props;
const params = {};
@ -423,6 +430,11 @@ class ProfileView extends React.Component {
}
}
toggleEnableMessageParserEarlyAdoption = (value) => {
// logEvent(events.RI_EDIT_TOGGLE_SYSTEM_MSG);
this.setState({ enableMessageParser: value });
}
logoutOtherLocations = () => {
logEvent(events.PL_OTHER_LOCATIONS);
showConfirmationAlert({
@ -442,7 +454,7 @@ class ProfileView extends React.Component {
render() {
const {
name, username, email, newPassword, avatarUrl, customFields, avatar, saving
name, username, email, newPassword, avatarUrl, customFields, avatar, saving, enableMessageParser
} = this.state;
const {
user,
@ -452,7 +464,8 @@ class ProfileView extends React.Component {
Accounts_AllowRealNameChange,
Accounts_AllowUserAvatarChange,
Accounts_AllowUsernameChange,
Accounts_CustomFields
Accounts_CustomFields,
Accounts_enableMessageParserEarlyAdoption
} = this.props;
return (
@ -538,6 +551,16 @@ class ProfileView extends React.Component {
testID='profile-view-new-password'
theme={theme}
/>
<SwitchContainer
value={enableMessageParser}
leftLabelPrimary={I18n.t('Enable_Message_Parser_Early_Adoption')}
// leftLabelSecondary={Accounts_enableMessageParserEarlyAdoption ? I18n.t('Overwrites_the_server_configuration_and_use_room_config') : I18n.t('Uses_server_configuration')}
theme={theme}
testID='profile-switch-message-parser-early-adoption'
onValueChange={value => this.setState({ enableMessageParser: value })}
labelContainerStyle={styles.hideSystemMessages}
leftLabelStyle={styles.systemMessagesLabel}
/>
{this.renderCustomFields()}
<RCTextInput
editable={Accounts_AllowUserAvatarChange}
@ -586,6 +609,7 @@ const mapStateToProps = state => ({
Accounts_AllowUserAvatarChange: state.settings.Accounts_AllowUserAvatarChange,
Accounts_AllowUsernameChange: state.settings.Accounts_AllowUsernameChange,
Accounts_CustomFields: state.settings.Accounts_CustomFields,
Accounts_enableMessageParserEarlyAdoption: state.settings.Accounts_Default_User_Preferences_enableMessageParserEarlyAdoption,
baseUrl: state.server.server
});

View File

@ -27903,10 +27903,17 @@
isa = PBXNativeTarget;
buildConfigurationList = F81785C975EC4B13D41AD12DB0FD45F4 /* Build configuration list for PBXNativeTarget "FBReactNativeSpec" */;
buildPhases = (
<<<<<<< Updated upstream
8CD73E24A416482310BBB269007E9E14 /* Headers */,
A42E9530A98E0D506CF859F67001A8D6 /* [CP-User] Generate Specs */,
C8935F11AC9EE2D5F5BB6D52AE2EB925 /* Sources */,
A4475EB91C5C44D2A349A2ECD6B17401 /* Frameworks */,
=======
39F2883A717B6D2F8D4BAFE8679E7F1D /* Headers */,
91FBF340993B4C09427008A98480F368 /* [CP-User] Generate Specs */,
DD8D6945B600427BB34E08C076BC22B6 /* Sources */,
5B6C5E8708BE022B93EC8821E8564DA3 /* Frameworks */,
>>>>>>> Stashed changes
);
buildRules = (
);
@ -28735,8 +28742,8 @@
BFDFE7DC352907FC980B868725387E98 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1240;
LastUpgradeCheck = 1240;
LastSwiftUpdateCheck = 1100;
LastUpgradeCheck = 1100;
};
buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */;
compatibilityVersion = "Xcode 3.2";
@ -28970,7 +28977,46 @@
shellPath = /bin/sh;
shellScript = "COMPATIBILITY_HEADER_PATH=\"${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h\"\nMODULE_MAP_PATH=\"${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap\"\n\nditto \"${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h\" \"${COMPATIBILITY_HEADER_PATH}\"\nditto \"${PODS_ROOT}/Headers/Public/react_native_simple_crypto/react-native-simple-crypto.modulemap\" \"${MODULE_MAP_PATH}\"\nditto \"${PODS_ROOT}/Headers/Public/react_native_simple_crypto/react-native-simple-crypto-umbrella.h\" \"${BUILT_PRODUCTS_DIR}\"\nprintf \"\\n\\nmodule ${PRODUCT_MODULE_NAME}.Swift {\\n header \\\"${COMPATIBILITY_HEADER_PATH}\\\"\\n requires objc\\n}\\n\" >> \"${MODULE_MAP_PATH}\"\n";
};
<<<<<<< Updated upstream
1823C66040CEB06687F1EF0782B7BF34 /* Copy generated compatibility header */ = {
=======
8A457D31C71892981F1B9D17D2EAAD44 /* [CP] Copy dSYMs */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/hermes-engine/destroot/Library/Frameworks/iphoneos/hermes.framework.dSYM",
);
name = "[CP] Copy dSYMs";
outputPaths = (
"${DWARF_DSYM_FOLDER_PATH}/hermes.framework.dSYM",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/hermes-engine/hermes-engine-copy-dsyms.sh\"\n";
showEnvVarsInLog = 0;
};
91FBF340993B4C09427008A98480F368 /* [CP-User] Generate Specs */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"/Users/gerzonc/Documents/GitHub/Rocket.Chat.ReactNative/node_modules/react-native/scripts/../Libraries",
);
name = "[CP-User] Generate Specs";
outputPaths = (
"$(DERIVED_FILE_DIR)/codegen-FBReactNativeSpec.log",
"/Users/gerzonc/Documents/GitHub/Rocket.Chat.ReactNative/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h",
"/Users/gerzonc/Documents/GitHub/Rocket.Chat.ReactNative/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -o pipefail\n\nbash -l -c 'SRCS_DIR=/Users/gerzonc/Documents/GitHub/Rocket.Chat.ReactNative/node_modules/react-native/scripts/../Libraries CODEGEN_MODULES_OUTPUT_DIR=/Users/gerzonc/Documents/GitHub/Rocket.Chat.ReactNative/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec CODEGEN_MODULES_LIBRARY_NAME=FBReactNativeSpec /Users/gerzonc/Documents/GitHub/Rocket.Chat.ReactNative/node_modules/react-native/scripts/generate-specs.sh' 2>&1 | tee \"${SCRIPT_OUTPUT_FILE_0}\"";
};
9D9B393568FBF72B52A30BA814D97FA8 /* Copy generated compatibility header */ = {
>>>>>>> Stashed changes
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@ -28994,6 +29040,7 @@
shellPath = /bin/sh;
shellScript = "COMPATIBILITY_HEADER_PATH=\"${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h\"\nMODULE_MAP_PATH=\"${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap\"\n\nditto \"${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h\" \"${COMPATIBILITY_HEADER_PATH}\"\nditto \"${PODS_ROOT}/Headers/Public/YogaKit/YogaKit.modulemap\" \"${MODULE_MAP_PATH}\"\nditto \"${PODS_ROOT}/Headers/Public/YogaKit/YogaKit-umbrella.h\" \"${BUILT_PRODUCTS_DIR}\"\nprintf \"\\n\\nmodule ${PRODUCT_MODULE_NAME}.Swift {\\n header \\\"${COMPATIBILITY_HEADER_PATH}\\\"\\n requires objc\\n}\\n\" >> \"${MODULE_MAP_PATH}\"\n";
};
<<<<<<< Updated upstream
3E210BA784CEBA16D1C0882FF8BA30F7 /* [CP] Copy XCFrameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -29032,6 +29079,13 @@
};
B2DB92034D1C262AA0075292C432E764 /* [CP] Copy dSYMs */ = {
isa = PBXShellScriptBuildPhase;
=======
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
01B4FBCB34E77F767333F283150C6F8A /* Sources */ = {
isa = PBXSourcesBuildPhase;
>>>>>>> Stashed changes
buildActionMask = 2147483647;
files = (
);
@ -39014,6 +39068,73 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
<<<<<<< Updated upstream
=======
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
903A0004D3E6651EFD5D2E16214D101B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"POD_CONFIGURATION_RELEASE=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
STRIP_INSTALLED_PRODUCT = NO;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
>>>>>>> Stashed changes
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
@ -40321,7 +40442,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 i386";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;

View File

@ -1923,7 +1923,7 @@
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 i386";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@ -1978,7 +1978,7 @@
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 i386";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;

View File

@ -45,6 +45,7 @@
"@react-navigation/drawer": "5.12.5",
"@react-navigation/native": "5.9.4",
"@react-navigation/stack": "5.14.5",
"@rocket.chat/message-parser": "^0.27.0",
"@rocket.chat/react-native-fast-image": "^8.2.0",
"@rocket.chat/sdk": "RocketChat/Rocket.Chat.js.SDK#mobile",
"@rocket.chat/ui-kit": "0.13.0",

View File

@ -3215,6 +3215,11 @@
resolved "https://registry.yarnpkg.com/@redux-saga/types/-/types-1.1.0.tgz#0e81ce56b4883b4b2a3001ebe1ab298b84237204"
integrity sha512-afmTuJrylUU/0OtqzaRkbyYFFNgCF73Bvel/sw90pvGrWIZ+vyoIJqA6eMSoA6+nb443kTmulmBtC9NerXboNg==
"@rocket.chat/message-parser@^0.27.0":
version "0.27.0"
resolved "https://registry.yarnpkg.com/@rocket.chat/message-parser/-/message-parser-0.27.0.tgz#55a07887da649bffb9277aa11ae843a0f5d22895"
integrity sha512-CJxV1N4aSOrTeGKPX+685EeYiG7AMivp8N23SHMZpmbxF36IoVsrdFlxlLRw11Dq8ZMkz4TXAyVk0i4Pvu/psA==
"@rocket.chat/react-native-fast-image@^8.2.0":
version "8.2.0"
resolved "https://registry.yarnpkg.com/@rocket.chat/react-native-fast-image/-/react-native-fast-image-8.2.0.tgz#4f48858f95f40afcb10b39cee9b1239c150d6c51"