cozy-viewer 7.0.2 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/Footer/BottomSheetContent.js +2 -2
- package/dist/Footer/DownloadButton.js +21 -23
- package/dist/Footer/FooterActionButtons.js +2 -2
- package/dist/Footer/FooterContent.d.ts +1 -1
- package/dist/Footer/FooterContent.js +13 -29
- package/dist/Footer/ForwardButton.js +59 -61
- package/dist/Footer/ForwardOrDownloadButton.js +2 -2
- package/dist/Footer/Sharing.js +2 -2
- package/dist/Footer/helpers.js +86 -98
- package/dist/NoViewer/DownloadButton.js +1 -3
- package/dist/NoViewer/FileIcon.js +1 -2
- package/dist/NoViewer/NoViewer.js +2 -2
- package/dist/Panel/ActionMenuDesktop.js +2 -2
- package/dist/Panel/ActionMenuMobile.js +2 -2
- package/dist/Panel/ActionMenuWrapper.js +34 -36
- package/dist/Panel/Informations.js +1 -3
- package/dist/Panel/PanelContent.js +1 -3
- package/dist/Panel/Qualification.js +19 -9
- package/dist/Panel/QualificationListItemContact.js +22 -21
- package/dist/Panel/QualificationListItemDate.js +2 -2
- package/dist/Panel/QualificationListItemInformation.js +2 -2
- package/dist/Panel/QualificationListItemOther.js +2 -2
- package/dist/Panel/QualificationListItemQualification.js +2 -2
- package/dist/Panel/QualificationListItemText.js +2 -2
- package/dist/Panel/Sharing.js +8 -9
- package/dist/Panel/Summary.js +24 -26
- package/dist/Panel/SummaryDialog.js +18 -20
- package/dist/Panel/getPanelBlocks.js +2 -5
- package/dist/Panel/helpers.d.ts +1 -0
- package/dist/Panel/helpers.js +19 -12
- package/dist/Panel/helpers.spec.d.ts +1 -0
- package/dist/Viewer.js +2 -2
- package/dist/ViewerContainer.js +3 -7
- package/dist/ViewerExposer.js +1 -2
- package/dist/ViewerInformationsWrapper.js +2 -2
- package/dist/ViewerWithCustomPanelAndFooter.js +1 -2
- package/dist/ViewersByFile/AudioViewer.js +1 -3
- package/dist/ViewersByFile/BlankPaperViewer.js +3 -5
- package/dist/ViewersByFile/ImageViewer.js +1 -2
- package/dist/ViewersByFile/NoNetworkViewer.js +1 -3
- package/dist/ViewersByFile/OnlyOfficeViewer.js +1 -3
- package/dist/ViewersByFile/PdfJsViewer.js +5 -11
- package/dist/ViewersByFile/PdfMobileViewer.js +29 -34
- package/dist/ViewersByFile/ShortcutViewer.js +1 -3
- package/dist/ViewersByFile/TextViewer.js +63 -70
- package/dist/ViewersByFile/VideoViewer.js +1 -3
- package/dist/components/ExpirationAlert.js +15 -19
- package/dist/components/ExpirationAnnotation.js +2 -2
- package/dist/components/Footer.js +1 -3
- package/dist/components/InformationPanel.js +3 -4
- package/dist/components/Navigation.js +2 -3
- package/dist/components/PdfToolbarButton.js +2 -2
- package/dist/components/PrintButton.js +34 -36
- package/dist/components/Toolbar.js +1 -4
- package/dist/components/ToolbarButtons.js +2 -2
- package/dist/components/ToolbarFilePath.js +2 -4
- package/dist/components/ViewerByFile.js +7 -8
- package/dist/components/ViewerControls.js +4 -13
- package/dist/components/ViewerSpinner.js +1 -3
- package/dist/helpers.d.ts +0 -3
- package/dist/helpers.js +18 -52
- package/dist/hoc/withFileUrl.js +47 -50
- package/dist/hoc/withViewerLocales.js +1 -2
- package/dist/hooks/useReferencedContactName.js +1 -2
- package/dist/index.js +1 -2
- package/dist/locales/index.js +2 -3
- package/dist/proptypes.js +2 -3
- package/dist/providers/ActionMenuProvider.js +2 -5
- package/dist/providers/DemoProvider.js +1 -2
- package/dist/queries.js +3 -7
- package/dist/stylesheet.css +5 -5
- package/package.json +6 -6
- package/src/Footer/FooterContent.jsx +15 -30
- package/src/Panel/Qualification.jsx +45 -32
- package/src/Panel/QualificationListItemContact.jsx +10 -10
- package/src/Panel/Sharing.jsx +27 -25
- package/src/Panel/Summary.jsx +1 -1
- package/src/Panel/SummaryDialog.jsx +1 -1
- package/src/Panel/helpers.js +16 -0
- package/src/Panel/helpers.spec.js +40 -0
- package/src/Readme.md +0 -1
- package/src/ViewerContainer.jsx +1 -3
- package/src/components/ViewerControls.jsx +0 -5
- package/src/components/styles.styl +4 -5
- package/src/helpers.js +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.0.1](https://github.com/cozy/cozy-libs/compare/cozy-viewer@8.0.0...cozy-viewer@8.0.1) (2024-12-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package cozy-viewer
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [8.0.0](https://github.com/cozy/cozy-libs/compare/cozy-viewer@7.0.2...cozy-viewer@8.0.0) (2024-12-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **Viewer:** It crashed for file without metadata ([85a25dd](https://github.com/cozy/cozy-libs/commit/85a25dd14d929f5326ba8d963e5929a2a3126771))
|
|
20
|
+
* **Viewer:** Last qualification divider wasn't displayed correctly ([2c24870](https://github.com/cozy/cozy-libs/commit/2c2487066866510f2352cb3a8aac32a0a730beb1))
|
|
21
|
+
* **Viewer:** Now hide qualification list if not relevant ([8deaa4a](https://github.com/cozy/cozy-libs/commit/8deaa4a4dd64c0cddeabde9218c2f8e356dbc52e))
|
|
22
|
+
* **Viewer:** Now qualification divider use correct tag ([09f29d1](https://github.com/cozy/cozy-libs/commit/09f29d1e6d35fc759e3b45ebc2c25f2e7e4f7c9a))
|
|
23
|
+
* **Viewer:** Now show correctly the owner in sharing block ([b88e24a](https://github.com/cozy/cozy-libs/commit/b88e24a707f619e24c6bb174107ffdb6d6f28668))
|
|
24
|
+
* **Viewer:** Sharing item style in panel wasn't correct ([7f76212](https://github.com/cozy/cozy-libs/commit/7f76212bfaf7a2f4b51c4001597367592c141456))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* **Viewer:** Show always panel, not just for certified/connected files ([9bc42e7](https://github.com/cozy/cozy-libs/commit/9bc42e76735ff4da9e10c3a71c5c0e4443f2bfe5))
|
|
30
|
+
* **Viewer:** Upgrade peerDep ([1e199ec](https://github.com/cozy/cozy-libs/commit/1e199ecbfd9dacc59224b70106963a212ef8b2b1))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### BREAKING CHANGES
|
|
34
|
+
|
|
35
|
+
* **Viewer:** You must have `cozy-sharing >= 16.11.0` and `cozy-harvest-lib >= 31.0.5`
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## [7.0.2](https://github.com/cozy/cozy-libs/compare/cozy-viewer@7.0.1...cozy-viewer@7.0.2) (2024-12-05)
|
|
7
42
|
|
|
8
43
|
**Note:** Version bump only for package cozy-viewer
|
|
@@ -46,27 +46,25 @@ var DownloadButton = function DownloadButton(_ref) {
|
|
|
46
46
|
var handleClick = /*#__PURE__*/function () {
|
|
47
47
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
48
48
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
49
|
-
while (1) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return _context.stop();
|
|
69
|
-
}
|
|
49
|
+
while (1) switch (_context.prev = _context.next) {
|
|
50
|
+
case 0:
|
|
51
|
+
_context.prev = 0;
|
|
52
|
+
_context.next = 3;
|
|
53
|
+
return client.collection('io.cozy.files').download(file);
|
|
54
|
+
|
|
55
|
+
case 3:
|
|
56
|
+
_context.next = 8;
|
|
57
|
+
break;
|
|
58
|
+
|
|
59
|
+
case 5:
|
|
60
|
+
_context.prev = 5;
|
|
61
|
+
_context.t0 = _context["catch"](0);
|
|
62
|
+
|
|
63
|
+
_Alerter.default.info('Viewer.error.generic');
|
|
64
|
+
|
|
65
|
+
case 8:
|
|
66
|
+
case "end":
|
|
67
|
+
return _context.stop();
|
|
70
68
|
}
|
|
71
69
|
}, _callee, null, [[0, 5]]);
|
|
72
70
|
}));
|
|
@@ -109,5 +107,5 @@ DownloadButton.propTypes = {
|
|
|
109
107
|
DownloadButton.defaultProptypes = {
|
|
110
108
|
variant: 'default'
|
|
111
109
|
};
|
|
112
|
-
|
|
113
|
-
exports.default =
|
|
110
|
+
|
|
111
|
+
var _default = exports.default = DownloadButton;
|
|
@@ -29,5 +29,5 @@ FooterActionButtons.propTypes = {
|
|
|
29
29
|
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.arrayOf(_propTypes.default.node)]),
|
|
30
30
|
file: _propTypes.default.object
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
exports.default =
|
|
32
|
+
|
|
33
|
+
var _default = exports.default = FooterActionButtons;
|
|
@@ -4,7 +4,7 @@ declare function FooterContent({ file, toolbarRef, children, isPublic }: {
|
|
|
4
4
|
toolbarRef: any;
|
|
5
5
|
children: any;
|
|
6
6
|
isPublic: any;
|
|
7
|
-
}): JSX.Element
|
|
7
|
+
}): JSX.Element;
|
|
8
8
|
declare namespace FooterContent {
|
|
9
9
|
namespace propTypes {
|
|
10
10
|
const file: PropTypes.Validator<object>;
|
|
@@ -23,8 +23,6 @@ var _helpers = require("./helpers");
|
|
|
23
23
|
|
|
24
24
|
var _PrintButton = _interopRequireDefault(require("../components/PrintButton"));
|
|
25
25
|
|
|
26
|
-
var _helpers2 = require("../helpers");
|
|
27
|
-
|
|
28
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
27
|
|
|
30
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -79,34 +77,20 @@ var FooterContent = function FooterContent(_ref2) {
|
|
|
79
77
|
isOpenMin: isPublic ? true : false,
|
|
80
78
|
mediumHeightRatio: isPublic ? undefined : 0.5
|
|
81
79
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
settings: bottomSheetSettings
|
|
92
|
-
}, /*#__PURE__*/_react.default.createElement(_BottomSheet.BottomSheetHeader, {
|
|
93
|
-
className: (0, _classnames.default)('u-ph-1 u-pb-1', styles.bottomSheetHeader)
|
|
94
|
-
}, /*#__PURE__*/_react.default.createElement(FooterButtons, {
|
|
95
|
-
file: file,
|
|
96
|
-
FooterActionButtonsWithFile: FooterActionButtonsWithFile
|
|
97
|
-
})), /*#__PURE__*/_react.default.createElement(_BottomSheetContent.default, {
|
|
98
|
-
file: file,
|
|
99
|
-
isPublic: isPublic
|
|
100
|
-
}));
|
|
101
|
-
} // If `FooterActionButtons` hasn't children
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (!FooterActionButtonsWithFile) return null;
|
|
105
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
-
className: styles.footer
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_BottomSheet.default, {
|
|
81
|
+
toolbarProps: toolbarProps,
|
|
82
|
+
portalProps: {
|
|
83
|
+
disablePortal: true
|
|
84
|
+
},
|
|
85
|
+
settings: bottomSheetSettings
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement(_BottomSheet.BottomSheetHeader, {
|
|
87
|
+
className: (0, _classnames.default)('u-ph-1 u-pb-1', styles.bottomSheetHeader)
|
|
107
88
|
}, /*#__PURE__*/_react.default.createElement(FooterButtons, {
|
|
108
89
|
file: file,
|
|
109
90
|
FooterActionButtonsWithFile: FooterActionButtonsWithFile
|
|
91
|
+
})), /*#__PURE__*/_react.default.createElement(_BottomSheetContent.default, {
|
|
92
|
+
file: file,
|
|
93
|
+
isPublic: isPublic
|
|
110
94
|
}));
|
|
111
95
|
};
|
|
112
96
|
|
|
@@ -116,5 +100,5 @@ FooterContent.propTypes = {
|
|
|
116
100
|
isPublic: _propTypes.default.bool,
|
|
117
101
|
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.arrayOf(_propTypes.default.node)])
|
|
118
102
|
};
|
|
119
|
-
|
|
120
|
-
exports.default =
|
|
103
|
+
|
|
104
|
+
var _default = exports.default = FooterContent;
|
|
@@ -65,66 +65,64 @@ var ForwardButton = function ForwardButton(_ref) {
|
|
|
65
65
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(file) {
|
|
66
66
|
var url, shareData;
|
|
67
67
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
68
|
-
while (1) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_context.next = 11;
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
_context.prev = 1;
|
|
77
|
-
_context.next = 4;
|
|
78
|
-
return (0, _helpers.exportFilesNative)(client, [file]);
|
|
79
|
-
|
|
80
|
-
case 4:
|
|
81
|
-
_context.next = 9;
|
|
68
|
+
while (1) switch (_context.prev = _context.next) {
|
|
69
|
+
case 0:
|
|
70
|
+
if (!(0, _cozyDeviceHelper.isMobileApp)()) {
|
|
71
|
+
_context.next = 11;
|
|
82
72
|
break;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_context.prev = 1;
|
|
76
|
+
_context.next = 4;
|
|
77
|
+
return (0, _helpers.exportFilesNative)(client, [file]);
|
|
78
|
+
|
|
79
|
+
case 4:
|
|
80
|
+
_context.next = 9;
|
|
81
|
+
break;
|
|
82
|
+
|
|
83
|
+
case 6:
|
|
84
|
+
_context.prev = 6;
|
|
85
|
+
_context.t0 = _context["catch"](1);
|
|
86
|
+
|
|
87
|
+
_Alerter.default.info("Viewer.error.".concat(_context.t0), {
|
|
88
|
+
fileMime: file.mime
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
case 9:
|
|
92
|
+
_context.next = 22;
|
|
93
|
+
break;
|
|
94
|
+
|
|
95
|
+
case 11:
|
|
96
|
+
_context.prev = 11;
|
|
97
|
+
_context.next = 14;
|
|
98
|
+
return (0, _sharing.getSharingLink)(client, [file.id]);
|
|
99
|
+
|
|
100
|
+
case 14:
|
|
101
|
+
url = _context.sent;
|
|
102
|
+
shareData = {
|
|
103
|
+
title: t('Viewer.share.title', {
|
|
104
|
+
name: file.name
|
|
105
|
+
}),
|
|
106
|
+
text: t('Viewer.share.text', {
|
|
107
|
+
name: file.name
|
|
108
|
+
}),
|
|
109
|
+
url: url
|
|
110
|
+
};
|
|
111
|
+
navigator.share(shareData);
|
|
112
|
+
_context.next = 22;
|
|
113
|
+
break;
|
|
114
|
+
|
|
115
|
+
case 19:
|
|
116
|
+
_context.prev = 19;
|
|
117
|
+
_context.t1 = _context["catch"](11);
|
|
118
|
+
|
|
119
|
+
_Alerter.default.error('Viewer.share.error', {
|
|
120
|
+
error: _context.t1
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
case 22:
|
|
124
|
+
case "end":
|
|
125
|
+
return _context.stop();
|
|
128
126
|
}
|
|
129
127
|
}, _callee, null, [[1, 6], [11, 19]]);
|
|
130
128
|
}));
|
|
@@ -173,5 +171,5 @@ ForwardButton.propTypes = {
|
|
|
173
171
|
ForwardButton.defaultProptypes = {
|
|
174
172
|
variant: 'default'
|
|
175
173
|
};
|
|
176
|
-
|
|
177
|
-
exports.default =
|
|
174
|
+
|
|
175
|
+
var _default = exports.default = ForwardButton;
|
|
@@ -38,5 +38,5 @@ var ForwardOrDownloadButton = function ForwardOrDownloadButton(_ref) {
|
|
|
38
38
|
ForwardOrDownloadButton.propTypes = {
|
|
39
39
|
file: _propTypes.default.object
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
exports.default =
|
|
41
|
+
|
|
42
|
+
var _default = exports.default = ForwardOrDownloadButton;
|
package/dist/Footer/Sharing.js
CHANGED
package/dist/Footer/helpers.js
CHANGED
|
@@ -19,16 +19,14 @@ var _cozyDeviceHelper = require("cozy-device-helper");
|
|
|
19
19
|
|
|
20
20
|
var _Alerter = _interopRequireDefault(require("cozy-ui/transpiled/react/deprecated/Alerter"));
|
|
21
21
|
|
|
22
|
-
var shouldBeForwardButton = function shouldBeForwardButton(client) {
|
|
22
|
+
var shouldBeForwardButton = exports.shouldBeForwardButton = function shouldBeForwardButton(client) {
|
|
23
23
|
var _client$appMetadata;
|
|
24
24
|
|
|
25
|
-
var isDrive = (client === null || client === void 0
|
|
25
|
+
var isDrive = (client === null || client === void 0 || (_client$appMetadata = client.appMetadata) === null || _client$appMetadata === void 0 ? void 0 : _client$appMetadata.slug) === 'drive';
|
|
26
26
|
if ((0, _cozyDeviceHelper.isMobileApp)() || navigator.share && !isDrive) return true;
|
|
27
27
|
return false;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
exports.shouldBeForwardButton = shouldBeForwardButton;
|
|
31
|
-
|
|
32
30
|
var isMissingFileError = function isMissingFileError(error) {
|
|
33
31
|
return error.status === 404;
|
|
34
32
|
};
|
|
@@ -45,96 +43,92 @@ var downloadFileError = function downloadFileError(error) {
|
|
|
45
43
|
*/
|
|
46
44
|
|
|
47
45
|
|
|
48
|
-
var exportFilesNative = /*#__PURE__*/function () {
|
|
46
|
+
var exportFilesNative = exports.exportFilesNative = /*#__PURE__*/function () {
|
|
49
47
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(client, files, filename) {
|
|
50
48
|
var downloadAllFiles, urls;
|
|
51
49
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
52
|
-
while (1) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
50
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
51
|
+
case 0:
|
|
52
|
+
downloadAllFiles = files.map( /*#__PURE__*/function () {
|
|
53
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(file) {
|
|
54
|
+
var response, blob, filenameToUse, localFile;
|
|
55
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
56
|
+
while (1) switch (_context.prev = _context.next) {
|
|
57
|
+
case 0:
|
|
58
|
+
_context.next = 2;
|
|
59
|
+
return client.collection('io.cozy.files').fetchFileContentById(file.id);
|
|
60
|
+
|
|
61
|
+
case 2:
|
|
62
|
+
response = _context.sent;
|
|
63
|
+
_context.next = 5;
|
|
64
|
+
return response.blob();
|
|
65
|
+
|
|
66
|
+
case 5:
|
|
67
|
+
blob = _context.sent;
|
|
68
|
+
filenameToUse = filename ? filename : file.name;
|
|
69
|
+
_context.next = 9;
|
|
70
|
+
return (0, _fsnative.saveFileWithCordova)(blob, filenameToUse);
|
|
71
|
+
|
|
72
|
+
case 9:
|
|
73
|
+
localFile = _context.sent;
|
|
74
|
+
return _context.abrupt("return", localFile.nativeURL);
|
|
75
|
+
|
|
76
|
+
case 11:
|
|
77
|
+
case "end":
|
|
78
|
+
return _context.stop();
|
|
79
|
+
}
|
|
80
|
+
}, _callee);
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
return function (_x4) {
|
|
84
|
+
return _ref2.apply(this, arguments);
|
|
85
|
+
};
|
|
86
|
+
}());
|
|
87
|
+
_context2.prev = 1;
|
|
88
|
+
|
|
89
|
+
_Alerter.default.info('Viewer.alert.preparing', {
|
|
90
|
+
duration: Math.min(downloadAllFiles.length * 2000, 6000)
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
_context2.next = 5;
|
|
94
|
+
return Promise.all(downloadAllFiles);
|
|
95
|
+
|
|
96
|
+
case 5:
|
|
97
|
+
urls = _context2.sent;
|
|
98
|
+
|
|
99
|
+
if (urls.length === 1 && (0, _cozyDeviceHelper.isIOS)()) {
|
|
100
|
+
// TODO
|
|
101
|
+
// It seems that files: is not well supported on iOS. url seems to work well
|
|
102
|
+
// at with one file. Need to check when severals
|
|
103
|
+
window.plugins.socialsharing.shareWithOptions({
|
|
104
|
+
url: urls[0]
|
|
105
|
+
}, function (result) {
|
|
106
|
+
if (result.completed === true) {
|
|
107
|
+
_Alerter.default.success('Viewer.share.success');
|
|
108
|
+
}
|
|
109
|
+
}, function (error) {
|
|
110
|
+
throw error;
|
|
111
|
+
});
|
|
112
|
+
} else {
|
|
113
|
+
window.plugins.socialsharing.shareWithOptions({
|
|
114
|
+
files: urls
|
|
115
|
+
}, null, function (error) {
|
|
116
|
+
throw error;
|
|
96
117
|
});
|
|
118
|
+
}
|
|
97
119
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}, function (result) {
|
|
111
|
-
if (result.completed === true) {
|
|
112
|
-
_Alerter.default.success('Viewer.share.success');
|
|
113
|
-
}
|
|
114
|
-
}, function (error) {
|
|
115
|
-
throw error;
|
|
116
|
-
});
|
|
117
|
-
} else {
|
|
118
|
-
window.plugins.socialsharing.shareWithOptions({
|
|
119
|
-
files: urls
|
|
120
|
-
}, null, function (error) {
|
|
121
|
-
throw error;
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
_context2.next = 12;
|
|
126
|
-
break;
|
|
127
|
-
|
|
128
|
-
case 9:
|
|
129
|
-
_context2.prev = 9;
|
|
130
|
-
_context2.t0 = _context2["catch"](1);
|
|
131
|
-
|
|
132
|
-
_Alerter.default.error(downloadFileError(_context2.t0));
|
|
133
|
-
|
|
134
|
-
case 12:
|
|
135
|
-
case "end":
|
|
136
|
-
return _context2.stop();
|
|
137
|
-
}
|
|
120
|
+
_context2.next = 12;
|
|
121
|
+
break;
|
|
122
|
+
|
|
123
|
+
case 9:
|
|
124
|
+
_context2.prev = 9;
|
|
125
|
+
_context2.t0 = _context2["catch"](1);
|
|
126
|
+
|
|
127
|
+
_Alerter.default.error(downloadFileError(_context2.t0));
|
|
128
|
+
|
|
129
|
+
case 12:
|
|
130
|
+
case "end":
|
|
131
|
+
return _context2.stop();
|
|
138
132
|
}
|
|
139
133
|
}, _callee2, null, [[1, 9]]);
|
|
140
134
|
}));
|
|
@@ -144,9 +138,7 @@ var exportFilesNative = /*#__PURE__*/function () {
|
|
|
144
138
|
};
|
|
145
139
|
}();
|
|
146
140
|
|
|
147
|
-
exports.
|
|
148
|
-
|
|
149
|
-
var mapToAllChildren = function mapToAllChildren(children, cb) {
|
|
141
|
+
var mapToAllChildren = exports.mapToAllChildren = function mapToAllChildren(children, cb) {
|
|
150
142
|
return _react.Children.map(children, function (child) {
|
|
151
143
|
if (! /*#__PURE__*/(0, _react.isValidElement)(child)) return child;
|
|
152
144
|
var grandchildren = child.props.children;
|
|
@@ -161,9 +153,7 @@ var mapToAllChildren = function mapToAllChildren(children, cb) {
|
|
|
161
153
|
});
|
|
162
154
|
};
|
|
163
155
|
|
|
164
|
-
exports.
|
|
165
|
-
|
|
166
|
-
var extractChildrenCompByName = function extractChildrenCompByName(_ref3) {
|
|
156
|
+
var extractChildrenCompByName = exports.extractChildrenCompByName = function extractChildrenCompByName(_ref3) {
|
|
167
157
|
var children = _ref3.children,
|
|
168
158
|
file = _ref3.file,
|
|
169
159
|
name = _ref3.name;
|
|
@@ -174,6 +164,4 @@ var extractChildrenCompByName = function extractChildrenCompByName(_ref3) {
|
|
|
174
164
|
file: file
|
|
175
165
|
}) : null;
|
|
176
166
|
return ChildrenCompWithFile;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
exports.extractChildrenCompByName = extractChildrenCompByName;
|
|
167
|
+
};
|