Skip to content

Commit 488ada3

Browse files
authored
Chore: fixes and improvements (#237)
* Change the URL validation logic * Style fixes * Message send issues * Release android/ios beta version 0.0.59 * Fix the button active style issue * Show chatwoot related links in official app only * Fix private message styles * Code beautification
1 parent 93b701a commit 488ada3

File tree

12 files changed

+48
-25
lines changed

12 files changed

+48
-25
lines changed

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ android {
134134
applicationId "com.chatwoot.app"
135135
minSdkVersion rootProject.ext.minSdkVersion
136136
targetSdkVersion rootProject.ext.targetSdkVersion
137-
versionCode 58
138-
versionName "0.0.58"
137+
versionCode 59
138+
versionName "0.0.59"
139139
multiDexEnabled true
140140
}
141141
splits {

ios/Chatwoot.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,13 +724,13 @@
724724
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
725725
CLANG_ENABLE_MODULES = YES;
726726
CODE_SIGN_ENTITLEMENTS = Chatwoot/Chatwoot.entitlements;
727-
CURRENT_PROJECT_VERSION = 58;
727+
CURRENT_PROJECT_VERSION = 59;
728728
DEVELOPMENT_TEAM = 6C953F3RX2;
729729
ENABLE_BITCODE = NO;
730730
INFOPLIST_FILE = Chatwoot/Info.plist;
731731
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
732732
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
733-
MARKETING_VERSION = 0.0.58;
733+
MARKETING_VERSION = 0.0.59;
734734
OTHER_LDFLAGS = (
735735
"$(inherited)",
736736
"-ObjC",
@@ -751,12 +751,12 @@
751751
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
752752
CLANG_ENABLE_MODULES = YES;
753753
CODE_SIGN_ENTITLEMENTS = Chatwoot/Chatwoot.entitlements;
754-
CURRENT_PROJECT_VERSION = 58;
754+
CURRENT_PROJECT_VERSION = 59;
755755
DEVELOPMENT_TEAM = 6C953F3RX2;
756756
INFOPLIST_FILE = Chatwoot/Info.plist;
757757
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
758758
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
759-
MARKETING_VERSION = 0.0.58;
759+
MARKETING_VERSION = 0.0.59;
760760
OTHER_LDFLAGS = (
761761
"$(inherited)",
762762
"-ObjC",

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chatwoot/mobile-app",
3-
"version": "0.0.58",
3+
"version": "0.0.59",
44
"private": true,
55
"scripts": {
66
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force",
@@ -58,7 +58,8 @@
5858
"redux-logger": "^3.0.6",
5959
"redux-persist": "^6.0.0",
6060
"redux-thunk": "^2.3.0",
61-
"tcomb-form-native": "^0.6.20"
61+
"tcomb-form-native": "^0.6.20",
62+
"validator": "^13.1.1"
6263
},
6364
"devDependencies": {
6465
"@babel/core": "^7.8.4",

src/actions/conversation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ export const sendMessage = ({ conversationId, message }) => async (dispatch) =>
290290
type: SEND_MESSAGE_SUCCESS,
291291
payload: response.data,
292292
});
293+
dispatch(addMessageToConversation({ message: response.data }));
293294
} catch (error) {
294295
dispatch({ type: SEND_MESSAGE_ERROR, payload: error });
295296
}

src/components/ChatMessageItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const styles = (theme) => ({
8181
color: theme['text-basic-color'],
8282
borderWidth: 1,
8383
borderColor: theme['color-border-activity'],
84-
padding: 12,
84+
padding: 16,
8585
},
8686
privateMessageView: {
8787
flexDirection: 'row',

src/components/ConversationItem.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ const styles = (theme) => ({
146146
paddingBottom: 12,
147147
backgroundColor: theme['background-basic-color-1'],
148148
marginVertical: 0.5,
149-
borderColor: theme['color-border'],
150-
borderBottomWidth: 0,
149+
borderColor: theme['item-border-color'],
150+
borderBottomWidth: 1,
151151
},
152152
itemView: {
153153
flexDirection: 'row',

src/helpers/formHelper.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import t from 'tcomb-form-native';
2-
2+
import validator from 'validator';
33
// eslint-disable-next-line no-useless-escape
44
const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
55
const nameRegex = /^.{2}/;
66
const passwordRegex = /^.{6}/;
7-
const urlRegex = /^(?:(http|https):\/\/)?(?:[\w-]+\.)+[a-z]{2,6}$/;
87
const mobileNumberValidator = (mobileNumber) => {
98
const regex = /^(?:(?:\+|0{0,2})91(\s*[-]\s*)?|[0]?)?[789]\d{9}$/g;
109
return regex.test(mobileNumber);
@@ -24,18 +23,15 @@ export const isStringName = (name) => {
2423
export const Name = t.refinement(t.String, (name) => isStringName(name));
2524

2625
export const isStringUrl = (url) => {
27-
const re = urlRegex;
28-
return re.test(url);
26+
return validator.isURL(url);
2927
};
3028
export const URL = t.refinement(t.String, (url) => isStringUrl(url));
3129

3230
export const isStringPassword = (password) => {
3331
const re = passwordRegex;
3432
return re.test(password);
3533
};
36-
export const Password = t.refinement(t.String, (password) =>
37-
isStringPassword(password),
38-
);
34+
export const Password = t.refinement(t.String, (password) => isStringPassword(password));
3935

4036
export const isNumberValid = (number) => {
4137
const regex = /^\+?\d{1,8}(?:\.\d{1,2})?$/;

src/screens/ChatScreen/ChatScreen.style.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const styles = (theme) => ({
2727
subHeaderTitle: {
2828
fontSize: theme['font-size-extra-small'],
2929
color: theme['color-gray'],
30-
paddingTop: 1,
30+
paddingTop: 4,
31+
paddingLeft: 4,
3132
},
3233

3334
container: {

src/screens/LoginScreen/LoginScreen.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import PropTypes from 'prop-types';
77

88
import { doLogin, resetAuth } from '../../actions/auth';
99

10+
import DeviceInfo from 'react-native-device-info';
1011
import styles from './LoginScreen.style';
1112
import { Email, Password } from '../../helpers/formHelper';
1213
import TextInputField from '../../components/TextInputField';
@@ -26,6 +27,8 @@ const LoginForm = t.struct({
2627
password: Password,
2728
});
2829

30+
const appName = DeviceInfo.getApplicationName();
31+
2932
const propTypes = {
3033
eva: PropTypes.shape({
3134
style: PropTypes.object,
@@ -144,10 +147,18 @@ const LoginScreenComponent = ({ navigation, eva }) => {
144147

145148
<View>
146149
<View style={style.accountView}>
147-
<TouchableOpacity onPress={() => openURL({ URL: `${installationUrl}${SIGNUP_URL}` })}>
148-
<CustomText style={style.textStyle}>{i18n.t('LOGIN.CREATE_ACCOUNT')}</CustomText>
149-
</TouchableOpacity>
150-
<CustomText style={style.textStyle}>{' | '}</CustomText>
150+
{appName === 'Chatwoot' && (
151+
<>
152+
<TouchableOpacity
153+
onPress={() => openURL({ URL: `${installationUrl}${SIGNUP_URL}` })}>
154+
<CustomText style={style.textStyle}>
155+
{i18n.t('LOGIN.CREATE_ACCOUNT')}
156+
</CustomText>
157+
</TouchableOpacity>
158+
<CustomText style={style.textStyle}>{' | '}</CustomText>
159+
</>
160+
)}
161+
151162
<TouchableOpacity onPress={() => navigate('ConfigureURL')}>
152163
<CustomText style={style.textStyle}> {i18n.t('LOGIN.CHANGE_URL')}</CustomText>
153164
</TouchableOpacity>

src/screens/Settings/SettingsScreen.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { withStyles } from '@ui-kitten/components';
33
import { connect } from 'react-redux';
44
import PropTypes from 'prop-types';
55
import { SafeAreaView } from 'react-native';
6+
import DeviceInfo from 'react-native-device-info';
67

78
import { View, Image } from 'react-native';
89
import packageFile from '../../../package.json';
@@ -23,6 +24,8 @@ import HeaderBar from '../../components/HeaderBar';
2324

2425
import { getNotificationSettings } from '../../actions/settings';
2526

27+
const appName = DeviceInfo.getApplicationName();
28+
2629
const settingsData = [
2730
{
2831
text: 'SWITCH_ACCOUNT',
@@ -138,11 +141,14 @@ class SettingsComponent extends Component {
138141
} = this.props;
139142

140143
// Show switch account option only if number of accounts is greater than one
141-
const settingsMenu =
144+
let settingsMenu =
142145
accounts && accounts.length > 1
143146
? settingsData
144147
: settingsData.filter((e) => e.itemName !== 'switch-account');
145148

149+
settingsMenu =
150+
appName === 'Chatwoot' ? settingsData : settingsData.filter((e) => e.itemName !== 'help');
151+
146152
return (
147153
<SafeAreaView style={style.container}>
148154
<HeaderBar title={i18n.t('SETTINGS.HEADER_TITLE')} />

0 commit comments

Comments
 (0)