Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
(feat) move channels buttons to a new line
· 0da9fcc2
Martin Santangelo
authored
Sep 16, 2019
0da9fcc2
(feat) use new v2 api for wires
· 4864f25f
Martin Santangelo
authored
Sep 16, 2019
4864f25f
Hide whitespace changes
Inline
Side-by-side
locales/en.json
View file @
4864f25f
...
...
@@ -189,7 +189,7 @@
"saveChanges"
:
"Save your changes"
,
"editChannel"
:
"Edit your channel settings"
,
"sendMessage"
:
"Send a message to this channel"
,
"message"
:
"M
ESSAGE
"
,
"message"
:
"M
essage
"
,
"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?"
,
...
...
src/channel/ChannelActions.js
View file @
4864f25f
...
...
@@ -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
:
{
...
...
src/channel/ChannelScreen.js
View file @
4864f25f
...
...
@@ -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
:
1
0
,
fontSize
:
1
4
,
color
:
'
#999
'
},
name
:
{
fontWeight
:
'
700
'
,
fontFamily
:
'
Roboto
'
,
fontSize
:
2
0
,
fontSize
:
2
2
,
letterSpacing
:
0.5
,
marginRight
:
8
,
color
:
'
#444
'
,
...
...
src/channel/header/ChannelHeader.js
View file @
4864f25f
...
...
@@ -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
...
...
src/styles/Common.js
View file @
4864f25f
...
...
@@ -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
...
...
src/wire/WireService.js
View file @
4864f25f
...
...
@@ -74,7 +74,7 @@ class WireService {
return
;
}
return
await
api
.
post
(
`api/v
1
/wire/
${
opts
.
guid
}
`
,
{
return
await
api
.
post
(
`api/v
2
/wire/
${
opts
.
guid
}
`
,
{
payload
,
method
:
payload
.
method
,
amount
:
opts
.
amount
,
...
...