1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"), 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit CoreFileKit 19 */ 20 21import { AsyncCallback, Callback } from './@ohos.base'; 22import Context from './application/Context'; 23import { window } from '@kit.ArkUI'; 24 25/** 26 * Provide the capabilities to use different pickers. 27 * 28 * @namespace picker 29 * @syscap SystemCapability.FileManagement.UserFileService 30 * @since 9 31 */ 32/** 33 * Provide the capabilities to use different pickers. 34 * 35 * @namespace picker 36 * @syscap SystemCapability.FileManagement.UserFileService 37 * @atomicservice 38 * @since 11 39 */ 40/** 41 * Provide the capabilities to use different pickers. 42 * 43 * @namespace picker 44 * @syscap SystemCapability.FileManagement.UserFileService 45 * @crossplatform 46 * @atomicservice 47 * @since 12 48 */ 49declare namespace picker { 50 /** 51 * PhotoViewMIMETypes represents the type of media resource that photo picker selects. 52 * 53 * @enum { string } PhotoViewMIMETypes 54 * @syscap SystemCapability.FileManagement.UserFileService 55 * @since 9 56 */ 57 /** 58 * PhotoViewMIMETypes represents the type of media resource that photo picker selects. 59 * 60 * @enum { string } PhotoViewMIMETypes 61 * @syscap SystemCapability.FileManagement.UserFileService 62 * @atomicservice 63 * @since 11 64 * @deprecated since 12 65 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoViewMIMETypes 66 */ 67 export enum PhotoViewMIMETypes { 68 /** 69 * Image type. 70 * 71 * @syscap SystemCapability.FileManagement.UserFileService 72 * @since 9 73 */ 74 /** 75 * Image type. 76 * 77 * @syscap SystemCapability.FileManagement.UserFileService 78 * @atomicservice 79 * @since 11 80 */ 81 IMAGE_TYPE = 'image/*', 82 83 /** 84 * Video type. 85 * 86 * @syscap SystemCapability.FileManagement.UserFileService 87 * @since 9 88 */ 89 /** 90 * Video type. 91 * 92 * @syscap SystemCapability.FileManagement.UserFileService 93 * @atomicservice 94 * @since 11 95 */ 96 VIDEO_TYPE = 'video/*', 97 98 /** 99 * Image and video type. 100 * 101 * @syscap SystemCapability.FileManagement.UserFileService 102 * @since 9 103 */ 104 /** 105 * Image and video type. 106 * 107 * @syscap SystemCapability.FileManagement.UserFileService 108 * @atomicservice 109 * @since 11 110 */ 111 IMAGE_VIDEO_TYPE = '*/*' 112 } 113 114 /** 115 * PhotoSelectOptions Object 116 * 117 * @syscap SystemCapability.FileManagement.UserFileService 118 * @since 9 119 */ 120 /** 121 * PhotoSelectOptions Object 122 * 123 * @syscap SystemCapability.FileManagement.UserFileService 124 * @atomicservice 125 * @since 11 126 * @deprecated since 12 127 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoSelectOptions 128 */ 129 class PhotoSelectOptions { 130 /** 131 * The Type of the file in the picker window. 132 * 133 * @type { ?PhotoViewMIMETypes } 134 * @syscap SystemCapability.FileManagement.UserFileService 135 * @since 9 136 */ 137 /** 138 * The Type of the file in the picker window. 139 * 140 * @type { ?PhotoViewMIMETypes } 141 * @syscap SystemCapability.FileManagement.UserFileService 142 * @atomicservice 143 * @since 11 144 */ 145 MIMEType?: PhotoViewMIMETypes; 146 147 /** 148 * Maximum number of images for a single selection. 149 * 150 * @type { ?number } 151 * @syscap SystemCapability.FileManagement.UserFileService 152 * @since 9 153 */ 154 /** 155 * Maximum number of images for a single selection. 156 * 157 * @type { ?number } 158 * @syscap SystemCapability.FileManagement.UserFileService 159 * @atomicservice 160 * @since 11 161 */ 162 maxSelectNumber?: number; 163 } 164 165 /** 166 * PhotoSelectResult Object 167 * 168 * @syscap SystemCapability.FileManagement.UserFileService 169 * @since 9 170 */ 171 /** 172 * PhotoSelectResult Object 173 * 174 * @syscap SystemCapability.FileManagement.UserFileService 175 * @atomicservice 176 * @since 11 177 * @deprecated since 12 178 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoSelectResult 179 */ 180 class PhotoSelectResult { 181 /** 182 * The uris for the selected files. 183 * 184 * @type { Array<string> } 185 * @syscap SystemCapability.FileManagement.UserFileService 186 * @since 9 187 */ 188 /** 189 * The uris for the selected files. 190 * 191 * @type { Array<string> } 192 * @syscap SystemCapability.FileManagement.UserFileService 193 * @atomicservice 194 * @since 11 195 */ 196 photoUris: Array<string>; 197 198 /** 199 * Original option. 200 * 201 * @type { boolean } 202 * @syscap SystemCapability.FileManagement.UserFileService 203 * @since 9 204 */ 205 /** 206 * Original option. 207 * 208 * @type { boolean } 209 * @syscap SystemCapability.FileManagement.UserFileService 210 * @atomicservice 211 * @since 11 212 */ 213 isOriginalPhoto: boolean; 214 } 215 216 /** 217 * PhotoSaveOptions Object 218 * 219 * @syscap SystemCapability.FileManagement.UserFileService 220 * @since 9 221 * @deprecated since 12 222 */ 223 class PhotoSaveOptions { 224 /** 225 * The names of the files to be saved. 226 * 227 * @type { ?Array<string> } 228 * @syscap SystemCapability.FileManagement.UserFileService 229 * @since 9 230 */ 231 newFileNames?: Array<string>; 232 } 233 234 /** 235 * PhotoViewPicker Object 236 * 237 * @syscap SystemCapability.FileManagement.UserFileService 238 * @since 9 239 */ 240 /** 241 * PhotoViewPicker Object 242 * 243 * @syscap SystemCapability.FileManagement.UserFileService 244 * @atomicservice 245 * @since 11 246 * @deprecated since 12 247 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper#PhotoViewPicker 248 */ 249 class PhotoViewPicker { 250 /** 251 * The constructor used to create a PhotoViewPicker object. 252 * 253 * @syscap SystemCapability.FileManagement.UserFileService 254 * @atomicservice 255 * @since 12 256 */ 257 constructor(); 258 259 /** 260 * The constructor used to create a PhotoViewPicker object. 261 * 262 * @param { Context } context - represents the context. 263 * @syscap SystemCapability.FileManagement.UserFileService 264 * @since 12 265 */ 266 constructor(context: Context); 267 268 /** 269 * Pull up the photo picker based on the selection mode. 270 * 271 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 272 * @returns { Promise<PhotoSelectResult> } Returns the uris for the selected files. 273 * @syscap SystemCapability.FileManagement.UserFileService 274 * @since 9 275 */ 276 /** 277 * Pull up the photo picker based on the selection mode. 278 * 279 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 280 * @returns { Promise<PhotoSelectResult> } Returns the uris for the selected files. 281 * @syscap SystemCapability.FileManagement.UserFileService 282 * @atomicservice 283 * @since 11 284 * @deprecated since 12 285 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper.PhotoViewPicker#select 286 */ 287 select(option?: PhotoSelectOptions): Promise<PhotoSelectResult>; 288 289 /** 290 * Pull up the photo picker based on the selection mode. 291 * 292 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 293 * @param { AsyncCallback<PhotoSelectResult> } callback - callback 294 * @syscap SystemCapability.FileManagement.UserFileService 295 * @since 9 296 */ 297 /** 298 * Pull up the photo picker based on the selection mode. 299 * 300 * @param { PhotoSelectOptions } option - represents the options provided in select mode. 301 * @param { AsyncCallback<PhotoSelectResult> } callback - callback 302 * @syscap SystemCapability.FileManagement.UserFileService 303 * @atomicservice 304 * @since 11 305 * @deprecated since 12 306 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper.PhotoViewPicker#select 307 */ 308 select(option: PhotoSelectOptions, callback: AsyncCallback<PhotoSelectResult>): void; 309 310 /** 311 * Pull up the photo picker based on the selection mode. 312 * 313 * @param { AsyncCallback<PhotoSelectResult> } callback - callback 314 * @syscap SystemCapability.FileManagement.UserFileService 315 * @since 9 316 */ 317 /** 318 * Pull up the photo picker based on the selection mode. 319 * 320 * @param { AsyncCallback<PhotoSelectResult> } callback - callback 321 * @syscap SystemCapability.FileManagement.UserFileService 322 * @atomicservice 323 * @since 11 324 * @deprecated since 12 325 * @useinstead ohos.file.photoAccessHelper/photoAccessHelper.PhotoViewPicker#select 326 */ 327 select(callback: AsyncCallback<PhotoSelectResult>): void; 328 329 /** 330 * Pull up the photo picker based on the save mode. 331 * 332 * @param { PhotoSaveOptions } option - represents the options provided in save mode. 333 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 334 * @syscap SystemCapability.FileManagement.UserFileService 335 * @since 9 336 * @deprecated since 12 337 * @useinstead save_button/SaveButton 338 */ 339 save(option?: PhotoSaveOptions): Promise<Array<string>>; 340 341 /** 342 * Pull up the photo picker based on the save mode. 343 * 344 * @param { PhotoSaveOptions } option - represents the options provided in save mode. 345 * @param { AsyncCallback<Array<string>> } callback - callback 346 * @syscap SystemCapability.FileManagement.UserFileService 347 * @since 9 348 * @deprecated since 12 349 * @useinstead save_button/SaveButton 350 */ 351 save(option: PhotoSaveOptions, callback: AsyncCallback<Array<string>>): void; 352 353 /** 354 * Pull up the photo picker based on the save mode. 355 * 356 * @param { AsyncCallback<Array<string>> } callback - callback 357 * @syscap SystemCapability.FileManagement.UserFileService 358 * @since 9 359 * @deprecated since 12 360 * @useinstead save_button/SaveButton 361 */ 362 save(callback: AsyncCallback<Array<string>>): void; 363 } 364 365 /** 366 * Enumerates the picker's select mode types. 367 * 368 * @enum { number } DocumentSelectMode 369 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 370 * @since 11 371 */ 372 /** 373 * Enumerates the picker's select mode types. 374 * 375 * @enum { number } DocumentSelectMode 376 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 377 * @crossplatform 378 * @atomicservice 379 * @since 12 380 */ 381 export enum DocumentSelectMode { 382 /** 383 * Indicates that only files are allowed to be selected. 384 * 385 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 386 * @since 11 387 */ 388 /** 389 * Indicates that only files are allowed to be selected. 390 * 391 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 392 * @crossplatform 393 * @atomicservice 394 * @since 12 395 */ 396 FILE = 0, 397 398 /** 399 * Indicates that only folders are allowed to be selected. 400 * 401 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 402 * @since 11 403 */ 404 /** 405 * Indicates that only folders are allowed to be selected. 406 * 407 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 408 * @crossplatform 409 * @atomicservice 410 * @since 12 411 */ 412 FOLDER = 1, 413 414 /** 415 * Indicates that files and folders are allowed to be selected. 416 * 417 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 418 * @since 11 419 */ 420 /** 421 * Indicates that files and folders are allowed to be selected. 422 * 423 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 424 * @atomicservice 425 * @since 12 426 */ 427 MIXED = 2, 428 } 429 430 /** 431 * Enumerates the picker's mode types. 432 * 433 * @enum { number } DocumentPickerMode 434 * @syscap SystemCapability.FileManagement.UserFileService 435 * @atomicservice 436 * @since 12 437 */ 438 export enum DocumentPickerMode { 439 /** 440 * Document mode. 441 * 442 * @syscap SystemCapability.FileManagement.UserFileService 443 * @atomicservice 444 * @since 12 445 */ 446 DEFAULT = 0, 447 448 /** 449 * Download mode. 450 * 451 * @syscap SystemCapability.FileManagement.UserFileService 452 * @atomicservice 453 * @since 12 454 */ 455 DOWNLOAD = 1, 456 } 457 458 /** 459 * Enumerates the picker's merge mode types. 460 * 461 * @enum { number } DocumentPickerMode 462 * @syscap SystemCapability.FileManagement.UserFileService 463 * @atomicservice 464 * @since 15 465 */ 466 export enum MergeTypeMode { 467 /** 468 * Indicates common mode. 469 * 470 * @syscap SystemCapability.FileManagement.UserFileService 471 * @atomicservice 472 * @since 15 473 */ 474 DEFAULT = 0, 475 476 /** 477 * Indicates that audios are allowed to be selected 478 * 479 * @syscap SystemCapability.FileManagement.UserFileService 480 * @atomicservice 481 * @since 15 482 */ 483 AUDIO = 1, 484 485 /** 486 * Indicates that videos are allowed to be selected 487 * 488 * @syscap SystemCapability.FileManagement.UserFileService 489 * @atomicservice 490 * @since 15 491 */ 492 VIDEO = 2, 493 494 /** 495 * Indicates that documents are allowed to be selected 496 * 497 * @syscap SystemCapability.FileManagement.UserFileService 498 * @atomicservice 499 * @since 15 500 */ 501 DOCUMENT = 3, 502 503 /** 504 * Indicates that pictures are allowed to be selected 505 * 506 * @syscap SystemCapability.FileManagement.UserFileService 507 * @atomicservice 508 * @since 15 509 */ 510 PICTURE = 4, 511 } 512 513 /** 514 * DocumentSelectOptions Object. 515 * 516 * @syscap SystemCapability.FileManagement.UserFileService 517 * @since 9 518 */ 519 /** 520 * DocumentSelectOptions Object. 521 * 522 * @syscap SystemCapability.FileManagement.UserFileService 523 * @crossplatform 524 * @atomicservice 525 * @since 12 526 */ 527 class DocumentSelectOptions { 528 /** 529 * The default opening uri of the picker window. 530 * 531 * @type { ?string } 532 * @syscap SystemCapability.FileManagement.UserFileService 533 * @since 10 534 */ 535 /** 536 * The default opening uri of the picker window. 537 * 538 * @type { ?string } 539 * @syscap SystemCapability.FileManagement.UserFileService 540 * @crossplatform 541 * @atomicservice 542 * @since 12 543 */ 544 defaultFilePathUri?: string; 545 546 /** 547 * Suffixes for file selected. 548 * 549 * @type { ?Array<string> } 550 * @syscap SystemCapability.FileManagement.UserFileService 551 * @since 10 552 */ 553 /** 554 * Suffixes for file selected. 555 * 556 * @type { ?Array<string> } 557 * @syscap SystemCapability.FileManagement.UserFileService 558 * @crossplatform 559 * @atomicservice 560 * @since 12 561 */ 562 fileSuffixFilters?: Array<string>; 563 564 /** 565 * Maximum number of files for a single selection. 566 * 567 * @type { ?number } 568 * @syscap SystemCapability.FileManagement.UserFileService 569 * @since 10 570 */ 571 /** 572 * Maximum number of files for a single selection. 573 * 574 * @type { ?number } 575 * @syscap SystemCapability.FileManagement.UserFileService 576 * @crossplatform 577 * @atomicservice 578 * @since 12 579 */ 580 maxSelectNumber?: number; 581 582 /** 583 * Selection mode. 584 * 585 * @type { ?DocumentSelectMode } 586 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 587 * @since 11 588 */ 589 /** 590 * Selection mode. 591 * 592 * @type { ?DocumentSelectMode } 593 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 594 * @crossplatform 595 * @atomicservice 596 * @since 12 597 */ 598 selectMode?: DocumentSelectMode; 599 600 /** 601 * Granting Permissions to Specified Directories or Files. 602 * The value true indicates that authorization is required. 603 * When authmode is set to true, the defaultFilePathUri field is mandatory. 604 * 605 * @type { ?boolean } 606 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 607 * @atomicservice 608 * @since 12 609 */ 610 authMode?: boolean; 611 612 /** 613 * Granting Permissions to Mutl file. 614 * 615 * @type { ?boolean } 616 * @syscap SystemCapability.FileManagement.UserFileService 617 * @atomicservice 618 * @since 15 619 */ 620 multiAuthMode?: boolean; 621 622 /** 623 * Mutl file to Granting Permissions 624 * 625 * @type { ?Array<string> } 626 * @syscap SystemCapability.FileManagement.UserFileService 627 * @atomicservice 628 * @since 15 629 */ 630 multiUriArray?: Array<string>; 631 632 /** 633 * Filtering by file type 634 * 635 * @type { ?MergeTypeMode } 636 * @syscap SystemCapability.FileManagement.UserFileService 637 * @atomicservice 638 * @since 15 639 */ 640 mergeMode?: MergeTypeMode; 641 } 642 643 /** 644 * DocumentSaveOptions Object 645 * 646 * @syscap SystemCapability.FileManagement.UserFileService 647 * @since 9 648 */ 649 /** 650 * DocumentSaveOptions Object 651 * 652 * @syscap SystemCapability.FileManagement.UserFileService 653 * @crossplatform 654 * @atomicservice 655 * @since 12 656 */ 657 class DocumentSaveOptions { 658 /** 659 * The names of the files to be saved. 660 * 661 * @type { ?Array<string> } 662 * @syscap SystemCapability.FileManagement.UserFileService 663 * @since 9 664 */ 665 /** 666 * The names of the files to be saved. 667 * 668 * @type { ?Array<string> } 669 * @syscap SystemCapability.FileManagement.UserFileService 670 * @crossplatform 671 * @atomicservice 672 * @since 12 673 */ 674 newFileNames?: Array<string>; 675 676 /** 677 * The default opening uri of the picker window. 678 * 679 * @type { ?string } 680 * @syscap SystemCapability.FileManagement.UserFileService 681 * @since 10 682 */ 683 /** 684 * The default opening uri of the picker window. 685 * 686 * @type { ?string } 687 * @syscap SystemCapability.FileManagement.UserFileService 688 * @crossplatform 689 * @atomicservice 690 * @since 12 691 */ 692 defaultFilePathUri?: string; 693 694 /** 695 * Suffixes for file saved. 696 * 697 * @type { ?Array<string> } 698 * @syscap SystemCapability.FileManagement.UserFileService 699 * @since 10 700 */ 701 /** 702 * Suffixes for file saved. 703 * 704 * @type { ?Array<string> } 705 * @syscap SystemCapability.FileManagement.UserFileService 706 * @atomicservice 707 * @since 12 708 */ 709 fileSuffixChoices?: Array<string>; 710 /** 711 * picker mode. 712 * 713 * @type { ?DocumentPickerMode } 714 * @syscap SystemCapability.FileManagement.UserFileService 715 * @atomicservice 716 * @since 12 717 */ 718 pickerMode?: DocumentPickerMode; 719 } 720 721 /** 722 * DocumentViewPicker Object 723 * 724 * @syscap SystemCapability.FileManagement.UserFileService 725 * @since 9 726 */ 727 /** 728 * DocumentViewPicker Object 729 * 730 * @syscap SystemCapability.FileManagement.UserFileService 731 * @crossplatform 732 * @atomicservice 733 * @since 12 734 */ 735 class DocumentViewPicker { 736 /** 737 * The constructor used to create a DocumentViewPicker object. 738 * 739 * @syscap SystemCapability.FileManagement.UserFileService 740 * @atomicservice 741 * @since 12 742 */ 743 constructor(); 744 745 /** 746 * The constructor used to create a DocumentViewPicker object. 747 * 748 * @param { Context } context - represents the context. 749 * @syscap SystemCapability.FileManagement.UserFileService 750 * @atomicservice 751 * @since 12 752 */ 753 constructor(context: Context); 754 755 /** 756 * The constructor used to create a DocumentViewPicker object. 757 * 758 * @param { Context } context - represents the context. 759 * @param { window.Window } window - represents the window. 760 * @syscap SystemCapability.FileManagement.UserFileService 761 * @since 13 762 */ 763 constructor(context: Context, window: window.Window); 764 765 /** 766 * Pull up the document picker based on the selection mode. 767 * 768 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 769 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 770 * @syscap SystemCapability.FileManagement.UserFileService 771 * @since 9 772 */ 773 /** 774 * Pull up the document picker based on the selection mode. 775 * 776 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 777 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 778 * @syscap SystemCapability.FileManagement.UserFileService 779 * @crossplatform 780 * @atomicservice 781 * @since 12 782 */ 783 select(option?: DocumentSelectOptions): Promise<Array<string>>; 784 785 /** 786 * Pull up the document picker based on the selection mode. 787 * 788 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 789 * @param { AsyncCallback<Array<string>> } callback - callback 790 * @syscap SystemCapability.FileManagement.UserFileService 791 * @since 9 792 */ 793 /** 794 * Pull up the document picker based on the selection mode. 795 * 796 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 797 * @param { AsyncCallback<Array<string>> } callback - callback 798 * @syscap SystemCapability.FileManagement.UserFileService 799 * @crossplatform 800 * @atomicservice 801 * @since 12 802 */ 803 select(option: DocumentSelectOptions, callback: AsyncCallback<Array<string>>): void; 804 805 /** 806 * Pull up the document picker based on the selection mode. 807 * 808 * @param { AsyncCallback<Array<string>> } callback - callback 809 * @syscap SystemCapability.FileManagement.UserFileService 810 * @since 9 811 */ 812 /** 813 * Pull up the document picker based on the selection mode. 814 * 815 * @param { AsyncCallback<Array<string>> } callback - callback 816 * @syscap SystemCapability.FileManagement.UserFileService 817 * @crossplatform 818 * @atomicservice 819 * @since 12 820 */ 821 select(callback: AsyncCallback<Array<string>>): void; 822 823 /** 824 * Pull up the document picker based on the save mode. 825 * 826 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 827 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 828 * @syscap SystemCapability.FileManagement.UserFileService 829 * @since 9 830 */ 831 /** 832 * Pull up the document picker based on the save mode. 833 * 834 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 835 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 836 * @syscap SystemCapability.FileManagement.UserFileService 837 * @crossplatform 838 * @atomicservice 839 * @since 12 840 */ 841 save(option?: DocumentSaveOptions): Promise<Array<string>>; 842 843 /** 844 * Pull up the document picker based on the save mode. 845 * 846 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 847 * @param { AsyncCallback<Array<string>> } callback - callback 848 * @syscap SystemCapability.FileManagement.UserFileService 849 * @since 9 850 */ 851 /** 852 * Pull up the document picker based on the save mode. 853 * 854 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 855 * @param { AsyncCallback<Array<string>> } callback - callback 856 * @syscap SystemCapability.FileManagement.UserFileService 857 * @crossplatform 858 * @atomicservice 859 * @since 12 860 */ 861 save(option: DocumentSaveOptions, callback: AsyncCallback<Array<string>>): void; 862 863 /** 864 * Pull up the document picker based on the save mode. 865 * 866 * @param { AsyncCallback<Array<string>> } callback - callback 867 * @syscap SystemCapability.FileManagement.UserFileService 868 * @since 9 869 */ 870 /** 871 * Pull up the document picker based on the save mode. 872 * 873 * @param { AsyncCallback<Array<string>> } callback - callback 874 * @syscap SystemCapability.FileManagement.UserFileService 875 * @crossplatform 876 * @atomicservice 877 * @since 12 878 */ 879 save(callback: AsyncCallback<Array<string>>): void; 880 881 /** 882 * Obtain the saving type selected by the user. 883 * 884 * @returns { number } Returns the index of the suffix array fileSuffixChoices configured by the user in DocumentSaveOptions. 885 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 886 * @crossplatform 887 * @atomicservice 888 * @since 14 889 */ 890 getSelectedIndex(): number; 891 } 892 893 /** 894 * AudioSelectOptions Object. Currently not supported. 895 * 896 * @syscap SystemCapability.FileManagement.UserFileService 897 * @since 9 898 */ 899 /** 900 * AudioSelectOptions Object. 901 * 902 * @syscap SystemCapability.FileManagement.UserFileService 903 * @crossplatform 904 * @atomicservice 905 * @since 12 906 */ 907 class AudioSelectOptions { 908 /** 909 * Maximum number of audio for a single selection. 910 * 911 * @type { ?number } 912 * @syscap SystemCapability.FileManagement.UserFileService 913 * @crossplatform 914 * @atomicservice 915 * @since 12 916 */ 917 maxSelectNumber?: number; 918 } 919 920 /** 921 * AudioSaveOptions Object 922 * 923 * @syscap SystemCapability.FileManagement.UserFileService 924 * @since 9 925 */ 926 /** 927 * AudioSaveOptions Object 928 * 929 * @syscap SystemCapability.FileManagement.UserFileService 930 * @crossplatform 931 * @atomicservice 932 * @since 12 933 */ 934 class AudioSaveOptions { 935 /** 936 * The names of the files to be saved. 937 * 938 * @type { ?Array<string> } 939 * @syscap SystemCapability.FileManagement.UserFileService 940 * @since 9 941 */ 942 /** 943 * The names of the files to be saved. 944 * 945 * @type { ?Array<string> } 946 * @syscap SystemCapability.FileManagement.UserFileService 947 * @crossplatform 948 * @atomicservice 949 * @since 12 950 */ 951 newFileNames?: Array<string>; 952 } 953 954 /** 955 * AudioViewPicker Object 956 * 957 * @syscap SystemCapability.FileManagement.UserFileService 958 * @since 9 959 */ 960 /** 961 * AudioViewPicker Object 962 * 963 * @syscap SystemCapability.FileManagement.UserFileService 964 * @crossplatform 965 * @atomicservice 966 * @since 12 967 */ 968 class AudioViewPicker { 969 /** 970 * The constructor used to create a AudioViewPicker object. 971 * 972 * @syscap SystemCapability.FileManagement.UserFileService 973 * @atomicservice 974 * @since 12 975 */ 976 constructor(); 977 978 /** 979 * The constructor used to create a AudioViewPicker object. 980 * 981 * @param { Context } context - represents the context. 982 * @syscap SystemCapability.FileManagement.UserFileService 983 * @atomicservice 984 * @since 12 985 */ 986 constructor(context: Context); 987 988 /** 989 * Pull up the audio picker based on the selection mode. 990 * 991 * @param { AudioSelectOptions } option - represents the options provided in select mode. 992 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 993 * @syscap SystemCapability.FileManagement.UserFileService 994 * @since 9 995 */ 996 /** 997 * Pull up the audio picker based on the selection mode. 998 * 999 * @param { AudioSelectOptions } option - represents the options provided in select mode. 1000 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 1001 * @syscap SystemCapability.FileManagement.UserFileService 1002 * @crossplatform 1003 * @atomicservice 1004 * @since 12 1005 */ 1006 select(option?: AudioSelectOptions): Promise<Array<string>>; 1007 1008 /** 1009 * Pull up the audio picker based on the selection mode. 1010 * 1011 * @param { AudioSelectOptions } option - represents the options provided in select mode. 1012 * @param { AsyncCallback<Array<string>> } callback - callback 1013 * @syscap SystemCapability.FileManagement.UserFileService 1014 * @since 9 1015 */ 1016 /** 1017 * Pull up the audio picker based on the selection mode. 1018 * 1019 * @param { AudioSelectOptions } option - represents the options provided in select mode. 1020 * @param { AsyncCallback<Array<string>> } callback - callback 1021 * @syscap SystemCapability.FileManagement.UserFileService 1022 * @crossplatform 1023 * @since 12 1024 */ 1025 select(option: AudioSelectOptions, callback: AsyncCallback<Array<string>>): void; 1026 1027 /** 1028 * Pull up the audio picker based on the selection mode. 1029 * 1030 * @param { AsyncCallback<Array<string>> } callback - callback 1031 * @syscap SystemCapability.FileManagement.UserFileService 1032 * @since 9 1033 */ 1034 /** 1035 * Pull up the audio picker based on the selection mode. 1036 * 1037 * @param { AsyncCallback<Array<string>> } callback - callback 1038 * @syscap SystemCapability.FileManagement.UserFileService 1039 * @crossplatform 1040 * @since 12 1041 */ 1042 select(callback: AsyncCallback<Array<string>>): void; 1043 1044 /** 1045 * Pull up the audio picker based on the save mode. 1046 * 1047 * @param { AudioSaveOptions } option - represents the options provided in save mode. 1048 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 1049 * @syscap SystemCapability.FileManagement.UserFileService 1050 * @since 9 1051 */ 1052 /** 1053 * Pull up the audio picker based on the save mode. 1054 * 1055 * @param { AudioSaveOptions } option - represents the options provided in save mode. 1056 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 1057 * @syscap SystemCapability.FileManagement.UserFileService 1058 * @crossplatform 1059 * @atomicservice 1060 * @since 12 1061 */ 1062 save(option?: AudioSaveOptions): Promise<Array<string>>; 1063 1064 /** 1065 * Pull up the audio picker based on the save mode. 1066 * 1067 * @param { AudioSaveOptions } option - represents the options provided in save mode. 1068 * @param { AsyncCallback<Array<string>> } callback - callback 1069 * @syscap SystemCapability.FileManagement.UserFileService 1070 * @since 9 1071 */ 1072 /** 1073 * Pull up the audio picker based on the save mode. 1074 * 1075 * @param { AudioSaveOptions } option - represents the options provided in save mode. 1076 * @param { AsyncCallback<Array<string>> } callback - callback 1077 * @syscap SystemCapability.FileManagement.UserFileService 1078 * @crossplatform 1079 * @since 12 1080 */ 1081 save(option: AudioSaveOptions, callback: AsyncCallback<Array<string>>): void; 1082 1083 /** 1084 * Pull up the audio picker based on the save mode. 1085 * 1086 * @param { AsyncCallback<Array<string>> } callback - callback 1087 * @syscap SystemCapability.FileManagement.UserFileService 1088 * @since 9 1089 */ 1090 /** 1091 * Pull up the audio picker based on the save mode. 1092 * 1093 * @param { AsyncCallback<Array<string>> } callback - callback 1094 * @syscap SystemCapability.FileManagement.UserFileService 1095 * @crossplatform 1096 * @since 12 1097 */ 1098 save(callback: AsyncCallback<Array<string>>): void; 1099 } 1100} 1101 1102export default picker; 1103