From fd3f3401c228967d3e5fd72aa0ba8c7d84517a91 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Thu, 18 Nov 2021 14:24:50 -0500 Subject: [PATCH] Add file downloads --- assets/js/NativeShell.staticjs | 6 +- components/DownloadListItem.js | 41 ++++++++++++ components/NativeShellWebView.js | 10 +++ constants/Screens.js | 1 + langs/en.json | 1 + navigation/TabNavigator.js | 12 ++++ package-lock.json | 8 +++ package.json | 3 +- screens/DownloadScreen.js | 104 +++++++++++++++++++++++++++++++ stores/DownloadStore.js | 33 ++++++++++ stores/RootStore.js | 3 + 11 files changed, 218 insertions(+), 4 deletions(-) create mode 100644 components/DownloadListItem.js create mode 100644 screens/DownloadScreen.js create mode 100644 stores/DownloadStore.js diff --git a/assets/js/NativeShell.staticjs b/assets/js/NativeShell.staticjs index e333a7c..b1f8235 100644 --- a/assets/js/NativeShell.staticjs +++ b/assets/js/NativeShell.staticjs @@ -6,7 +6,7 @@ // List of supported features as reported in Safari const ExpoSupportedFeatures = [ - // 'filedownload', + 'filedownload', 'exit', 'plugins', 'externallinks', @@ -102,8 +102,8 @@ window.NativeShell = { } }, - downloadFile: function(url) { - postExpoEvent('downloadFile', { url: url }); + downloadFile: function(item) { + postExpoEvent('downloadFile', { item: item }); }, enableFullscreen: function() { diff --git a/components/DownloadListItem.js b/components/DownloadListItem.js new file mode 100644 index 0000000..a3ed88a --- /dev/null +++ b/components/DownloadListItem.js @@ -0,0 +1,41 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +import PropTypes from 'prop-types'; +import React from 'react'; +import { ActivityIndicator } from 'react-native'; +import { Button, ListItem } from 'react-native-elements'; + +import { getIconName } from '../utils/Icons'; + +const DownloadListItem = ({ item, index, onShare }) => ( + + + {item.title} + + {item.isComplete ? +