@plusscommunities/pluss-newsletter-app-menu 1.2.21 → 1.2.25

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.21",
3
+ "version": "1.2.25",
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.3",
20
+ "@plusscommunities/pluss-core-app": "^1.2.3",
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,
@@ -44,6 +44,7 @@ import {
44
44
  getValidUrl,
45
45
  HEADER_HEIGHT,
46
46
  allowComments,
47
+ isVideoUrl,
47
48
  } from '../../js';
48
49
  import { newsActions, analyticsActions } from '../../webapi';
49
50
  import { softUpdateUser } from '../../actions';
@@ -62,9 +63,9 @@ class NewsletterPost extends Component {
62
63
  loadingUpdate: !this.props.update,
63
64
  fontScaleOpen: false,
64
65
  taggedOpen: false,
65
-
66
66
  selectedPDF: null,
67
67
  selectedPDFIndex: null,
68
+ isFullScreen: false,
68
69
  };
69
70
  this.imageSetRef = null;
70
71
  }
@@ -318,7 +319,11 @@ class NewsletterPost extends Component {
318
319
  },
319
320
  ]}
320
321
  >
321
- <Text style={styles.attachmentLogoText}>Web</Text>
322
+ {isVideoUrl(link.Url) ? (
323
+ <Icon name="video-camera" type="font-awesome" iconStyle={[styles.attachmentLogoText, styles.attachmentLogoIcon]} />
324
+ ) : (
325
+ <Text style={styles.attachmentLogoText}>Web</Text>
326
+ )}
322
327
  </View>
323
328
  <View style={styles.attachmentFill}>
324
329
  <Text style={styles.attachmentTitle}>{link.Text}</Text>
@@ -391,6 +396,7 @@ class NewsletterPost extends Component {
391
396
  scrollView={this.scrollView}
392
397
  entityType="news"
393
398
  entityId={this.state.update.RowId}
399
+ entityName={this.state.update.Title}
394
400
  site={this.state.update.Site}
395
401
  />
396
402
  );
@@ -429,6 +435,8 @@ class NewsletterPost extends Component {
429
435
  }
430
436
 
431
437
  render() {
438
+ const { isFullScreen } = this.state;
439
+
432
440
  if (this.state.loadingUpdate) {
433
441
  return (
434
442
  <View style={styles.page}>
@@ -446,7 +454,7 @@ class NewsletterPost extends Component {
446
454
 
447
455
  return (
448
456
  <KeyboardAvoidingView behavior={Platform.OS === 'ios' && 'padding'} style={styles.page}>
449
- {this.renderHeader()}
457
+ {!isFullScreen && this.renderHeader()}
450
458
  <FontScalePopup
451
459
  style={styles.fontScalePopup}
452
460
  onPressSmall={this.changeFontSize.bind(this, -2)}
@@ -462,44 +470,53 @@ class NewsletterPost extends Component {
462
470
  }}
463
471
  >
464
472
  <View style={{ minHeight: SCREEN_HEIGHT - StatusBarHeight(HEADER_HEIGHT) - 56 }}>
465
- <View style={styles.topContainer}>
466
- <Text style={[styles.title, { fontSize: this.getAdjustedSize(24), lineHeight: this.getAdjustedSize(32) }]}>
467
- {this.state.update.Title}
468
- </Text>
469
- {this.renderAuthorTime()}
470
- </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
+ )}
471
481
  <NewsletterImageSet
472
482
  ref={ref => {
473
483
  this.imageSetRef = ref;
474
484
  }}
475
485
  news={this.state.update}
476
486
  width={SCREEN_WIDTH}
487
+ orientationChanged={isFullScreen => this.setState({ isFullScreen })}
477
488
  />
478
- {this.renderSponsor()}
479
- {this.renderTaggedUsers()}
480
- <View style={styles.bottomContainer}>
481
- <FormattedText style={[styles.text, { fontSize: this.getAdjustedSize(14), lineHeight: this.getAdjustedSize(24) }]}>
482
- {this.state.update.Text}
483
- </FormattedText>
484
- {this.renderLinks()}
485
- {this.renderAttachments()}
486
- {this.state.update.Type !== 'WelcomePage' && (
487
- <Reactions
488
- style={{ marginTop: 16 }}
489
- entity={this.state.update}
490
- entityType={values.featureKey}
491
- entityId={this.state.update ? this.state.update.RowId : `${getSite(this.props.user.site)}_${this.props.id}`}
492
- anyHighlighted={this.hasReacted()}
493
- user={this.props.user}
494
- site={this.state.update ? this.state.update.Site : getSite(this.props.user.site)}
495
- onUpdateReactions={this.refreshUpdate.bind(this)}
496
- />
497
- )}
498
- </View>
499
- {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()}
500
519
  </View>
501
- {this.renderCommentReply()}
502
- {this.renderPDF()}
503
520
  </ScrollView>
504
521
  </KeyboardAvoidingView>
505
522
  );
@@ -541,6 +558,9 @@ const styles = {
541
558
  fontFamily: 'sf-bold',
542
559
  fontSize: 10,
543
560
  },
561
+ attachmentLogoIcon: {
562
+ fontSize: 18,
563
+ },
544
564
  attachmentFill: {
545
565
  flex: 1,
546
566
  justifyContent: 'center',
@@ -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',
@@ -7,28 +7,28 @@ import { newsActions } from './webapi';
7
7
  import { getSite } from './js';
8
8
 
9
9
  const values = {
10
- featureKey: 'personaldevelopmenthub',
11
- reducerKey: 'newsPersonalDevelopmentHub',
12
- serviceKey: 'newsletterPersonalDevelopmentHub',
13
- updateKey: 'newsPersonalDevelopmentHub',
14
- analyticsKey: 'newsPersonalDevelopmentHub',
15
- actionNewsLoaded: 'NEWS_LOADEDPersonalDevelopmentHub',
16
- actionNewsAdded: 'NEWS_ADDEDPersonalDevelopmentHub',
17
- actionLoadNewsSubmissions: 'load_NEWSSUBMISSIONSPersonalDevelopmentHub',
18
- actionRemoveNewsSubmission: 'REMOVE_NEWSSUBMISSIONPersonalDevelopmentHub',
19
- notificationApproveNewsSubmission: 'ApproveNewsSubmissionPersonalDevelopmentHub',
20
- notificationNewsletterPublished: 'NewsletterPublishedPersonalDevelopmentHub',
21
- screenNewsletterPost: 'newsletterPostPersonalDevelopmentHub',
22
- screenNewsletter: 'newsletterPersonalDevelopmentHub',
23
- screenNewsSubmission: 'newsSubmissionPersonalDevelopmentHub',
24
- screenNewNewsletter: 'newNewsletterPersonalDevelopmentHub',
25
- permissionNewsletter: 'newsletterPersonalDevelopmentHub',
26
- accessPostingPermitted: 'postingPermittedPersonalDevelopmentHub',
27
- accessReviewRequired: 'reviewRequiredPersonalDevelopmentHub',
28
- optionForceNewsAuthorName: 'forceNewsAuthorNamePersonalDevelopmentHub',
29
- optionNewsComments: 'newsCommentsPersonalDevelopmentHub',
30
- optionNewsNotifications: 'newsNotificationsPersonalDevelopmentHub',
31
- optionUseLargeNews: 'useLargeNewsPersonalDevelopmentHub',
10
+ featureKey: 'personalDevHub',
11
+ reducerKey: 'newsPersonalDev',
12
+ serviceKey: 'newsletterPersonalDev',
13
+ updateKey: 'newsPersonalDev',
14
+ analyticsKey: 'newsPersonalDev',
15
+ actionNewsLoaded: 'NEWS_LOADEDPersonalDev',
16
+ actionNewsAdded: 'NEWS_ADDEDPersonalDev',
17
+ actionLoadNewsSubmissions: 'load_NEWSSUBMISSIONSPersonalDev',
18
+ actionRemoveNewsSubmission: 'REMOVE_NEWSSUBMISSIONPersonalDev',
19
+ notificationApproveNewsSubmission: 'ApproveNewsSubmissionPersonalDev',
20
+ notificationNewsletterPublished: 'NewsletterPublishedPersonalDev',
21
+ screenNewsletterPost: 'newsletterPostPersonalDev',
22
+ screenNewsletter: 'newsletterPersonalDev',
23
+ screenNewsSubmission: 'newsSubmissionPersonalDev',
24
+ screenNewNewsletter: 'newNewsletterPersonalDev',
25
+ permissionNewsletter: 'newsletterPersonalDev',
26
+ accessPostingPermitted: 'postingPermittedPersonalDev',
27
+ accessReviewRequired: 'reviewRequiredPersonalDev',
28
+ optionForceNewsAuthorName: 'forceNewsAuthorNamePersonalDev',
29
+ optionNewsComments: 'newsCommentsPersonalDev',
30
+ optionNewsNotifications: 'newsNotificationsPersonalDev',
31
+ optionUseLargeNews: 'useLargeNewsPersonalDev',
32
32
  iconGridMenu: 'tab_hub4',
33
33
  iconAddMenu: 'tab_hub4',
34
34
  orderAddMenu: 2.7,
package/src/js/index.js CHANGED
@@ -23,6 +23,7 @@ export const getYoutubeEmbed = Helper.getYoutubeEmbed;
23
23
  export const getThumb300 = Helper.getThumb300;
24
24
  export const get1400 = Helper.get1400;
25
25
  export const isVideo = Helper.isVideo;
26
+ export const isVideoUrl = Helper.isVideoUrl;
26
27
  export const imageExists = Helper.imageExists;
27
28
  export const hasReacted = Helper.hasReacted;
28
29
  export const getPluralOptions = Helper.getPluralOptions;