Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lbry
lbry-react-native
Commits
0361b105
Commit
0361b105
authored
Jan 20, 2020
by
Akinwale Ariwodola
Browse files
add onDownloadAborted event handler
parent
b9dec86c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/component/AppNavigator.js
View file @
0361b105
...
...
@@ -38,7 +38,15 @@ import {
ToastAndroid
,
}
from
'
react-native
'
;
import
{
selectDrawerStack
}
from
'
redux/selectors/drawer
'
;
import
{
SETTINGS
,
doDismissToast
,
doPopulateSharedUserState
,
doPreferenceGet
,
doToast
,
selectToast
}
from
'
lbry-redux
'
;
import
{
ACTIONS
,
SETTINGS
,
doDismissToast
,
doPopulateSharedUserState
,
doPreferenceGet
,
doToast
,
selectToast
,
}
from
'
lbry-redux
'
;
import
{
Lbryio
,
doGetSync
,
...
...
@@ -313,6 +321,7 @@ class AppWithNavigationState extends React.Component {
this
.
emailVerifyCheckInterval
=
setInterval
(()
=>
this
.
checkEmailVerification
(),
5000
);
Linking
.
addEventListener
(
'
url
'
,
this
.
_handleUrl
);
DeviceEventEmitter
.
addListener
(
'
onDownloadAborted
'
,
this
.
handleDownloadAborted
);
DeviceEventEmitter
.
addListener
(
'
onDownloadStarted
'
,
this
.
handleDownloadStarted
);
DeviceEventEmitter
.
addListener
(
'
onDownloadUpdated
'
,
this
.
handleDownloadUpdated
);
DeviceEventEmitter
.
addListener
(
'
onDownloadCompleted
'
,
this
.
handleDownloadCompleted
);
...
...
@@ -369,7 +378,24 @@ class AppWithNavigationState extends React.Component {
dispatch
(
doCompleteDownload
(
uri
,
outpoint
,
fileInfo
));
};
handleDownloadAborted
=
evt
=>
{
const
{
dispatch
}
=
this
.
props
;
const
{
uri
,
outpoint
}
=
evt
;
dispatch
({
type
:
ACTIONS
.
DOWNLOADING_CANCELED
,
data
:
{
uri
,
outpoint
},
});
dispatch
({
type
:
ACTIONS
.
FILE_DELETE
,
data
:
{
outpoint
,
},
});
};
componentWillUnmount
()
{
DeviceEventEmitter
.
removeListener
(
'
onDownloadAborted
'
,
this
.
handleDownloadAborted
);
DeviceEventEmitter
.
removeListener
(
'
onDownloadStarted
'
,
this
.
handleDownloadStarted
);
DeviceEventEmitter
.
removeListener
(
'
onDownloadUpdated
'
,
this
.
handleDownloadUpdated
);
DeviceEventEmitter
.
removeListener
(
'
onDownloadCompleted
'
,
this
.
handleDownloadCompleted
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment