Skip to content

add support setOwnedByMe #53

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default App;
| disableDefaultView | boolean | false | disables default view |
| viewId | string | DOCS | ViewIdOptions |
| viewMimeTypes | string | optional |Comma separated mimetypes. Use this in place of viewId if you need to filter multiple type of files. list: https://developers.google.com/drive/api/v3/mime-types.|
|setOwnedByMe | boolean | false |Only show owned documents. Do not combine this setting with setIncludeFolders. When setIncludeFolders is set true, setOwnedByMe is ignored.|
|setIncludeFolders| boolean | false |Show folders in the view items.|
|setSelectFolderEnabled|boolean| false |Allows the user to select a folder in Google Drive.|
| token | string | optional | access_token to skip auth part|
Expand Down
10 changes: 9 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export default function useDrivePicker(): [
customViews,
locale = 'en',
setIncludeFolders,
setOwnedByMe,
setSelectFolderEnabled,
disableDefaultView = false,
callbackFunction,
Expand All @@ -124,7 +125,14 @@ export default function useDrivePicker(): [

const view = new google.picker.DocsView(google.picker.ViewId[viewId])
if (viewMimeTypes) view.setMimeTypes(viewMimeTypes)
if (setIncludeFolders) view.setIncludeFolders(true)
if (setOwnedByMe){
view.setIncludeFolders(false)
view.setOwnedByMe(true)
}
if (setIncludeFolders) {
view.setIncludeFolders(true)
view.setOwnedByMe(false)
}
if (setSelectFolderEnabled) view.setSelectFolderEnabled(true)

const uploadView = new google.picker.DocsUploadView()
Expand Down
1 change: 1 addition & 0 deletions src/typeDefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export type PickerConfiguration = {
viewId?: ViewIdOptions
viewMimeTypes?: string
setIncludeFolders?: boolean
setOwnedByMe?: boolean
setSelectFolderEnabled?: boolean
disableDefaultView?: boolean
token?: string
Expand Down