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.FolderSelection 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 /** 798 * AudioSelectOptions Object. Currently not supported. 799 * 800 * @syscap SystemCapability.FileManagement.UserFileService 801 * @since 9 802 */ 803 /** 804 * AudioSelectOptions Object. 805 * 806 * @syscap SystemCapability.FileManagement.UserFileService 807 * @crossplatform 808 * @atomicservice 809 * @since 12 810 */ 811 class AudioSelectOptions { 812 /** 813 * Maximum number of audio for a single selection. 814 * 815 * @type { ?number } 816 * @syscap SystemCapability.FileManagement.UserFileService 817 * @crossplatform 818 * @atomicservice 819 * @since 12 820 */ 821 maxSelectNumber?: number; 822 } 823 824 /** 825 * AudioSaveOptions Object 826 * 827 * @syscap SystemCapability.FileManagement.UserFileService 828 * @since 9 829 */ 830 /** 831 * AudioSaveOptions Object 832 * 833 * @syscap SystemCapability.FileManagement.UserFileService 834 * @crossplatform 835 * @atomicservice 836 * @since 12 837 */ 838 class AudioSaveOptions { 839 /** 840 * The names of the files to be saved. 841 * 842 * @type { ?Array<string> } 843 * @syscap SystemCapability.FileManagement.UserFileService 844 * @since 9 845 */ 846 /** 847 * The names of the files to be saved. 848 * 849 * @type { ?Array<string> } 850 * @syscap SystemCapability.FileManagement.UserFileService 851 * @crossplatform 852 * @atomicservice 853 * @since 12 854 */ 855 newFileNames?: Array<string>; 856 } 857 858 /** 859 * AudioViewPicker Object 860 * 861 * @syscap SystemCapability.FileManagement.UserFileService 862 * @since 9 863 */ 864 /** 865 * AudioViewPicker Object 866 * 867 * @syscap SystemCapability.FileManagement.UserFileService 868 * @crossplatform 869 * @atomicservice 870 * @since 12 871 */ 872 class AudioViewPicker { 873 /** 874 * The constructor used to create a AudioViewPicker object. 875 * 876 * @syscap SystemCapability.FileManagement.UserFileService 877 * @atomicservice 878 * @since 12 879 */ 880 constructor(); 881 882 /** 883 * The constructor used to create a AudioViewPicker object. 884 * 885 * @param { Context } context - represents the context. 886 * @syscap SystemCapability.FileManagement.UserFileService 887 * @atomicservice 888 * @since 12 889 */ 890 constructor(context: Context); 891 892 /** 893 * Pull up the audio picker based on the selection mode. 894 * 895 * @param { AudioSelectOptions } option - represents the options provided in select mode. 896 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 897 * @syscap SystemCapability.FileManagement.UserFileService 898 * @since 9 899 */ 900 /** 901 * Pull up the audio picker based on the selection mode. 902 * 903 * @param { AudioSelectOptions } option - represents the options provided in select mode. 904 * @returns { Promise<Array<string>> } Returns the uris for the selected files. 905 * @syscap SystemCapability.FileManagement.UserFileService 906 * @crossplatform 907 * @atomicservice 908 * @since 12 909 */ 910 select(option?: AudioSelectOptions): Promise<Array<string>>; 911 912 /** 913 * Pull up the audio picker based on the selection mode. 914 * 915 * @param { AudioSelectOptions } option - represents the options provided in select mode. 916 * @param { AsyncCallback<Array<string>> } callback - callback 917 * @syscap SystemCapability.FileManagement.UserFileService 918 * @since 9 919 */ 920 /** 921 * Pull up the audio picker based on the selection mode. 922 * 923 * @param { AudioSelectOptions } option - represents the options provided in select mode. 924 * @param { AsyncCallback<Array<string>> } callback - callback 925 * @syscap SystemCapability.FileManagement.UserFileService 926 * @crossplatform 927 * @since 12 928 */ 929 select(option: AudioSelectOptions, callback: AsyncCallback<Array<string>>): void; 930 931 /** 932 * Pull up the audio picker based on the selection mode. 933 * 934 * @param { AsyncCallback<Array<string>> } callback - callback 935 * @syscap SystemCapability.FileManagement.UserFileService 936 * @since 9 937 */ 938 /** 939 * Pull up the audio picker based on the selection mode. 940 * 941 * @param { AsyncCallback<Array<string>> } callback - callback 942 * @syscap SystemCapability.FileManagement.UserFileService 943 * @crossplatform 944 * @since 12 945 */ 946 select(callback: AsyncCallback<Array<string>>): void; 947 948 /** 949 * Pull up the audio picker based on the save mode. 950 * 951 * @param { AudioSaveOptions } option - represents the options provided in save mode. 952 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 953 * @syscap SystemCapability.FileManagement.UserFileService 954 * @since 9 955 */ 956 /** 957 * Pull up the audio picker based on the save mode. 958 * 959 * @param { AudioSaveOptions } option - represents the options provided in save mode. 960 * @returns { Promise<Array<string>> } Returns the uris for the saved files. 961 * @syscap SystemCapability.FileManagement.UserFileService 962 * @crossplatform 963 * @atomicservice 964 * @since 12 965 */ 966 save(option?: AudioSaveOptions): Promise<Array<string>>; 967 968 /** 969 * Pull up the audio picker based on the save mode. 970 * 971 * @param { AudioSaveOptions } option - represents the options provided in save mode. 972 * @param { AsyncCallback<Array<string>> } callback - callback 973 * @syscap SystemCapability.FileManagement.UserFileService 974 * @since 9 975 */ 976 /** 977 * Pull up the audio picker based on the save mode. 978 * 979 * @param { AudioSaveOptions } option - represents the options provided in save mode. 980 * @param { AsyncCallback<Array<string>> } callback - callback 981 * @syscap SystemCapability.FileManagement.UserFileService 982 * @crossplatform 983 * @since 12 984 */ 985 save(option: AudioSaveOptions, callback: AsyncCallback<Array<string>>): void; 986 987 /** 988 * Pull up the audio picker based on the save mode. 989 * 990 * @param { AsyncCallback<Array<string>> } callback - callback 991 * @syscap SystemCapability.FileManagement.UserFileService 992 * @since 9 993 */ 994 /** 995 * Pull up the audio picker based on the save mode. 996 * 997 * @param { AsyncCallback<Array<string>> } callback - callback 998 * @syscap SystemCapability.FileManagement.UserFileService 999 * @crossplatform 1000 * @since 12 1001 */ 1002 save(callback: AsyncCallback<Array<string>>): void; 1003 } 1004} 1005 1006export default picker; 1007