From e208a9960ff07b7d09babdf3bea93ba1626599b7 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 20 Nov 2019 00:59:05 +0100 Subject: [PATCH 1/2] default sort content on channel view by newest first --- src/page/channel/view.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/page/channel/view.js b/src/page/channel/view.js index 4432c72..905a6a6 100644 --- a/src/page/channel/view.js +++ b/src/page/channel/view.js @@ -36,7 +36,7 @@ class ChannelPage extends React.PureComponent { autoStyle: null, showSortPicker: false, showTimePicker: false, - orderBy: Constants.DEFAULT_ORDER_BY, + orderBy: ['release_time'], // sort by new by default activeTab: Constants.CONTENT_TAB, }; @@ -48,8 +48,9 @@ class ChannelPage extends React.PureComponent { } componentDidMount() { - const { fetchChannelListMine } = this.props; + const { fetchChannelListMine, setSortByItem } = this.props; NativeModules.Firebase.setCurrentScreen('Channel'); + setSortByItem(Constants.CLAIM_SEARCH_SORT_BY_ITEMS[1]); // sort by newest first fetchChannelListMine(); } -- 2.45.2 From fe5462971ed1617edf861a5172be582bccd249b5 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 22 Nov 2019 02:56:16 +0100 Subject: [PATCH 2/2] auto-fetch image and text types --- src/page/file/view.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/page/file/view.js b/src/page/file/view.js index 883c5df..1601585 100644 --- a/src/page/file/view.js +++ b/src/page/file/view.js @@ -61,6 +61,7 @@ class FilePage extends React.PureComponent { constructor(props) { super(props); this.state = { + attemptAutoGet: false, autoPlayMedia: false, autoDownloadStarted: false, downloadButtonShown: false, @@ -189,10 +190,12 @@ class FilePage extends React.PureComponent { const { claim, contentType, + costInfo, fileInfo, isResolvingUri, resolveUri, navigation, + purchaseUri, searchRecommended, title, } = this.props; @@ -214,6 +217,21 @@ class FilePage extends React.PureComponent { uri: this.state.uri, }; } + + // attempt to retrieve images and html/text automatically once the claim is loaded, and it's free + const mediaType = Lbry.getMediaType(contentType); + const isViewable = mediaType === 'image' || mediaType === 'text'; + if (claim && costInfo && costInfo.cost === 0 && !this.state.autoGetAttempted && isViewable) { + this.setState( + { + autoGetAttempted: true, + downloadPressed: true, + autoPlayMedia: true, + stopDownloadConfirmed: false, + }, + () => purchaseUri(claim.permanent_url, costInfo, true) + ); + } } fetchFileInfo(props) { -- 2.45.2