1048147e0Sopenharmony_ci// @ts-nocheck 2048147e0Sopenharmony_ci/** 3048147e0Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 4048147e0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 5048147e0Sopenharmony_ci * you may not use this file except in compliance with the License. 6048147e0Sopenharmony_ci * You may obtain a copy of the License at 7048147e0Sopenharmony_ci * 8048147e0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 9048147e0Sopenharmony_ci * 10048147e0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 11048147e0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 12048147e0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13048147e0Sopenharmony_ci * See the License for the specific language governing permissions and 14048147e0Sopenharmony_ci * limitations under the License. 15048147e0Sopenharmony_ci */ 16048147e0Sopenharmony_ciimport BaseDataSource from './BaseDataSource'; 17048147e0Sopenharmony_ciimport HiLog from '../utils/HiLog'; 18048147e0Sopenharmony_ci 19048147e0Sopenharmony_ciconst TAG = 'transmitMsgDataSource'; 20048147e0Sopenharmony_ci 21048147e0Sopenharmony_ciexport default class TransmitMsgDataSource extends BaseDataSource { 22048147e0Sopenharmony_ci private mmsList: Array = []; 23048147e0Sopenharmony_ci 24048147e0Sopenharmony_ci public totalCount(): number { 25048147e0Sopenharmony_ci return this.mmsList.length; 26048147e0Sopenharmony_ci } 27048147e0Sopenharmony_ci 28048147e0Sopenharmony_ci public getData(index: number): any { 29048147e0Sopenharmony_ci if (this.mmsList == null || index >= this.mmsList.length) { 30048147e0Sopenharmony_ci HiLog.i(TAG, 'getData Conversationlist is empty'); 31048147e0Sopenharmony_ci return null; 32048147e0Sopenharmony_ci } else { 33048147e0Sopenharmony_ci let conversation = this.mmsList[index]; 34048147e0Sopenharmony_ci return { 35048147e0Sopenharmony_ci index: index, 36048147e0Sopenharmony_ci conversation: conversation 37048147e0Sopenharmony_ci }; 38048147e0Sopenharmony_ci } 39048147e0Sopenharmony_ci } 40048147e0Sopenharmony_ci 41048147e0Sopenharmony_ci public refresh(conversationList) { 42048147e0Sopenharmony_ci HiLog.i(TAG, ' refresh!'); 43048147e0Sopenharmony_ci this.mmsList = conversationList; 44048147e0Sopenharmony_ci this.notifyDataReload(); 45048147e0Sopenharmony_ci } 46048147e0Sopenharmony_ci}