0.5.0 rc (#436)
* fixes for release * fix subscriptions view. change Latest First to Latest Only. * fix channel subscription uri * fix subscription notifications * some iconography and label changes * change sdk log level for release builds * sort all subscriptions by newest first * fix crash with Picasso thumbnail fetch operation * add check for null / undefined filenames after stopping download * update sdk to 0.32.3. fix download notification.
This commit is contained in:
parent
5329154121
commit
8f609fa900
13 changed files with 84 additions and 46 deletions
4
app/package-lock.json
generated
4
app/package-lock.json
generated
|
@ -4060,8 +4060,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lbry-redux": {
|
"lbry-redux": {
|
||||||
"version": "github:lbryio/lbry-redux#42c185e922a7c6091b0e1580bacbfd8e02f45a91",
|
"version": "github:lbryio/lbry-redux#3ab065b11a52d3e2e6a50a25459f9ff0aac03b13",
|
||||||
"from": "github:lbryio/lbry-redux#031sdk-resolve",
|
"from": "github:lbryio/lbry-redux",
|
||||||
"requires": {
|
"requires": {
|
||||||
"proxy-polyfill": "0.1.6",
|
"proxy-polyfill": "0.1.6",
|
||||||
"reselect": "^3.0.0",
|
"reselect": "^3.0.0",
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"base-64": "^0.1.0",
|
"base-64": "^0.1.0",
|
||||||
"@expo/vector-icons": "^8.1.0",
|
"@expo/vector-icons": "^8.1.0",
|
||||||
"lbry-redux": "lbryio/lbry-redux",
|
"lbry-redux": "lbryio/lbry-redux#old-search",
|
||||||
"lbryinc": "lbryio/lbryinc",
|
"lbryinc": "lbryio/lbryinc",
|
||||||
"moment": "^2.22.1",
|
"moment": "^2.22.1",
|
||||||
"react": "16.2.0",
|
"react": "16.2.0",
|
||||||
|
|
|
@ -126,7 +126,7 @@ const mySubscriptionsStack = createStackNavigator({
|
||||||
Subscriptions: {
|
Subscriptions: {
|
||||||
screen: SubscriptionsPage,
|
screen: SubscriptionsPage,
|
||||||
navigationOptions: ({ navigation }) => ({
|
navigationOptions: ({ navigation }) => ({
|
||||||
title: 'My Subscriptions',
|
title: 'Subscriptions',
|
||||||
headerLeft: menuNavigationButton(navigation),
|
headerLeft: menuNavigationButton(navigation),
|
||||||
headerTitleStyle: discoverStyle.titleText
|
headerTitleStyle: discoverStyle.titleText
|
||||||
})
|
})
|
||||||
|
@ -173,13 +173,13 @@ const drawer = createDrawerNavigator({
|
||||||
title: 'Trending', drawerIcon: ({ tintColor }) => <Icon name="fire" size={20} style={{ color: tintColor }} />
|
title: 'Trending', drawerIcon: ({ tintColor }) => <Icon name="fire" size={20} style={{ color: tintColor }} />
|
||||||
}},
|
}},
|
||||||
MySubscriptionsStack: { screen: mySubscriptionsStack, navigationOptions: {
|
MySubscriptionsStack: { screen: mySubscriptionsStack, navigationOptions: {
|
||||||
title: 'My Subscriptions', drawerIcon: ({ tintColor }) => <Icon name="rss-square" size={20} style={{ color: tintColor }} />
|
title: 'Subscriptions', drawerIcon: ({ tintColor }) => <Icon name="heart" solid={true} size={20} style={{ color: tintColor }} />
|
||||||
}},
|
}},
|
||||||
WalletStack: { screen: walletStack, navigationOptions: {
|
WalletStack: { screen: walletStack, navigationOptions: {
|
||||||
title: 'Wallet', drawerIcon: ({ tintColor }) => <Icon name="wallet" size={20} style={{ color: tintColor }} />
|
title: 'Wallet', drawerIcon: ({ tintColor }) => <Icon name="wallet" size={20} style={{ color: tintColor }} />
|
||||||
}},
|
}},
|
||||||
Rewards: { screen: rewardsStack, navigationOptions: {
|
Rewards: { screen: rewardsStack, navigationOptions: {
|
||||||
drawerIcon: ({ tintColor }) => <Icon name="trophy" size={20} style={{ color: tintColor }} />
|
drawerIcon: ({ tintColor }) => <Icon name="award" size={20} style={{ color: tintColor }} />
|
||||||
}},
|
}},
|
||||||
MyLBRYStack: { screen: myLbryStack, navigationOptions: {
|
MyLBRYStack: { screen: myLbryStack, navigationOptions: {
|
||||||
title: 'Downloads', drawerIcon: ({ tintColor }) => <Icon name="folder" size={20} style={{ color: tintColor }} />
|
title: 'Downloads', drawerIcon: ({ tintColor }) => <Icon name="folder" size={20} style={{ color: tintColor }} />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { parseURI } from 'lbry-redux';
|
import { normalizeURI, parseURI } from 'lbry-redux';
|
||||||
import { NativeModules, Text, View, TouchableOpacity } from 'react-native';
|
import { NativeModules, Text, View, TouchableOpacity } from 'react-native';
|
||||||
import Button from '../button';
|
import Button from '../button';
|
||||||
import Colors from '../../styles/colors';
|
import Colors from '../../styles/colors';
|
||||||
|
@ -39,7 +39,7 @@ class SubscribeButton extends React.PureComponent {
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
subscriptionHandler({
|
subscriptionHandler({
|
||||||
channelName: claimName,
|
channelName: claimName,
|
||||||
uri,
|
uri: normalizeURI(uri),
|
||||||
});
|
});
|
||||||
}} />
|
}} />
|
||||||
);
|
);
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
Text,
|
Text,
|
||||||
View
|
View
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { normalizeURI, parseURI } from 'lbry-redux';
|
import { Lbry, normalizeURI, parseURI } from 'lbry-redux';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import Constants from 'constants';
|
import Constants from 'constants';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
|
@ -64,6 +64,7 @@ class DiscoverPage extends React.PureComponent {
|
||||||
if (allSubscriptions) {
|
if (allSubscriptions) {
|
||||||
for (let i = 0; i < allSubscriptions.length; i++) {
|
for (let i = 0; i < allSubscriptions.length; i++) {
|
||||||
const sub = allSubscriptions[i];
|
const sub = allSubscriptions[i];
|
||||||
|
|
||||||
if (sub.claim_id === claimId && sub.name === claimName && sub.channel_name === channelName) {
|
if (sub.claim_id === claimId && sub.name === claimName && sub.channel_name === channelName) {
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +75,7 @@ class DiscoverPage extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
const { allSubscriptions, unreadSubscriptions, enabledChannelNotifications } = this.props;
|
const { unreadSubscriptions, enabledChannelNotifications } = this.props;
|
||||||
|
|
||||||
const utility = NativeModules.UtilityModule;
|
const utility = NativeModules.UtilityModule;
|
||||||
if (utility) {
|
if (utility) {
|
||||||
|
@ -89,7 +90,8 @@ class DiscoverPage extends React.PureComponent {
|
||||||
// check if notifications are enabled for the channel
|
// check if notifications are enabled for the channel
|
||||||
if (enabledChannelNotifications.indexOf(channelName) > -1) {
|
if (enabledChannelNotifications.indexOf(channelName) > -1) {
|
||||||
uris.forEach(uri => {
|
uris.forEach(uri => {
|
||||||
const sub = this.subscriptionForUri(uri, channelName);
|
Lbry.resolve({ urls: uri }).then(result => {
|
||||||
|
const sub = result[uri].claim;
|
||||||
if (sub && sub.value && sub.value.stream) {
|
if (sub && sub.value && sub.value.stream) {
|
||||||
let isPlayable = false;
|
let isPlayable = false;
|
||||||
const source = sub.value.stream.source;
|
const source = sub.value.stream.source;
|
||||||
|
@ -102,6 +104,7 @@ class DiscoverPage extends React.PureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,11 @@ import {
|
||||||
FlatList,
|
FlatList,
|
||||||
NativeModules,
|
NativeModules,
|
||||||
SectionList,
|
SectionList,
|
||||||
|
ScrollView,
|
||||||
Text,
|
Text,
|
||||||
View
|
View
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { buildURI } from 'lbry-redux';
|
import { buildURI, parseURI } from 'lbry-redux';
|
||||||
import { uriFromFileInfo } from 'utils/helper';
|
import { uriFromFileInfo } from 'utils/helper';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
|
@ -76,7 +77,7 @@ class SubscriptionsPage extends React.PureComponent {
|
||||||
onPress={() => this.changeViewMode(Constants.SUBSCRIPTIONS_VIEW_ALL)}
|
onPress={() => this.changeViewMode(Constants.SUBSCRIPTIONS_VIEW_ALL)}
|
||||||
/>
|
/>
|
||||||
<Link
|
<Link
|
||||||
text={'Latest First'}
|
text={'Latest Only'}
|
||||||
style={[subscriptionsStyle.viewModeLink,
|
style={[subscriptionsStyle.viewModeLink,
|
||||||
((viewMode === Constants.SUBSCRIPTIONS_VIEW_LATEST_FIRST) ? subscriptionsStyle.activeMode : subscriptionsStyle.inactiveMode)]}
|
((viewMode === Constants.SUBSCRIPTIONS_VIEW_LATEST_FIRST) ? subscriptionsStyle.activeMode : subscriptionsStyle.inactiveMode)]}
|
||||||
onPress={() => this.changeViewMode(Constants.SUBSCRIPTIONS_VIEW_LATEST_FIRST)}
|
onPress={() => this.changeViewMode(Constants.SUBSCRIPTIONS_VIEW_LATEST_FIRST)}
|
||||||
|
|
|
@ -54,7 +54,13 @@ export function doUpdateLoadStatus(uri, outpoint) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (NativeModules.LbryDownloadManager) {
|
if (NativeModules.LbryDownloadManager) {
|
||||||
NativeModules.LbryDownloadManager.updateDownload(uri, fileInfo.file_name, 100, writtenBytes, totalBytes);
|
NativeModules.LbryDownloadManager.updateDownload(
|
||||||
|
uri,
|
||||||
|
fileInfo.file_name ? fileInfo.file_name : '',
|
||||||
|
100,
|
||||||
|
writtenBytes ? writtenBytes : 0,
|
||||||
|
totalBytes ? totalBytes : 0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Once a download has been completed, delete the individual blob files to save space
|
// Once a download has been completed, delete the individual blob files to save space
|
||||||
|
@ -84,7 +90,13 @@ export function doUpdateLoadStatus(uri, outpoint) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (NativeModules.LbryDownloadManager) {
|
if (NativeModules.LbryDownloadManager) {
|
||||||
NativeModules.LbryDownloadManager.updateDownload(uri, fileInfo.file_name, progress, writtenBytes, totalBytes);
|
NativeModules.LbryDownloadManager.updateDownload(
|
||||||
|
uri,
|
||||||
|
fileInfo.file_name ? fileInfo.file_name : '',
|
||||||
|
progress ? progress : 0,
|
||||||
|
writtenBytes ? writtenBytes : 0,
|
||||||
|
totalBytes ? totalBytes: 0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -118,7 +130,7 @@ export function doStartDownload(uri, outpoint) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (NativeModules.LbryDownloadManager) {
|
if (NativeModules.LbryDownloadManager) {
|
||||||
NativeModules.LbryDownloadManager.startDownload(uri, fileInfo.file_name);
|
NativeModules.LbryDownloadManager.startDownload(uri, fileInfo.file_name ? fileInfo.file_name : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(doUpdateLoadStatus(uri, outpoint));
|
dispatch(doUpdateLoadStatus(uri, outpoint));
|
||||||
|
@ -146,7 +158,7 @@ export function doStopDownloadingFile(uri, fileInfo) {
|
||||||
dispatch(doDeleteFile(fileInfo.outpoint, uri));
|
dispatch(doDeleteFile(fileInfo.outpoint, uri));
|
||||||
|
|
||||||
if (NativeModules.LbryDownloadManager) {
|
if (NativeModules.LbryDownloadManager) {
|
||||||
NativeModules.LbryDownloadManager.stopDownload(uri, fileInfo.file_name);
|
NativeModules.LbryDownloadManager.stopDownload(uri, fileInfo.file_name ? fileInfo.file_name : '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
# comma seperated e.g. requirements = sqlite3,kivy
|
# comma seperated e.g. requirements = sqlite3,kivy
|
||||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git@v0.32.0#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp==3.4.4, multidict==4.5.2, idna_ssl==1.1.0, typing_extensions==3.6.5, yarl, chardet==3.0.4, async_timeout==3.0.1, aiorpcX==0.9.0, git+https://github.com/lbryio/torba#egg=torba, coincurve
|
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git@v0.32.3#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp==3.4.4, multidict==4.5.2, idna_ssl==1.1.0, typing_extensions==3.6.5, yarl, chardet==3.0.4, async_timeout==3.0.1, aiorpcX==0.9.0, git+https://github.com/lbryio/torba#egg=torba, coincurve
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
|
|
@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
# comma seperated e.g. requirements = sqlite3,kivy
|
# comma seperated e.g. requirements = sqlite3,kivy
|
||||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git@v0.32.0#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp==3.4.4, multidict==4.5.2, idna_ssl==1.1.0, typing_extensions==3.6.5, yarl, chardet==3.0.4, async_timeout==3.0.1, aiorpcX==0.9.0, git+https://github.com/lbryio/torba#egg=torba, coincurve
|
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git@v0.32.3#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp==3.4.4, multidict==4.5.2, idna_ssl==1.1.0, typing_extensions==3.6.5, yarl, chardet==3.0.4, async_timeout==3.0.1, aiorpcX==0.9.0, git+https://github.com/lbryio/torba#egg=torba, coincurve
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
|
|
@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
# comma seperated e.g. requirements = sqlite3,kivy
|
# comma seperated e.g. requirements = sqlite3,kivy
|
||||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git@v0.32.0#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp==3.4.4, multidict==4.5.2, idna_ssl==1.1.0, typing_extensions==3.6.5, yarl, chardet==3.0.4, async_timeout==3.0.1, aiorpcX==0.9.0, git+https://github.com/lbryio/torba#egg=torba, coincurve
|
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git@v0.32.3#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp==3.4.4, multidict==4.5.2, idna_ssl==1.1.0, typing_extensions==3.6.5, yarl, chardet==3.0.4, async_timeout==3.0.1, aiorpcX==0.9.0, git+https://github.com/lbryio/torba#egg=torba, coincurve
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
|
|
@ -32,6 +32,8 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||||
|
|
||||||
private HashMap<String, Integer> downloadIdNotificationIdMap = new HashMap<String, Integer>();
|
private HashMap<String, Integer> downloadIdNotificationIdMap = new HashMap<String, Integer>();
|
||||||
|
|
||||||
|
private HashMap<String, Boolean> stoppedDownloadsMap = new HashMap<String, Boolean>();
|
||||||
|
|
||||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#");
|
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#");
|
||||||
|
|
||||||
private static final int MAX_FILENAME_LENGTH = 20;
|
private static final int MAX_FILENAME_LENGTH = 20;
|
||||||
|
@ -115,6 +117,10 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void startDownload(String id, String filename) {
|
public void startDownload(String id, String filename) {
|
||||||
|
if (filename == null || filename.trim().length() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
createNotificationChannel();
|
createNotificationChannel();
|
||||||
createNotificationGroup();
|
createNotificationGroup();
|
||||||
|
|
||||||
|
@ -129,6 +135,7 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||||
.setSmallIcon(android.R.drawable.stat_sys_download);
|
.setSmallIcon(android.R.drawable.stat_sys_download);
|
||||||
|
|
||||||
int notificationId = getNotificationId(id);
|
int notificationId = getNotificationId(id);
|
||||||
|
downloadIdNotificationIdMap.put(id, notificationId);
|
||||||
builders.put(notificationId, builder);
|
builders.put(notificationId, builder);
|
||||||
notificationManager.notify(notificationId, builder.build());
|
notificationManager.notify(notificationId, builder.build());
|
||||||
|
|
||||||
|
@ -140,11 +147,23 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void updateDownload(String id, String filename, double progress, double writtenBytes, double totalBytes) {
|
public void updateDownload(String id, String filename, double progress, double writtenBytes, double totalBytes) {
|
||||||
|
if (filename == null || filename.trim().length() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int notificationId = getNotificationId(id);
|
int notificationId = getNotificationId(id);
|
||||||
if (notificationId == -1) {
|
if (notificationId == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stoppedDownloadsMap.containsKey(id) && stoppedDownloadsMap.get(id)) {
|
||||||
|
// if this happens, the download was canceled, so remove the notification
|
||||||
|
// TODO: Figure out why updateDownload is called in the React Native code after stopDownload
|
||||||
|
removeDownloadNotification(id);
|
||||||
|
stoppedDownloadsMap.remove(id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
createNotificationChannel();
|
createNotificationChannel();
|
||||||
createNotificationGroup();
|
createNotificationGroup();
|
||||||
|
|
||||||
|
@ -198,6 +217,12 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void stopDownload(String id, String filename) {
|
public void stopDownload(String id, String filename) {
|
||||||
|
android.util.Log.d("ReactNativeJS", "Stop download for id=" + id + "; filename=" + filename);
|
||||||
|
stoppedDownloadsMap.put(id, true);
|
||||||
|
removeDownloadNotification(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeDownloadNotification(String id) {
|
||||||
if (!downloadIdNotificationIdMap.containsKey(id)) {
|
if (!downloadIdNotificationIdMap.containsKey(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,7 +244,7 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||||
protected Bitmap doInBackground(Void... params) {
|
protected Bitmap doInBackground(Void... params) {
|
||||||
try {
|
try {
|
||||||
return Picasso.get().load(thumbnailUri).get();
|
return Picasso.get().load(thumbnailUri).get();
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ def configure_logging(conf):
|
||||||
|
|
||||||
logging.getLogger('aioupnp').setLevel(logging.WARNING)
|
logging.getLogger('aioupnp').setLevel(logging.WARNING)
|
||||||
logging.getLogger('aiohttp').setLevel(logging.CRITICAL)
|
logging.getLogger('aiohttp').setLevel(logging.CRITICAL)
|
||||||
logging.getLogger('lbrynet').setLevel(logging.DEBUG)
|
logging.getLogger('lbrynet').setLevel(logging.DEBUG if lbrynet_android_utils.isDebug() else logging.INFO)
|
||||||
logging.getLogger('torba').setLevel(logging.INFO)
|
logging.getLogger('torba').setLevel(logging.INFO)
|
||||||
|
|
||||||
loggly_handler = get_loggly_handler()
|
loggly_handler = get_loggly_handler()
|
||||||
|
@ -90,9 +90,8 @@ def start():
|
||||||
log.info('Starting lbry sdk {}'.format(lbrynet_version));
|
log.info('Starting lbry sdk {}'.format(lbrynet_version));
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
loop.set_debug(True)
|
loop.set_debug(lbrynet_android_utils.isDebug())
|
||||||
|
|
||||||
if check_connection():
|
|
||||||
daemon = Daemon(conf)
|
daemon = Daemon(conf)
|
||||||
try:
|
try:
|
||||||
loop.run_until_complete(daemon.start())
|
loop.run_until_complete(daemon.start())
|
||||||
|
@ -103,8 +102,6 @@ def start():
|
||||||
loop.run_until_complete(daemon.stop())
|
loop.run_until_complete(daemon.stop())
|
||||||
if hasattr(loop, 'shutdown_asyncgens'):
|
if hasattr(loop, 'shutdown_asyncgens'):
|
||||||
loop.run_until_complete(loop.shutdown_asyncgens())
|
loop.run_until_complete(loop.shutdown_asyncgens())
|
||||||
else:
|
|
||||||
print("Not connected to internet, unable to start")
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
start()
|
start()
|
||||||
|
|
Loading…
Reference in a new issue