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