From aba0b860e867254f86ff5a5a330af1a52e142813 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 30 Sep 2019 12:55:30 +0100 Subject: [PATCH 1/3] show the camera after the required permissions have been granted (#48) --- src/page/publish/view.js | 61 ++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/src/page/publish/view.js b/src/page/publish/view.js index fcb6404..1ff1ded 100644 --- a/src/page/publish/view.js +++ b/src/page/publish/view.js @@ -870,6 +870,7 @@ class PublishPage extends React.PureComponent { const { allThumbnailsChecked, canUseCamera, + showCameraOverlay, currentPhase, checkedThumbnails, loadingVideos, @@ -882,7 +883,9 @@ class PublishPage extends React.PureComponent { content = ( - {canUseCamera && } + {canUseCamera && !showCameraOverlay && ( + + )} )} - {this.state.canUseCamera && this.state.showCameraOverlay && ( + {this.state.showCameraOverlay && ( - { - this.camera = ref; - }} - type={this.state.cameraType} - flashMode={RNCamera.Constants.FlashMode.off} - androidCameraPermissionOptions={{ - title: 'Camera', - message: 'Please grant access to make use of your camera', - buttonPositive: 'OK', - buttonNegative: 'Cancel', - }} - androidRecordAudioPermissionOptions={{ - title: 'Audio', - message: 'Please grant access to record audio', - buttonPositive: 'OK', - buttonNegative: 'Cancel', - }} - notAuthorizedView={ - - Camera not authorized - - } - /> + {this.state.canUseCamera && ( + { + this.camera = ref; + }} + type={this.state.cameraType} + flashMode={RNCamera.Constants.FlashMode.off} + androidCameraPermissionOptions={{ + title: __('Camera'), + message: __('Please grant access to make use of your camera'), + buttonPositive: __('OK'), + buttonNegative: __('Cancel'), + }} + androidRecordAudioPermissionOptions={{ + title: __('Audio'), + message: __('Please grant access to record audio'), + buttonPositive: __('OK'), + buttonNegative: __('Cancel'), + }} + notAuthorizedView={ + + Camera not authorized + + } + /> + )} Date: Mon, 30 Sep 2019 17:36:55 +0100 Subject: [PATCH 2/3] fix subscription notifications --- package-lock.json | 4 +-- package.json | 2 +- src/index.js | 2 +- src/page/discover/view.js | 74 +++++++++++++++++++-------------------- 4 files changed, 40 insertions(+), 42 deletions(-) diff --git a/package-lock.json b/package-lock.json index 57c6435..0b63958 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5649,8 +5649,8 @@ } }, "lbryinc": { - "version": "github:lbryio/lbryinc#67bb3e215be3f13605c5e3f9f2b0e2fb880724cf", - "from": "github:lbryio/lbryinc#67bb3e215be3f13605c5e3f9f2b0e2fb880724cf", + "version": "github:lbryio/lbryinc#c55a2c98ab92c72149c824ee5906aed4404fd89b", + "from": "github:lbryio/lbryinc#c55a2c98ab92c72149c824ee5906aed4404fd89b", "requires": { "reselect": "^3.0.0" } diff --git a/package.json b/package.json index 40155f1..4e3f28b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@expo/vector-icons": "^8.1.0", "gfycat-style-urls": "^1.0.3", "lbry-redux": "lbryio/lbry-redux#7ec72a737bcd336f000c5f5085891643110298c3", - "lbryinc": "lbryio/lbryinc#67bb3e215be3f13605c5e3f9f2b0e2fb880724cf", + "lbryinc": "lbryio/lbryinc#c55a2c98ab92c72149c824ee5906aed4404fd89b", "lodash": ">=4.17.11", "merge": ">=1.2.1", "moment": "^2.22.1", diff --git a/src/index.js b/src/index.js index 4013fe2..4b470b0 100644 --- a/src/index.js +++ b/src/index.js @@ -83,7 +83,7 @@ const compressor = createCompressor(); const authFilter = createFilter('auth', ['authToken']); const contentFilter = createFilter('content', ['positions']); const saveClaimsFilter = createFilter('claims', ['claimsByUri']); -const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions']); +const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions', 'latest']); const settingsFilter = createFilter('settings', ['clientSettings']); const tagsFilter = createFilter('tags', ['followedTags']); const walletFilter = createFilter('wallet', ['receiveAddress']); diff --git a/src/page/discover/view.js b/src/page/discover/view.js index efcd203..34794e7 100644 --- a/src/page/discover/view.js +++ b/src/page/discover/view.js @@ -61,11 +61,10 @@ class DiscoverPage extends React.PureComponent { } }); - const { sortByItem, fetchRewardedContent, fetchSubscriptions, fileList, followedTags } = this.props; + const { sortByItem, fetchRewardedContent, fileList, followedTags } = this.props; this.buildTagCollection(followedTags); fetchRewardedContent(); - fetchSubscriptions(); fileList(); this.handleSortByItemSelected(sortByItem); @@ -88,9 +87,11 @@ class DiscoverPage extends React.PureComponent { } onComponentFocused = () => { - const { pushDrawerStack } = this.props; + const { fetchSubscriptions, pushDrawerStack } = this.props; // pushDrawerStack(); - NativeModules.Firebase.setCurrentScreen('Your tags'); + NativeModules.Firebase.setCurrentScreen('Your tags').then(result => { + fetchSubscriptions(); + }); }; handleSortByItemSelected = item => { @@ -127,44 +128,41 @@ class DiscoverPage extends React.PureComponent { const { unreadSubscriptions, enabledChannelNotifications } = this.props; const utility = NativeModules.UtilityModule; - if (utility) { - const hasUnread = - prevProps.unreadSubscriptions && - prevProps.unreadSubscriptions.length !== unreadSubscriptions.length && - unreadSubscriptions.length > 0; + const hasUnread = + prevProps.unreadSubscriptions && + prevProps.unreadSubscriptions.length !== unreadSubscriptions.length && + unreadSubscriptions.length > 0; - if (hasUnread) { - unreadSubscriptions.map(({ channel, uris }) => { - const { claimName: channelName } = parseURI(channel); + if (hasUnread) { + unreadSubscriptions.map(({ channel, uris }) => { + const { claimName: channelName } = parseURI(channel); - // check if notifications are enabled for the channel - if (enabledChannelNotifications.indexOf(channelName) > -1) { - uris.forEach(uri => { - Lbry.resolve({ urls: uri }).then(result => { - const sub = result[uri].claim; - if (sub && sub.value && sub.value.stream) { - let isPlayable = false; - const source = sub.value.stream.source; - const metadata = sub.value.stream.metadata; - if (source) { - isPlayable = - source.contentType && ['audio', 'video'].indexOf(source.contentType.substring(0, 5)) > -1; - } - if (metadata) { - utility.showNotificationForContent( - uri, - metadata.title, - channelName, - metadata.thumbnail, - isPlayable - ); - } + // check if notifications are enabled for the channel + if (enabledChannelNotifications.indexOf(channelName) > -1) { + uris.forEach(uri => { + Lbry.resolve({ urls: uri }).then(result => { + const sub = result[uri]; + + if (sub && sub.value) { + let isPlayable = false; + const { source, title, thumbnail } = sub.value; + if (source) { + isPlayable = source.media_type && ['audio', 'video'].indexOf(source.media_type.substring(0, 5)) > -1; } - }); + if (title) { + utility.showNotificationForContent( + uri, + title, + channelName, + thumbnail ? thumbnail.url : null, + isPlayable + ); + } + } }); - } - }); - } + }); + } + }); } } -- 2.45.2 From fc30e8575c1200f374ec174eefa480b05a2a5b56 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 2 Oct 2019 10:35:03 +0100 Subject: [PATCH 3/3] fixes as per review --- src/page/discover/view.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/page/discover/view.js b/src/page/discover/view.js index 34794e7..96394be 100644 --- a/src/page/discover/view.js +++ b/src/page/discover/view.js @@ -138,17 +138,15 @@ class DiscoverPage extends React.PureComponent { const { claimName: channelName } = parseURI(channel); // check if notifications are enabled for the channel - if (enabledChannelNotifications.indexOf(channelName) > -1) { + if (enabledChannelNotifications.includes(channelName)) { uris.forEach(uri => { Lbry.resolve({ urls: uri }).then(result => { const sub = result[uri]; if (sub && sub.value) { - let isPlayable = false; const { source, title, thumbnail } = sub.value; - if (source) { - isPlayable = source.media_type && ['audio', 'video'].indexOf(source.media_type.substring(0, 5)) > -1; - } + const isPlayable = + source && source.media_type && ['audio', 'video'].includes(source.media_type.substring(0, 5)); if (title) { utility.showNotificationForContent( uri, -- 2.45.2