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 * DocumentSelectOptions Object. 460 * 461 * @syscap SystemCapability.FileManagement.UserFileService 462 * @since 9 463 */ 464 /** 465 * DocumentSelectOptions Object. 466 * 467 * @syscap SystemCapability.FileManagement.UserFileService 468 * @crossplatform 469 * @atomicservice 470 * @since 12 471 */ 472 class DocumentSelectOptions { 473 /** 474 * The default opening uri of the picker window. 475 * 476 * @type { ?string } 477 * @syscap SystemCapability.FileManagement.UserFileService 478 * @since 10 479 */ 480 /** 481 * The default opening uri of the picker window. 482 * 483 * @type { ?string } 484 * @syscap SystemCapability.FileManagement.UserFileService 485 * @crossplatform 486 * @atomicservice 487 * @since 12 488 */ 489 defaultFilePathUri?: string; 490 491 /** 492 * Suffixes for file selected. 493 * 494 * @type { ?Array<string> } 495 * @syscap SystemCapability.FileManagement.UserFileService 496 * @since 10 497 */ 498 /** 499 * Suffixes for file selected. 500 * 501 * @type { ?Array<string> } 502 * @syscap SystemCapability.FileManagement.UserFileService 503 * @crossplatform 504 * @atomicservice 505 * @since 12 506 */ 507 fileSuffixFilters?: Array<string>; 508 509 /** 510 * Maximum number of files for a single selection. 511 * 512 * @type { ?number } 513 * @syscap SystemCapability.FileManagement.UserFileService 514 * @since 10 515 */ 516 /** 517 * Maximum number of files for a single selection. 518 * 519 * @type { ?number } 520 * @syscap SystemCapability.FileManagement.UserFileService 521 * @crossplatform 522 * @atomicservice 523 * @since 12 524 */ 525 maxSelectNumber?: number; 526 527 /** 528 * Selection mode. 529 * 530 * @type { ?DocumentSelectMode } 531 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 532 * @since 11 533 */ 534 /** 535 * Selection mode. 536 * 537 * @type { ?DocumentSelectMode } 538 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 539 * @crossplatform 540 * @atomicservice 541 * @since 12 542 */ 543 selectMode?: DocumentSelectMode; 544 545 /** 546 * Granting Permissions to Specified Directories or Files. 547 * The value true indicates that authorization is required. 548 * When authmode is set to true, the defaultFilePathUri field is mandatory. 549 * 550 * @type { ?boolean } 551 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 552 * @atomicservice 553 * @since 12 554 */ 555 authMode?: boolean; 556 } 557 558 /** 559 * DocumentSaveOptions Object 560 * 561 * @syscap SystemCapability.FileManagement.UserFileService 562 * @since 9 563 */ 564 /** 565 * DocumentSaveOptions Object 566 * 567 * @syscap SystemCapability.FileManagement.UserFileService 568 * @crossplatform 569 * @atomicservice 570 * @since 12 571 */ 572 class DocumentSaveOptions { 573 /** 574 * The names of the files to be saved. 575 * 576 * @type { ?Array<string> } 577 * @syscap SystemCapability.FileManagement.UserFileService 578 * @since 9 579 */ 580 /** 581 * The names of the files to be saved. 582 * 583 * @type { ?Array<string> } 584 * @syscap SystemCapability.FileManagement.UserFileService 585 * @crossplatform 586 * @atomicservice 587 * @since 12 588 */ 589 newFileNames?: Array<string>; 590 591 /** 592 * The default opening uri of the picker window. 593 * 594 * @type { ?string } 595 * @syscap SystemCapability.FileManagement.UserFileService 596 * @since 10 597 */ 598 /** 599 * The default opening uri of the picker window. 600 * 601 * @type { ?string } 602 * @syscap SystemCapability.FileManagement.UserFileService 603 * @crossplatform 604 * @atomicservice 605 * @since 12 606 */ 607 defaultFilePathUri?: string; 608 609 /** 610 * Suffixes for file saved. 611 * 612 * @type { ?Array<string> } 613 * @syscap SystemCapability.FileManagement.UserFileService 614 * @since 10 615 */ 616 /** 617 * Suffixes for file saved. 618 * 619 * @type { ?Array<string> } 620 * @syscap SystemCapability.FileManagement.UserFileService 621 * @atomicservice 622 * @since 12 623 */ 624 fileSuffixChoices?: Array<string>; 625 /** 626 * picker mode. 627 * 628 * @type { ?DocumentPickerMode } 629 * @syscap SystemCapability.FileManagement.UserFileService 630 * @atomicservice 631 * @since 12 632 */ 633 pickerMode?: DocumentPickerMode; 634 } 635 636 /** 637 * DocumentViewPicker Object 638 * 639 * @syscap SystemCapability.FileManagement.UserFileService 640 * @since 9 641 */ 642 /** 643 * DocumentViewPicker Object 644 * 645 * @syscap SystemCapability.FileManagement.UserFileService 646 * @crossplatform 647 * @atomicservice 648 * @since 12 649 */ 650 class DocumentViewPicker { 651 /** 652 * The constructor used to create a DocumentViewPicker object. 653 * 654 * @syscap SystemCapability.FileManagement.UserFileService 655 * @atomicservice 656 * @since 12 657 */ 658 constructor(); 659 660 /** 661 * The constructor used to create a DocumentViewPicker object. 662 * 663 * @param { Context } context - represents the context. 664 * @syscap SystemCapability.FileManagement.UserFileService 665 * @atomicservice 666 * @since 12 667 */ 668 constructor(context: Context); 669 670 /** 671 * The constructor used to create a DocumentViewPicker object. 672 * 673 * @param { Context } context - represents the context. 674 * @param { window.Window } window - represents the window. 675 * @syscap SystemCapability.FileManagement.UserFileService 676 * @since 13 677 */ 678 constructor(context: Context, window: window.Window); 679 680 /** 681 * Pull up the document picker based on the selection mode. 682 * 683 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 684 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 685 * @syscap SystemCapability.FileManagement.UserFileService 686 * @since 9 687 */ 688 /** 689 * Pull up the document picker based on the selection mode. 690 * 691 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 692 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 693 * @syscap SystemCapability.FileManagement.UserFileService 694 * @crossplatform 695 * @atomicservice 696 * @since 12 697 */ 698 select(option?: DocumentSelectOptions): Promise<Array<string>>; 699 700 /** 701 * Pull up the document picker based on the selection mode. 702 * 703 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 704 * @param { AsyncCallback<Array<string>> } callback - callback 705 * @syscap SystemCapability.FileManagement.UserFileService 706 * @since 9 707 */ 708 /** 709 * Pull up the document picker based on the selection mode. 710 * 711 * @param { DocumentSelectOptions } option - represents the options provided in select mode. 712 * @param { AsyncCallback<Array<string>> } callback - callback 713 * @syscap SystemCapability.FileManagement.UserFileService 714 * @crossplatform 715 * @atomicservice 716 * @since 12 717 */ 718 select(option: DocumentSelectOptions, callback: AsyncCallback<Array<string>>): void; 719 720 /** 721 * Pull up the document picker based on the selection mode. 722 * 723 * @param { AsyncCallback<Array<string>> } callback - callback 724 * @syscap SystemCapability.FileManagement.UserFileService 725 * @since 9 726 */ 727 /** 728 * Pull up the document picker based on the selection mode. 729 * 730 * @param { AsyncCallback<Array<string>> } callback - callback 731 * @syscap SystemCapability.FileManagement.UserFileService 732 * @crossplatform 733 * @atomicservice 734 * @since 12 735 */ 736 select(callback: AsyncCallback<Array<string>>): void; 737 738 /** 739 * Pull up the document picker based on the save mode. 740 * 741 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 742 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 743 * @syscap SystemCapability.FileManagement.UserFileService 744 * @since 9 745 */ 746 /** 747 * Pull up the document picker based on the save mode. 748 * 749 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 750 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 751 * @syscap SystemCapability.FileManagement.UserFileService 752 * @crossplatform 753 * @atomicservice 754 * @since 12 755 */ 756 save(option?: DocumentSaveOptions): Promise<Array<string>>; 757 758 /** 759 * Pull up the document picker based on the save mode. 760 * 761 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 762 * @param { AsyncCallback<Array<string>> } callback - callback 763 * @syscap SystemCapability.FileManagement.UserFileService 764 * @since 9 765 */ 766 /** 767 * Pull up the document picker based on the save mode. 768 * 769 * @param { DocumentSaveOptions } option - represents the options provided in save mode. 770 * @param { AsyncCallback<Array<string>> } callback - callback 771 * @syscap SystemCapability.FileManagement.UserFileService 772 * @crossplatform 773 * @atomicservice 774 * @since 12 775 */ 776 save(option: DocumentSaveOptions, callback: AsyncCallback<Array<string>>): void; 777 778 /** 779 * Pull up the document picker based on the save mode. 780 * 781 * @param { AsyncCallback<Array<string>> } callback - callback 782 * @syscap SystemCapability.FileManagement.UserFileService 783 * @since 9 784 */ 785 /** 786 * Pull up the document picker based on the save mode. 787 * 788 * @param { AsyncCallback<Array<string>> } callback - callback 789 * @syscap SystemCapability.FileManagement.UserFileService 790 * @crossplatform 791 * @atomicservice 792 * @since 12 793 */ 794 save(callback: AsyncCallback<Array<string>>): void; 795 796 /** 797 * Obtain the saving type selected by the user. 798 * 799 * @returns { number } Returns the index of the suffix array fileSuffixChoices configured by the user in DocumentSaveOptions. 800 * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection 801 * @crossplatform 802 * @atomicservice 803 * @since 14 804 */ 805 getSelectedIndex(): number; 806 } 807 808 /** 809 * AudioSelectOptions Object. Currently not supported. 810 * 811 * @syscap SystemCapability.FileManagement.UserFileService 812 * @since 9 813 */ 814 /** 815 * AudioSelectOptions Object. 816 * 817 * @syscap SystemCapability.FileManagement.UserFileService 818 * @crossplatform 819 * @atomicservice 820 * @since 12 821 */ 822 class AudioSelectOptions { 823 /** 824 * Maximum number of audio for a single selection. 825 * 826 * @type { ?number } 827 * @syscap SystemCapability.FileManagement.UserFileService 828 * @crossplatform 829 * @atomicservice 830 * @since 12 831 */ 832 maxSelectNumber?: number; 833 } 834 835 /** 836 * AudioSaveOptions Object 837 * 838 * @syscap SystemCapability.FileManagement.UserFileService 839 * @since 9 840 */ 841 /** 842 * AudioSaveOptions Object 843 * 844 * @syscap SystemCapability.FileManagement.UserFileService 845 * @crossplatform 846 * @atomicservice 847 * @since 12 848 */ 849 class AudioSaveOptions { 850 /** 851 * The names of the files to be saved. 852 * 853 * @type { ?Array<string> } 854 * @syscap SystemCapability.FileManagement.UserFileService 855 * @since 9 856 */ 857 /** 858 * The names of the files to be saved. 859 * 860 * @type { ?Array<string> } 861 * @syscap SystemCapability.FileManagement.UserFileService 862 * @crossplatform 863 * @atomicservice 864 * @since 12 865 */ 866 newFileNames?: Array<string>; 867 } 868 869 /** 870 * AudioViewPicker Object 871 * 872 * @syscap SystemCapability.FileManagement.UserFileService 873 * @since 9 874 */ 875 /** 876 * AudioViewPicker Object 877 * 878 * @syscap SystemCapability.FileManagement.UserFileService 879 * @crossplatform 880 * @atomicservice 881 * @since 12 882 */ 883 class AudioViewPicker { 884 /** 885 * The constructor used to create a AudioViewPicker object. 886 * 887 * @syscap SystemCapability.FileManagement.UserFileService 888 * @atomicservice 889 * @since 12 890 */ 891 constructor(); 892 893 /** 894 * The constructor used to create a AudioViewPicker object. 895 * 896 * @param { Context } context - represents the context. 897 * @syscap SystemCapability.FileManagement.UserFileService 898 * @atomicservice 899 * @since 12 900 */ 901 constructor(context: Context); 902 903 /** 904 * Pull up the audio picker based on the selection mode. 905 * 906 * @param { AudioSelectOptions } option - represents the options provided in select mode. 907 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 908 * @syscap SystemCapability.FileManagement.UserFileService 909 * @since 9 910 */ 911 /** 912 * Pull up the audio picker based on the selection mode. 913 * 914 * @param { AudioSelectOptions } option - represents the options provided in select mode. 915 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 916 * @syscap SystemCapability.FileManagement.UserFileService 917 * @crossplatform 918 * @atomicservice 919 * @since 12 920 */ 921 select(option?: AudioSelectOptions): Promise<Array<string>>; 922 923 /** 924 * Pull up the audio picker based on the selection mode. 925 * 926 * @param { AudioSelectOptions } option - represents the options provided in select mode. 927 * @param { AsyncCallback<Array<string>> } callback - callback 928 * @syscap SystemCapability.FileManagement.UserFileService 929 * @since 9 930 */ 931 /** 932 * Pull up the audio picker based on the selection mode. 933 * 934 * @param { AudioSelectOptions } option - represents the options provided in select mode. 935 * @param { AsyncCallback<Array<string>> } callback - callback 936 * @syscap SystemCapability.FileManagement.UserFileService 937 * @crossplatform 938 * @since 12 939 */ 940 select(option: AudioSelectOptions, callback: AsyncCallback<Array<string>>): void; 941 942 /** 943 * Pull up the audio picker based on the selection mode. 944 * 945 * @param { AsyncCallback<Array<string>> } callback - callback 946 * @syscap SystemCapability.FileManagement.UserFileService 947 * @since 9 948 */ 949 /** 950 * Pull up the audio picker based on the selection mode. 951 * 952 * @param { AsyncCallback<Array<string>> } callback - callback 953 * @syscap SystemCapability.FileManagement.UserFileService 954 * @crossplatform 955 * @since 12 956 */ 957 select(callback: AsyncCallback<Array<string>>): void; 958 959 /** 960 * Pull up the audio picker based on the save mode. 961 * 962 * @param { AudioSaveOptions } option - represents the options provided in save mode. 963 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 964 * @syscap SystemCapability.FileManagement.UserFileService 965 * @since 9 966 */ 967 /** 968 * Pull up the audio picker based on the save mode. 969 * 970 * @param { AudioSaveOptions } option - represents the options provided in save mode. 971 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 972 * @syscap SystemCapability.FileManagement.UserFileService 973 * @crossplatform 974 * @atomicservice 975 * @since 12 976 */ 977 save(option?: AudioSaveOptions): Promise<Array<string>>; 978 979 /** 980 * Pull up the audio picker based on the save mode. 981 * 982 * @param { AudioSaveOptions } option - represents the options provided in save mode. 983 * @param { AsyncCallback<Array<string>> } callback - callback 984 * @syscap SystemCapability.FileManagement.UserFileService 985 * @since 9 986 */ 987 /** 988 * Pull up the audio picker based on the save mode. 989 * 990 * @param { AudioSaveOptions } option - represents the options provided in save mode. 991 * @param { AsyncCallback<Array<string>> } callback - callback 992 * @syscap SystemCapability.FileManagement.UserFileService 993 * @crossplatform 994 * @since 12 995 */ 996 save(option: AudioSaveOptions, callback: AsyncCallback<Array<string>>): void; 997 998 /** 999 * Pull up the audio picker based on the save mode. 1000 * 1001 * @param { AsyncCallback<Array<string>> } callback - callback 1002 * @syscap SystemCapability.FileManagement.UserFileService 1003 * @since 9 1004 */ 1005 /** 1006 * Pull up the audio picker based on the save mode. 1007 * 1008 * @param { AsyncCallback<Array<string>> } callback - callback 1009 * @syscap SystemCapability.FileManagement.UserFileService 1010 * @crossplatform 1011 * @since 12 1012 */ 1013 save(callback: AsyncCallback<Array<string>>): void; 1014 } 1015} 1016 1017export default picker; 1018