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
5f008b3a
Commit
5f008b3a
authored
Jan 20, 2020
by
Akinwale Ariwodola
Browse files
download confirmation dialog
parent
3f21c4e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/page/file/view.js
View file @
5f008b3a
...
...
@@ -21,7 +21,7 @@ import {
}
from
'
react-native
'
;
import
{
WebView
}
from
'
react-native-webview
'
;
import
{
NavigationEvents
}
from
'
react-navigation
'
;
import
{
navigateBack
,
navigateToUri
,
formatLbryUrlForWeb
}
from
'
utils/helper
'
;
import
{
navigateBack
,
navigateToUri
,
formatBytes
,
formatLbryUrlForWeb
}
from
'
utils/helper
'
;
import
Icon
from
'
react-native-vector-icons/FontAwesome5
'
;
import
ImageViewer
from
'
react-native-image-zoom-viewer
'
;
import
Button
from
'
component/button
'
;
...
...
@@ -648,6 +648,7 @@ class FilePage extends React.PureComponent {
const
{
notify
,
purchaseUri
,
title
}
=
this
.
props
;
if
(
!
costInfo
)
{
notify
({
message
:
__
(
'
This content cannot be viewed at this time. Please try again in a bit.
'
),
isError
:
true
});
this
.
setState
({
downloadPressed
:
false
});
this
.
fetchCostInfo
(
uri
,
this
.
props
);
return
;
}
...
...
@@ -686,7 +687,7 @@ class FilePage extends React.PureComponent {
NativeModules
.
Firebase
.
track
(
'
purchase_uri
'
,
{
uri
:
purchaseUrl
});
if
(
!
isPlayable
)
{
this
.
checkStoragePermissionForDownloa
d
();
this
.
onDownloadPresse
d
();
}
else
{
this
.
confirmPurchaseUri
(
purchaseUrl
,
costInfo
,
!
isPlayable
);
}
...
...
@@ -694,7 +695,6 @@ class FilePage extends React.PureComponent {
if
(
isPlayable
)
{
this
.
startTime
=
Date
.
now
();
this
.
setState
({
downloadPressed
:
true
,
autoPlayMedia
:
true
,
stopDownloadConfirmed
:
false
});
// setPlayerVisible(purchaseUrl);
}
if
(
isViewable
)
{
this
.
setState
({
downloadPressed
:
true
});
...
...
@@ -718,7 +718,24 @@ class FilePage extends React.PureComponent {
};
onDownloadPressed
=
()
=>
{
this
.
checkStoragePermissionForDownload
();
const
{
claim
,
title
}
=
this
.
props
;
const
fileSize
=
claim
&&
claim
.
value
&&
claim
.
value
.
source
?
claim
.
value
.
source
.
size
:
0
;
Alert
.
alert
(
__
(
'
Download file
'
),
fileSize
>
0
?
__
(
'
Save "%title%" (%size%) to your device
'
,
{
title
,
size
:
formatBytes
(
fileSize
,
0
)
})
:
__
(
'
Save "%title%" to your device
'
,
{
title
}),
[
{
text
:
__
(
'
No
'
)
},
{
text
:
__
(
'
Yes
'
),
onPress
:
()
=>
{
this
.
checkStoragePermissionForDownload
();
},
},
],
{
cancelable
:
true
},
);
};
checkStoragePermissionForDownload
=
()
=>
{
...
...
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