Added Create Team
This commit is contained in:
parent
f14868678b
commit
2f5f247915
|
@ -709,5 +709,7 @@
|
||||||
"This_room_encryption_has_been_disabled_by__username_": "This room's encryption has been disabled by {{username}}",
|
"This_room_encryption_has_been_disabled_by__username_": "This room's encryption has been disabled by {{username}}",
|
||||||
"Teams": "Teams",
|
"Teams": "Teams",
|
||||||
"No_team_channels_found": "No channels found",
|
"No_team_channels_found": "No channels found",
|
||||||
"Team_not_found": "Team not found"
|
"Team_not_found": "Team not found",
|
||||||
}
|
"Create_Team": "Create Team",
|
||||||
|
"Team_Name": "Team Name"
|
||||||
|
}
|
||||||
|
|
|
@ -728,7 +728,10 @@ const RocketChat = {
|
||||||
prid, pmid, t_name, reply, users, encrypted
|
prid, pmid, t_name, reply, users, encrypted
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
createTeam(name) {
|
||||||
|
// RC 3.13.0
|
||||||
|
return this.post('teams.create', name);
|
||||||
|
},
|
||||||
joinRoom(roomId, joinCode, type) {
|
joinRoom(roomId, joinCode, type) {
|
||||||
// TODO: join code
|
// TODO: join code
|
||||||
// RC 0.48.0
|
// RC 0.48.0
|
||||||
|
|
|
@ -87,6 +87,7 @@ export default {
|
||||||
|
|
||||||
// NEW MESSAGE VIEW
|
// NEW MESSAGE VIEW
|
||||||
NEW_MSG_CREATE_CHANNEL: 'new_msg_create_channel',
|
NEW_MSG_CREATE_CHANNEL: 'new_msg_create_channel',
|
||||||
|
NEW_MSG_CREATE_TEAM: 'new_msg_create_team',
|
||||||
NEW_MSG_CREATE_GROUP_CHAT: 'new_msg_create_group_chat',
|
NEW_MSG_CREATE_GROUP_CHAT: 'new_msg_create_group_chat',
|
||||||
NEW_MSG_CREATE_DISCUSSION: 'new_msg_create_discussion',
|
NEW_MSG_CREATE_DISCUSSION: 'new_msg_create_discussion',
|
||||||
NEW_MSG_CHAT_WITH_USER: 'new_msg_chat_with_user',
|
NEW_MSG_CHAT_WITH_USER: 'new_msg_chat_with_user',
|
||||||
|
|
|
@ -69,11 +69,12 @@ const styles = StyleSheet.create({
|
||||||
|
|
||||||
class CreateChannelView extends React.Component {
|
class CreateChannelView extends React.Component {
|
||||||
static navigationOptions = () => ({
|
static navigationOptions = () => ({
|
||||||
title: I18n.t('Create_Channel')
|
title: this.props?.route?.params?.isTeam ? I18n.t('Create_Team') : I18n.t('Create_Channel')
|
||||||
});
|
})
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
navigation: PropTypes.object,
|
navigation: PropTypes.object,
|
||||||
|
route: PropTypes.object,
|
||||||
baseUrl: PropTypes.string,
|
baseUrl: PropTypes.string,
|
||||||
create: PropTypes.func.isRequired,
|
create: PropTypes.func.isRequired,
|
||||||
removeUser: PropTypes.func.isRequired,
|
removeUser: PropTypes.func.isRequired,
|
||||||
|
@ -302,7 +303,10 @@ class CreateChannelView extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { channelName } = this.state;
|
const { channelName } = this.state;
|
||||||
const { users, isFetching, theme } = this.props;
|
const {
|
||||||
|
users, isFetching, route, theme
|
||||||
|
} = this.props;
|
||||||
|
const { isTeam } = route?.params;
|
||||||
const userCount = users.length;
|
const userCount = users.length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -312,18 +316,18 @@ class CreateChannelView extends React.Component {
|
||||||
keyboardVerticalOffset={128}
|
keyboardVerticalOffset={128}
|
||||||
>
|
>
|
||||||
<StatusBar />
|
<StatusBar />
|
||||||
<SafeAreaView testID='create-channel-view'>
|
<SafeAreaView testID={isTeam ? 'create-team-view' : 'create-channel-view'}>
|
||||||
<ScrollView {...scrollPersistTaps}>
|
<ScrollView {...scrollPersistTaps}>
|
||||||
<View style={[sharedStyles.separatorVertical, { borderColor: themes[theme].separatorColor }]}>
|
<View style={[sharedStyles.separatorVertical, { borderColor: themes[theme].separatorColor }]}>
|
||||||
<TextInput
|
<TextInput
|
||||||
autoFocus
|
autoFocus
|
||||||
style={[styles.input, { backgroundColor: themes[theme].backgroundColor }]}
|
style={[styles.input, { backgroundColor: themes[theme].backgroundColor }]}
|
||||||
label={I18n.t('Channel_Name')}
|
label={isTeam ? I18n.t('Team_Name') : I18n.t('Channel_Name')}
|
||||||
value={channelName}
|
value={channelName}
|
||||||
onChangeText={this.onChangeText}
|
onChangeText={this.onChangeText}
|
||||||
placeholder={I18n.t('Channel_Name')}
|
placeholder={isTeam ? I18n.t('Team_Name') : I18n.t('Channel_Name')}
|
||||||
returnKeyType='done'
|
returnKeyType='done'
|
||||||
testID='create-channel-name'
|
testID={isTeam ? 'create-team-name' : 'create-channel-name'}
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
autoCapitalize='none'
|
autoCapitalize='none'
|
||||||
theme={theme}
|
theme={theme}
|
||||||
|
|
|
@ -116,6 +116,12 @@ class NewMessageView extends React.Component {
|
||||||
navigation.navigate('SelectedUsersViewCreateChannel', { nextAction: () => navigation.navigate('CreateChannelView') });
|
navigation.navigate('SelectedUsersViewCreateChannel', { nextAction: () => navigation.navigate('CreateChannelView') });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createTeam = () => {
|
||||||
|
logEvent(events.NEW_MSG_CREATE_TEAM);
|
||||||
|
const { navigation } = this.props;
|
||||||
|
navigation.navigate('SelectedUsersViewCreateChannel', { nextAction: () => navigation.navigate('CreateChannelView', { isTeam: true }) });
|
||||||
|
}
|
||||||
|
|
||||||
createGroupChat = () => {
|
createGroupChat = () => {
|
||||||
logEvent(events.NEW_MSG_CREATE_GROUP_CHAT);
|
logEvent(events.NEW_MSG_CREATE_GROUP_CHAT);
|
||||||
const { createChannel, maxUsers, navigation } = this.props;
|
const { createChannel, maxUsers, navigation } = this.props;
|
||||||
|
@ -172,6 +178,12 @@ class NewMessageView extends React.Component {
|
||||||
testID: 'new-message-view-create-channel',
|
testID: 'new-message-view-create-channel',
|
||||||
first: true
|
first: true
|
||||||
})}
|
})}
|
||||||
|
{this.renderButton({
|
||||||
|
onPress: this.createTeam,
|
||||||
|
title: I18n.t('Create_Team'),
|
||||||
|
icon: 'team',
|
||||||
|
testID: 'new-message-view-create-team'
|
||||||
|
})}
|
||||||
{maxUsers > 2 ? this.renderButton({
|
{maxUsers > 2 ? this.renderButton({
|
||||||
onPress: this.createGroupChat,
|
onPress: this.createGroupChat,
|
||||||
title: I18n.t('Create_Direct_Messages'),
|
title: I18n.t('Create_Direct_Messages'),
|
||||||
|
|
Loading…
Reference in New Issue