176fd607bSopenharmony_ci/* 276fd607bSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 376fd607bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 476fd607bSopenharmony_ci * you may not use this file except in compliance with the License. 576fd607bSopenharmony_ci * You may obtain a copy of the License at 676fd607bSopenharmony_ci * 776fd607bSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 876fd607bSopenharmony_ci * 976fd607bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1076fd607bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1176fd607bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1276fd607bSopenharmony_ci * See the License for the specific language governing permissions and 1376fd607bSopenharmony_ci * limitations under the License. 1476fd607bSopenharmony_ci */ 1576fd607bSopenharmony_ci 1676fd607bSopenharmony_ciexport class AlbumPickerComponent extends ViewPU { 1776fd607bSopenharmony_ci constructor(e, o, n, t = -1, i = void 0) { 1876fd607bSopenharmony_ci super(e, n, t); 1976fd607bSopenharmony_ci 'function' === typeof i && (this.paramsGenerator_ = i); 2076fd607bSopenharmony_ci this.albumPickerOptions = void 0; 2176fd607bSopenharmony_ci this.onAlbumClick = void 0; 2276fd607bSopenharmony_ci this.onEmptyAreaClick = void 0; 2376fd607bSopenharmony_ci this.setInitiallyProvidedValue(o); 2476fd607bSopenharmony_ci } 2576fd607bSopenharmony_ci 2676fd607bSopenharmony_ci setInitiallyProvidedValue(e) { 2776fd607bSopenharmony_ci void 0 !== e.albumPickerOptions && (this.albumPickerOptions = e.albumPickerOptions); 2876fd607bSopenharmony_ci void 0 !== e.onAlbumClick && (this.onAlbumClick = e.onAlbumClick); 2976fd607bSopenharmony_ci void 0 !== e.onEmptyAreaClick && (this.onEmptyAreaClick = e.onEmptyAreaClick); 3076fd607bSopenharmony_ci } 3176fd607bSopenharmony_ci 3276fd607bSopenharmony_ci updateStateVars(e) { 3376fd607bSopenharmony_ci } 3476fd607bSopenharmony_ci 3576fd607bSopenharmony_ci purgeVariableDependenciesOnElmtId(e) { 3676fd607bSopenharmony_ci } 3776fd607bSopenharmony_ci 3876fd607bSopenharmony_ci aboutToBeDeleted() { 3976fd607bSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 4076fd607bSopenharmony_ci this.aboutToBeDeletedInternal(); 4176fd607bSopenharmony_ci } 4276fd607bSopenharmony_ci 4376fd607bSopenharmony_ci initialRender() { 4476fd607bSopenharmony_ci this.observeComponentCreation2(((e, o) => { 4576fd607bSopenharmony_ci Row.create(); 4676fd607bSopenharmony_ci Row.height('100%'); 4776fd607bSopenharmony_ci }), Row); 4876fd607bSopenharmony_ci this.observeComponentCreation2(((e, o) => { 4976fd607bSopenharmony_ci Column.create(); 5076fd607bSopenharmony_ci Column.width('100%'); 5176fd607bSopenharmony_ci }), Column); 5276fd607bSopenharmony_ci this.observeComponentCreation2(((e, o) => { 5376fd607bSopenharmony_ci var n; 5476fd607bSopenharmony_ci var m; 5576fd607bSopenharmony_ci SecurityUIExtensionComponent.create({ 5676fd607bSopenharmony_ci parameters: { 5776fd607bSopenharmony_ci 'ability.want.params.uiExtensionTargetType': 'photoPicker', 5876fd607bSopenharmony_ci targetPage: 'albumPage', 5976fd607bSopenharmony_ci themeColorMode: null === (n = this.albumPickerOptions) || void 0 === n ? void 0 : n.themeColorMode, 6076fd607bSopenharmony_ci filterType: null === (m = this.albumPickerOptions) || void 0 === m ? void 0 : m.filterType 6176fd607bSopenharmony_ci } 6276fd607bSopenharmony_ci }); 6376fd607bSopenharmony_ci SecurityUIExtensionComponent.height('100%'); 6476fd607bSopenharmony_ci SecurityUIExtensionComponent.width('100%'); 6576fd607bSopenharmony_ci SecurityUIExtensionComponent.onRemoteReady((e => { 6676fd607bSopenharmony_ci console.info('AlbumPickerComponent onRemoteReady'); 6776fd607bSopenharmony_ci })); 6876fd607bSopenharmony_ci SecurityUIExtensionComponent.onReceive((e => { 6976fd607bSopenharmony_ci this.handleOnRecevie(e); 7076fd607bSopenharmony_ci })); 7176fd607bSopenharmony_ci SecurityUIExtensionComponent.onError((() => { 7276fd607bSopenharmony_ci console.info('AlbumPickerComponent onError'); 7376fd607bSopenharmony_ci })); 7476fd607bSopenharmony_ci }), SecurityUIExtensionComponent); 7576fd607bSopenharmony_ci Column.pop(); 7676fd607bSopenharmony_ci Row.pop(); 7776fd607bSopenharmony_ci } 7876fd607bSopenharmony_ci 7976fd607bSopenharmony_ci handleOnRecevie(e) { 8076fd607bSopenharmony_ci let o = e; 8176fd607bSopenharmony_ci let n = o.dataType; 8276fd607bSopenharmony_ci if ('selectAlbum' === n) { 8376fd607bSopenharmony_ci if (this.onAlbumClick) { 8476fd607bSopenharmony_ci let e = new AlbumInfo; 8576fd607bSopenharmony_ci e.uri = o.albumUri; 8676fd607bSopenharmony_ci e.albumName = o.albumName; 8776fd607bSopenharmony_ci this.onAlbumClick(e); 8876fd607bSopenharmony_ci } 8976fd607bSopenharmony_ci } else if ('emptyAreaClick' === n) { 9076fd607bSopenharmony_ci if (this.onEmptyAreaClick) { 9176fd607bSopenharmony_ci this.onEmptyAreaClick(); 9276fd607bSopenharmony_ci } 9376fd607bSopenharmony_ci } else { 9476fd607bSopenharmony_ci console.info('AlbumPickerComponent onReceive: other case'); 9576fd607bSopenharmony_ci } 9676fd607bSopenharmony_ci console.info('AlbumPickerComponent onReceive ' + n); 9776fd607bSopenharmony_ci } 9876fd607bSopenharmony_ci 9976fd607bSopenharmony_ci rerender() { 10076fd607bSopenharmony_ci this.updateDirtyElements(); 10176fd607bSopenharmony_ci } 10276fd607bSopenharmony_ci} 10376fd607bSopenharmony_ci 10476fd607bSopenharmony_ciexport class AlbumPickerOptions { 10576fd607bSopenharmony_ci} 10676fd607bSopenharmony_ci 10776fd607bSopenharmony_ciexport class AlbumInfo { 10876fd607bSopenharmony_ci} 10976fd607bSopenharmony_ci 11076fd607bSopenharmony_ciexport default { AlbumPickerComponent, AlbumPickerOptions, AlbumInfo };