@plusscommunities/pluss-newsletter-app-menu 1.2.22 → 1.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-newsletter-app-menu",
3
- "version": "1.2.22",
3
+ "version": "1.2.26",
4
4
  "description": "Extension package to enable newsletter on Pluss Communities Platform",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -17,7 +17,7 @@
17
17
  "author": "Phillip Suh",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "@plusscommunities/pluss-core-app": "^1.1.5",
20
+ "@plusscommunities/pluss-core-app": "1.2.4",
21
21
  "axios": "^0.16.2",
22
22
  "lodash": "^4.17.4",
23
23
  "moment": "^2.18.1",
@@ -41,5 +41,6 @@ export const FormattedText = Components.FormattedText;
41
41
  export const Reactions = Components.Reactions;
42
42
  export const CommentReply = Components.CommentReply;
43
43
  export const CommentSection = Components.CommentSection;
44
+ export const MediaPlayer = Components.MediaPlayer;
44
45
 
45
46
  // TODO: Add core components as required
@@ -807,9 +807,7 @@ class NewNewsletter extends Component {
807
807
  const { showFullscreenVideo, currentVideoUrl } = this.state;
808
808
  if (!currentVideoUrl) return;
809
809
 
810
- return (
811
- <VideoPopup uri={currentVideoUrl} visible={showFullscreenVideo} showFullscreenButton={false} onClose={this.toggleFullscreenVideo} />
812
- );
810
+ return <VideoPopup uri={currentVideoUrl} visible={showFullscreenVideo} onClose={this.toggleFullscreenVideo} />;
813
811
  }
814
812
 
815
813
  renderButtons() {
@@ -15,13 +15,10 @@ const SCREEN_HEIGHT = Dimensions.get('window').height;
15
15
  class NewsletterEntryPreview extends Component {
16
16
  constructor(props) {
17
17
  super(props);
18
- this.state = {
19
- playVideo: false,
20
- };
18
+ this.state = {};
21
19
  }
22
20
 
23
21
  onPress() {
24
- this.setState({ playVideo: false });
25
22
  NavigationService.navigate(values.screenNewsletterPost, { update: this.props.update });
26
23
  }
27
24
 
@@ -99,7 +96,6 @@ class NewsletterEntryPreview extends Component {
99
96
  {hasImage && (
100
97
  <NewsletterImage
101
98
  news={this.props.update}
102
- playVideo={this.state.playVideo}
103
99
  autoScaleHeight
104
100
  width={SCREEN_WIDTH - 32}
105
101
  style={{
@@ -127,7 +123,7 @@ class NewsletterEntryPreview extends Component {
127
123
  }
128
124
  return (
129
125
  <View style={[styles.container, getShadowStyle(), this.props.containerStyle]}>
130
- <NewsletterImage news={this.props.update} playVideo={this.state.playVideo} />
126
+ <NewsletterImage news={this.props.update} />
131
127
  <View style={styles.rightContent}>
132
128
  <Text style={styles.title} numberOfLines={2}>
133
129
  {this.props.update.Title}
@@ -1,6 +1,4 @@
1
1
  import React, { PureComponent } from 'react';
2
- import { Video } from 'expo-av';
3
- import VideoPlayer from 'expo-video-player';
4
2
  import { View, ImageBackground } from 'react-native';
5
3
  import { LinearGradient } from 'expo-linear-gradient';
6
4
  import { connect } from 'react-redux';
@@ -77,26 +75,6 @@ class NewsletterImage extends PureComponent {
77
75
  </LinearGradient>
78
76
  );
79
77
  }
80
- if (this.props.playVideo) {
81
- return (
82
- <View
83
- style={{
84
- marginBottom: 5,
85
- }}
86
- >
87
- <VideoPlayer
88
- videoProps={{
89
- shouldPlay: true,
90
- resizeMode: Video.RESIZE_MODE_CONTAIN,
91
- source: {
92
- uri: this.props.news.Video,
93
- },
94
- }}
95
- inFullscreen
96
- />
97
- </View>
98
- );
99
- }
100
78
  const videoContent = !this.props.disableOverlays && !_.isEmpty(this.props.news.Video) && (
101
79
  <Icon
102
80
  name="play"
@@ -1,20 +1,16 @@
1
1
  import React, { Component } from 'react';
2
2
  import { AppState, View, Text, TouchableOpacity, Image, ImageBackground } from 'react-native';
3
- import WebView from 'react-native-webview';
4
3
  import { connect } from 'react-redux';
5
4
  import { Icon } from 'react-native-elements';
6
5
  import _ from 'lodash';
7
- import { Video } from 'expo-av';
8
- import VideoPlayer from 'expo-video-player';
9
- import { ImagePopup, VideoPopup, PositionedImage } from '../common';
10
- import { isYoutube, getYoutubeEmbed, getMainBrandingColourFromState, getThumb300, isVideo, get1400 } from '../../js';
6
+ import { ImagePopup, VideoPopup, PositionedImage, MediaPlayer } from '../common';
7
+ import { getMainBrandingColourFromState, getThumb300, isVideo, get1400 } from '../../js';
11
8
 
12
9
  class NewsletterImageSet extends Component {
13
10
  constructor(props) {
14
11
  super(props);
15
12
 
16
13
  this.state = {
17
- showVideo: false,
18
14
  galleryOpen: false,
19
15
  appBackgroundState: '',
20
16
  showFullscreenVideo: false,
@@ -34,25 +30,6 @@ class NewsletterImageSet extends Component {
34
30
  this.setState({ appBackgroundState: nextAppState });
35
31
  };
36
32
 
37
- openVideoPlayer() {
38
- if (!isYoutube(this.props.news.Video) && this.refs.videoRef) {
39
- this.refs.videoRef
40
- .presentFullscreenPlayer()
41
- .then(res => {
42
- //playing
43
- })
44
- .catch(err => {
45
- this.setState({ showVideo: true });
46
- });
47
- } else {
48
- this.setState({ showVideo: true });
49
- }
50
- }
51
-
52
- closeVideo() {
53
- this.setState({ showVideo: false });
54
- }
55
-
56
33
  openGallery(index) {
57
34
  this.setState({
58
35
  galleryOpen: true,
@@ -86,9 +63,7 @@ class NewsletterImageSet extends Component {
86
63
  const { showFullscreenVideo, currentVideoUrl } = this.state;
87
64
  if (!currentVideoUrl) return;
88
65
 
89
- return (
90
- <VideoPopup uri={currentVideoUrl} visible={showFullscreenVideo} showFullscreenButton={false} onClose={this.toggleFullscreenVideo} />
91
- );
66
+ return <VideoPopup uri={currentVideoUrl} visible={showFullscreenVideo} onClose={this.toggleFullscreenVideo} />;
92
67
  }
93
68
 
94
69
  renderPlayableImage(index, containerStyle, applyImageOffset) {
@@ -208,40 +183,6 @@ class NewsletterImageSet extends Component {
208
183
  if (_.isEmpty(news.Image) && _.isEmpty(news.Video)) {
209
184
  return null;
210
185
  }
211
- // CHECK IF YOUTUBE URL
212
- if (this.state.showVideo && this.state.appBackgroundState !== 'background' && isYoutube(news.Video)) {
213
- return (
214
- <View style={[styles.webViewContainer, { width: width, height: width / 2 }]}>
215
- <WebView
216
- startInLoadingState
217
- javaScriptEnabled
218
- scrollEnabled={false}
219
- startInLoadingState
220
- automaticallyAdjustContentInsets={false}
221
- mediaPlaybackRequiresUserAction={true}
222
- style={{ backgroundColor: '#000' }}
223
- source={{ uri: getYoutubeEmbed(news.Video) }}
224
- />
225
- </View>
226
- );
227
- }
228
- if (this.state.showVideo) {
229
- return (
230
- <View>
231
- <VideoPlayer
232
- videoProps={{
233
- shouldPlay: true,
234
- resizeMode: Video.RESIZE_MODE_CONTAIN,
235
- source: { uri: news.Video },
236
- }}
237
- inFullscreen={true}
238
- height={width / 2}
239
- switchToLandscape={this.toggleFullscreenVideo.bind(this, news.Video)}
240
- switchToPortrait={this.toggleFullscreenVideo}
241
- />
242
- </View>
243
- );
244
- }
245
186
  if (!_.isEmpty(news.Images) && news.Images.length === 2) {
246
187
  const sideBySideImageContainerStyle = {
247
188
  flex: 1,
@@ -260,14 +201,15 @@ class NewsletterImageSet extends Component {
260
201
  }
261
202
  if (!_.isEmpty(news.Video)) {
262
203
  return (
263
- <ImageBackground style={[styles.image, { height: width / 2 }]} source={{ uri: news.Image }}>
264
- <View style={styles.videoThumbContainer}>
265
- <TouchableOpacity onPress={this.openVideoPlayer.bind(this)}>
266
- <Icon name="play" style={styles.playIconContainer} type="font-awesome" iconStyle={styles.playIcon} />
267
- </TouchableOpacity>
268
- </View>
269
- {!isYoutube(news.Video) && <Video ref="videoRef" source={{ uri: news.Video }} />}
270
- </ImageBackground>
204
+ <View style={[styles.image, { height: width / 2, marginBottom: 12 }]}>
205
+ <MediaPlayer
206
+ source={news.Video}
207
+ autoPlay={false}
208
+ orientationChanged={isFullScreen => {
209
+ if (this.props.orientationChanged) this.props.orientationChanged(isFullScreen);
210
+ }}
211
+ />
212
+ </View>
271
213
  );
272
214
  }
273
215
  return _.isEmpty(news.Images) ? null : <View style={{ height: width / 2 }}>{this.renderPlayableImage(0, null, true)}</View>;
@@ -285,13 +227,6 @@ class NewsletterImageSet extends Component {
285
227
  }
286
228
 
287
229
  const styles = {
288
- webViewContainer: {
289
- padding: 0,
290
- margin: 0,
291
- backgroundColor: 'black',
292
- justifyContent: 'center',
293
- alignContent: 'center',
294
- },
295
230
  image: {
296
231
  height: 185,
297
232
  width: 'auto',
@@ -299,29 +234,6 @@ const styles = {
299
234
  mainImageRoll: {
300
235
  marginBottom: 0,
301
236
  },
302
- playIconContainer: {
303
- height: 60,
304
- width: 60,
305
- alignItems: 'center',
306
- justifyContent: 'center',
307
- borderRadius: 30,
308
- backgroundColor: '#000',
309
- },
310
- playIcon: {
311
- fontSize: 35,
312
- width: 37,
313
- paddingLeft: 7,
314
- backgroundColor: 'transparent',
315
- color: '#fff',
316
- alignSelf: 'center',
317
- },
318
- videoThumbContainer: {
319
- flex: 1,
320
- backgroundColor: 'rgba(0,0,0,0.1)',
321
- borderRadius: 5,
322
- justifyContent: 'center',
323
- alignItems: 'center',
324
- },
325
237
  imageRoll: {
326
238
  flexDirection: 'row',
327
239
  marginTop: 8,
@@ -63,9 +63,9 @@ class NewsletterPost extends Component {
63
63
  loadingUpdate: !this.props.update,
64
64
  fontScaleOpen: false,
65
65
  taggedOpen: false,
66
-
67
66
  selectedPDF: null,
68
67
  selectedPDFIndex: null,
68
+ isFullScreen: false,
69
69
  };
70
70
  this.imageSetRef = null;
71
71
  }
@@ -435,6 +435,8 @@ class NewsletterPost extends Component {
435
435
  }
436
436
 
437
437
  render() {
438
+ const { isFullScreen } = this.state;
439
+
438
440
  if (this.state.loadingUpdate) {
439
441
  return (
440
442
  <View style={styles.page}>
@@ -452,7 +454,7 @@ class NewsletterPost extends Component {
452
454
 
453
455
  return (
454
456
  <KeyboardAvoidingView behavior={Platform.OS === 'ios' && 'padding'} style={styles.page}>
455
- {this.renderHeader()}
457
+ {!isFullScreen && this.renderHeader()}
456
458
  <FontScalePopup
457
459
  style={styles.fontScalePopup}
458
460
  onPressSmall={this.changeFontSize.bind(this, -2)}
@@ -468,44 +470,53 @@ class NewsletterPost extends Component {
468
470
  }}
469
471
  >
470
472
  <View style={{ minHeight: SCREEN_HEIGHT - StatusBarHeight(HEADER_HEIGHT) - 56 }}>
471
- <View style={styles.topContainer}>
472
- <Text style={[styles.title, { fontSize: this.getAdjustedSize(24), lineHeight: this.getAdjustedSize(32) }]}>
473
- {this.state.update.Title}
474
- </Text>
475
- {this.renderAuthorTime()}
476
- </View>
473
+ {!isFullScreen && (
474
+ <View style={styles.topContainer}>
475
+ <Text style={[styles.title, { fontSize: this.getAdjustedSize(24), lineHeight: this.getAdjustedSize(32) }]}>
476
+ {this.state.update.Title}
477
+ </Text>
478
+ {this.renderAuthorTime()}
479
+ </View>
480
+ )}
477
481
  <NewsletterImageSet
478
482
  ref={ref => {
479
483
  this.imageSetRef = ref;
480
484
  }}
481
485
  news={this.state.update}
482
486
  width={SCREEN_WIDTH}
487
+ orientationChanged={isFullScreen => this.setState({ isFullScreen })}
483
488
  />
484
- {this.renderSponsor()}
485
- {this.renderTaggedUsers()}
486
- <View style={styles.bottomContainer}>
487
- <FormattedText style={[styles.text, { fontSize: this.getAdjustedSize(14), lineHeight: this.getAdjustedSize(24) }]}>
488
- {this.state.update.Text}
489
- </FormattedText>
490
- {this.renderLinks()}
491
- {this.renderAttachments()}
492
- {this.state.update.Type !== 'WelcomePage' && (
493
- <Reactions
494
- style={{ marginTop: 16 }}
495
- entity={this.state.update}
496
- entityType={values.featureKey}
497
- entityId={this.state.update ? this.state.update.RowId : `${getSite(this.props.user.site)}_${this.props.id}`}
498
- anyHighlighted={this.hasReacted()}
499
- user={this.props.user}
500
- site={this.state.update ? this.state.update.Site : getSite(this.props.user.site)}
501
- onUpdateReactions={this.refreshUpdate.bind(this)}
502
- />
503
- )}
504
- </View>
505
- {this.renderComments()}
489
+ {!isFullScreen && (
490
+ <View>
491
+ {this.renderSponsor()}
492
+ {this.renderTaggedUsers()}
493
+ <View style={styles.bottomContainer}>
494
+ <FormattedText style={[styles.text, { fontSize: this.getAdjustedSize(14), lineHeight: this.getAdjustedSize(24) }]}>
495
+ {this.state.update.Text}
496
+ </FormattedText>
497
+ {this.renderLinks()}
498
+ {this.renderAttachments()}
499
+ {this.state.update.Type !== 'WelcomePage' && (
500
+ <Reactions
501
+ style={{ marginTop: 16 }}
502
+ entity={this.state.update}
503
+ entityType={values.featureKey}
504
+ entityId={this.state.update ? this.state.update.RowId : `${getSite(this.props.user.site)}_${this.props.id}`}
505
+ anyHighlighted={this.hasReacted()}
506
+ user={this.props.user}
507
+ site={this.state.update ? this.state.update.Site : getSite(this.props.user.site)}
508
+ onUpdateReactions={this.refreshUpdate.bind(this)}
509
+ />
510
+ )}
511
+ </View>
512
+ {this.renderComments()}
513
+ </View>
514
+ )}
515
+ </View>
516
+ <View>
517
+ {this.renderCommentReply()}
518
+ {this.renderPDF()}
506
519
  </View>
507
- {this.renderCommentReply()}
508
- {this.renderPDF()}
509
520
  </ScrollView>
510
521
  </KeyboardAvoidingView>
511
522
  );
@@ -7,7 +7,7 @@ import { newsActions } from './webapi';
7
7
  import { getSite } from './js';
8
8
 
9
9
  const values = {
10
- featureKey: 'coachings',
10
+ featureKey: 'coaching',
11
11
  reducerKey: 'newsCoaching',
12
12
  serviceKey: 'newsletterCoaching',
13
13
  updateKey: 'newsCoaching',