-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Onyx File handling - preparation #4908
Changes from all commits
9c287f3
ee4f659
f37b502
5fd5dab
b677931
4a484ec
91d8f40
a2ac108
e474acd
3ea51ec
e9c5d50
4073718
5971da5
044278d
1da8e87
62de152
8d0f6cd
d33702c
7805eb0
bbfdc5c
2a02fb1
06ef491
29565c6
f862014
f5de171
2ba8109
4f322dd
48c80d2
1db1d72
13083c8
2539f47
769141b
856dd1e
bd00a83
1e548cb
41004ea
555d9ae
3266600
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ function getImagePickerOptions(type) { | |
*/ | ||
const documentPickerOptions = { | ||
type: [RNDocumentPicker.types.allFiles], | ||
copyTo: 'cachesDirectory', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does android have a cachesDirectory? I only see it for IOS There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documentation says:
I take it the option |
||
}; | ||
|
||
/** | ||
|
@@ -66,7 +67,7 @@ function getDataForUpload(fileData) { | |
const fileResult = { | ||
name: fileData.fileName || fileData.name || 'chat_attachment', | ||
type: fileData.type, | ||
uri: fileData.uri, | ||
uri: fileData.fileCopyUri || fileData.uri, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The document picker makes the attachment available until the application is terminated The |
||
size: fileData.fileSize || fileData.size, | ||
}; | ||
|
||
|
@@ -127,20 +128,22 @@ class AttachmentPicker extends Component { | |
* Handles the image/document picker result and | ||
* sends the selected attachment to the caller (parent component) | ||
* | ||
* @param {ImagePickerResponse|DocumentPickerResponse} attachment | ||
* @param {Array<ImagePickerResponse|DocumentPickerResponse>} attachments | ||
* @returns {Promise} | ||
*/ | ||
pickAttachment(attachment) { | ||
if (!attachment) { | ||
pickAttachment(attachments = []) { | ||
if (attachments.length === 0) { | ||
return; | ||
} | ||
|
||
if (attachment.width === -1 || attachment.height === -1) { | ||
const fileData = _.first(attachments); | ||
|
||
if (fileData.width === -1 || fileData.height === -1) { | ||
this.showImageCorruptionAlert(); | ||
return; | ||
} | ||
|
||
return getDataForUpload(attachment).then((result) => { | ||
return getDataForUpload(fileData).then((result) => { | ||
this.completeAttachmentSelection(result); | ||
}).catch((error) => { | ||
this.showGeneralAlert(error.message); | ||
|
@@ -196,7 +199,7 @@ class AttachmentPicker extends Component { | |
} | ||
|
||
// Resolve with the first (and only) selected file | ||
return resolve(response.assets[0]); | ||
return resolve(response.assets); | ||
}); | ||
}); | ||
} | ||
|
@@ -225,7 +228,7 @@ class AttachmentPicker extends Component { | |
/** | ||
* Launch the DocumentPicker. Results are in the same format as ImagePicker | ||
* | ||
* @returns {Promise<DocumentPickerResponse>} | ||
* @returns {Promise<DocumentPickerResponse[]>} | ||
*/ | ||
showDocumentPicker() { | ||
return RNDocumentPicker.pick(documentPickerOptions).catch((error) => { | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just not used? Not seeing it in any changes from this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was used here:
src/libs/SignoutManager.js
But now the file is deleted - no longer necessary
What the
SignoutManager
did was to synchronize the logout across multiple tabsBut now with
localForage
this is no longer neededWe're touching on this here: Expensify/react-native-onyx#102 (comment)