Skip to content
Commits on Source (2)
......@@ -189,7 +189,7 @@
"saveChanges":"Save your changes",
"editChannel":"Edit your channel settings",
"sendMessage":"Send a message to this channel",
"message":"MESSAGE",
"message":"Message",
"mature":"This channel contains mature content",
"confirmUnsubscribe":"Are you sure you want to unsubscribe from this channel?",
"subscribe":"Subscribe",
......@@ -723,6 +723,7 @@
"hide":"Hide",
"ops":"Oops",
"pin":"Pin",
"more":"More",
"unpin":"Unpin",
"downloadGallery":"Download to gallery",
"wantToDownloadImage":"Do you want to download this image?",
......
......@@ -7,7 +7,6 @@ import {
Image,
View,
ActivityIndicator,
Button,
StyleSheet
} from 'react-native';
......@@ -22,7 +21,12 @@ import i18n from '../common/services/i18n.service';
import ActionSheet from 'react-native-actionsheet';
import WireAction from '../newsfeed/activity/actions/WireAction';
import featuresService from '../common/services/features.service';
import sessionService from '../common/services/session.service';
import Button from '../common/components/Button';
import withPreventDoubleTap from '../common/components/PreventDoubleTap';
import { CommonStyle as CS } from '../styles/Common';
const ButtonCustom = withPreventDoubleTap(Button);
/**
* Channel Actions
*/
......@@ -39,7 +43,7 @@ export default class ChannelActions extends Component {
this.handleSelection = this.handleSelection.bind(this);
}
showActionSheet() {
showActionSheet = () => {
this.ActionSheet.show();
}
......@@ -85,6 +89,68 @@ export default class ChannelActions extends Component {
}
}
toggleSubscription = () => {
this.props.store.channel.toggleSubscription();
}
/**
* Navigate To conversation
*/
navToConversation = () => {
if (this.props.navigation) {
this.props.navigation.push('Conversation', { conversation: { guid : this.props.store.channel.guid + ':' + sessionService.guid } });
}
}
openWire = () => {
this.props.navigation.navigate('WireFab', { owner: this.props.store.channel});
}
onEditAction = () => {
this.props.onEditAction();
}
/**
* Get Action Button, Message or Subscribe
*/
getActionButton() {
if (!this.props.store.loaded && sessionService.guid !== this.props.store.channel.guid )
return null;
if (sessionService.guid === this.props.store.channel.guid) {
return (
<ButtonCustom
onPress={this.onEditAction}
containerStyle={[CS.rowJustifyCenter, CS.marginLeft0x]}
accessibilityLabel={this.props.editing ? i18n.t('channel.saveChanges') : i18n.t('channel.editChannel')}
text={this.props.editing ? i18n.t('save').toUpperCase() : i18n.t('edit').toUpperCase()}
loading={this.props.saving}
/>
);
} else if (!!this.props.store.channel.subscribed) {
return (
<ButtonCustom
onPress={ this.navToConversation }
containerStyle={[CS.rowJustifyCenter, CS.marginLeft0x]}
accessibilityLabel={i18n.t('channel.sendMessage')}
text={i18n.t('channel.message')}
/>
);
} else if (sessionService.guid !== this.props.store.channel.guid) {
return (
<ButtonCustom
onPress={this.toggleSubscription}
containerStyle={[CS.rowJustifyCenter, CS.marginLeft0x]}
accessibilityLabel={i18n.t('channel.subscribeMessage')}
text={i18n.t('channel.subscribe').toUpperCase()}
/>
);
} else if (this.props.store.isUploading) {
return (
<ActivityIndicator size="small" />
)
}
}
/**
* Render Header
*/
......@@ -94,9 +160,30 @@ export default class ChannelActions extends Component {
const showWire = !channel.blocked && !channel.isOwner() && featuresService.has('crypto');
return (
<View style={styles.wrapper}>
{!!showWire && <WireAction owner={this.props.store.channel} navigation={this.props.navigation}/>}
<Icon name="md-settings" style={ styles.icon } onPress={() => this.showActionSheet()} size={24} />
<View style={[CS.rowJustifyEnd, CS.marginTop2x]}>
{this.getActionButton()}
{!!showWire &&
<ButtonCustom
onPress={ this.openWire }
accessibilityLabel="Wire Button"
containerStyle={[CS.rowJustifyCenter]}
textStyle={[CS.marginLeft, CS.marginRight]}
icon="ios-flash"
text="Wire"
>
<Icon name='ios-flash' size={18} style={[CS.marginLeft, CS.colorPrimary]} />
</ButtonCustom>
}
{!channel.isOwner() &&
<ButtonCustom
onPress={ this.showActionSheet }
accessibilityLabel={i18n.t('more')}
containerStyle={[CS.rowJustifyCenter]}
textStyle={[CS.marginLeft, CS.marginRight]}
icon="ios-flash"
text={i18n.t('more')}
/>
}
<ActionSheet
ref={o => this.ActionSheet = o}
title={title}
......@@ -116,7 +203,6 @@ const styles = StyleSheet.create({
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'flex-end',
width: featuresService.has('crypto') ? 60 : 40,
height: 40,
},
icon: {
......
......@@ -310,9 +310,9 @@ const styles = StyleSheet.create({
buttonscol: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'flex-end',
justifyContent: 'flex-start',
//width: 150,
alignSelf:'flex-end'
alignSelf:'flex-start'
},
carouselcontainer: {
flex: 1,
......@@ -331,13 +331,13 @@ const styles = StyleSheet.create({
flexDirection: 'row',
},
username: {
fontSize: 10,
fontSize: 14,
color: '#999'
},
name: {
fontWeight: '700',
fontFamily: 'Roboto',
fontSize: 20,
fontSize: 22,
letterSpacing: 0.5,
marginRight: 8,
color: '#444',
......
......@@ -40,7 +40,6 @@ import CompleteProfile from './CompleteProfile';
// prevent accidental double tap in touchables
const TouchableHighlightCustom = withPreventDoubleTap(TouchableHighlight);
const TouchableCustom = withPreventDoubleTap(Touchable);
const ButtonCustom = withPreventDoubleTap(Button);
/**
* Channel Header
......@@ -88,15 +87,6 @@ export default class ChannelHeader extends Component {
return this.props.store.channel.getAvatarSource('large');
}
/**
* Navigate To conversation
*/
_navToConversation() {
if (this.props.navigation) {
this.props.navigation.push('Conversation', { conversation: { guid : this.props.store.channel.guid + ':' + session.guid } });
}
}
_navToSubscribers() {
if (this.props.navigation) {
this.props.navigation.push('Subscribers', { guid : this.props.store.channel.guid });
......@@ -149,51 +139,6 @@ export default class ChannelHeader extends Component {
}
}
/**
* Get Action Button, Message or Subscribe
*/
getActionButton() {
const styles = this.props.styles;
if (!this.props.store.loaded && session.guid !== this.props.store.channel.guid )
return null;
if (session.guid === this.props.store.channel.guid) {
return (
<ButtonCustom
onPress={this.onEditAction}
accessibilityLabel={this.state.edit ? i18n.t('channel.saveChanges') : i18n.t('channel.editChannel')}
text={this.state.edit ? i18n.t('save').toUpperCase() : i18n.t('edit').toUpperCase()}
loading={this.state.saving}
/>
);
} else if (!!this.props.store.channel.subscribed) {
return (
<TouchableHighlightCustom
onPress={() => { this._navToConversation() }}
underlayColor='transparent'
style={[ComponentsStyle.button, ComponentsStyle.buttonAction, styles.bluebutton]}
accessibilityLabel={i18n.t('channel.sendMessage')}
>
<Text style={{ color: colors.primary }} > {i18n.t('channel.message')} </Text>
</TouchableHighlightCustom>
);
} else if (session.guid !== this.props.store.channel.guid) {
return (
<TouchableHighlightCustom
onPress={() => { this.subscribe() }}
underlayColor='transparent'
style={[ComponentsStyle.button, ComponentsStyle.buttonAction, styles.bluebutton]}
accessibilityLabel={i18n.t('channel.subscribeMessage')}
>
<Text style={{ color: colors.primary }} > {i18n.t('channel.subscribe').toUpperCase()} </Text>
</TouchableHighlightCustom>
);
} else if (this.props.store.isUploading) {
return (
<ActivityIndicator size="small" />
)
}
}
subscribe() {
this.props.store.channel.toggleSubscription();
}
......@@ -297,12 +242,15 @@ export default class ChannelHeader extends Component {
</View>}
<Text style={styles.username}>@{channel.username}</Text>
</View>
<View style={styles.buttonscol}>
{ !channel.blocked && this.getActionButton() }
{ session.guid !== channel.guid?
<ChannelActions navigation={this.props.navigation} store={this.props.store} me={session}></ChannelActions> : <View></View>
}
</View>
</View>
<View style={styles.buttonscol}>
<ChannelActions
navigation={this.props.navigation}
store={this.props.store}
onEditAction={this.onEditAction}
editing={this.state.edit}
saving={this.state.saving}
/>
</View>
{isEditable && <View style={styles.briefdescriptionTextInputView}>
<TextInput
......
......@@ -240,6 +240,20 @@ export const CommonStyle = StyleSheet.create({
marginBottom: {
marginBottom: 5
},
marginTop0x: {
marginTop: 0
},
marginLeft0x: {
marginLeft: 0
},
marginRight0x: {
marginRight: 0
},
marginBottom0x: {
marginBottom: 0
},
// padding
padding4x: {
padding: 20
......
......@@ -74,7 +74,7 @@ class WireService {
return;
}
return await api.post(`api/v1/wire/${opts.guid}`, {
return await api.post(`api/v2/wire/${opts.guid}`, {
payload,
method: payload.method,
amount: opts.amount,
......