mirror of
https://gitee.com/openharmony/applications_mms
synced 2024-11-26 17:30:42 +00:00
修改codeCheck
Signed-off-by: liyufan <liyufan5@huawei.com>
This commit is contained in:
parent
e624598e06
commit
ae4956b60b
@ -12,21 +12,21 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import AbilityStage from '@ohos.app.ability.UIAbility'
|
||||
import AbilityStage from '@ohos.app.ability.UIAbility';
|
||||
import notification from '@ohos.notificationManager';
|
||||
|
||||
import HiLog from '../utils/HiLog';
|
||||
|
||||
const TAG = "MyAbilityStage"
|
||||
const TAG = 'MyAbilityStage';
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
HiLog.i(TAG, "AbilityStage onCreate");
|
||||
HiLog.i(TAG, 'AbilityStage onCreate');
|
||||
notification.setNotificationEnable({
|
||||
bundle: "com.ohos.mms"
|
||||
bundle: 'com.ohos.mms'
|
||||
}, true, (err, data) => {
|
||||
if (err) {
|
||||
HiLog.i(TAG, "enableNotification err: " + JSON.stringify(err));
|
||||
HiLog.i(TAG, 'enableNotification err: ' + JSON.stringify(err));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -15,61 +15,61 @@
|
||||
import Ability from '@ohos.app.ability.UIAbility'
|
||||
import Window from '@ohos.window'
|
||||
|
||||
import HiLog from "../utils/HiLog";
|
||||
import MmsPreferences from "../utils/MmsPreferences";
|
||||
import WorkFactory, { WorkerType } from "../workers/WorkFactory";
|
||||
import simCardService from "../service/SimCardService";
|
||||
import HiLog from '../utils/HiLog';
|
||||
import MmsPreferences from '../utils/MmsPreferences';
|
||||
import WorkFactory, { WorkerType } from '../workers/WorkFactory';
|
||||
import simCardService from '../service/SimCardService';
|
||||
|
||||
const TAG = "app";
|
||||
const TAG = 'app';
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
HiLog.i(TAG, "Ability onCreate com.ohos.mms version: 1.0.0.41");
|
||||
globalThis.mmsContext = this.context;
|
||||
globalThis.abilityWant = want;
|
||||
globalThis.needToUpdate = true;
|
||||
MmsPreferences.getInstance().initPreferences();
|
||||
globalThis.DataWorker = WorkFactory.getWorker(WorkerType.DataWorker);
|
||||
}
|
||||
onCreate(want, launchParam): void {
|
||||
HiLog.i(TAG, 'Ability onCreate com.ohos.mms version: 1.0.0.41');
|
||||
globalThis.mmsContext = this.context;
|
||||
globalThis.abilityWant = want;
|
||||
globalThis.needToUpdate = true;
|
||||
MmsPreferences.getInstance().initPreferences();
|
||||
globalThis.DataWorker = WorkFactory.getWorker(WorkerType.DataWorker);
|
||||
}
|
||||
|
||||
onNewWant(want, launchParam) {
|
||||
HiLog.i(TAG, 'Application onNewWant');
|
||||
globalThis.abilityWant = want;
|
||||
}
|
||||
onNewWant(want, launchParam): void {
|
||||
HiLog.i(TAG, 'Application onNewWant');
|
||||
globalThis.abilityWant = want;
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage: Window.WindowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
windowStage.loadContent('pages/index', (err, data) => {
|
||||
if (err.code) {
|
||||
HiLog.e(TAG, 'testTag', 'Failed to load the content.');
|
||||
return;
|
||||
}
|
||||
HiLog.i(TAG, 'testTag', 'Succeeded in loading the content. Data: %{public}s');
|
||||
});
|
||||
}
|
||||
onWindowStageCreate(windowStage: Window.WindowStage): void {
|
||||
// Main window is created, set main page for this ability
|
||||
windowStage.loadContent('pages/index', (err, data) => {
|
||||
if (err.code) {
|
||||
HiLog.e(TAG, 'testTag', 'Failed to load the content.');
|
||||
return;
|
||||
}
|
||||
HiLog.i(TAG, 'testTag', 'Succeeded in loading the content. Data: %{public}s');
|
||||
});
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
HiLog.i(TAG, 'Ability onWindowStageDestroy');
|
||||
}
|
||||
onWindowStageDestroy(): void {
|
||||
// Main window is destroyed, release UI related resources
|
||||
HiLog.i(TAG, 'Ability onWindowStageDestroy');
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
HiLog.i(TAG, 'Ability onForeground');
|
||||
simCardService.init();
|
||||
}
|
||||
onForeground(): void {
|
||||
// Ability has brought to foreground
|
||||
HiLog.i(TAG, 'Ability onForeground');
|
||||
simCardService.init();
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
HiLog.i(TAG, 'Ability onBackground');
|
||||
simCardService.deInit();
|
||||
}
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
HiLog.i(TAG, 'Ability onBackground');
|
||||
simCardService.deInit();
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
HiLog.i(TAG, 'Ability onDestroy');
|
||||
if (globalThis.DataWorker == null || globalThis.DataWorker == undefined) {
|
||||
return;
|
||||
}
|
||||
globalThis.DataWorker.close();
|
||||
onDestroy() {
|
||||
HiLog.i(TAG, 'Ability onDestroy');
|
||||
if (globalThis.DataWorker == null || globalThis.DataWorker == undefined) {
|
||||
return;
|
||||
}
|
||||
globalThis.DataWorker.close();
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import commonEvent from "@ohos.commonEventManager";
|
||||
import telSim from "@ohos.telephony.sms";
|
||||
import http from "@ohos.net.http";
|
||||
import commonEvent from '@ohos.commonEventManager';
|
||||
import telSim from '@ohos.telephony.sms';
|
||||
import http from '@ohos.net.http';
|
||||
|
||||
import common from '../data/commonData';
|
||||
import telephoneUtils from '../utils/TelephoneUtil';
|
||||
@ -42,7 +42,7 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
}
|
||||
|
||||
public async dealSmsReceiveData(data, context): Promise<void> {
|
||||
let netType: string = data.parameters.isCdma ? "3gpp2" : "3gpp";
|
||||
let netType: string = data.parameters.isCdma ? '3gpp2' : '3gpp';
|
||||
// Synchronize wait operation
|
||||
let promisesAll = [];
|
||||
data.parameters.pdus.forEach(pdu => {
|
||||
@ -59,7 +59,7 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
result.content += shortMessage.visibleMessageBody;
|
||||
});
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "dealSmsReceiveData, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'dealSmsReceiveData, error: ' + JSON.stringify(error));
|
||||
result.code = common.int.FAILURE;
|
||||
});
|
||||
await createMessagePromise;
|
||||
@ -100,13 +100,13 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
{
|
||||
method: http.RequestMethod.GET,
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
extraData: baseUrl,
|
||||
readTimeout: 50000,
|
||||
connectTimeout: 50000
|
||||
}, (err, data) => {
|
||||
HiLog.i(TAG, "saveAttachment, err: " + JSON.stringify(err.message));
|
||||
HiLog.i(TAG, 'saveAttachment, err: ' + JSON.stringify(err.message));
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -123,19 +123,19 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
break;
|
||||
// Pictures
|
||||
case 1:
|
||||
content = "(picture)" + themeContent;
|
||||
content = '(picture)' + themeContent;
|
||||
break;
|
||||
// Video
|
||||
case 2:
|
||||
content = "(video)" + themeContent;
|
||||
content = '(video)' + themeContent;
|
||||
break;
|
||||
// Audio
|
||||
case 3:
|
||||
content = "(audio)" + themeContent;
|
||||
content = '(audio)' + themeContent;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
content = "(slide)" + mmsSource[0].content;
|
||||
content = '(slide)' + mmsSource[0].content;
|
||||
}
|
||||
return content;
|
||||
}
|
||||
@ -167,11 +167,11 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
let length: number = wby.length;
|
||||
let isDouble: boolean = (length % 2) == 0;
|
||||
let halfSize: number = parseInt('' + length / 2);
|
||||
HiLog.i(TAG, "convertStrArray, length=" + length + ", isDouble=" + isDouble);
|
||||
HiLog.i(TAG, 'convertStrArray, length=' + length + ', isDouble=' + isDouble);
|
||||
if (isDouble) {
|
||||
let number0xArray = new Array(halfSize);
|
||||
for (let i = 0;i < halfSize; i++) {
|
||||
number0xArray[i] = "0x" + wby.substr(i * 2, 2);
|
||||
number0xArray[i] = '0x' + wby.substr(i * 2, 2);
|
||||
}
|
||||
let numberArray = new Array(halfSize);
|
||||
for (let i = 0;i < halfSize; i++) {
|
||||
@ -181,21 +181,21 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
} else {
|
||||
let number0xArray = new Array(halfSize + 1);
|
||||
for (let i = 0;i < halfSize; i++) {
|
||||
number0xArray[i] = "0x" + wby.substr(i * 2, 2);
|
||||
number0xArray[i] = '0x' + wby.substr(i * 2, 2);
|
||||
}
|
||||
number0xArray[halfSize] = "0x" + wby.substr((halfSize * 2) + 1, 1);
|
||||
number0xArray[halfSize] = '0x' + wby.substr((halfSize * 2) + 1, 1);
|
||||
let numberArray = new Array(halfSize + 1);
|
||||
for (let i = 0;i < halfSize; i++) {
|
||||
numberArray[i] = parseInt(number0xArray[i], 16);
|
||||
}
|
||||
let last0x = "0x" + wby.substr(wby.length - 1, 1);
|
||||
let last0x = '0x' + wby.substr(wby.length - 1, 1);
|
||||
numberArray[halfSize] = parseInt(last0x);
|
||||
return numberArray;
|
||||
}
|
||||
}
|
||||
|
||||
public publishData(telephone, content): void {
|
||||
HiLog.i(TAG, "publishData, start");
|
||||
HiLog.i(TAG, 'publishData, start');
|
||||
let actionData = {
|
||||
telephone: telephone,
|
||||
content: content
|
||||
@ -213,22 +213,22 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
let condition: LooseObject = {};
|
||||
condition.telephones = [telephone];
|
||||
ContactService.getInstance().queryContactDataByCondition(condition, res => {
|
||||
HiLog.i(TAG, "sendNotification, callback");
|
||||
HiLog.i(TAG, 'sendNotification, callback');
|
||||
if (res.code == common.int.FAILURE) {
|
||||
return;
|
||||
}
|
||||
let contacts: Array<LooseObject> = res.abilityResult;
|
||||
let actionData: LooseObject = this.dealContactParams(contacts, telephone);
|
||||
if (content.length > 15) {
|
||||
content = content.substring(0, 15) + "...";
|
||||
content = content.substring(0, 15) + '...';
|
||||
}
|
||||
let title: string = telephone;
|
||||
if(contacts.length > 0) {
|
||||
title = contacts[0].displayName
|
||||
}
|
||||
let message: LooseObject = {
|
||||
"title": title,
|
||||
"text": content,
|
||||
'title': title,
|
||||
'text': content,
|
||||
};
|
||||
actionData.message = message;
|
||||
actionData.msgId = msgId;
|
||||
|
@ -1,22 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import pasteboard from "@ohos.pasteboard";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import pasteboard from '@ohos.pasteboard';
|
||||
import HiLog from '../utils/HiLog';
|
||||
|
||||
const TAG = "Pasteboard";
|
||||
const TAG = 'Pasteboard';
|
||||
let commonPasteboard = {
|
||||
getPasteboard() {
|
||||
let sysPasteboard = pasteboard.getSystemPasteboard();
|
||||
@ -26,7 +26,7 @@ let commonPasteboard = {
|
||||
let sysPasteboard = pasteboard.getSystemPasteboard();
|
||||
let textData = pasteboard.createPlainTextData(text);
|
||||
sysPasteboard.setPasteData(textData, () => {
|
||||
HiLog.i(TAG, "setPasteboard done");
|
||||
HiLog.i(TAG, 'setPasteboard done');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -15,8 +15,8 @@
|
||||
|
||||
export default {
|
||||
bool: {
|
||||
TRUE: "1",
|
||||
FALSE: "0",
|
||||
TRUE: '1',
|
||||
FALSE: '0',
|
||||
},
|
||||
route: {
|
||||
// Update the value of the delivery report switch.
|
||||
@ -95,136 +95,136 @@ export default {
|
||||
EVENT_SLOTID_CHANGE: 2,
|
||||
},
|
||||
string: {
|
||||
SMS_TYPE: "0",
|
||||
SMS_TYPE: '0',
|
||||
// Empty String
|
||||
EMPTY_STR: '',
|
||||
// comma
|
||||
COMMA: ",",
|
||||
COMMA: ',',
|
||||
// bundleName
|
||||
BUNDLE_NAME: "com.ohos.mms",
|
||||
BUNDLE_NAME: 'com.ohos.mms',
|
||||
// abilityName
|
||||
ABILITY_NAME: "com.ohos.mms.MainAbility",
|
||||
ABILITY_NAME: 'com.ohos.mms.MainAbility',
|
||||
// BundleName of a contact.
|
||||
CONTACT_BUNDLE_NAME: "com.ohos.contacts",
|
||||
CONTACT_BUNDLE_NAME: 'com.ohos.contacts',
|
||||
// contact AbilityName
|
||||
CONTACT_ABILITY_NAME: "com.ohos.contacts.MainAbility",
|
||||
CONTACT_ABILITY_NAME: 'com.ohos.contacts.MainAbility',
|
||||
// Public entity
|
||||
COMMON_ENTITIES: "entity.system.home",
|
||||
COMMON_ENTITIES: 'entity.system.home',
|
||||
// Processing succeeded.
|
||||
SUCCESS: "success",
|
||||
SUCCESS: 'success',
|
||||
// Storage path of the lightweight preference database
|
||||
PATH_OF_PREFERENCES: "/PREFERENCES_FOR_MMS",
|
||||
PATH_OF_PREFERENCES: '/PREFERENCES_FOR_MMS',
|
||||
// Notification information integration
|
||||
KEY_OF_INTEGRATION_SWITCH: "integrationSwitch",
|
||||
KEY_OF_INTEGRATION_SWITCH: 'integrationSwitch',
|
||||
// Malicious Website Identification
|
||||
KEY_OF_MALICIOUS_WEB_SWITCH: "maliciousWebSwitch",
|
||||
KEY_OF_MALICIOUS_WEB_SWITCH: 'maliciousWebSwitch',
|
||||
// Display contact avatar
|
||||
KEY_OF_SHOW_CONTACT_SWITCH: "showContactSwitch",
|
||||
KEY_OF_SHOW_CONTACT_SWITCH: 'showContactSwitch',
|
||||
// Delivery Report
|
||||
KEY_OF_DELIVERY_REPORT_SWITCH: "deliveryReportSwitch",
|
||||
KEY_OF_DELIVERY_REPORT_SWITCH: 'deliveryReportSwitch',
|
||||
// Automatically downloading MMs
|
||||
KEY_OF_AUTO_RETRIEVE_SWITCH: "autoRetrieveMmsSwitch",
|
||||
KEY_OF_AUTO_RETRIEVE_SWITCH: 'autoRetrieveMmsSwitch',
|
||||
// Cancel Sending
|
||||
KEY_OF_RECALL_MESSAGE_SWITCH: "recallMessageSwitch",
|
||||
KEY_OF_RECALL_MESSAGE_SWITCH: 'recallMessageSwitch',
|
||||
// Automatically delete notification information
|
||||
KEY_OF_AUTO_DELETE_INFO_SWITCH: "autoDeleteInfoSwitch",
|
||||
KEY_OF_AUTO_DELETE_INFO_SWITCH: 'autoDeleteInfoSwitch',
|
||||
// Number of SIM cards
|
||||
KEY_OF_SIM_COUNT: "simCount",
|
||||
KEY_OF_SIM_COUNT: 'simCount',
|
||||
// Carrier name of SIM card 1
|
||||
KEY_OF_SIM_0_SPN: "simSpn0",
|
||||
KEY_OF_SIM_0_SPN: 'simSpn0',
|
||||
// Carrier name of SIM card 2
|
||||
KEY_OF_SIM_1_SPN: "simSpn1",
|
||||
KEY_OF_SIM_1_SPN: 'simSpn1',
|
||||
// Whether SIM card 1 exists
|
||||
KEY_OF_SIM_0_EXIST_FLAG: "simExistFlag0",
|
||||
KEY_OF_SIM_0_EXIST_FLAG: 'simExistFlag0',
|
||||
// Whether SIM card 2 exists
|
||||
KEY_OF_SIM_1_EXIST_FLAG: "simExistFlag1",
|
||||
KEY_OF_SIM_1_EXIST_FLAG: 'simExistFlag1',
|
||||
// If the SMSC number of SIM card 1 is changed, the new SMSC number is changed.
|
||||
KEY_OF_NEW_SIM_0_SMSC: "newSimSmsc0",
|
||||
KEY_OF_NEW_SIM_0_SMSC: 'newSimSmsc0',
|
||||
// If the SMSC number of SIM card 2 is changed, the new SMSC number is changed.
|
||||
KEY_OF_NEW_SIM_1_SMSC: "newSimSmsc1",
|
||||
KEY_OF_NEW_SIM_1_SMSC: 'newSimSmsc1',
|
||||
// Mobile number of the SIM card
|
||||
KEY_OF_SIM_0_NUMBER: "sim_0_number",
|
||||
KEY_OF_SIM_1_NUMBER: "sim_1_number",
|
||||
KEY_OF_SELECTED_SLOTID: "selected_slotId",
|
||||
KEY_OF_MAX_SIM_COUNT: "maxSimCount",
|
||||
KEY_OF_HAVE_MULTI_SIM_CARD_READY: "haveMultiSimCardReady",
|
||||
KEY_OF_HAVE_SIM_CARD_READY: "haveSimCardReady",
|
||||
KEY_OF_DEFAULT_SLOT: "defaultSlot",
|
||||
KEY_OF_SIM_0_NUMBER: 'sim_0_number',
|
||||
KEY_OF_SIM_1_NUMBER: 'sim_1_number',
|
||||
KEY_OF_SELECTED_SLOTID: 'selected_slotId',
|
||||
KEY_OF_MAX_SIM_COUNT: 'maxSimCount',
|
||||
KEY_OF_HAVE_MULTI_SIM_CARD_READY: 'haveMultiSimCardReady',
|
||||
KEY_OF_HAVE_SIM_CARD_READY: 'haveSimCardReady',
|
||||
KEY_OF_DEFAULT_SLOT: 'defaultSlot',
|
||||
// Events for Subscribing to Notifications usual.event.SMS_RECEIVE_COMPLETED
|
||||
SUBSCRIBER_EVENT: "usual.event.SMS_RECEIVE_COMPLETED",
|
||||
SUBSCRIBER_EVENT: 'usual.event.SMS_RECEIVE_COMPLETED',
|
||||
// Receiving and forwarding
|
||||
RECEIVE_TRANSMIT_EVENT: "usual.event.RECEIVE_COMPLETED_TRANSMIT",
|
||||
RECEIVE_TRANSMIT_EVENT: 'usual.event.RECEIVE_COMPLETED_TRANSMIT',
|
||||
// MMS message receiving event
|
||||
MMS_SUBSCRIBER_EVENT: "usual.event.MMS_RECEIVE_COMPLETED",
|
||||
MMS_SUBSCRIBER_EVENT: 'usual.event.MMS_RECEIVE_COMPLETED',
|
||||
// Contact database
|
||||
URI_ROW_CONTACTS: "datashare:///com.ohos.contactsdataability",
|
||||
URI_ROW_CONTACTS: 'datashare:///com.ohos.contactsdataability',
|
||||
// Contact Information
|
||||
CONTACT_DATA_URI: "/contacts/contact_data",
|
||||
CONTACT_DATA_URI: '/contacts/contact_data',
|
||||
// Business Card Contact
|
||||
PROFILE_DATA_URI: "/profile/raw_contact",
|
||||
PROFILE_DATA_URI: '/profile/raw_contact',
|
||||
// Querying Contacts
|
||||
CONTACT_SEARCHE: "/contacts/search_contact",
|
||||
CONTACT_SEARCHE: '/contacts/search_contact',
|
||||
// Contact Information
|
||||
CONTACT_URI: "/contacts/contact",
|
||||
CONTACT_URI: '/contacts/contact',
|
||||
// SMS database
|
||||
URI_MESSAGE_LOG: "datashare:///com.ohos.smsmmsability",
|
||||
URI_MESSAGE_LOG: 'datashare:///com.ohos.smsmmsability',
|
||||
// sms_mms_info table
|
||||
URI_MESSAGE_INFO_TABLE: "/sms_mms/sms_mms_info",
|
||||
URI_MESSAGE_INFO_TABLE: '/sms_mms/sms_mms_info',
|
||||
// session table
|
||||
URI_MESSAGE_SESSION_TABLE: "/sms_mms/session",
|
||||
URI_MESSAGE_SESSION_TABLE: '/sms_mms/session',
|
||||
// Statistic
|
||||
URI_MESSAGE_UNREAD_COUNT: "/sms_mms/sms_mms_info/unread_total",
|
||||
URI_MESSAGE_UNREAD_COUNT: '/sms_mms/sms_mms_info/unread_total',
|
||||
// Get the largest groupID
|
||||
URI_MESSAGE_MAX_GROUP: "/sms_mms/sms_mms_info/max_group",
|
||||
URI_MESSAGE_MAX_GROUP: '/sms_mms/sms_mms_info/max_group',
|
||||
// Querying MMS Messages
|
||||
URI_MESSAGE_MMS_PART: "/sms_mms/mms_part",
|
||||
AUDIO_NAME: "recording2021111512454545.amr",
|
||||
URI_MESSAGE_MMS_PART: '/sms_mms/mms_part',
|
||||
AUDIO_NAME: 'recording2021111512454545.amr',
|
||||
// MMSC
|
||||
MMS_URL: "http://mmsc.monternet.com"
|
||||
MMS_URL: 'http://mmsc.monternet.com'
|
||||
},
|
||||
DELIVERY_REPORTS: {
|
||||
// Closed
|
||||
DISABLED: "0",
|
||||
DISABLED: '0',
|
||||
// SMS
|
||||
SMS: "1",
|
||||
SMS: '1',
|
||||
// MMS
|
||||
MMS: "2",
|
||||
MMS: '2',
|
||||
// SMS and MMS
|
||||
SMS_AND_MMS: "3"
|
||||
SMS_AND_MMS: '3'
|
||||
},
|
||||
AUTO_RETRIEVE_MMS: {
|
||||
// OFF
|
||||
OFF: "0",
|
||||
OFF: '0',
|
||||
// Non-roaming
|
||||
NOT_WHEN_ROAMING: "1",
|
||||
NOT_WHEN_ROAMING: '1',
|
||||
// All networks
|
||||
ALWAYS: "2"
|
||||
ALWAYS: '2'
|
||||
},
|
||||
SPN_CHINA: {
|
||||
// TELECOM
|
||||
TELECOM: "中国电信",
|
||||
TELECOM: '中国电信',
|
||||
// MOBILE
|
||||
MOBILE: "CMCC",
|
||||
MOBILE: 'CMCC',
|
||||
// UNICOM
|
||||
UNICOM: "China Unicom",
|
||||
UNICOM: 'China Unicom',
|
||||
},
|
||||
contactPage: {
|
||||
// Go to New Contact
|
||||
PAGE_FLAG_SAVE_CONTACT: "page_flag_save_contact",
|
||||
PAGE_FLAG_SAVE_CONTACT: 'page_flag_save_contact',
|
||||
// Edit Before Call
|
||||
PAGE_FLAG_EDIT_BEFORE_CALLING: "page_flag_edit_before_calling",
|
||||
PAGE_FLAG_EDIT_BEFORE_CALLING: 'page_flag_edit_before_calling',
|
||||
// Save to Existing Contacts
|
||||
PAGE_FLAG_SAVE_EXIST_CONTACT: "page_flag_save_exist_contact",
|
||||
PAGE_FLAG_SAVE_EXIST_CONTACT: 'page_flag_save_exist_contact',
|
||||
// The page for selecting a contact is displayed after an SMS message is sent.
|
||||
PAGE_FLAG_SINGLE_CHOOSE: "page_flag_single_choose",
|
||||
PAGE_FLAG_SINGLE_CHOOSE: 'page_flag_single_choose',
|
||||
// Select Contact List Page
|
||||
PAGE_FLAG_CHOOSE_CONTACTS: "page_flag_choose_contacts",
|
||||
PAGE_FLAG_CHOOSE_CONTACTS: 'page_flag_choose_contacts',
|
||||
// Contact details page
|
||||
PAGE_FLAG_CONTACT_DETAILS: "page_flag_contact_details",
|
||||
PAGE_FLAG_CONTACT_DETAILS: 'page_flag_contact_details',
|
||||
// The My Business Card page is displayed.
|
||||
PAGE_FLAG_CALLING_CARD: "page_flag_card_details",
|
||||
PAGE_FLAG_CALLING_CARD: 'page_flag_card_details',
|
||||
// Querying MMS Data
|
||||
URI_MESSAGE_MMS_PART: "/sms_mms/mms_part"
|
||||
URI_MESSAGE_MMS_PART: '/sms_mms/mms_part'
|
||||
},
|
||||
MESSAGE_TAB_INDEX: {
|
||||
TAB_CAMERA: 0,
|
||||
@ -286,26 +286,26 @@ export default {
|
||||
},
|
||||
RUN_IN_WORKER_METHOD: {
|
||||
// Contacts
|
||||
queryContactDataByCondition: "queryContactDataByCondition",
|
||||
queryContactDataSizeByCondition: "queryContactDataSizeByCondition",
|
||||
queryContactByCondition: "queryContactByCondition",
|
||||
queryContactSizeByCondition: "queryContactSizeByCondition",
|
||||
queryRawContactSizeByCondition: "queryRawContactSizeByCondition",
|
||||
queryContactViewByCondition: "queryContactViewByCondition",
|
||||
queryContactDataByCondition: 'queryContactDataByCondition',
|
||||
queryContactDataSizeByCondition: 'queryContactDataSizeByCondition',
|
||||
queryContactByCondition: 'queryContactByCondition',
|
||||
queryContactSizeByCondition: 'queryContactSizeByCondition',
|
||||
queryRawContactSizeByCondition: 'queryRawContactSizeByCondition',
|
||||
queryContactViewByCondition: 'queryContactViewByCondition',
|
||||
// detail
|
||||
insertSmsMmsInfo: "insertSmsMmsInfo",
|
||||
deleteSmsMmsInfoByCondition: "deleteSmsMmsInfoByCondition",
|
||||
updateSmsMmsInfoByCondition: "updateSmsMmsInfoByCondition",
|
||||
querySmsMmsInfoByCondition: "querySmsMmsInfoByCondition",
|
||||
querySmsMmsInfoSizeByCondition: "querySmsMmsInfoSizeByCondition",
|
||||
queryMaxGroupId: "queryMaxGroupId",
|
||||
statisticalData: "statisticalData",
|
||||
insertSmsMmsInfo: 'insertSmsMmsInfo',
|
||||
deleteSmsMmsInfoByCondition: 'deleteSmsMmsInfoByCondition',
|
||||
updateSmsMmsInfoByCondition: 'updateSmsMmsInfoByCondition',
|
||||
querySmsMmsInfoByCondition: 'querySmsMmsInfoByCondition',
|
||||
querySmsMmsInfoSizeByCondition: 'querySmsMmsInfoSizeByCondition',
|
||||
queryMaxGroupId: 'queryMaxGroupId',
|
||||
statisticalData: 'statisticalData',
|
||||
// list
|
||||
insertSession: "insertSession",
|
||||
deleteSessionByCondition: "deleteSessionByCondition",
|
||||
updateSessionByCondition: "updateSessionByCondition",
|
||||
querySessionByCondition: "querySessionByCondition",
|
||||
querySessionSizeByCondition: "querySessionSizeByCondition"
|
||||
insertSession: 'insertSession',
|
||||
deleteSessionByCondition: 'deleteSessionByCondition',
|
||||
updateSessionByCondition: 'updateSessionByCondition',
|
||||
querySessionByCondition: 'querySessionByCondition',
|
||||
querySessionSizeByCondition: 'querySessionSizeByCondition'
|
||||
},
|
||||
sms_type: {
|
||||
COMMON: 0,
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -15,116 +15,116 @@
|
||||
export default {
|
||||
// Name of the field corresponding to the session list
|
||||
sessionField: {
|
||||
id: "id", //session Table id integer
|
||||
time: "time", // Last SMS message time integer
|
||||
telephone: "telephone", //Phone number TEXT
|
||||
content: "content", // SMS message content TEXT
|
||||
contactsNum: "contacts_num", // Number of Contacts integer
|
||||
smsType: "sms_type", //Sms Type 0-Common,1-Notice integer
|
||||
unreadCount: "unread_count", // Number of unread SMs integer
|
||||
sendStatus: "sending_status", // Sending success status 0:Success ,1 :Fail , 2 : Sending... integer
|
||||
hasDraft: "has_draft", //Whether there is a draft 0: no, 1:have integer
|
||||
hasLock: "has_lock", // Whether there is a lock 0: no, 1:have integer
|
||||
messageCount: "message_count", //Total number of messages integer
|
||||
hasMms: "has_mms", //Whether there is a new message 0: no, 1:have integer
|
||||
hasAttachment: "has_attachment" //Whether there are attachments 0: no, 1:have integer
|
||||
id: 'id', //session Table id integer
|
||||
time: 'time', // Last SMS message time integer
|
||||
telephone: 'telephone', //Phone number TEXT
|
||||
content: 'content', // SMS message content TEXT
|
||||
contactsNum: 'contacts_num', // Number of Contacts integer
|
||||
smsType: 'sms_type', //Sms Type 0-Common,1-Notice integer
|
||||
unreadCount: 'unread_count', // Number of unread SMs integer
|
||||
sendStatus: 'sending_status', // Sending success status 0:Success ,1 :Fail , 2 : Sending... integer
|
||||
hasDraft: 'has_draft', //Whether there is a draft 0: no, 1:have integer
|
||||
hasLock: 'has_lock', // Whether there is a lock 0: no, 1:have integer
|
||||
messageCount: 'message_count', //Total number of messages integer
|
||||
hasMms: 'has_mms', //Whether there is a new message 0: no, 1:have integer
|
||||
hasAttachment: 'has_attachment' //Whether there are attachments 0: no, 1:have integer
|
||||
},
|
||||
// Name of the field corresponding to the SMS message details.
|
||||
messageInfo: {
|
||||
msgId: "msg_id", //sms_mms_info Table id integer
|
||||
slotId: "slot_id", //slot_id integer
|
||||
receiverNumber: "receiver_number", //Recipient number TEXT
|
||||
senderNumber: "sender_number", //Sender number TEXT
|
||||
startTime: "start_time", //Start Time TEXT
|
||||
endTime: "end_time", //End Time TEXT
|
||||
msgType: "msg_type", //Message Type 0 Subject、1 Pictures、2 Video、3 Audio、4 Text、5 business card integer
|
||||
smsType: "sms_type", //SM Type 0-Common,1-Notice integer
|
||||
msgTitle: "msg_title", //Message Title TEXT
|
||||
msgContent: "msg_content", //Message content TEXT
|
||||
msgState: "msg_state", //Message Status 0:Success ,1 :fail , 2 : Sending... integer
|
||||
operatorServiceNumber: "operator_service_number", //Operator service number TEXT
|
||||
msgCode: "msg_code", //Message Code integer
|
||||
isLock: "is_lock", //Locked 0-No,1-Yes integer
|
||||
isRead: "is_read", // Read or Not
|
||||
isCollect: "is_collect", //Favorites 0-Not favorited,1-Favorites integer
|
||||
sessionType: "session_type", //Session Type 0 - Common 1 - broadcast 2 - Group Sending integer
|
||||
retryNumber: "retry_number", //Retry Times integer
|
||||
isSubsection: "is_subsection", //Branch 0 - NO 1 - Yes integer
|
||||
sessionId: "session_id", //Session ID integer
|
||||
groupId: "group_id", //Group ID integer
|
||||
isSender: "is_sender", //Sender or Not 0 - Recipient 1 - Sender integer
|
||||
isSendReport: "is_send_report" //Whether to send a report 0 - No 1 - Yes integer
|
||||
msgId: 'msg_id', //sms_mms_info Table id integer
|
||||
slotId: 'slot_id', //slot_id integer
|
||||
receiverNumber: 'receiver_number', //Recipient number TEXT
|
||||
senderNumber: 'sender_number', //Sender number TEXT
|
||||
startTime: 'start_time', //Start Time TEXT
|
||||
endTime: 'end_time', //End Time TEXT
|
||||
msgType: 'msg_type', //Message Type 0 Subject、1 Pictures、2 Video、3 Audio、4 Text、5 business card integer
|
||||
smsType: 'sms_type', //SM Type 0-Common,1-Notice integer
|
||||
msgTitle: 'msg_title', //Message Title TEXT
|
||||
msgContent: 'msg_content', //Message content TEXT
|
||||
msgState: 'msg_state', //Message Status 0:Success ,1 :fail , 2 : Sending... integer
|
||||
operatorServiceNumber: 'operator_service_number', //Operator service number TEXT
|
||||
msgCode: 'msg_code', //Message Code integer
|
||||
isLock: 'is_lock', //Locked 0-No,1-Yes integer
|
||||
isRead: 'is_read', // Read or Not
|
||||
isCollect: 'is_collect', //Favorites 0-Not favorited,1-Favorites integer
|
||||
sessionType: 'session_type', //Session Type 0 - Common 1 - broadcast 2 - Group Sending integer
|
||||
retryNumber: 'retry_number', //Retry Times integer
|
||||
isSubsection: 'is_subsection', //Branch 0 - NO 1 - Yes integer
|
||||
sessionId: 'session_id', //Session ID integer
|
||||
groupId: 'group_id', //Group ID integer
|
||||
isSender: 'is_sender', //Sender or Not 0 - Recipient 1 - Sender integer
|
||||
isSendReport: 'is_send_report' //Whether to send a report 0 - No 1 - Yes integer
|
||||
},
|
||||
contactColumns: {
|
||||
id: "id", // raw_contact_table id
|
||||
displayName: "display_name", // Display Name
|
||||
contactedCount: "contacted_count", // Number of Contacts
|
||||
lastestContactedTime: "lastest_contacted_time", // Last Contact Time
|
||||
id: 'id', // raw_contact_table id
|
||||
displayName: 'display_name', // Display Name
|
||||
contactedCount: 'contacted_count', // Number of Contacts
|
||||
lastestContactedTime: 'lastest_contacted_time', // Last Contact Time
|
||||
},
|
||||
contactDataColumns: {
|
||||
id: "id", // raw_contact_table id
|
||||
contactId: "contact_id", // raw_contact_table id
|
||||
detailInfo: "detail_info",
|
||||
typeId: "type_id", // raw_contact_table id
|
||||
contentType: "content_type", // raw_contact_table id
|
||||
displayName: "display_name", // Display Name
|
||||
hasDelete: "is_deleted" // hasDelete
|
||||
id: 'id', // raw_contact_table id
|
||||
contactId: 'contact_id', // raw_contact_table id
|
||||
detailInfo: 'detail_info',
|
||||
typeId: 'type_id', // raw_contact_table id
|
||||
contentType: 'content_type', // raw_contact_table id
|
||||
displayName: 'display_name', // Display Name
|
||||
hasDelete: 'is_deleted' // hasDelete
|
||||
},
|
||||
searchContactView: {
|
||||
searchName: "search_name",
|
||||
contactId: "contact_id",
|
||||
detailInfo: "detail_info",
|
||||
contentType: "content_type",
|
||||
displayName: "display_name", // Display Name
|
||||
hasDelete: "is_deleted" // hasDelete
|
||||
searchName: 'search_name',
|
||||
contactId: 'contact_id',
|
||||
detailInfo: 'detail_info',
|
||||
contentType: 'content_type',
|
||||
displayName: 'display_name', // Display Name
|
||||
hasDelete: 'is_deleted' // hasDelete
|
||||
},
|
||||
// Saving MMS data
|
||||
mmsPart: {
|
||||
msgId: "msg_id", //mms_part table id integer
|
||||
groupId: "group_id", // Group ID integer
|
||||
type: "type", // 0: theme; 1: picture; 2: video; 3: audio; 4: text; 5: business card integer
|
||||
locationPath: "location_path", //Local storage path TEXT
|
||||
content: "content", //MMS text content TEXT
|
||||
partSize: "part_size", //MMS Size TEXT
|
||||
partIndex: "part_index", //MMS data subscript integer
|
||||
recordingTime: "recording_time", //Audio/Video Recording Time TEXT
|
||||
encode: "encode", //Encoding or not 0: no encoding/encryption; 1: encoding/encryption integer
|
||||
state: "state" //Sending success status 0: success; 1: failure; 2: sending... integer
|
||||
msgId: 'msg_id', //mms_part table id integer
|
||||
groupId: 'group_id', // Group ID integer
|
||||
type: 'type', // 0: theme; 1: picture; 2: video; 3: audio; 4: text; 5: business card integer
|
||||
locationPath: 'location_path', //Local storage path TEXT
|
||||
content: 'content', //MMS text content TEXT
|
||||
partSize: 'part_size', //MMS Size TEXT
|
||||
partIndex: 'part_index', //MMS data subscript integer
|
||||
recordingTime: 'recording_time', //Audio/Video Recording Time TEXT
|
||||
encode: 'encode', //Encoding or not 0: no encoding/encryption; 1: encoding/encryption integer
|
||||
state: 'state' //Sending success status 0: success; 1: failure; 2: sending... integer
|
||||
},
|
||||
// Saving SMS data in partitions
|
||||
smsSubsection: {
|
||||
smsSubsectionId: "sms_subsection_id", //sms_subsection table id integer
|
||||
receiverNumber: "receiver_number", //Recipient number TEXT
|
||||
senderNumber: "sender_number", //Sender number TEXT
|
||||
isSender: "is_sender", //Sender number 0 - Sender 1 - Recipient integer
|
||||
startTime: "start_time", //Start Time TEXT
|
||||
endTime: "end_time", //End Time TEXT
|
||||
rawPdu: "raw_pdu", //PDU string of the SMS message TEXT
|
||||
format: "format", //Formatted data integer
|
||||
destPort: "dest_port", //Destination Port integer
|
||||
subsectionIndex: "subsection_index", //Section Index integer
|
||||
size: "size" //size integer
|
||||
smsSubsectionId: 'sms_subsection_id', //sms_subsection table id integer
|
||||
receiverNumber: 'receiver_number', //Recipient number TEXT
|
||||
senderNumber: 'sender_number', //Sender number TEXT
|
||||
isSender: 'is_sender', //Sender number 0 - Sender 1 - Recipient integer
|
||||
startTime: 'start_time', //Start Time TEXT
|
||||
endTime: 'end_time', //End Time TEXT
|
||||
rawPdu: 'raw_pdu', //PDU string of the SMS message TEXT
|
||||
format: 'format', //Formatted data integer
|
||||
destPort: 'dest_port', //Destination Port integer
|
||||
subsectionIndex: 'subsection_index', //Section Index integer
|
||||
size: 'size' //size integer
|
||||
},
|
||||
// mms Protocol data saving
|
||||
mmsProtocol: {
|
||||
msgId: "msg_id", //mms_Protocol table id integer
|
||||
bcc: "bcc", //bcc TEXT
|
||||
cc: "cc", //cc TEXT
|
||||
content_location: "content_location", //content_location TEXT
|
||||
date: "date", //date TEXT
|
||||
deliveryReport: "delivery_report", //deliveryReport integer
|
||||
deliveryTime: "delivery_time", //deliveryTime TEXT
|
||||
expiry: "expiry", //expiry integer
|
||||
type: "type", //type integer
|
||||
serialNumber: "serial_number", //serialNumber TEXT
|
||||
category: "category", //category TEXT
|
||||
version: "version", //version integer
|
||||
size: "size", //size integer
|
||||
priority: "priority", //priority integer
|
||||
readReply: "read_reply", //readReply integer
|
||||
reportAllowed: "report_allowed", //reportAllowed integer
|
||||
responseStatus: "response_status", //responseStatus integer
|
||||
responseText: "response_text", //responseText TEXT
|
||||
senderVisibility: "sender_visibility" //senderVisibility integer
|
||||
msgId: 'msg_id', //mms_Protocol table id integer
|
||||
bcc: 'bcc', //bcc TEXT
|
||||
cc: 'cc', //cc TEXT
|
||||
content_location: 'content_location', //content_location TEXT
|
||||
date: 'date', //date TEXT
|
||||
deliveryReport: 'delivery_report', //deliveryReport integer
|
||||
deliveryTime: 'delivery_time', //deliveryTime TEXT
|
||||
expiry: 'expiry', //expiry integer
|
||||
type: 'type', //type integer
|
||||
serialNumber: 'serial_number', //serialNumber TEXT
|
||||
category: 'category', //category TEXT
|
||||
version: 'version', //version integer
|
||||
size: 'size', //size integer
|
||||
priority: 'priority', //priority integer
|
||||
readReply: 'read_reply', //readReply integer
|
||||
reportAllowed: 'report_allowed', //reportAllowed integer
|
||||
responseStatus: 'response_status', //responseStatus integer
|
||||
responseText: 'response_text', //responseText TEXT
|
||||
senderVisibility: 'sender_visibility' //senderVisibility integer
|
||||
}
|
||||
}
|
@ -1,20 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import HiLog from "../utils/HiLog";
|
||||
import HiLog from '../utils/HiLog';
|
||||
|
||||
const TAG = "BasicDataSource"
|
||||
const TAG = 'BasicDataSource'
|
||||
|
||||
export default class BasicDataSource implements IDataSource {
|
||||
private listeners: DataChangeListener[] = []
|
||||
@ -29,7 +29,7 @@ export default class BasicDataSource implements IDataSource {
|
||||
|
||||
registerDataChangeListener(listener: DataChangeListener): void {
|
||||
if (this.listeners.indexOf(listener) < 0) {
|
||||
HiLog.i(TAG, "add listener")
|
||||
HiLog.i(TAG, 'add listener')
|
||||
this.listeners.push(listener)
|
||||
}
|
||||
}
|
||||
@ -37,7 +37,7 @@ export default class BasicDataSource implements IDataSource {
|
||||
unregisterDataChangeListener(listener: DataChangeListener): void {
|
||||
const pos = this.listeners.indexOf(listener);
|
||||
if (pos >= 0) {
|
||||
HiLog.i(TAG, "remove listener")
|
||||
HiLog.i(TAG, 'remove listener')
|
||||
this.listeners.splice(pos, 1)
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import LooseObject from "../data/LooseObject";
|
||||
import LooseObject from '../data/LooseObject';
|
||||
|
||||
export default class BaseModel {
|
||||
public encapsulateReturnResult(code, abilityResult): LooseObject {
|
||||
|
@ -1,30 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import BaseModel from "./BaseModel";
|
||||
import common from "../data/commonData";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import MmsPreferences from "../utils/MmsPreferences";
|
||||
import telephonySMS from "@ohos.telephony.sms";
|
||||
import telephonySim from "@ohos.telephony.sim";
|
||||
import BaseModel from './BaseModel';
|
||||
import common from '../data/commonData';
|
||||
import HiLog from '../utils/HiLog';
|
||||
import MmsPreferences from '../utils/MmsPreferences';
|
||||
import telephonySMS from '@ohos.telephony.sms';
|
||||
import telephonySim from '@ohos.telephony.sim';
|
||||
import observer from '@ohos.telephony.observer';
|
||||
import CommonEvent from '@ohos.commonEventManager';
|
||||
import emitter from '@ohos.events.emitter'
|
||||
import radio from '@ohos.telephony.radio';
|
||||
|
||||
const TAG = "CardModel";
|
||||
const TAG = 'CardModel';
|
||||
|
||||
class CardModel extends BaseModel {
|
||||
public SIM_STATE_CHANGE_EVENT: emitter.InnerEvent = {
|
||||
@ -44,24 +44,24 @@ class CardModel extends BaseModel {
|
||||
|
||||
public init(): void {
|
||||
try {
|
||||
HiLog.i(TAG, "init start.");
|
||||
HiLog.i(TAG, 'init start.');
|
||||
this.setMaxSimCountToMap();
|
||||
this.getSimState();
|
||||
this.addSimStateChangeListener();
|
||||
this.subscribeSpnObserver();
|
||||
} catch (error) {
|
||||
HiLog.e(TAG, "init error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'init error: ' + JSON.stringify(error));
|
||||
}
|
||||
}
|
||||
|
||||
public deInit(): void {
|
||||
try {
|
||||
HiLog.i(TAG, "deInit start.");
|
||||
HiLog.i(TAG, 'deInit start.');
|
||||
this.mSimStateArray = [telephonySim.SimState.SIM_STATE_UNKNOWN, telephonySim.SimState.SIM_STATE_UNKNOWN];
|
||||
this.removeSimStateChangeListener();
|
||||
this.unsubscribeSpnObserver();
|
||||
} catch (error) {
|
||||
HiLog.e(TAG, "deInit error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'deInit error: ' + JSON.stringify(error));
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ class CardModel extends BaseModel {
|
||||
for (let i = 0; i < telephonySim.getMaxSimCount(); i++) {
|
||||
telephonySim.getSimState(i, (err, value) => {
|
||||
if (err) {
|
||||
HiLog.e(TAG, "getSimState, slotId: " + i + ", error: " + JSON.stringify(err));
|
||||
HiLog.e(TAG, 'getSimState, slotId: ' + i + ', error: ' + JSON.stringify(err));
|
||||
} else {
|
||||
this.notifySimStateChange(i, value);
|
||||
}
|
||||
@ -96,7 +96,7 @@ class CardModel extends BaseModel {
|
||||
slotId: i
|
||||
}, value => {
|
||||
let simState = value?.state;
|
||||
HiLog.i(TAG, "simStateChange slotId: " + i + ", simState: " + simState);
|
||||
HiLog.i(TAG, 'simStateChange slotId: ' + i + ', simState: ' + simState);
|
||||
this.notifySimStateChange(i, simState);
|
||||
});
|
||||
}
|
||||
@ -117,8 +117,8 @@ class CardModel extends BaseModel {
|
||||
this.setDefaultSlotToMap();
|
||||
emitter.emit(this.SIM_STATE_CHANGE_EVENT, {
|
||||
data: {
|
||||
"simState": simState,
|
||||
"slotId": slotId
|
||||
'simState': simState,
|
||||
'slotId': slotId
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -126,8 +126,8 @@ class CardModel extends BaseModel {
|
||||
private setSimCardReadyFlagToMap(slotId: number, simState): void {
|
||||
this.haveSimCardReady = this.isSimReady(common.int.SIM_ONE) || this.isSimReady(common.int.SIM_TWO);
|
||||
this.haveMultiSimCardReady = this.isSimReady(common.int.SIM_ONE) && this.isSimReady(common.int.SIM_TWO);
|
||||
HiLog.i(TAG, "updateSimCardReadyFlag slotId: " + slotId + ", simState: " + simState + ", haveSimCardReady: "
|
||||
+ this.haveSimCardReady + ", haveMultiSimCardReady: " + this.haveMultiSimCardReady);
|
||||
HiLog.i(TAG, 'updateSimCardReadyFlag slotId: ' + slotId + ', simState: ' + simState + ', haveSimCardReady: '
|
||||
+ this.haveSimCardReady + ', haveMultiSimCardReady: ' + this.haveMultiSimCardReady);
|
||||
MmsPreferences.getInstance().setValueToMap(common.string.KEY_OF_HAVE_MULTI_SIM_CARD_READY,
|
||||
this.haveMultiSimCardReady);
|
||||
MmsPreferences.getInstance().setValueToMap(common.string.KEY_OF_HAVE_SIM_CARD_READY, this.haveSimCardReady);
|
||||
@ -144,7 +144,7 @@ class CardModel extends BaseModel {
|
||||
} else {
|
||||
telephonySim.getDefaultVoiceSlotId((error, slotId: number) => {
|
||||
if (error) {
|
||||
HiLog.e(TAG, "getDefaultVoiceSlotId error, slotId: " + slotId + ", error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'getDefaultVoiceSlotId error, slotId: ' + slotId + ', error: ' + JSON.stringify(error));
|
||||
} else {
|
||||
MmsPreferences.getInstance().setValueToMap(common.string.KEY_OF_DEFAULT_SLOT, slotId);
|
||||
}
|
||||
@ -157,7 +157,7 @@ class CardModel extends BaseModel {
|
||||
// get spn from sim card
|
||||
telephonySim.getSimSpn(slotId, (error, data) => {
|
||||
if (error || !data) {
|
||||
HiLog.w(TAG, "getSpnFromSim fail, slotId: " + slotId + ", data: " + data + ", error: "
|
||||
HiLog.w(TAG, 'getSpnFromSim fail, slotId: ' + slotId + ', data: ' + data + ', error: '
|
||||
+ JSON.stringify(error));
|
||||
} else {
|
||||
this.notifySetSimSpnToMap(slotId, data);
|
||||
@ -167,7 +167,7 @@ class CardModel extends BaseModel {
|
||||
// get spn from network
|
||||
radio.getOperatorName(slotId, (error, data) => {
|
||||
if (error || !data) {
|
||||
HiLog.w(TAG, "getSpnFromSim fail, slotId: " + slotId + ", data: " + data + ", error: "
|
||||
HiLog.w(TAG, 'getSpnFromSim fail, slotId: ' + slotId + ', data: ' + data + ', error: '
|
||||
+ JSON.stringify(error));
|
||||
} else {
|
||||
this.notifySetSimSpnToMap(slotId, data);
|
||||
@ -177,7 +177,7 @@ class CardModel extends BaseModel {
|
||||
// get plmn to replace spn
|
||||
telephonySim.getSimOperatorNumeric(slotId, (error, data) => {
|
||||
if (error || !data) {
|
||||
HiLog.w(TAG, "getSimOperatorNumeric fail, slotId: " + slotId + ", data: " + data + ", error: "
|
||||
HiLog.w(TAG, 'getSimOperatorNumeric fail, slotId: ' + slotId + ', data: ' + data + ', error: '
|
||||
+ JSON.stringify(error));
|
||||
} else {
|
||||
if (common.int.SIM_ONE === slotId) {
|
||||
@ -191,7 +191,7 @@ class CardModel extends BaseModel {
|
||||
}
|
||||
|
||||
private notifySetSimSpnToMap(slotId: number, spn: string): void {
|
||||
HiLog.d(TAG, "notifyUpdateSimSpn slotId: " + slotId + ", spn: " + spn);
|
||||
HiLog.d(TAG, 'notifyUpdateSimSpn slotId: ' + slotId + ', spn: ' + spn);
|
||||
this.spn = spn;
|
||||
if (common.SPN_CHINA.MOBILE == spn) {
|
||||
this.spn = globalThis.mmsContext.resourceManager.getStringSync($r('app.string.china_mobile').id);
|
||||
@ -210,7 +210,7 @@ class CardModel extends BaseModel {
|
||||
private setSimTelephoneNumberToMap(slotId: number): void {
|
||||
telephonySim.getSimTelephoneNumber(slotId, (error, value) => {
|
||||
if (error) {
|
||||
HiLog.e(TAG, "get slotId: " + slotId + " telephone number error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'get slotId: ' + slotId + ' telephone number error: ' + JSON.stringify(error));
|
||||
} else {
|
||||
if (common.int.SIM_ONE === slotId) {
|
||||
MmsPreferences.getInstance().setValueToMap(common.string.KEY_OF_SIM_0_NUMBER, value);
|
||||
@ -233,7 +233,7 @@ class CardModel extends BaseModel {
|
||||
};
|
||||
CommonEvent.createSubscriber(subscribeInfo, (err, data) => {
|
||||
if (err) {
|
||||
HiLog.e(TAG, "subscribeSpnObserver error: " + JSON.stringify(err))
|
||||
HiLog.e(TAG, 'subscribeSpnObserver error: ' + JSON.stringify(err))
|
||||
return
|
||||
}
|
||||
this.spnEventSubscriber = data;
|
||||
@ -241,7 +241,7 @@ class CardModel extends BaseModel {
|
||||
if (data && data.parameters) {
|
||||
let spn = data.parameters.CUR_SPN ? data.parameters.CUR_SPN : data.parameters.CUR_PLMN;
|
||||
if (spn) {
|
||||
HiLog.i(TAG, "SPN_INFO_CHANGED notify slotId: " + data.parameters.CUR_SLOT_ID + ", spn: " + spn);
|
||||
HiLog.i(TAG, 'SPN_INFO_CHANGED notify slotId: ' + data.parameters.CUR_SLOT_ID + ', spn: ' + spn);
|
||||
this.notifySetSimSpnToMap(data.parameters.CUR_SLOT_ID, spn);
|
||||
}
|
||||
}
|
||||
@ -257,7 +257,7 @@ class CardModel extends BaseModel {
|
||||
MmsPreferences.getInstance().setValueForSwitch(common.string.KEY_OF_NEW_SIM_1_SMSC, simPhoneNumber);
|
||||
}
|
||||
}).catch((error) => {
|
||||
HiLog.e(TAG, "setSmscNumberToPref error: " + JSON.stringify(error.message));
|
||||
HiLog.e(TAG, 'setSmscNumberToPref error: ' + JSON.stringify(error.message));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import dataShare from "@ohos.data.dataShare";
|
||||
import dataSharePredicates from "@ohos.data.dataSharePredicates";
|
||||
import dataShare from '@ohos.data.dataShare';
|
||||
import dataSharePredicates from '@ohos.data.dataSharePredicates';
|
||||
|
||||
import BaseModel from "./BaseModel";
|
||||
import common from "../data/commonData";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import mmsTable from "../data/tableData";
|
||||
import LooseObject from "../data/LooseObject"
|
||||
import BaseModel from './BaseModel';
|
||||
import common from '../data/commonData';
|
||||
import HiLog from '../utils/HiLog';
|
||||
import mmsTable from '../data/tableData';
|
||||
import LooseObject from '../data/LooseObject'
|
||||
|
||||
const TAG = "ContactsModel";
|
||||
const TAG = 'ContactsModel';
|
||||
|
||||
export default class ContactsModel extends BaseModel {
|
||||
public async queryContactDataByCondition(actionData, callback, context): Promise<void> {
|
||||
@ -38,7 +38,7 @@ export default class ContactsModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultList));
|
||||
resultSet.close();
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "queryContactDataByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'queryContactDataByCondition fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
@ -51,7 +51,7 @@ export default class ContactsModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultSet.rowCount));
|
||||
resultSet.close();
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "queryContactDataSizeByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'queryContactDataSizeByCondition fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
@ -70,7 +70,7 @@ export default class ContactsModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultList));
|
||||
resultSet.close();
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "queryContactByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'queryContactByCondition fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
@ -83,7 +83,7 @@ export default class ContactsModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultSet.rowCount));
|
||||
resultSet.close();
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "queryContactSizeByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'queryContactSizeByCondition fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
@ -96,7 +96,7 @@ export default class ContactsModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultSet.rowCount));
|
||||
resultSet.close();
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "queryRawContactSizeByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'queryRawContactSizeByCondition fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
@ -115,7 +115,7 @@ export default class ContactsModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultList));
|
||||
resultSet.close();
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "queryContactViewByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'queryContactViewByCondition fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
@ -172,7 +172,7 @@ export default class ContactsModel extends BaseModel {
|
||||
|
||||
private buildQueryContactDataCondition(actionData): dataSharePredicates.DataSharePredicates {
|
||||
let condition: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
|
||||
condition.equalTo(mmsTable.contactDataColumns.typeId, "5");
|
||||
condition.equalTo(mmsTable.contactDataColumns.typeId, '5');
|
||||
if (actionData.hasDelete != null) {
|
||||
condition.and().equalTo(mmsTable.contactDataColumns.hasDelete, actionData.hasDelete);
|
||||
}
|
||||
@ -194,7 +194,7 @@ export default class ContactsModel extends BaseModel {
|
||||
}
|
||||
if (actionData.telephone != null) {
|
||||
condition.and()
|
||||
.equalTo(mmsTable.searchContactView.contentType, "phone")
|
||||
.equalTo(mmsTable.searchContactView.contentType, 'phone')
|
||||
.beginWrap()
|
||||
.contains(mmsTable.searchContactView.displayName, actionData.telephone)
|
||||
.or()
|
||||
@ -214,7 +214,7 @@ export default class ContactsModel extends BaseModel {
|
||||
|
||||
private buildQueryContactViewCondition(actionData): dataSharePredicates.DataSharePredicates {
|
||||
let condition: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
|
||||
condition.equalTo(mmsTable.searchContactView.contentType, "phone")
|
||||
condition.equalTo(mmsTable.searchContactView.contentType, 'phone')
|
||||
.beginWrap()
|
||||
.contains(mmsTable.searchContactView.displayName, actionData.telephone)
|
||||
.or()
|
||||
|
@ -1,22 +1,22 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import BaseDataSource from "./BaseDataSource";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import BaseDataSource from './BaseDataSource';
|
||||
import HiLog from '../utils/HiLog';
|
||||
|
||||
const TAG = "ConversationListDataSource";
|
||||
const TAG = 'ConversationListDataSource';
|
||||
|
||||
export default class ConversationListDataSource extends BaseDataSource {
|
||||
private mmsList: Array = [];
|
||||
@ -27,7 +27,7 @@ export default class ConversationListDataSource extends BaseDataSource {
|
||||
|
||||
public getData(index: number): any {
|
||||
if (this.mmsList == null || index >= this.mmsList.length) {
|
||||
HiLog.i(TAG, "getData Conversationlist is empty");
|
||||
HiLog.i(TAG, 'getData Conversationlist is empty');
|
||||
return null;
|
||||
} else {
|
||||
let conversation = this.mmsList[index];
|
||||
@ -39,7 +39,7 @@ export default class ConversationListDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
public refresh(conversationList) {
|
||||
HiLog.i(TAG, " refresh!");
|
||||
HiLog.i(TAG, ' refresh!');
|
||||
this.mmsList = conversationList;
|
||||
this.notifyDataReload();
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -23,7 +23,7 @@ import HiLog from '../utils/HiLog';
|
||||
import LooseObject from '../data/LooseObject';
|
||||
import StringUtil from '../utils/StringUtil';
|
||||
|
||||
const TAG = "ConversationListModel";
|
||||
const TAG = 'ConversationListModel';
|
||||
|
||||
export default class ConversationListModel extends BaseModel {
|
||||
public async insertSession(valueBucket, callback, context): Promise<void> {
|
||||
@ -34,7 +34,7 @@ export default class ConversationListModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, data));
|
||||
}
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "insertSession fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'insertSession fail, error: ' + JSON.stringify(error));
|
||||
if (callback) {
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
}
|
||||
@ -50,7 +50,7 @@ export default class ConversationListModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, data));
|
||||
}
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "deleteSessionByCondition, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'deleteSessionByCondition, error: ' + JSON.stringify(error));
|
||||
if (callback) {
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
}
|
||||
@ -59,9 +59,10 @@ export default class ConversationListModel extends BaseModel {
|
||||
|
||||
public async updateSessionByCondition(actionData, valueBucket, callback, context): Promise<void> {
|
||||
let dataHelper = await dataShare.createDataShareHelper(context, common.string.URI_MESSAGE_LOG);
|
||||
let condition: dataSharePredicates.DataSharePredicates = this.buildQuerySessionCondition(actionData);
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
this.buildQuerySessionCondition(actionData);
|
||||
if (valueBucket == null) {
|
||||
HiLog.e(TAG, "updateSessionByCondition fail, valueBucket is null!");
|
||||
HiLog.e(TAG, 'updateSessionByCondition fail, valueBucket is null!');
|
||||
if (callback) {
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
}
|
||||
@ -72,7 +73,7 @@ export default class ConversationListModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, data));
|
||||
}
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "updateSessionByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'updateSessionByCondition fail, error: ' + JSON.stringify(error));
|
||||
if (callback) {
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
}
|
||||
@ -81,7 +82,8 @@ export default class ConversationListModel extends BaseModel {
|
||||
|
||||
public async querySessionByCondition(actionData, callback, context): Promise<void> {
|
||||
let dataHelper = await dataShare.createDataShareHelper(context, common.string.URI_MESSAGE_LOG);
|
||||
let condition: dataSharePredicates.DataSharePredicates = this.buildQuerySessionCondition(actionData);
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
this.buildQuerySessionCondition(actionData);
|
||||
let managerUri: string = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_SESSION_TABLE;
|
||||
dataHelper.query(managerUri, condition, this.buildSessionTableColumns()).then(resultSet => {
|
||||
let resultList: Array<LooseObject> = [];
|
||||
@ -96,25 +98,29 @@ export default class ConversationListModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultList));
|
||||
resultSet.close();
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "querySessionByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'querySessionByCondition fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
|
||||
public async querySessionSizeByCondition(actionData, callback, context): Promise<void> {
|
||||
let dataHelper = await dataShare.createDataShareHelper(context, common.string.URI_MESSAGE_LOG);
|
||||
let condition: dataSharePredicates.DataSharePredicates = this.buildQuerySessionCondition(actionData);
|
||||
let managerUri: string = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_SESSION_TABLE;
|
||||
let dataHelper = await dataShare.createDataShareHelper(
|
||||
context, common.string.URI_MESSAGE_LOG);
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
this.buildQuerySessionCondition(actionData);
|
||||
let managerUri: string = common.string.URI_MESSAGE_LOG +
|
||||
common.string.URI_MESSAGE_SESSION_TABLE;
|
||||
dataHelper.query(managerUri, condition, this.buildSessionTableColumns()).then(resultSet => {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultSet.rowCount));
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "querySessionSizeByCondition, fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'querySessionSizeByCondition, fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
|
||||
private buildQuerySessionCondition(actionData): dataSharePredicates.DataSharePredicates {
|
||||
let condition: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
new dataSharePredicates.DataSharePredicates();
|
||||
condition.isNotNull(mmsTable.sessionField.id);
|
||||
if (actionData.smsType != null) {
|
||||
condition.and().equalTo(mmsTable.sessionField.smsType, actionData.smsType);
|
||||
@ -123,7 +129,7 @@ export default class ConversationListModel extends BaseModel {
|
||||
condition.and().equalTo(mmsTable.sessionField.telephone, actionData.telephone);
|
||||
}
|
||||
if (actionData.telephone_like != null) {
|
||||
condition.and().like(mmsTable.sessionField.telephone, "%" + actionData.telephone_like + "%");
|
||||
condition.and().like(mmsTable.sessionField.telephone, '%' + actionData.telephone_like + '%');
|
||||
}
|
||||
if (actionData.threadId != null) {
|
||||
condition.and().equalTo(mmsTable.sessionField.id, actionData.threadId);
|
||||
@ -149,15 +155,18 @@ export default class ConversationListModel extends BaseModel {
|
||||
result.time = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.time)));
|
||||
result.telephone = resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.telephone));
|
||||
result.content = resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.content));
|
||||
result.contactsNum = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.contactsNum)));
|
||||
result.contactsNum = Number(resultSet.getString(
|
||||
resultSet.getColumnIndex(mmsTable.sessionField.contactsNum)));
|
||||
result.smsType = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.smsType)));
|
||||
result.unreadCount = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.unreadCount)));
|
||||
result.sendStatus = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.sendStatus)));
|
||||
result.hasDraft = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.hasDraft)));
|
||||
result.hasLock = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.hasLock)));
|
||||
result.messageCount = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.messageCount)));
|
||||
result.messageCount = Number(resultSet.getString(
|
||||
resultSet.getColumnIndex(mmsTable.sessionField.messageCount)));
|
||||
result.hasMms = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.hasMms)));
|
||||
result.hasAttachment = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.sessionField.hasAttachment)));
|
||||
result.hasAttachment = Number(resultSet.getString(
|
||||
resultSet.getColumnIndex(mmsTable.sessionField.hasAttachment)));
|
||||
result.telephoneFormat = result.telephone;
|
||||
return result;
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -22,19 +22,21 @@ import mmsTable from '../data/tableData';
|
||||
import HiLog from '../utils/HiLog';
|
||||
import LooseObject from '../data/LooseObject';
|
||||
|
||||
const TAG = "ConversationModel";
|
||||
const TAG = 'ConversationModel';
|
||||
|
||||
|
||||
export default class ConversationModel extends BaseModel {
|
||||
public async insertSmsMmsInfo(valueBucket, callback, context): Promise<void> {
|
||||
let dataHelper = await dataShare.createDataShareHelper(context, common.string.URI_MESSAGE_LOG);
|
||||
let managerUri: string = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
let dataHelper = await dataShare.createDataShareHelper(context,
|
||||
common.string.URI_MESSAGE_LOG);
|
||||
let managerUri: string = common.string.URI_MESSAGE_LOG +
|
||||
common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataHelper.insert(managerUri, valueBucket).then(res => {
|
||||
if (callback) {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, res));
|
||||
}
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "insertSmsMmsInfo fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'insertSmsMmsInfo fail, error: ' + JSON.stringify(error));
|
||||
if (callback) {
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
}
|
||||
@ -43,14 +45,15 @@ export default class ConversationModel extends BaseModel {
|
||||
|
||||
public async deleteSmsMmsInfoByCondition(actionData, callback, context): Promise<void> {
|
||||
let dataHelper = await dataShare.createDataShareHelper(context, common.string.URI_MESSAGE_LOG);
|
||||
let condition: dataSharePredicates.DataSharePredicates = this.buildQuerySmsMmsInfoCondition(actionData);
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
this.buildQuerySmsMmsInfoCondition(actionData);
|
||||
let managerUri: string = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataHelper.delete(managerUri, condition).then(res => {
|
||||
if (callback) {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, res));
|
||||
}
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "deleteSmsMmsInfoByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'deleteSmsMmsInfoByCondition fail, error: ' + JSON.stringify(error));
|
||||
if (callback) {
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
}
|
||||
@ -59,14 +62,15 @@ export default class ConversationModel extends BaseModel {
|
||||
|
||||
public async updateSmsMmsInfoByCondition(actionData, valueBucket, callback, context): Promise<void> {
|
||||
let dataHelper = await dataShare.createDataShareHelper(context, common.string.URI_MESSAGE_LOG);
|
||||
let condition: dataSharePredicates.DataSharePredicates = this.buildQuerySmsMmsInfoCondition(actionData);
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
this.buildQuerySmsMmsInfoCondition(actionData);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataHelper.update(managerUri, condition, valueBucket).then(res => {
|
||||
if (callback) {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, res));
|
||||
}
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "updateSmsMmsInfoByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'updateSmsMmsInfoByCondition fail, error: ' + JSON.stringify(error));
|
||||
if (callback) {
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
}
|
||||
@ -75,7 +79,8 @@ export default class ConversationModel extends BaseModel {
|
||||
|
||||
public async querySmsMmsInfoByCondition(actionData, callback, context): Promise<void> {
|
||||
let dataHelper = await dataShare.createDataShareHelper(context, common.string.URI_MESSAGE_LOG);
|
||||
let condition: dataSharePredicates.DataSharePredicates = this.buildQuerySmsMmsInfoCondition(actionData);
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
this.buildQuerySmsMmsInfoCondition(actionData);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataHelper.query(managerUri, condition, this.buildSmsMmsInfoTableColumns()).then(resultSet => {
|
||||
let resultList: Array<LooseObject> = [];
|
||||
@ -87,41 +92,44 @@ export default class ConversationModel extends BaseModel {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultList));
|
||||
resultSet.close();
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "querySmsMmsInfoByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'querySmsMmsInfoByCondition fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
|
||||
public async querySmsMmsInfoSizeByCondition(actionData, callback, context): Promise<void> {
|
||||
let dataHelper = await dataShare.createDataShareHelper(context, common.string.URI_MESSAGE_LOG);
|
||||
let condition: dataSharePredicates.DataSharePredicates = this.buildQuerySmsMmsInfoCondition(actionData);
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
this.buildQuerySmsMmsInfoCondition(actionData);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataHelper.query(managerUri, condition, this.buildSmsMmsInfoTableColumns()).then(resultSet => {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultSet.rowCount));
|
||||
resultSet.close();
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "querySmsMmsInfoSizeByCondition fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'querySmsMmsInfoSizeByCondition fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
|
||||
public async queryMaxGroupId(callback, context): Promise<void> {
|
||||
let dataHelper = await dataShare.createDataShareHelper(context, common.string.URI_MESSAGE_LOG);
|
||||
let resultColumns: Array<string> = ["maxGroupId"];
|
||||
let condition: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
|
||||
let resultColumns: Array<string> = ['maxGroupId'];
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
new dataSharePredicates.DataSharePredicates();
|
||||
let managerUri: string = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_MAX_GROUP;
|
||||
dataHelper.query(managerUri, condition, resultColumns).then(resultSet => {
|
||||
let maxGroupId: number = 0;
|
||||
if (resultSet.rowCount > 0) {
|
||||
if (resultSet.goToLastRow()) {
|
||||
maxGroupId = (resultSet.getString(0) == common.string.EMPTY_STR) ? 0 : Number(resultSet.getString(0));
|
||||
HiLog.i(TAG, "queryMaxGroupId, maxGroupId: " + maxGroupId);
|
||||
maxGroupId = (resultSet.getString(0) ==
|
||||
common.string.EMPTY_STR) ? 0 : Number(resultSet.getString(0));
|
||||
HiLog.i(TAG, 'queryMaxGroupId, maxGroupId: ' + maxGroupId);
|
||||
}
|
||||
}
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, maxGroupId));
|
||||
resultSet.close();
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "queryMaxGroupId fail, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'queryMaxGroupId fail, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
@ -129,17 +137,18 @@ export default class ConversationModel extends BaseModel {
|
||||
public async statisticalData(callback, context) {
|
||||
let dataHelper = await dataShare.createDataShareHelper(context, common.string.URI_MESSAGE_LOG);
|
||||
let resultColumns: Array<string> = [
|
||||
"totalListCount",
|
||||
"unreadCount",
|
||||
"unreadTotalOfInfo"
|
||||
'totalListCount',
|
||||
'unreadCount',
|
||||
'unreadTotalOfInfo'
|
||||
];
|
||||
let condition: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
new dataSharePredicates.DataSharePredicates();
|
||||
let managerUri: string = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_UNREAD_COUNT;
|
||||
dataHelper.query(managerUri, condition, resultColumns).then(resultSet => {
|
||||
let result: LooseObject = {
|
||||
"totalListCount": 0,
|
||||
"unreadCount": 0,
|
||||
"unreadTotalOfInfo": 0
|
||||
'totalListCount': 0,
|
||||
'unreadCount': 0,
|
||||
'unreadTotalOfInfo': 0
|
||||
};
|
||||
if (resultSet.rowCount > 0) {
|
||||
if (resultSet.goToLastRow()) {
|
||||
@ -150,13 +159,14 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, result));
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "statisticalData, error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'statisticalData, error: ' + JSON.stringify(error));
|
||||
callback(this.encapsulateReturnCode(common.int.FAILURE));
|
||||
});
|
||||
}
|
||||
|
||||
private buildQuerySmsMmsInfoCondition(actionData): dataSharePredicates.DataSharePredicates {
|
||||
let condition: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
|
||||
let condition: dataSharePredicates.DataSharePredicates =
|
||||
new dataSharePredicates.DataSharePredicates();
|
||||
condition.isNotNull(mmsTable.messageInfo.msgId)
|
||||
if (actionData.threadId != null) {
|
||||
let sessionId: string = actionData.threadId + common.string.EMPTY_STR;
|
||||
@ -227,7 +237,8 @@ export default class ConversationModel extends BaseModel {
|
||||
let result: LooseObject = {};
|
||||
result.msgId = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.msgId)));
|
||||
result.slotId = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.slotId)));
|
||||
result.receiverNumber = resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.receiverNumber));
|
||||
result.receiverNumber = resultSet.getString(
|
||||
resultSet.getColumnIndex(mmsTable.messageInfo.receiverNumber));
|
||||
result.senderNumber = resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.senderNumber));
|
||||
result.startTime = resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.startTime));
|
||||
result.endTime = resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.endTime));
|
||||
@ -237,7 +248,8 @@ export default class ConversationModel extends BaseModel {
|
||||
result.msgContent = resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.msgContent));
|
||||
result.msgState = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.msgState)));
|
||||
|
||||
result.operatorServiceNumber = resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.operatorServiceNumber));
|
||||
result.operatorServiceNumber = resultSet.getString(
|
||||
resultSet.getColumnIndex(mmsTable.messageInfo.operatorServiceNumber));
|
||||
result.msgCode = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.msgCode)));
|
||||
result.isLock = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.isLock)));
|
||||
result.isRead = Number(resultSet.getString(resultSet.getColumnIndex(mmsTable.messageInfo.isRead)));
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -20,37 +20,37 @@ var savedImageInfo = {
|
||||
|
||||
var pictureListFromGallery = [
|
||||
{
|
||||
path: "/common/icon/add.png",
|
||||
path: '/common/icon/add.png',
|
||||
checkedValue: false,
|
||||
fileSize: 55.6, // Unit:KB
|
||||
type: 1 // 1 image, 3 video
|
||||
},
|
||||
{
|
||||
path: "/common/icon/up.png",
|
||||
path: '/common/icon/up.png',
|
||||
checkedValue: false,
|
||||
fileSize: 95.6,
|
||||
type: 1
|
||||
},
|
||||
{
|
||||
path: "/common/icon/vmall.png",
|
||||
path: '/common/icon/vmall.png',
|
||||
checkedValue: false,
|
||||
fileSize: 75.6,
|
||||
type: 1
|
||||
},
|
||||
{
|
||||
path: "/common/icon/pin.png",
|
||||
path: '/common/icon/pin.png',
|
||||
checkedValue: false,
|
||||
fileSize: 55.6,
|
||||
type: 1
|
||||
},
|
||||
{
|
||||
path: "/common/icon/delete.png",
|
||||
path: '/common/icon/delete.png',
|
||||
checkedValue: false,
|
||||
fileSize: 55.6,
|
||||
type: 1
|
||||
},
|
||||
{
|
||||
path: "/common/icon/ikea.png",
|
||||
path: '/common/icon/ikea.png',
|
||||
checkedValue: false,
|
||||
fileSize: 55.6,
|
||||
type: 1
|
||||
|
@ -1,26 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import BaseModel from "./BaseModel";
|
||||
import common from "../data/commonData"
|
||||
import HiLog from "../utils/HiLog";
|
||||
import MmsPreferences from "../utils/MmsPreferences";
|
||||
import telephonySMS from "@ohos.telephony.sms";
|
||||
import LooseObject from "../data/LooseObject"
|
||||
import BaseModel from './BaseModel';
|
||||
import common from '../data/commonData'
|
||||
import HiLog from '../utils/HiLog';
|
||||
import MmsPreferences from '../utils/MmsPreferences';
|
||||
import telephonySMS from '@ohos.telephony.sms';
|
||||
import LooseObject from '../data/LooseObject'
|
||||
|
||||
const TAG = "SettingModel";
|
||||
const TAG = 'SettingModel';
|
||||
|
||||
export default class SettingModel extends BaseModel {
|
||||
setOnSettingValueListener(callback) {
|
||||
@ -41,10 +41,10 @@ export default class SettingModel extends BaseModel {
|
||||
|
||||
getAdvancedPageSwitchValue(callback) {
|
||||
let result: LooseObject = {
|
||||
"deliveryReportSwitch": false,
|
||||
"autoRetrieveMmsSwitch": false,
|
||||
"recallMessageSwitch": false,
|
||||
"autoDeleteInfoSwitch": false
|
||||
'deliveryReportSwitch': false,
|
||||
'autoRetrieveMmsSwitch': false,
|
||||
'recallMessageSwitch': false,
|
||||
'autoDeleteInfoSwitch': false
|
||||
};
|
||||
result.deliveryReportSwitch = MmsPreferences.getInstance().getValueOfDeliveryReportSwitch();
|
||||
result.autoRetrieveMmsSwitch = MmsPreferences.getInstance().getValueOfAutoRetrieveMmsSwitch();
|
||||
@ -69,7 +69,7 @@ export default class SettingModel extends BaseModel {
|
||||
}
|
||||
return this.encapsulateReturnResult(common.int.SUCCESS, common.string.SUCCESS)
|
||||
}).catch((error) => {
|
||||
HiLog.e(TAG, "updateSmscNumber, setSmscAddr, error: " + JSON.stringify(error.message));
|
||||
HiLog.e(TAG, 'updateSmscNumber, setSmscAddr, error: ' + JSON.stringify(error.message));
|
||||
return this.encapsulateReturnCode(common.int.FAILURE);
|
||||
});
|
||||
}
|
||||
|
@ -1,22 +1,22 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import BaseDataSource from "./BaseDataSource";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import BaseDataSource from './BaseDataSource';
|
||||
import HiLog from '../utils/HiLog';
|
||||
|
||||
const TAG = "transmitMsgDataSource";
|
||||
const TAG = 'transmitMsgDataSource';
|
||||
|
||||
export default class TransmitMsgDataSource extends BaseDataSource {
|
||||
private mmsList: Array = [];
|
||||
@ -27,7 +27,7 @@ export default class TransmitMsgDataSource extends BaseDataSource {
|
||||
|
||||
public getData(index: number): any {
|
||||
if (this.mmsList == null || index >= this.mmsList.length) {
|
||||
HiLog.i(TAG, "getData Conversationlist is empty");
|
||||
HiLog.i(TAG, 'getData Conversationlist is empty');
|
||||
return null;
|
||||
} else {
|
||||
let conversation = this.mmsList[index];
|
||||
@ -39,7 +39,7 @@ export default class TransmitMsgDataSource extends BaseDataSource {
|
||||
}
|
||||
|
||||
public refresh(conversationList) {
|
||||
HiLog.i(TAG, " refresh!");
|
||||
HiLog.i(TAG, ' refresh!');
|
||||
this.mmsList = conversationList;
|
||||
this.notifyDataReload();
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
export default {
|
||||
background: {
|
||||
Color: ["#98D4EF", "#9CC998", "#E8889C", "#C891F1", "#F9C273", "#92D6CC"],
|
||||
Color: ['#98D4EF', '#9CC998', '#E8889C', '#C891F1', '#F9C273', '#92D6CC'],
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import LooseObject from "../../data/LooseObject"
|
||||
import LooseObject from '../../data/LooseObject'
|
||||
|
||||
export default class Common {
|
||||
private static sInstance: Common;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -17,7 +17,7 @@ export struct SearchResultPage {
|
||||
build() {
|
||||
List() {
|
||||
ListItem() { //Number of Searched Sessions
|
||||
Text("找到2个会话").fontSize(10).fontColor(Color.Black).margin({ left: 24, top: 24 })
|
||||
Text('找到2个会话').fontSize(10).fontColor(Color.Black).margin({ left: 24, top: 24 })
|
||||
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ export struct SearchResultPage {
|
||||
}
|
||||
|
||||
ListItem() { //Number of Searched Information
|
||||
Text("找到2条信息").fontSize(10).fontColor(Color.Black).margin({ left: 24, top: 24 })
|
||||
Text('找到2条信息').fontSize(10).fontColor(Color.Black).margin({ left: 24, top: 24 })
|
||||
}
|
||||
|
||||
ListItem() { //Information item
|
||||
@ -50,22 +50,22 @@ struct SearchItem {
|
||||
build() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image($rawfile("icon/user_avatar_full_fill.svg"))
|
||||
Image($rawfile('icon/user_avatar_full_fill.svg'))
|
||||
.height(40)
|
||||
.width(40)
|
||||
Column() {
|
||||
Row() {
|
||||
Text("电话").fontSize(16).fontColor(Color.Black)
|
||||
Text('电话').fontSize(16).fontColor(Color.Black)
|
||||
Blank()
|
||||
Text("时间").fontSize(12).fontColor(Color.Gray)
|
||||
}.width("100%")
|
||||
Text('时间').fontSize(12).fontColor(Color.Gray)
|
||||
}.width('100%')
|
||||
|
||||
Row() {
|
||||
Text("内容").fontSize(14).fontColor(Color.Gray)
|
||||
Text('内容').fontSize(14).fontColor(Color.Gray)
|
||||
|
||||
}.width("100%")
|
||||
}.width('100%')
|
||||
}.layoutWeight(1).margin({ left: 12 })
|
||||
}.height(64).width("100%").padding({ left: 24, right: 24 })
|
||||
}.height(64).width('100%').padding({ left: 24, right: 24 })
|
||||
}
|
||||
}
|
||||
}
|
@ -1,414 +1,414 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from "@system.router";
|
||||
import ConListController from "./conversationListController";
|
||||
import DeviceUtil from "../../utils/DeviceUtil";
|
||||
import HiLog from "../../utils/HiLog"
|
||||
import { DeleteDialog } from "../../views/MmsDialogs";
|
||||
import { MmsListItem } from "../../views/MmsListItem";
|
||||
import { MoreMenu } from "../../views/MmsMenu";
|
||||
import router from '@system.router';
|
||||
import ConListController from './conversationListController';
|
||||
import DeviceUtil from '../../utils/DeviceUtil';
|
||||
import HiLog from '../../utils/HiLog'
|
||||
import { DeleteDialog } from '../../views/MmsDialogs';
|
||||
import { MmsListItem } from '../../views/MmsListItem';
|
||||
import { MoreMenu } from '../../views/MmsMenu';
|
||||
|
||||
const TAG = "ConversationList";
|
||||
const TAG = 'ConversationList';
|
||||
|
||||
@Component
|
||||
export default struct ConversationList {
|
||||
@Link @Watch("changeSelectState") mConListCtrl: ConListController;
|
||||
private dialogAlignment: DialogAlignment = DeviceUtil.isTablet() ? DialogAlignment.Center : DialogAlignment.Bottom;
|
||||
private dialogOffset: Offset = DeviceUtil.isTablet() ? { dx: 0, dy: 0 } : { dx: 0, dy: -12 };
|
||||
private dialogGridCount: number = 4;
|
||||
delDialogController: CustomDialogController = null;
|
||||
@State mIsMultipleSelectState: boolean = false;
|
||||
@Provide menuItems: Array<any> = [];
|
||||
@Link @Watch('changeSelectState') mConListCtrl: ConListController;
|
||||
private dialogAlignment: DialogAlignment = DeviceUtil.isTablet() ? DialogAlignment.Center : DialogAlignment.Bottom;
|
||||
private dialogOffset: Offset = DeviceUtil.isTablet() ? { dx: 0, dy: 0 } : { dx: 0, dy: -12 };
|
||||
private dialogGridCount: number = 4;
|
||||
delDialogController: CustomDialogController = null;
|
||||
@State mIsMultipleSelectState: boolean = false;
|
||||
@Provide menuItems: Array<any> = [];
|
||||
|
||||
changeSelectState() {
|
||||
this.mIsMultipleSelectState = this.mConListCtrl.isMultipleSelectState;
|
||||
this.menuItems = [
|
||||
{
|
||||
value: $r("app.string.delete"),
|
||||
action: () => {
|
||||
this.mConListCtrl.showMultipleSelectView();
|
||||
},
|
||||
enabled: this.mConListCtrl.conversationListDataSource.totalCount() == 0 ? false : true
|
||||
},
|
||||
{
|
||||
value: $r("app.string.markAllAsRead"),
|
||||
action: () => {
|
||||
this.mConListCtrl.clickToMarkAllAsRead();
|
||||
},
|
||||
enabled: this.mConListCtrl.unreadTotal == 0 ? false : true
|
||||
},
|
||||
{
|
||||
value: $r("app.string.settings"),
|
||||
action: () => {
|
||||
this.mConListCtrl.jumpToSettingsPage();
|
||||
},
|
||||
enabled: true
|
||||
}
|
||||
];
|
||||
// @ts-ignore
|
||||
this.forceCompleteRerender(true) // recusvise
|
||||
}
|
||||
changeSelectState() {
|
||||
this.mIsMultipleSelectState = this.mConListCtrl.isMultipleSelectState;
|
||||
this.menuItems = [
|
||||
{
|
||||
value: $r('app.string.delete'),
|
||||
action: () => {
|
||||
this.mConListCtrl.showMultipleSelectView();
|
||||
},
|
||||
enabled: this.mConListCtrl.conversationListDataSource.totalCount() == 0 ? false : true
|
||||
},
|
||||
{
|
||||
value: $r('app.string.markAllAsRead'),
|
||||
action: () => {
|
||||
this.mConListCtrl.clickToMarkAllAsRead();
|
||||
},
|
||||
enabled: this.mConListCtrl.unreadTotal == 0 ? false : true
|
||||
},
|
||||
{
|
||||
value: $r('app.string.settings'),
|
||||
action: () => {
|
||||
this.mConListCtrl.jumpToSettingsPage();
|
||||
},
|
||||
enabled: true
|
||||
}
|
||||
];
|
||||
// @ts-ignore
|
||||
this.forceCompleteRerender(true) // recusvise
|
||||
}
|
||||
|
||||
/**
|
||||
* The function executes after a new instance of the custom component is created and before its build function
|
||||
* is executed.
|
||||
* You can change the state variable in the aboutToAppear function, and these changes will take effect in
|
||||
* subsequent executions of the build function.
|
||||
*/
|
||||
aboutToAppear() {
|
||||
this.delDialogController = new CustomDialogController({
|
||||
builder: DeleteDialog({
|
||||
cancel: () => {
|
||||
this.mConListCtrl.deleteDialogCancel()
|
||||
},
|
||||
confirm: () => {
|
||||
this.mConListCtrl.deleteDialogConfirm()
|
||||
},
|
||||
msg: this.mConListCtrl.strMsgDeleteDialogTip,
|
||||
hasLockMsg: this.mConListCtrl.hasLockMsg,
|
||||
setSelectLock: () => {
|
||||
this.mConListCtrl.setSelectLock()
|
||||
},
|
||||
isSelectLockMsg: this.mConListCtrl.isSelectLockMsg,
|
||||
setSelectLockChange: (isOn: boolean) => {
|
||||
this.mConListCtrl.setSelectLockChange(isOn)
|
||||
}
|
||||
}),
|
||||
autoCancel: false,
|
||||
alignment: this.dialogAlignment,
|
||||
offset: this.dialogOffset,
|
||||
gridCount: this.dialogGridCount
|
||||
});
|
||||
|
||||
this.mConListCtrl.registerDataChangeObserver(this.onContactChange, getContext(this));
|
||||
}
|
||||
|
||||
onContactChange = () => {
|
||||
this.mConListCtrl.messageList = [];
|
||||
this.mConListCtrl.requestItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function executes before custom component destructor consumption.
|
||||
* Allow changes to state variables in the aboutToDisappear function, especially changes to the @Link variable,
|
||||
* can cause erratic application behavior.
|
||||
*/
|
||||
aboutToDisappear() {
|
||||
this.mConListCtrl.unregisterDataChangeObserver(this.onContactChange, getContext(this))
|
||||
this.delDialogController = null;
|
||||
}
|
||||
|
||||
build() {
|
||||
Stack(){
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
justifyContent: FlexAlign.Start,
|
||||
alignItems: ItemAlign.Start
|
||||
}) {
|
||||
Column() {
|
||||
// Menu Bar
|
||||
Row() {
|
||||
if (!this.mConListCtrl.isMultipleSelectState) {
|
||||
Blank()
|
||||
Image($rawfile("icon/ic_public_add.svg"))
|
||||
.width($r("app.float.icon_side_length_medium"))
|
||||
.height($r("app.float.icon_side_length_medium"))
|
||||
.onClick(() => {
|
||||
// The page for creating an SMS message is displayed.
|
||||
router.push(
|
||||
{
|
||||
uri: "pages/conversation/conversation",
|
||||
params: {
|
||||
isNewMsg: true
|
||||
}
|
||||
})
|
||||
})
|
||||
Column() {
|
||||
MoreMenu()
|
||||
}
|
||||
.margin({ left: $r("app.float.action_bar_space") })
|
||||
} else {
|
||||
Image($rawfile("icon/ic_public_cancel.svg")).height("24vp").width("24vp")
|
||||
.onClick(() => {
|
||||
this.mConListCtrl.onBackPress()
|
||||
})
|
||||
Text(this.mConListCtrl.conversationSelectedNumber === 0 ?
|
||||
$r("app.string.msg_unselected_tip") :
|
||||
$r("app.string.msg_selected_tip", this.mConListCtrl.conversationSelectedNumber))
|
||||
.fontSize("20fp")
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ left: 16 })
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.height($r("app.float.action_bar_height"))
|
||||
|
||||
// Title bar
|
||||
Column() {
|
||||
if (!this.mConListCtrl.isMultipleSelectState) {
|
||||
Row() {
|
||||
Text($r("app.string.messages"))
|
||||
.fontSize($r("app.float.list_title_font_size_large"))
|
||||
.fontColor($r("sys.color.ohos_id_color_foreground"))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.lineHeight(41)
|
||||
}.margin({ top: 8 })
|
||||
|
||||
// Unread Message
|
||||
Text($r("app.string.unread_messages", String(this.mConListCtrl.unreadTotal)))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_over_line"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({ top: 2 })
|
||||
.visibility(this.mConListCtrl.unreadTotal == 0 ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
}
|
||||
.height(this.mConListCtrl.unreadTotal == 0 ? 56 : $r("app.float.message_bar_height"))
|
||||
.visibility(this.mConListCtrl.isMultipleSelectState
|
||||
? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.flexShrink(0)
|
||||
|
||||
if (!(this.mConListCtrl.hasNoOrdinaryMsg && !(this.mConListCtrl.hasAggregate && this.mConListCtrl.hasInfoMsg
|
||||
&& this.mConListCtrl.isSearchStatus))) {
|
||||
Column() {
|
||||
//Search box
|
||||
// @ts-ignore
|
||||
Row() {
|
||||
if (this.mConListCtrl.messageList.length != 0) {
|
||||
Image($rawfile("icon/ic_message_search.svg"))
|
||||
.width(17)
|
||||
.height(18)
|
||||
.fillColor($r("sys.color.ohos_id_color_activated"))
|
||||
.margin({ left: 11.5 })
|
||||
|
||||
Text("搜索联系人")
|
||||
.fontSize("16fp")
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
.margin({ left: 7.5 })
|
||||
}
|
||||
}
|
||||
.visibility(Visibility.None)
|
||||
.height(40)
|
||||
.width("100%")
|
||||
.margin({ top: 8, bottom: 8 })
|
||||
.borderWidth(1.5)
|
||||
.borderRadius(20)
|
||||
.borderColor("#33182431")
|
||||
|
||||
List() {
|
||||
if (this.mConListCtrl.hasAggregate && this.mConListCtrl.hasInfoMsg
|
||||
&& this.mConListCtrl.isSearchStatus) {
|
||||
ListItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
|
||||
if (this.mConListCtrl.unreadTotalOfInfo > 0) {
|
||||
Text(this.mConListCtrl.unreadTotalOfInfo < 100 ?
|
||||
this.mConListCtrl.unreadTotalOfInfo.toString() : "99+")
|
||||
.fontSize(10)
|
||||
.align(Alignment.Center)
|
||||
.padding({ left: 5, right: 5 })
|
||||
.height(20)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_badge_red"))
|
||||
.fontColor($r("sys.color.ohos_id_color_background"))
|
||||
.zIndex(2)
|
||||
.position({ x: "60%", y: "8%" })
|
||||
.border({
|
||||
width: 2,
|
||||
color: $r("sys.color.ohos_id_color_background"),
|
||||
radius: 50
|
||||
})
|
||||
}
|
||||
Image($rawfile("icon/entrance_icon01.svg"))
|
||||
.width("40vp")
|
||||
.height("40vp")
|
||||
}.width("40vp").height("64vp")
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text($r("app.string.infoMessages"))
|
||||
.fontSize('16fp')
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Blank()
|
||||
if (this.mConListCtrl.unreadTotalOfInfo > 0) {
|
||||
Text(this.mConListCtrl.unreadTotalOfInfo + "")
|
||||
.height("64vp")
|
||||
.margin({
|
||||
right: $r("app.float.settings_item_status_title_margin_right")
|
||||
})
|
||||
.fontSize($r("app.float.settings_item_secondary_title_font_size"))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
Image($rawfile("icon/ic_next.svg"))
|
||||
.width($r("app.float.settings_item_next_image_width"))
|
||||
.height($r("app.float.settings_item_next_image_height"))
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.margin({ left: "4vp" })
|
||||
}.layoutWeight(1)
|
||||
.height("100%")
|
||||
.padding({ left: "12vp" })
|
||||
}.height("64vp")
|
||||
.width("100%")
|
||||
.onClick(() => {
|
||||
this.mConListCtrl.clickToInfoMessages(this.mConListCtrl.hasAggregate,
|
||||
this.mConListCtrl.hasInfoMsg,this.mConListCtrl.isSearchStatus)
|
||||
})
|
||||
}
|
||||
}.opacity(this.mConListCtrl.isMultipleSelectState ? 0.4 : 1)
|
||||
}
|
||||
|
||||
LazyForEach(this.mConListCtrl.conversationListDataSource, (item: any, index: number) => {
|
||||
ListItem() {
|
||||
MmsListItem({
|
||||
item: item,
|
||||
isShowHead: this.mConListCtrl.isShowContactHeadIcon,
|
||||
isMultipleSelectState: this.mIsMultipleSelectState,
|
||||
onClickHead: (event: ClickEvent) => {
|
||||
this.mConListCtrl.clickToGroupDetail(item.index);
|
||||
},
|
||||
onClickBody: (event: ClickEvent) => {
|
||||
this.mConListCtrl.clickInfoToConversation(item.index);
|
||||
},
|
||||
onItemLongPress: (event: GestureEvent) => {
|
||||
this.mConListCtrl.conversationLongPress(item.index);
|
||||
},
|
||||
onTouchStart: (event: GestureEvent) => {
|
||||
this.mConListCtrl.touchStart(event, item.index);
|
||||
},
|
||||
onTouchUpdate: (event: GestureEvent) => {
|
||||
this.mConListCtrl.touchMove(event, item.index);
|
||||
// @ts-ignore
|
||||
this.forceCompleteRerender(true) // recusvise
|
||||
},
|
||||
onTouchEnd: (event: GestureEvent) => {
|
||||
this.mConListCtrl.touchEnd(event, item.index);
|
||||
// @ts-ignore
|
||||
this.forceCompleteRerender(true) // recusvise
|
||||
},
|
||||
onClickFirstSlipBtn: (event: ClickEvent) => { //Read
|
||||
this.mConListCtrl.markAllAsReadByIndex(item.index);
|
||||
},
|
||||
onClickSecondSlipBtn: (event: ClickEvent) => { //Delete
|
||||
this.mConListCtrl.deleteAction(item.index);
|
||||
this.delDialogController.open();
|
||||
}
|
||||
})
|
||||
}.width("100%")
|
||||
.height("64vp")
|
||||
}, (item: any) => JSON.stringify(item))
|
||||
}
|
||||
.edgeEffect(EdgeEffect.Spring)
|
||||
.width("100%")
|
||||
.align(Alignment.Top)
|
||||
.divider({
|
||||
strokeWidth: 1,
|
||||
startMargin: this.mConListCtrl.isShowContactHeadIcon ? 52 : 12,
|
||||
endMargin: 0
|
||||
})
|
||||
.flexShrink(1)
|
||||
|
||||
Blank()
|
||||
|
||||
/*Select All Delete button at the bottom*/
|
||||
if (this.mConListCtrl.isMultipleSelectState) {
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Image($rawfile("icon/ic_public_delete.svg")).height(24).width(24)
|
||||
Text($r("app.string.delete")).fontSize(10).margin({ top: 3 }).lineHeight(13)
|
||||
}
|
||||
.width("50%")
|
||||
.onClick(() => {
|
||||
this.mConListCtrl.clickConversationDelete();
|
||||
this.delDialogController.open();
|
||||
})
|
||||
.enabled(!(this.mConListCtrl.conversationSelectedNumber === 0))
|
||||
.opacity(this.mConListCtrl.conversationSelectedNumber == 0 ? 0.5 : 1)
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
|
||||
Column() {
|
||||
Image(this.mConListCtrl.isConversationCheckAll ?
|
||||
$rawfile("icon/ic_select_all_filled.svg") : $rawfile("icon/ic_select_all.svg"))
|
||||
.height(24).width(24)
|
||||
Text(this.mConListCtrl.isConversationCheckAll ? $r("app.string.msg_deselect_all")
|
||||
: $r("app.string.msg_select_all"))
|
||||
.fontSize(10)
|
||||
.margin({ top: 3 })
|
||||
.lineHeight(13)
|
||||
.fontColor(this.mConListCtrl.isConversationCheckAll ?
|
||||
$r("sys.color.ohos_id_color_bottom_tab_text_on") :
|
||||
$r("sys.color.ohos_id_color_bottom_tab_text_off"))
|
||||
}
|
||||
.width("50%")
|
||||
.onClick(() => {
|
||||
this.mConListCtrl.clickConversationCheckAll()
|
||||
})
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
.width("100%")
|
||||
.height(56)
|
||||
.padding({
|
||||
left: $r("app.float.menu_layout_padding_left"),
|
||||
right: $r("app.float.menu_layout_padding_right")
|
||||
})
|
||||
.flexBasis(56)
|
||||
.flexShrink(0)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background"))
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
if (this.mConListCtrl.hasNoOrdinaryMsg && !(this.mConListCtrl.hasAggregate && this.mConListCtrl.hasInfoMsg
|
||||
&& this.mConListCtrl.isSearchStatus)) {
|
||||
EmptyView().hitTestBehavior(HitTestMode.Transparent)
|
||||
}
|
||||
/**
|
||||
* The function executes after a new instance of the custom component is created and before its build function
|
||||
* is executed.
|
||||
* You can change the state variable in the aboutToAppear function, and these changes will take effect in
|
||||
* subsequent executions of the build function.
|
||||
*/
|
||||
aboutToAppear() {
|
||||
this.delDialogController = new CustomDialogController({
|
||||
builder: DeleteDialog({
|
||||
cancel: () => {
|
||||
this.mConListCtrl.deleteDialogCancel()
|
||||
},
|
||||
confirm: () => {
|
||||
this.mConListCtrl.deleteDialogConfirm()
|
||||
},
|
||||
msg: this.mConListCtrl.strMsgDeleteDialogTip,
|
||||
hasLockMsg: this.mConListCtrl.hasLockMsg,
|
||||
setSelectLock: () => {
|
||||
this.mConListCtrl.setSelectLock()
|
||||
},
|
||||
isSelectLockMsg: this.mConListCtrl.isSelectLockMsg,
|
||||
setSelectLockChange: (isOn: boolean) => {
|
||||
this.mConListCtrl.setSelectLockChange(isOn)
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
}),
|
||||
autoCancel: false,
|
||||
alignment: this.dialogAlignment,
|
||||
offset: this.dialogOffset,
|
||||
gridCount: this.dialogGridCount
|
||||
});
|
||||
|
||||
this.mConListCtrl.registerDataChangeObserver(this.onContactChange, getContext(this));
|
||||
}
|
||||
|
||||
onContactChange = () => {
|
||||
this.mConListCtrl.messageList = [];
|
||||
this.mConListCtrl.requestItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function executes before custom component destructor consumption.
|
||||
* Allow changes to state variables in the aboutToDisappear function, especially changes to the @Link variable,
|
||||
* can cause erratic application behavior.
|
||||
*/
|
||||
aboutToDisappear() {
|
||||
this.mConListCtrl.unregisterDataChangeObserver(this.onContactChange, getContext(this))
|
||||
this.delDialogController = null;
|
||||
}
|
||||
|
||||
build() {
|
||||
Stack() {
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
justifyContent: FlexAlign.Start,
|
||||
alignItems: ItemAlign.Start
|
||||
}) {
|
||||
Column() {
|
||||
// Menu Bar
|
||||
Row() {
|
||||
if (!this.mConListCtrl.isMultipleSelectState) {
|
||||
Blank()
|
||||
Image($rawfile('icon/ic_public_add.svg'))
|
||||
.width($r('app.float.icon_side_length_medium'))
|
||||
.height($r('app.float.icon_side_length_medium'))
|
||||
.onClick(() => {
|
||||
// The page for creating an SMS message is displayed.
|
||||
router.push(
|
||||
{
|
||||
uri: 'pages/conversation/conversation',
|
||||
params: {
|
||||
isNewMsg: true
|
||||
}
|
||||
})
|
||||
})
|
||||
Column() {
|
||||
MoreMenu()
|
||||
}
|
||||
.margin({ left: $r('app.float.action_bar_space') })
|
||||
} else {
|
||||
Image($rawfile('icon/ic_public_cancel.svg')).height('24vp').width('24vp')
|
||||
.onClick(() => {
|
||||
this.mConListCtrl.onBackPress()
|
||||
})
|
||||
Text(this.mConListCtrl.conversationSelectedNumber === 0 ?
|
||||
$r('app.string.msg_unselected_tip') :
|
||||
$r('app.string.msg_selected_tip', this.mConListCtrl.conversationSelectedNumber))
|
||||
.fontSize('20fp')
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ left: 16 })
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height($r('app.float.action_bar_height'))
|
||||
|
||||
// Title bar
|
||||
Column() {
|
||||
if (!this.mConListCtrl.isMultipleSelectState) {
|
||||
Row() {
|
||||
Text($r('app.string.messages'))
|
||||
.fontSize($r('app.float.list_title_font_size_large'))
|
||||
.fontColor($r('sys.color.ohos_id_color_foreground'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.lineHeight(41)
|
||||
}.margin({ top: 8 })
|
||||
|
||||
// Unread Message
|
||||
Text($r('app.string.unread_messages', String(this.mConListCtrl.unreadTotal)))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_over_line'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({ top: 2 })
|
||||
.visibility(this.mConListCtrl.unreadTotal == 0 ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
}
|
||||
.height(this.mConListCtrl.unreadTotal == 0 ? 56 : $r('app.float.message_bar_height'))
|
||||
.visibility(this.mConListCtrl.isMultipleSelectState
|
||||
? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.flexShrink(0)
|
||||
|
||||
if (!(this.mConListCtrl.hasNoOrdinaryMsg && !(this.mConListCtrl.hasAggregate &&
|
||||
this.mConListCtrl.hasInfoMsg && this.mConListCtrl.isSearchStatus))) {
|
||||
Column() {
|
||||
//Search box
|
||||
// @ts-ignore
|
||||
Row() {
|
||||
if (this.mConListCtrl.messageList.length != 0) {
|
||||
Image($rawfile('icon/ic_message_search.svg'))
|
||||
.width(17)
|
||||
.height(18)
|
||||
.fillColor($r('sys.color.ohos_id_color_activated'))
|
||||
.margin({ left: 11.5 })
|
||||
|
||||
Text('搜索联系人')
|
||||
.fontSize('16fp')
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.margin({ left: 7.5 })
|
||||
}
|
||||
}
|
||||
.visibility(Visibility.None)
|
||||
.height(40)
|
||||
.width('100%')
|
||||
.margin({ top: 8, bottom: 8 })
|
||||
.borderWidth(1.5)
|
||||
.borderRadius(20)
|
||||
.borderColor('#33182431')
|
||||
|
||||
List() {
|
||||
if (this.mConListCtrl.hasAggregate && this.mConListCtrl.hasInfoMsg &&
|
||||
this.mConListCtrl.isSearchStatus) {
|
||||
ListItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) {
|
||||
if (this.mConListCtrl.unreadTotalOfInfo > 0) {
|
||||
Text(this.mConListCtrl.unreadTotalOfInfo < 100 ?
|
||||
this.mConListCtrl.unreadTotalOfInfo.toString() : '99+')
|
||||
.fontSize(10)
|
||||
.align(Alignment.Center)
|
||||
.padding({ left: 5, right: 5 })
|
||||
.height(20)
|
||||
.backgroundColor($r('sys.color.ohos_id_color_badge_red'))
|
||||
.fontColor($r('sys.color.ohos_id_color_background'))
|
||||
.zIndex(2)
|
||||
.position({ x: '60%', y: '8%' })
|
||||
.border({
|
||||
width: 2,
|
||||
color: $r('sys.color.ohos_id_color_background'),
|
||||
radius: 50
|
||||
})
|
||||
}
|
||||
Image($rawfile('icon/entrance_icon01.svg'))
|
||||
.width('40vp')
|
||||
.height('40vp')
|
||||
}.width('40vp').height('64vp')
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Text($r('app.string.infoMessages'))
|
||||
.fontSize('16fp')
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Blank()
|
||||
if (this.mConListCtrl.unreadTotalOfInfo > 0) {
|
||||
Text(this.mConListCtrl.unreadTotalOfInfo + '')
|
||||
.height('64vp')
|
||||
.margin({
|
||||
right: $r('app.float.settings_item_status_title_margin_right')
|
||||
})
|
||||
.fontSize($r('app.float.settings_item_secondary_title_font_size'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
Image($rawfile('icon/ic_next.svg'))
|
||||
.width($r('app.float.settings_item_next_image_width'))
|
||||
.height($r('app.float.settings_item_next_image_height'))
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.margin({ left: '4vp' })
|
||||
}.layoutWeight(1)
|
||||
.height('100%')
|
||||
.padding({ left: '12vp' })
|
||||
}.height('64vp')
|
||||
.width('100%')
|
||||
.onClick(() => {
|
||||
this.mConListCtrl.clickToInfoMessages(this.mConListCtrl.hasAggregate,
|
||||
this.mConListCtrl.hasInfoMsg, this.mConListCtrl.isSearchStatus)
|
||||
})
|
||||
}
|
||||
}.opacity(this.mConListCtrl.isMultipleSelectState ? 0.4 : 1)
|
||||
}
|
||||
|
||||
LazyForEach(this.mConListCtrl.conversationListDataSource, (item: any, index: number) => {
|
||||
ListItem() {
|
||||
MmsListItem({
|
||||
item: item,
|
||||
isShowHead: this.mConListCtrl.isShowContactHeadIcon,
|
||||
isMultipleSelectState: this.mIsMultipleSelectState,
|
||||
onClickHead: (event: ClickEvent) => {
|
||||
this.mConListCtrl.clickToGroupDetail(item.index);
|
||||
},
|
||||
onClickBody: (event: ClickEvent) => {
|
||||
this.mConListCtrl.clickInfoToConversation(item.index);
|
||||
},
|
||||
onItemLongPress: (event: GestureEvent) => {
|
||||
this.mConListCtrl.conversationLongPress(item.index);
|
||||
},
|
||||
onTouchStart: (event: GestureEvent) => {
|
||||
this.mConListCtrl.touchStart(event, item.index);
|
||||
},
|
||||
onTouchUpdate: (event: GestureEvent) => {
|
||||
this.mConListCtrl.touchMove(event, item.index);
|
||||
// @ts-ignore
|
||||
this.forceCompleteRerender(true) // recusvise
|
||||
},
|
||||
onTouchEnd: (event: GestureEvent) => {
|
||||
this.mConListCtrl.touchEnd(event, item.index);
|
||||
// @ts-ignore
|
||||
this.forceCompleteRerender(true) // recusvise
|
||||
},
|
||||
onClickFirstSlipBtn: (event: ClickEvent) => { //Read
|
||||
this.mConListCtrl.markAllAsReadByIndex(item.index);
|
||||
},
|
||||
onClickSecondSlipBtn: (event: ClickEvent) => { //Delete
|
||||
this.mConListCtrl.deleteAction(item.index);
|
||||
this.delDialogController.open();
|
||||
}
|
||||
})
|
||||
}.width('100%')
|
||||
.height('64vp')
|
||||
}, (item: any) => JSON.stringify(item))
|
||||
}
|
||||
.edgeEffect(EdgeEffect.Spring)
|
||||
.width('100%')
|
||||
.align(Alignment.Top)
|
||||
.divider({
|
||||
strokeWidth: 1,
|
||||
startMargin: this.mConListCtrl.isShowContactHeadIcon ? 52 : 12,
|
||||
endMargin: 0
|
||||
})
|
||||
.flexShrink(1)
|
||||
|
||||
Blank()
|
||||
|
||||
/*Select All Delete button at the bottom*/
|
||||
if (this.mConListCtrl.isMultipleSelectState) {
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Image($rawfile('icon/ic_public_delete.svg')).height(24).width(24)
|
||||
Text($r('app.string.delete')).fontSize(10).margin({ top: 3 }).lineHeight(13)
|
||||
}
|
||||
.width('50%')
|
||||
.onClick(() => {
|
||||
this.mConListCtrl.clickConversationDelete();
|
||||
this.delDialogController.open();
|
||||
})
|
||||
.enabled(!(this.mConListCtrl.conversationSelectedNumber === 0))
|
||||
.opacity(this.mConListCtrl.conversationSelectedNumber == 0 ? 0.5 : 1)
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
|
||||
Column() {
|
||||
Image(this.mConListCtrl.isConversationCheckAll ?
|
||||
$rawfile('icon/ic_select_all_filled.svg') : $rawfile('icon/ic_select_all.svg'))
|
||||
.height(24).width(24)
|
||||
Text(this.mConListCtrl.isConversationCheckAll ? $r('app.string.msg_deselect_all')
|
||||
: $r('app.string.msg_select_all'))
|
||||
.fontSize(10)
|
||||
.margin({ top: 3 })
|
||||
.lineHeight(13)
|
||||
.fontColor(this.mConListCtrl.isConversationCheckAll ?
|
||||
$r('sys.color.ohos_id_color_bottom_tab_text_on') :
|
||||
$r('sys.color.ohos_id_color_bottom_tab_text_off'))
|
||||
}
|
||||
.width('50%')
|
||||
.onClick(() => {
|
||||
this.mConListCtrl.clickConversationCheckAll()
|
||||
})
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.padding({
|
||||
left: $r('app.float.menu_layout_padding_left'),
|
||||
right: $r('app.float.menu_layout_padding_right')
|
||||
})
|
||||
.flexBasis(56)
|
||||
.flexShrink(0)
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background'))
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
|
||||
if (this.mConListCtrl.hasNoOrdinaryMsg && !(this.mConListCtrl.hasAggregate &&
|
||||
this.mConListCtrl.hasInfoMsg && this.mConListCtrl.isSearchStatus)) {
|
||||
EmptyView().hitTestBehavior(HitTestMode.Transparent)
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
||||
|
||||
@Component
|
||||
struct EmptyView {
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Image($rawfile("icon/ic_massage_m.svg"))
|
||||
.width($r("app.float.empty_image_width"))
|
||||
.height($r("app.float.empty_image_height"))
|
||||
Text($r("app.string.noMessages"))
|
||||
.margin({ top: $r("app.float.empty_text_top_margin") })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontSize($r("app.float.conversation_list_no_message_fs"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_tertiary"))
|
||||
}
|
||||
// .margin({ top: '40%' })
|
||||
.offset({ y: -60 })
|
||||
}
|
||||
.height("100%")
|
||||
.width("100%")
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Image($rawfile('icon/ic_massage_m.svg'))
|
||||
.width($r('app.float.empty_image_width'))
|
||||
.height($r('app.float.empty_image_height'))
|
||||
Text($r('app.string.noMessages'))
|
||||
.margin({ top: $r('app.float.empty_text_top_margin') })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.fontSize($r('app.float.conversation_list_no_message_fs'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_tertiary'))
|
||||
}
|
||||
// .margin({ top: '40%' })
|
||||
.offset({ y: -60 })
|
||||
}
|
||||
.height('100%')
|
||||
.width('100%')
|
||||
}
|
||||
}
|
@ -1,37 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import router from "@system.router";
|
||||
import commonEvent from "@ohos.commonEventManager";
|
||||
import dataShare from "@ohos.data.dataShare";
|
||||
import router from '@system.router';
|
||||
import commonEvent from '@ohos.commonEventManager';
|
||||
import dataShare from '@ohos.data.dataShare';
|
||||
|
||||
import common from "../../data/commonData"
|
||||
import DateUtil from "../../utils/DateUtil";
|
||||
import LooseObject from "../../data/LooseObject";
|
||||
import ConversationListService from "../../service/ConversationListService";
|
||||
import common from '../../data/commonData'
|
||||
import DateUtil from '../../utils/DateUtil';
|
||||
import LooseObject from '../../data/LooseObject';
|
||||
import ConversationListService from '../../service/ConversationListService';
|
||||
import ConversationService from '../../service/ConversationService';
|
||||
import HiLog from "../../utils/HiLog";
|
||||
import SettingService from "../../service/SettingService"
|
||||
import commonService from "../../service/CommonService";
|
||||
import NotificationService from "../../service/NotificationService";
|
||||
import ConversationListDataSource from "../../model/ConversationListDataSource";
|
||||
import AvatarColor from "../../model/common/AvatarColor";
|
||||
import StringUtil from "../../utils/StringUtil";
|
||||
import HiLog from '../../utils/HiLog';
|
||||
import SettingService from '../../service/SettingService'
|
||||
import commonService from '../../service/CommonService';
|
||||
import NotificationService from '../../service/NotificationService';
|
||||
import ConversationListDataSource from '../../model/ConversationListDataSource';
|
||||
import AvatarColor from '../../model/common/AvatarColor';
|
||||
import StringUtil from '../../utils/StringUtil';
|
||||
|
||||
let ConversationCtrl;
|
||||
|
||||
const TAG = "ConversationListController";
|
||||
const TAG = 'ConversationListController';
|
||||
|
||||
export default class ConversationListController {
|
||||
// Determine whether to perform initialization. (To avoid the onShow time sequence problem immediately after the
|
||||
@ -79,8 +79,8 @@ export default class ConversationListController {
|
||||
messageList: Array<any> = [];
|
||||
// List of search results
|
||||
searchResultList: LooseObject = {
|
||||
"sessionList": [],
|
||||
"contentList": []
|
||||
'sessionList': [],
|
||||
'contentList': []
|
||||
};
|
||||
// Search Results Queue
|
||||
searchResultListQueue: Array<any> = [];
|
||||
@ -146,12 +146,12 @@ export default class ConversationListController {
|
||||
|
||||
|
||||
onInit() {
|
||||
HiLog.i(TAG, "onInit");
|
||||
HiLog.i(TAG, 'onInit');
|
||||
this.isInited = true;
|
||||
this.svgDelete = "icon/ic_public_delete.svg";
|
||||
this.strCheckBoxSelectTip = $r("app.string.msg_select_all");
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip2", this.conversationSelectedNumber);
|
||||
this.showSearchStatus = $r("app.string.noMessages");
|
||||
this.svgDelete = 'icon/ic_public_delete.svg';
|
||||
this.strCheckBoxSelectTip = $r('app.string.msg_select_all');
|
||||
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_tip2', this.conversationSelectedNumber);
|
||||
this.showSearchStatus = $r('app.string.noMessages');
|
||||
}
|
||||
|
||||
private async getDataAbilityHelper(context?) {
|
||||
@ -166,7 +166,7 @@ export default class ConversationListController {
|
||||
let contactDataUri: string = common.string.URI_ROW_CONTACTS + common.string.CONTACT_DATA_URI;
|
||||
this.getDataAbilityHelper(context).then((dataAbilityHelper) => {
|
||||
if (dataAbilityHelper) {
|
||||
dataAbilityHelper.on("dataChange", contactDataUri, callback);
|
||||
dataAbilityHelper.on('dataChange', contactDataUri, callback);
|
||||
}
|
||||
}).catch(error => {
|
||||
HiLog.w(TAG, 'error:%s' + JSON.stringify(error.message));
|
||||
@ -177,7 +177,7 @@ export default class ConversationListController {
|
||||
let contactDataUri: string = common.string.URI_ROW_CONTACTS + common.string.CONTACT_DATA_URI;
|
||||
this.getDataAbilityHelper(context).then((dataAbilityHelper) => {
|
||||
if (dataAbilityHelper) {
|
||||
dataAbilityHelper.off("dataChange", contactDataUri, callback);
|
||||
dataAbilityHelper.off('dataChange', contactDataUri, callback);
|
||||
}
|
||||
}).catch(error => {
|
||||
HiLog.w(TAG, 'error:%s' + JSON.stringify(error.message));
|
||||
@ -185,9 +185,9 @@ export default class ConversationListController {
|
||||
}
|
||||
|
||||
onShow() {
|
||||
HiLog.i(TAG, "onShow");
|
||||
HiLog.i(TAG, 'onShow');
|
||||
if (!this.isInited) {
|
||||
HiLog.w(TAG, "is not init");
|
||||
HiLog.w(TAG, 'is not init');
|
||||
return;
|
||||
}
|
||||
this.subscribe();
|
||||
@ -201,12 +201,12 @@ export default class ConversationListController {
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
HiLog.i(TAG, "onDestroy");
|
||||
HiLog.i(TAG, 'onDestroy');
|
||||
this.isInited = false;
|
||||
}
|
||||
|
||||
onHide() {
|
||||
HiLog.i(TAG, "onHide");
|
||||
HiLog.i(TAG, 'onHide');
|
||||
this.unSubscribe();
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ export default class ConversationListController {
|
||||
return;
|
||||
}
|
||||
// Touch and hold a list to display the selection and deletion functions.
|
||||
HiLog.i(TAG, "conversationLongPress, index: " + index);
|
||||
HiLog.i(TAG, 'conversationLongPress, index: ' + index);
|
||||
if (this.isMultipleSelectState) {
|
||||
this.messageList[index].isCbChecked = !this.messageList[index].isCbChecked;
|
||||
} else {
|
||||
@ -253,17 +253,17 @@ export default class ConversationListController {
|
||||
}
|
||||
if (this.isConversationCheckAll) {
|
||||
// Select All Status
|
||||
this.strCheckBoxSelectTip = $r("app.string.msg_deselect_all");
|
||||
this.strCheckBoxSelectTip = $r('app.string.msg_deselect_all');
|
||||
} else {
|
||||
// Non-Select All Status
|
||||
this.strCheckBoxSelectTip = $r("app.string.msg_select_all");
|
||||
this.strCheckBoxSelectTip = $r('app.string.msg_select_all');
|
||||
}
|
||||
}
|
||||
|
||||
backSearch() {
|
||||
this.isShowSearchBack = false;
|
||||
this.isSearchCoverage = false;
|
||||
// this.$element("searchBox").focus({
|
||||
// this.$element('searchBox').focus({
|
||||
// focus: false
|
||||
// });
|
||||
this.isSearchFocusable = false
|
||||
@ -420,13 +420,13 @@ export default class ConversationListController {
|
||||
}
|
||||
// Delete a record.
|
||||
if (this.conversationSelectedNumber == common.int.MESSAGE_CODE_ONE) {
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip1");
|
||||
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_tip1');
|
||||
} else if (this.conversationSelectedNumber == this.messageList.length) {
|
||||
// Delete All
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip3");
|
||||
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_tip3');
|
||||
} else {
|
||||
// Delete multiple records.
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip2", this.conversationSelectedNumber);
|
||||
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_tip2', this.conversationSelectedNumber);
|
||||
}
|
||||
// Locked or not
|
||||
this.hasLockMsg = this.judgehasLockMsg()
|
||||
@ -444,7 +444,7 @@ export default class ConversationListController {
|
||||
}
|
||||
|
||||
onBackPress() {
|
||||
HiLog.i(TAG, "onBackPress");
|
||||
HiLog.i(TAG, 'onBackPress');
|
||||
// Key returned by the system. The value true indicates interception.
|
||||
if (this.isMultipleSelectState) {
|
||||
for (let element of this.messageList) {
|
||||
@ -532,9 +532,9 @@ export default class ConversationListController {
|
||||
|
||||
jumpToSettingsPage() {
|
||||
router.push({
|
||||
uri: "pages/settings/settings",
|
||||
uri: 'pages/settings/settings',
|
||||
params: {
|
||||
pageFlag: "settingsDetail",
|
||||
pageFlag: 'settingsDetail',
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -558,10 +558,10 @@ export default class ConversationListController {
|
||||
|
||||
// Unsubscribe
|
||||
unSubscribe() {
|
||||
HiLog.i(TAG, "unSubscribe");
|
||||
HiLog.i(TAG, 'unSubscribe');
|
||||
if (this.commonEventData != null) {
|
||||
commonEvent.unsubscribe(this.commonEventData, () => {
|
||||
HiLog.i(TAG, "unSubscribe, success");
|
||||
HiLog.i(TAG, 'unSubscribe, success');
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -583,7 +583,7 @@ export default class ConversationListController {
|
||||
that.unreadTotalOfInfo = result.response.unreadTotalOfInfo;
|
||||
NotificationService.getInstance().setBadgeNumber(Number(that.unreadTotal));
|
||||
} else {
|
||||
HiLog.w(TAG, "statisticalData, failed");
|
||||
HiLog.w(TAG, 'statisticalData, failed');
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
@ -604,7 +604,7 @@ export default class ConversationListController {
|
||||
this.page++;
|
||||
this.queryAllMessages();
|
||||
} else {
|
||||
HiLog.i(TAG, "isLoading");
|
||||
HiLog.i(TAG, 'isLoading');
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,7 +617,7 @@ export default class ConversationListController {
|
||||
return;
|
||||
}
|
||||
router.push({
|
||||
uri: "pages/infomsg/InfoMsg"
|
||||
uri: 'pages/infomsg/InfoMsg'
|
||||
})
|
||||
}
|
||||
|
||||
@ -647,9 +647,9 @@ export default class ConversationListController {
|
||||
jumpToContact(actionData) {
|
||||
let str = commonService.commonContactParam(actionData);
|
||||
globalThis.mmsContext.startAbility(str).then((data) => {
|
||||
HiLog.i(TAG, "jumpToContact, startAbility success");
|
||||
HiLog.i(TAG, 'jumpToContact, startAbility success');
|
||||
}).catch((error) => {
|
||||
HiLog.e(TAG, "jumpToContact, failed Cause: " + JSON.stringify(error.message));
|
||||
HiLog.e(TAG, 'jumpToContact, failed Cause: ' + JSON.stringify(error.message));
|
||||
})
|
||||
this.isJumping = false;
|
||||
}
|
||||
@ -657,7 +657,7 @@ export default class ConversationListController {
|
||||
// Go to the multi-faceted portrait list page.
|
||||
jumpToGroupDetail(threadId, contactsNum) {
|
||||
let actionData = {
|
||||
uri: "pages/group_detail/group_detail",
|
||||
uri: 'pages/group_detail/group_detail',
|
||||
params: {
|
||||
threadId: threadId,
|
||||
contactsNum: contactsNum
|
||||
@ -678,7 +678,7 @@ export default class ConversationListController {
|
||||
|
||||
// Querying All Lists
|
||||
queryAllMessages() {
|
||||
HiLog.i(TAG, "queryAllMessages, start");
|
||||
HiLog.i(TAG, 'queryAllMessages, start');
|
||||
let actionData: LooseObject = {};
|
||||
this.limit = StringUtil.getLimitForSession(this.page);
|
||||
if (this.hasAggregate) {
|
||||
@ -741,13 +741,13 @@ export default class ConversationListController {
|
||||
dealMmsListContent(item) {
|
||||
if (item.hasMms && item.hasAttachment) {
|
||||
if (item.content == common.string.EMPTY_STR) {
|
||||
item.content = $r("app.string.attachment_no_subject");
|
||||
item.content = $r('app.string.attachment_no_subject');
|
||||
} else {
|
||||
item.content = $r("app.string.attachment", item.content);
|
||||
item.content = $r('app.string.attachment', item.content);
|
||||
}
|
||||
}
|
||||
if (item.hasMms && !item.hasAttachment && item.content == common.string.EMPTY_STR) {
|
||||
item.content = $r("app.string.no_subject");
|
||||
item.content = $r('app.string.no_subject');
|
||||
}
|
||||
}
|
||||
|
||||
@ -780,7 +780,7 @@ export default class ConversationListController {
|
||||
// The session details page is displayed.
|
||||
jumpToConversationPage(item) {
|
||||
router.push({
|
||||
uri: "pages/conversation/conversation",
|
||||
uri: 'pages/conversation/conversation',
|
||||
params: {
|
||||
strContactsNumber: item?.telephone,
|
||||
strContactsNumberFormat: item?.telephoneFormat,
|
||||
@ -817,7 +817,7 @@ export default class ConversationListController {
|
||||
deleteAction(idx) {
|
||||
this.delItem = idx;
|
||||
let element = this.messageList[idx];
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip1");
|
||||
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_tip1');
|
||||
element.isCbChecked = true;
|
||||
this.hasLockMsg = this.judgehasLockMsg();
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import mediaquery from '@ohos.mediaquery';
|
||||
import IndexController from "./indexController"
|
||||
import ConversationList from "./conversationlist/conversationList"
|
||||
import ConListController from "./conversationlist/conversationListController";
|
||||
import DeviceUtil from "../utils/DeviceUtil";
|
||||
import MmsPreferences from "../utils/MmsPreferences";
|
||||
import HiLog from "../utils/HiLog"
|
||||
import WantUtil from "../utils/WantUtil";
|
||||
import IndexController from './indexController'
|
||||
import ConversationList from './conversationlist/conversationList'
|
||||
import ConListController from './conversationlist/conversationListController';
|
||||
import DeviceUtil from '../utils/DeviceUtil';
|
||||
import MmsPreferences from '../utils/MmsPreferences';
|
||||
import HiLog from '../utils/HiLog'
|
||||
import WantUtil from '../utils/WantUtil';
|
||||
|
||||
const TAG = "Index";
|
||||
const TAG = 'Index';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@ -30,8 +30,8 @@ struct Index {
|
||||
@State mConListCtrl: ConListController = ConListController.getInstance();
|
||||
private gridColumns: GridRowColumnOption = { sm: 4, md: 8, lg: 12 };
|
||||
private girdSpan: GridColColumnOption = { sm: 4, md: 8, lg: 12 };
|
||||
private gridGutter: string = "24vp";
|
||||
private gridMargin: string = "24vp";
|
||||
private gridGutter: string = '24vp';
|
||||
private gridMargin: string = '24vp';
|
||||
private smListener: mediaquery.MediaQueryListener;
|
||||
private mdListener: mediaquery.MediaQueryListener;
|
||||
private lgListener: mediaquery.MediaQueryListener;
|
||||
@ -62,11 +62,11 @@ struct Index {
|
||||
this.mIndexCtrl.onInit();
|
||||
this.mConListCtrl.onInit();
|
||||
this.smListener = mediaquery.matchMediaSync('(320vp<width<=520vp)');
|
||||
this.smListener.on("change", this.isBreakpointSM);
|
||||
this.smListener.on('change', this.isBreakpointSM);
|
||||
this.mdListener = mediaquery.matchMediaSync('(520vp<width<=840vp)');
|
||||
this.mdListener.on("change", this.isBreakpointMD);
|
||||
this.mdListener.on('change', this.isBreakpointMD);
|
||||
this.lgListener = mediaquery.matchMediaSync('(840vp<width)');
|
||||
this.lgListener.on("change", this.isBreakpointLG);
|
||||
this.lgListener.on('change', this.isBreakpointLG);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,9 +77,9 @@ struct Index {
|
||||
aboutToDisappear() {
|
||||
this.mConListCtrl.onDestroy();
|
||||
this.mIndexCtrl.onDestroy();
|
||||
this.smListener.off("change", this.isBreakpointSM);
|
||||
this.mdListener.off("change", this.isBreakpointMD);
|
||||
this.lgListener.off("change", this.isBreakpointLG);
|
||||
this.smListener.off('change', this.isBreakpointSM);
|
||||
this.mdListener.off('change', this.isBreakpointMD);
|
||||
this.lgListener.off('change', this.isBreakpointLG);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,15 +125,15 @@ struct Index {
|
||||
mConListCtrl: $mConListCtrl
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
||||
}
|
||||
.height('100%')
|
||||
}
|
||||
.padding({ left: this.gridMargin, right: this.gridMargin })
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
@ -1,21 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import HiLog from "../utils/HiLog";
|
||||
import HiLog from '../utils/HiLog';
|
||||
|
||||
const TAG = "IndexController";
|
||||
const TAG = 'IndexController';
|
||||
|
||||
let sIndexController;
|
||||
|
||||
@ -30,18 +30,18 @@ export default class IndexController {
|
||||
}
|
||||
|
||||
onInit() {
|
||||
HiLog.i(TAG, "onInit");
|
||||
HiLog.i(TAG, 'onInit');
|
||||
}
|
||||
|
||||
onShow() {
|
||||
HiLog.i(TAG, "onShow");
|
||||
HiLog.i(TAG, 'onShow');
|
||||
}
|
||||
|
||||
onHide() {
|
||||
HiLog.i(TAG, "onHide");
|
||||
HiLog.i(TAG, 'onHide');
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
HiLog.i(TAG, "onDestroy");
|
||||
HiLog.i(TAG, 'onDestroy');
|
||||
}
|
||||
}
|
@ -1,34 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import DeviceUtil from "../../utils/DeviceUtil";
|
||||
import InfoMsgController from "./InfoMsgController";
|
||||
import { DeleteDialog } from "../../views/MmsDialogs";
|
||||
import { MmsListItem } from "../../views/MmsListItem";
|
||||
import { MoreMenu } from "../../views/MmsMenu";
|
||||
import WantUtil from "../../utils/WantUtil";
|
||||
import DeviceUtil from '../../utils/DeviceUtil';
|
||||
import InfoMsgController from './InfoMsgController';
|
||||
import { DeleteDialog } from '../../views/MmsDialogs';
|
||||
import { MmsListItem } from '../../views/MmsListItem';
|
||||
import { MoreMenu } from '../../views/MmsMenu';
|
||||
import WantUtil from '../../utils/WantUtil';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
export default struct InfoMsg {
|
||||
@StorageLink("InfoMsgController") @Watch("changeSelectState") mInfoMsgCtrl: InfoMsgController = InfoMsgController.getInstance();
|
||||
@StorageLink('InfoMsgController') @Watch('changeSelectState') mInfoMsgCtrl: InfoMsgController = InfoMsgController.getInstance();
|
||||
@State mIsMultipleSelectState : boolean = false;
|
||||
@State misShowContactHeadIcon : boolean = true;
|
||||
private gridColumns: GridRowColumnOption = { sm: 4, md: 8, lg: 12 };
|
||||
private girdSpan: GridColColumnOption = { sm: 4, md: 8, lg: 12 };
|
||||
private gridGutter: string = "24vp";
|
||||
private gridMargin: string = "24vp";
|
||||
private gridGutter: string = '24vp';
|
||||
private gridMargin: string = '24vp';
|
||||
private dialogGridCount: number = 4;
|
||||
private dialogAlignment: DialogAlignment = DeviceUtil.isTablet() ? DialogAlignment.Center : DialogAlignment.Bottom;
|
||||
private dialogOffset: Offset = DeviceUtil.isTablet() ? { dx: 0, dy: 0 } : { dx: 0, dy: -12 };
|
||||
@ -59,7 +59,7 @@ export default struct InfoMsg {
|
||||
})
|
||||
@Provide menuItems: Array<any> = [
|
||||
{
|
||||
value: $r("app.string.delete"),
|
||||
value: $r('app.string.delete'),
|
||||
action: () => {
|
||||
this.mInfoMsgCtrl.selectInMoreMenu(1);
|
||||
},
|
||||
@ -67,7 +67,7 @@ export default struct InfoMsg {
|
||||
}
|
||||
// ,
|
||||
// {
|
||||
// value: $r("app.string.blocked"),
|
||||
// value: $r('app.string.blocked'),
|
||||
// action: () => {
|
||||
// this.mInfoMsgCtrl.selectInMoreMenu(2);
|
||||
// },
|
||||
@ -147,48 +147,48 @@ export default struct InfoMsg {
|
||||
//Multi-Select Status Title
|
||||
Flex({ direction: FlexDirection.Column }) {
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
|
||||
Image($rawfile("icon/ic_public_cancel.svg"))
|
||||
.width("24vp")
|
||||
.height("24vp")
|
||||
Image($rawfile('icon/ic_public_cancel.svg'))
|
||||
.width('24vp')
|
||||
.height('24vp')
|
||||
.onClick(() => {
|
||||
this.onBackPress()
|
||||
})
|
||||
Text(this.mInfoMsgCtrl.conversationSelectedNumber == 0 ?
|
||||
$r("app.string.msg_unselected_tip") :
|
||||
$r("app.string.msg_selected_tip", this.mInfoMsgCtrl.conversationSelectedNumber))
|
||||
.padding({ left: "16vp" })
|
||||
.fontSize("20fp")
|
||||
$r('app.string.msg_unselected_tip') :
|
||||
$r('app.string.msg_selected_tip', this.mInfoMsgCtrl.conversationSelectedNumber))
|
||||
.padding({ left: '16vp' })
|
||||
.fontSize('20fp')
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.height("56vp")
|
||||
.height('56vp')
|
||||
}
|
||||
.width("100%")
|
||||
.height("56vp")
|
||||
.width('100%')
|
||||
.height('56vp')
|
||||
} else if (!this.mInfoMsgCtrl.searchStatus) {
|
||||
//Header Row
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
|
||||
Image($rawfile("icon/ic_message_back.svg"))
|
||||
.width("24vp")
|
||||
.height("24vp")
|
||||
Image($rawfile('icon/ic_message_back.svg'))
|
||||
.width('24vp')
|
||||
.height('24vp')
|
||||
.onClick(() => {
|
||||
this.mInfoMsgCtrl.back()
|
||||
})
|
||||
Text($r("app.string.infoMessages"))
|
||||
.padding({ left: "16vp" })
|
||||
.fontSize("20fp")
|
||||
Text($r('app.string.infoMessages'))
|
||||
.padding({ left: '16vp' })
|
||||
.fontSize('20fp')
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.height("56vp")
|
||||
.height('56vp')
|
||||
}
|
||||
.width("100%")
|
||||
.height("56vp")
|
||||
.width('100%')
|
||||
.height('56vp')
|
||||
}
|
||||
|
||||
Row() {
|
||||
//Back button
|
||||
if (this.mInfoMsgCtrl.isShowSearchBack) {
|
||||
Image($rawfile("icon/ic_message_back.svg"))
|
||||
Image($rawfile('icon/ic_message_back.svg'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.onClick((event: ClickEvent) => {
|
||||
@ -197,12 +197,12 @@ export default struct InfoMsg {
|
||||
}
|
||||
//Search box
|
||||
// @ts-ignore
|
||||
Search({ value: this.mInfoMsgCtrl.inputValueOfSearch, placeholder: "搜索通知信息" })
|
||||
Search({ value: this.mInfoMsgCtrl.inputValueOfSearch, placeholder: '搜索通知信息' })
|
||||
.layoutWeight(1)
|
||||
.height("40vp")
|
||||
.border({ radius: "20vp" })
|
||||
.height('40vp')
|
||||
.border({ radius: '20vp' })
|
||||
.enabled(!this.mIsMultipleSelectState)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_text_field_bg"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_text_field_bg'))
|
||||
.onChange((value: string) => {
|
||||
//this.mInfoMsgCtrl.clickToSearch(value);
|
||||
})
|
||||
@ -211,8 +211,8 @@ export default struct InfoMsg {
|
||||
})
|
||||
}
|
||||
.visibility(Visibility.None)
|
||||
.width("100%")
|
||||
.height("56vp")
|
||||
.width('100%')
|
||||
.height('56vp')
|
||||
.padding({ left: 24, right: 24 })
|
||||
.alignItems(VerticalAlign.Center)
|
||||
|
||||
@ -258,8 +258,8 @@ export default struct InfoMsg {
|
||||
}
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.height("64vp")
|
||||
.width('100%')
|
||||
.height('64vp')
|
||||
.alignSelf(ItemAlign.Start)
|
||||
}, item => JSON.stringify(item))
|
||||
}
|
||||
@ -267,13 +267,13 @@ export default struct InfoMsg {
|
||||
.align(Alignment.Top)
|
||||
.cachedCount(this.mInfoMsgCtrl.limit)
|
||||
.edgeEffect(EdgeEffect.Spring)
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.divider({
|
||||
strokeWidth: 1,
|
||||
startMargin: this.mInfoMsgCtrl.isShowContactHeadIcon ? 52 : 12,
|
||||
endMargin: 0
|
||||
})
|
||||
}.width("100%")
|
||||
}.width('100%')
|
||||
//Search Above
|
||||
//SMS Search Session Item
|
||||
//Left avatar
|
||||
@ -292,8 +292,8 @@ export default struct InfoMsg {
|
||||
if (this.mInfoMsgCtrl.isSearchCoverage) {
|
||||
//Display of layers for search
|
||||
Flex()
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.opacity(0.2)
|
||||
.backgroundColor(Color.Gray)
|
||||
.onTouch((event: TouchEvent) => {
|
||||
@ -317,16 +317,16 @@ export default struct InfoMsg {
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Image($rawfile(this.mInfoMsgCtrl.svgDelete))
|
||||
.width("24vp")
|
||||
.height("24vp")
|
||||
.margin({ top: "3vp" })
|
||||
Text($r("app.string.delete"))
|
||||
.fontSize("10fp")
|
||||
.width('24vp')
|
||||
.height('24vp')
|
||||
.margin({ top: '3vp' })
|
||||
Text($r('app.string.delete'))
|
||||
.fontSize('10fp')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.margin({ top: 3 })
|
||||
}
|
||||
.width("50%")
|
||||
.width('50%')
|
||||
.opacity(this.mInfoMsgCtrl.checkSelectedNumberIsEmpty() ? 0.4 : 1)
|
||||
.onClick(() => {
|
||||
if (!this.mInfoMsgCtrl.checkSelectedNumberIsEmpty()) {
|
||||
@ -342,29 +342,29 @@ export default struct InfoMsg {
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Image($rawfile(this.mInfoMsgCtrl.isConversationCheckAll ?
|
||||
"icon/ic_select_all_filled.svg" :
|
||||
"icon/ic_select_all.svg"))
|
||||
.width("24vp")
|
||||
.height("24vp")
|
||||
.margin({ top: "3vp" })
|
||||
'icon/ic_select_all_filled.svg' :
|
||||
'icon/ic_select_all.svg'))
|
||||
.width('24vp')
|
||||
.height('24vp')
|
||||
.margin({ top: '3vp' })
|
||||
Text(this.mInfoMsgCtrl.strCheckBoxSelectTip)
|
||||
.fontSize("10fp")
|
||||
.fontSize('10fp')
|
||||
.fontColor(this.mInfoMsgCtrl.isConversationCheckAll ?
|
||||
$r("sys.color.ohos_id_color_bottom_tab_text_on") :
|
||||
$r("sys.color.ohos_id_color_bottom_tab_text_off"))
|
||||
$r('sys.color.ohos_id_color_bottom_tab_text_on') :
|
||||
$r('sys.color.ohos_id_color_bottom_tab_text_off'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.margin({ top: 3 })
|
||||
}
|
||||
.width("50%")
|
||||
.width('50%')
|
||||
.onClick(() => {
|
||||
this.mInfoMsgCtrl.clickConversationCheckAll()
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.padding({ left: $r("app.float.menu_layout_padding_left"),
|
||||
right: $r("app.float.menu_layout_padding_right") })
|
||||
.padding({ left: $r('app.float.menu_layout_padding_left'),
|
||||
right: $r('app.float.menu_layout_padding_right') })
|
||||
.flexBasis(56)
|
||||
.flexShrink(0)
|
||||
}
|
||||
@ -378,16 +378,16 @@ export default struct InfoMsg {
|
||||
justifyContent: FlexAlign.Center,
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Image($rawfile("icon/ic_allread.svg"))
|
||||
.width("24vp")
|
||||
.height("24vp")
|
||||
.margin({ top: "3vp" })
|
||||
Text($r("app.string.markAllAsRead"))
|
||||
.fontSize($r("sys.float.ohos_id_text_size_caption"))
|
||||
Image($rawfile('icon/ic_allread.svg'))
|
||||
.width('24vp')
|
||||
.height('24vp')
|
||||
.margin({ top: '3vp' })
|
||||
Text($r('app.string.markAllAsRead'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_caption'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r("sys.color.ohos_id_color_toolbar_text"))
|
||||
.fontColor($r('sys.color.ohos_id_color_toolbar_text'))
|
||||
}
|
||||
.width("50%")
|
||||
.width('50%')
|
||||
.opacity(this.mInfoMsgCtrl.unreadTotalOfInfo == 0 ? 0.4 : 1)
|
||||
.onClick(() => {
|
||||
this.mInfoMsgCtrl.clickToMarkAllAsReadForInfo()
|
||||
@ -399,23 +399,23 @@ export default struct InfoMsg {
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
MoreMenu({
|
||||
menuText: $r("app.string.more")
|
||||
menuText: $r('app.string.more')
|
||||
})
|
||||
}
|
||||
.width("50%")
|
||||
.width('50%')
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.padding({ left: $r("app.float.menu_layout_padding_left"),
|
||||
right: $r("app.float.menu_layout_padding_right") })
|
||||
.padding({ left: $r('app.float.menu_layout_padding_left'),
|
||||
right: $r('app.float.menu_layout_padding_right') })
|
||||
.flexBasis(56)
|
||||
.flexShrink(0)
|
||||
}
|
||||
//Setting the background of the navigation bar
|
||||
//Delete pop-up dialog box
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
||||
.margin({ left: this.gridMargin, right: this.gridMargin })
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -26,14 +26,14 @@ import NotificationService from '../../service/NotificationService';
|
||||
import settingService from '../../service/SettingService';
|
||||
import ConversationListDataSource from '../../model/ConversationListDataSource'
|
||||
|
||||
const TAG = "InfoMsgController"
|
||||
const TAG = 'InfoMsgController'
|
||||
|
||||
let sInfoMsgCtrl;
|
||||
|
||||
export default class InfoMsgController {
|
||||
delDialogShow: boolean = false;
|
||||
commonEventData: any = null;
|
||||
svgDelete: string = "icon/ic_public_delete.svg"
|
||||
svgDelete: string = 'icon/ic_public_delete.svg'
|
||||
total: number = 0;
|
||||
strCheckBoxSelectTip: Resource;
|
||||
strMsgDeleteDialogTip: Resource;
|
||||
@ -51,8 +51,8 @@ export default class InfoMsgController {
|
||||
isSelectLockMsg: boolean = false;
|
||||
// List of search results
|
||||
searchResultList: LooseObject = {
|
||||
"sessionList": [],
|
||||
"contentList": []
|
||||
'sessionList': [],
|
||||
'contentList': []
|
||||
};
|
||||
// Search Results Queue
|
||||
searchResultListQueue: Array<any> = [];
|
||||
@ -112,19 +112,19 @@ export default class InfoMsgController {
|
||||
static getInstance() {
|
||||
if (sInfoMsgCtrl == null) {
|
||||
sInfoMsgCtrl = new InfoMsgController();
|
||||
AppStorage.SetAndLink("InfoMsgController", sInfoMsgCtrl);
|
||||
AppStorage.SetAndLink('InfoMsgController', sInfoMsgCtrl);
|
||||
}
|
||||
return sInfoMsgCtrl;
|
||||
}
|
||||
|
||||
onInit() {
|
||||
HiLog.i(TAG, "onInit");
|
||||
this.strCheckBoxSelectTip = $r("app.string.msg_select_all");
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip2", this.conversationSelectedNumber);
|
||||
HiLog.i(TAG, 'onInit');
|
||||
this.strCheckBoxSelectTip = $r('app.string.msg_select_all');
|
||||
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_tip2', this.conversationSelectedNumber);
|
||||
}
|
||||
|
||||
onShow() {
|
||||
HiLog.i(TAG, "onShow");
|
||||
HiLog.i(TAG, 'onShow');
|
||||
this.isJumping = false;
|
||||
this.getSettingFlagForConvListPage();
|
||||
this.page = 0;
|
||||
@ -134,7 +134,7 @@ export default class InfoMsgController {
|
||||
}
|
||||
|
||||
onHide() {
|
||||
HiLog.i(TAG, "onHide");
|
||||
HiLog.i(TAG, 'onHide');
|
||||
this.unsubscribeInfo();
|
||||
}
|
||||
// Querying List Data
|
||||
@ -146,7 +146,7 @@ export default class InfoMsgController {
|
||||
actionData.orderByTimeDesc = true;
|
||||
ConversationListService.getInstance().querySessionList(actionData, result => {
|
||||
if (result.code == common.int.SUCCESS) {
|
||||
HiLog.i(TAG, "queryAllMessages, Success");
|
||||
HiLog.i(TAG, 'queryAllMessages, Success');
|
||||
let res = this.buildSessionList(result);
|
||||
this.messageList = res;
|
||||
this.conversationListDataSource.refresh(this.messageList);
|
||||
@ -156,7 +156,7 @@ export default class InfoMsgController {
|
||||
this.countUnread();
|
||||
}
|
||||
} else {
|
||||
HiLog.w(TAG, "queryAllMessages, failed");
|
||||
HiLog.w(TAG, 'queryAllMessages, failed');
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
@ -164,13 +164,13 @@ export default class InfoMsgController {
|
||||
dealMmsListContent(element) {
|
||||
if (element.hasMms && element.hasAttachment) {
|
||||
if (element.content == common.string.EMPTY_STR) {
|
||||
element.content = $r("app.string.attachment_no_subject");
|
||||
element.content = $r('app.string.attachment_no_subject');
|
||||
} else {
|
||||
element.content = $r("app.string.attachment", element.content);
|
||||
element.content = $r('app.string.attachment', element.content);
|
||||
}
|
||||
}
|
||||
if (element.hasMms && !element.hasAttachment && element.content == common.string.EMPTY_STR) {
|
||||
element.content = $r("app.string.no_subject");
|
||||
element.content = $r('app.string.no_subject');
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ export default class InfoMsgController {
|
||||
}
|
||||
// Tap More at the bottom of the screen
|
||||
clickMore() {
|
||||
// this.$element("moreDialog").show();
|
||||
// this.$element('moreDialog').show();
|
||||
}
|
||||
// Delete a single piece of information from a notification.
|
||||
clickToDelete() {
|
||||
@ -242,7 +242,7 @@ export default class InfoMsgController {
|
||||
}
|
||||
// Touch and hold a list to display the selection and deletion functions.
|
||||
this.showToolBar = false;
|
||||
HiLog.i(TAG, "conversationLongPress, index: " + index);
|
||||
HiLog.i(TAG, 'conversationLongPress, index: ' + index);
|
||||
if (this.isMultipleSelectState) {
|
||||
this.messageList[index].isCbChecked = !this.messageList[index].isCbChecked;
|
||||
} else {
|
||||
@ -277,10 +277,10 @@ export default class InfoMsgController {
|
||||
this.conversationListDataSource.refresh(this.messageList);
|
||||
if (!this.isConversationCheckAll) {
|
||||
// Non-Select All Status
|
||||
this.strCheckBoxSelectTip = $r("app.string.msg_select_all");
|
||||
this.strCheckBoxSelectTip = $r('app.string.msg_select_all');
|
||||
} else {
|
||||
// Select All Status
|
||||
this.strCheckBoxSelectTip = $r("app.string.msg_deselect_all");
|
||||
this.strCheckBoxSelectTip = $r('app.string.msg_deselect_all');
|
||||
}
|
||||
}
|
||||
// The SM details page is displayed.
|
||||
@ -308,7 +308,7 @@ export default class InfoMsgController {
|
||||
// The session details page is displayed.
|
||||
jumpToConversationPage(item) {
|
||||
router.push({
|
||||
uri: "pages/conversation/conversation",
|
||||
uri: 'pages/conversation/conversation',
|
||||
params: {
|
||||
strContactsNumber: item?.telephone,
|
||||
strContactsNumberFormat: item?.telephoneFormat,
|
||||
@ -351,7 +351,7 @@ export default class InfoMsgController {
|
||||
// Go to the multi-faceted portrait list page.
|
||||
jumpToGroupDetail(threadId, contactsNum) {
|
||||
let actionData = {
|
||||
uri: "pages/group_detail/group_detail",
|
||||
uri: 'pages/group_detail/group_detail',
|
||||
params: {
|
||||
threadId: threadId,
|
||||
contactsNum: contactsNum
|
||||
@ -368,7 +368,7 @@ export default class InfoMsgController {
|
||||
searchMmsClicked(item) {
|
||||
if (item.isFavorite) {
|
||||
router.push({
|
||||
uri: "pages/my_star/my_star",
|
||||
uri: 'pages/my_star/my_star',
|
||||
params: {
|
||||
searchContent: this.inputValueOfSearch
|
||||
}
|
||||
@ -396,10 +396,10 @@ export default class InfoMsgController {
|
||||
if (result.code == common.int.SUCCESS) {
|
||||
// Unreading of notification messages
|
||||
that.unreadTotalOfInfo = result.response.unreadTotalOfInfo;
|
||||
HiLog.i(TAG, "countUnread = " + that.unreadTotalOfInfo);
|
||||
HiLog.i(TAG, 'countUnread = ' + that.unreadTotalOfInfo);
|
||||
NotificationService.getInstance().setBadgeNumber(Number(result.response.totalListCount));
|
||||
} else {
|
||||
HiLog.w(TAG, "countUnread, statisticalData failed");
|
||||
HiLog.w(TAG, 'countUnread, statisticalData failed');
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
@ -460,11 +460,11 @@ export default class InfoMsgController {
|
||||
return;
|
||||
}
|
||||
if (this.conversationSelectedNumber == common.int.MESSAGE_CODE_ONE) {
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip1");
|
||||
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_tip1');
|
||||
} else if (this.conversationSelectedNumber == this.messageList.length) {
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip3");
|
||||
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_tip3');
|
||||
} else {
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip2", this.conversationSelectedNumber);
|
||||
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_tip2', this.conversationSelectedNumber);
|
||||
}
|
||||
this.hasLockMsg = (this.messageList.some((element, index) => element.isCbChecked && element.isLock));
|
||||
}
|
||||
@ -648,7 +648,7 @@ export default class InfoMsgController {
|
||||
|
||||
deleteAction(idx) {
|
||||
let element = this.messageList[idx];
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip1");
|
||||
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_tip1');
|
||||
element.isCbChecked = true;
|
||||
this.hasLockMsg = (this.messageList.some((element, index) => element.isCbChecked && element.isLock));
|
||||
}
|
||||
@ -670,7 +670,7 @@ export default class InfoMsgController {
|
||||
}
|
||||
// Subscribe to New Messages Received
|
||||
subscribeInfo() {
|
||||
HiLog.i(TAG, "subscribeInfo, start");
|
||||
HiLog.i(TAG, 'subscribeInfo, start');
|
||||
let events = [common.string.RECEIVE_TRANSMIT_EVENT]
|
||||
let commonEventSubscribeInfo = {
|
||||
events: events
|
||||
@ -705,7 +705,7 @@ export default class InfoMsgController {
|
||||
unsubscribeInfo() {
|
||||
if (this.commonEventData != null) {
|
||||
commonEvent.unsubscribe(this.commonEventData, () => {
|
||||
HiLog.i(TAG, "unsubscribeInfo, success");
|
||||
HiLog.i(TAG, 'unsubscribeInfo, success');
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -714,7 +714,7 @@ export default class InfoMsgController {
|
||||
var str = commonService.commonContactParam(actionData);
|
||||
globalThis.mmsContext.startAbility(str).then((data) => {
|
||||
}).catch((error) => {
|
||||
HiLog.e(TAG, "jumpToContact, failed: " + JSON.stringify(error.message));
|
||||
HiLog.e(TAG, 'jumpToContact, failed: ' + JSON.stringify(error.message));
|
||||
})
|
||||
this.isJumping = false;
|
||||
}
|
||||
|
@ -1,30 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import DeviceUtil from "../../utils/DeviceUtil";
|
||||
import router from "@system.router";
|
||||
import QueryReportController from "./queryReportController";
|
||||
import WantUtil from "../../utils/WantUtil";
|
||||
import DeviceUtil from '../../utils/DeviceUtil';
|
||||
import router from '@system.router';
|
||||
import QueryReportController from './queryReportController';
|
||||
import WantUtil from '../../utils/WantUtil';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct queryReport {
|
||||
@StorageLink("QueryReportController") queryReportController: QueryReportController = QueryReportController.getInstance();
|
||||
@StorageLink('QueryReportController') queryReportController: QueryReportController = QueryReportController.getInstance();
|
||||
private gridColumns: GridRowColumnOption = { sm: 4, md: 8, lg: 12 };
|
||||
private girdSpan: GridColColumnOption = { sm: 4, md: 8, lg: 12 };
|
||||
private gridGutter: string = "24vp";
|
||||
private gridMargin: string = "24vp";
|
||||
private gridGutter: string = '24vp';
|
||||
private gridMargin: string = '24vp';
|
||||
|
||||
onPageShow(): void {
|
||||
this.queryReportController.onShow();
|
||||
@ -44,7 +44,7 @@ struct queryReport {
|
||||
.onClick(() => {
|
||||
router.back()
|
||||
})
|
||||
Text($r("app.string.send_reports"))
|
||||
Text($r('app.string.send_reports'))
|
||||
.margin({ left: 16 })
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
@ -55,7 +55,7 @@ struct queryReport {
|
||||
|
||||
Column() {
|
||||
Text() {
|
||||
Span($r("app.string.putAddresser")).fontSize(16)
|
||||
Span($r('app.string.putAddresser')).fontSize(16)
|
||||
Span(this.queryReportController.telephone).fontSize(16)
|
||||
}
|
||||
.fontSize(16)
|
||||
@ -64,7 +64,7 @@ struct queryReport {
|
||||
.lineHeight(22)
|
||||
|
||||
Text() {
|
||||
Span($r("app.string.Status")).fontSize(16)
|
||||
Span($r('app.string.Status')).fontSize(16)
|
||||
Span(this.queryReportController.sendStatusDesc).fontSize(16)
|
||||
}
|
||||
.fontSize(16)
|
||||
@ -74,9 +74,9 @@ struct queryReport {
|
||||
|
||||
if (!this.queryReportController.isMsm && this.queryReportController.sendStatus != 2) {
|
||||
Text() {
|
||||
Span($r("app.string.Delivered")).fontSize(16)
|
||||
Span($r('app.string.Delivered')).fontSize(16)
|
||||
Span(this.queryReportController.mmsTime).fontSize(16)
|
||||
Span(" ")
|
||||
Span(' ')
|
||||
Span(this.queryReportController.specificTime).fontSize(16)
|
||||
}
|
||||
.fontSize(16)
|
||||
@ -89,8 +89,8 @@ struct queryReport {
|
||||
.padding({ left: 12, right: 12 })
|
||||
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.margin({ left: this.gridMargin, right: this.gridMargin })
|
||||
}
|
||||
}
|
@ -1,23 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import common from "../../data/commonData";
|
||||
import dateUtil from "../../utils/DateUtil";
|
||||
import router from "@system.router";
|
||||
import HiLog from "../../utils/HiLog"
|
||||
import common from '../../data/commonData';
|
||||
import dateUtil from '../../utils/DateUtil';
|
||||
import router from '@system.router';
|
||||
import HiLog from '../../utils/HiLog'
|
||||
|
||||
const TAG = "QueryReportController";
|
||||
const TAG = 'QueryReportController';
|
||||
|
||||
let queryReportCtrl;
|
||||
|
||||
@ -33,29 +33,29 @@ export default class QueryReportController {
|
||||
// Specific morning and afternoon time
|
||||
specificTime: Resource;
|
||||
// Timestamp
|
||||
timeMillisecond: string = "0";
|
||||
timeMillisecond: string = '0';
|
||||
// telephoneNo
|
||||
telephone: string = '';
|
||||
|
||||
static getInstance() {
|
||||
if (queryReportCtrl == null) {
|
||||
queryReportCtrl = new QueryReportController();
|
||||
AppStorage.SetAndLink("QueryReportController", queryReportCtrl);
|
||||
AppStorage.SetAndLink('QueryReportController', queryReportCtrl);
|
||||
}
|
||||
return queryReportCtrl;
|
||||
};
|
||||
|
||||
onInit() {
|
||||
HiLog.i(TAG, "onInit")
|
||||
HiLog.i(TAG, 'onInit')
|
||||
this.isMsm = router.getParams().isMsm == undefined ? true : Boolean(router.getParams().isMsm);
|
||||
this.sendStatus = router.getParams().sendStatus == undefined ? 0 : Number(router.getParams().sendStatus);
|
||||
this.timeMillisecond =
|
||||
router.getParams().timeMillisecond == undefined ? "0" : String(router.getParams().timeMillisecond);
|
||||
router.getParams().timeMillisecond == undefined ? '0' : String(router.getParams().timeMillisecond);
|
||||
this.telephone = router.getParams().telephone == undefined ? '' : String(router.getParams().telephone)
|
||||
};
|
||||
|
||||
onShow() {
|
||||
HiLog.i(TAG, "onShow")
|
||||
HiLog.i(TAG, 'onShow')
|
||||
// The status is changed to Chinese description.
|
||||
this.dealSendStatus();
|
||||
// Time Conversion
|
||||
@ -63,13 +63,13 @@ export default class QueryReportController {
|
||||
};
|
||||
|
||||
dealSendStatus() {
|
||||
HiLog.i(TAG, "dealSendStatus sendStatus=" + this.sendStatus)
|
||||
HiLog.i(TAG, 'dealSendStatus sendStatus=' + this.sendStatus)
|
||||
if (this.sendStatus == common.int.SEND_MESSAGE_SUCCESS) {
|
||||
this.sendStatusDesc = $r("app.string.received");
|
||||
this.sendStatusDesc = $r('app.string.received');
|
||||
} else if (this.sendStatus == common.int.SEND_MESSAGE_FAILED) {
|
||||
this.sendStatusDesc = this.isMsm ? $r("app.string.refused") : $r("app.string.failed");
|
||||
this.sendStatusDesc = this.isMsm ? $r('app.string.refused') : $r('app.string.failed');
|
||||
} else {
|
||||
this.sendStatusDesc = $r("app.string.rending");
|
||||
this.sendStatusDesc = $r('app.string.rending');
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,49 +1,49 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import AdvancedSettingsController from "./advancedSettingsController";
|
||||
import DeviceUtil from "../../../utils/DeviceUtil";
|
||||
import { MmsSimpleDialog } from "../../../views/MmsDialogs";
|
||||
import { MoreMenu } from "../../../views/MmsMenu";
|
||||
import router from "@system.router";
|
||||
import { SettingItemJump } from "../../../views/SettingItem";
|
||||
import WantUtil from "../../../utils/WantUtil";
|
||||
import SettingsController from "../settingsController"
|
||||
import AdvancedSettingsController from './advancedSettingsController';
|
||||
import DeviceUtil from '../../../utils/DeviceUtil';
|
||||
import { MmsSimpleDialog } from '../../../views/MmsDialogs';
|
||||
import { MoreMenu } from '../../../views/MmsMenu';
|
||||
import router from '@system.router';
|
||||
import { SettingItemJump } from '../../../views/SettingItem';
|
||||
import WantUtil from '../../../utils/WantUtil';
|
||||
import SettingsController from '../settingsController'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct AdvancedSettings {
|
||||
@StorageLink("AdvancedSettingsController") @Watch("changeSelectState") mAdvancedSettingsCtrl:
|
||||
@StorageLink('AdvancedSettingsController') @Watch('changeSelectState') mAdvancedSettingsCtrl:
|
||||
AdvancedSettingsController = AdvancedSettingsController.getInstance();
|
||||
@StorageLink("SettingsController") @Watch("changeSelectState") mSettingsCtrl:
|
||||
@StorageLink('SettingsController') @Watch('changeSelectState') mSettingsCtrl:
|
||||
SettingsController = SettingsController.getInstance()
|
||||
private gridColumns: GridRowColumnOption = { sm: 4, md: 8, lg: 12 };
|
||||
private girdSpan: GridColColumnOption = { sm: 4, md: 6, lg: 8 };
|
||||
private gridColOffset: GridColColumnOption = { md: 1, lg: 2 };
|
||||
private gridGutter: string = "12vp";
|
||||
private gridGutter: string = '12vp';
|
||||
private dialogGridCount: number = 4;
|
||||
dialogAlignment: DialogAlignment = DeviceUtil.isTablet() ? DialogAlignment.Center : DialogAlignment.Bottom;
|
||||
dialogOffset: Offset = DeviceUtil.isTablet() ? { dx: 0, dy: 0 } : { dx: 0, dy: -16 };
|
||||
private restoreDialog = new MmsSimpleDialog({
|
||||
message: $r("app.string.restore_all_default_settings"),
|
||||
message: $r('app.string.restore_all_default_settings'),
|
||||
primaryButton: {
|
||||
value: $r("app.string.cancel"),
|
||||
value: $r('app.string.cancel'),
|
||||
action: () => {
|
||||
}
|
||||
},
|
||||
secondaryButton: {
|
||||
value: $r("app.string.restore"),
|
||||
value: $r('app.string.restore'),
|
||||
action: () => {
|
||||
this.mAdvancedSettingsCtrl.restoreSettingPageSwitchValue();
|
||||
this.mSettingsCtrl.restoreSettingsPageSwitchValue();
|
||||
@ -52,7 +52,7 @@ struct AdvancedSettings {
|
||||
});
|
||||
@Provide menuItems: Array<any> = [
|
||||
{
|
||||
value: $r("app.string.restore_default_settings"),
|
||||
value: $r('app.string.restore_default_settings'),
|
||||
action: () => {
|
||||
this.restoreDialog.show();
|
||||
},
|
||||
@ -124,32 +124,32 @@ struct AdvancedSettings {
|
||||
Column() {
|
||||
// Top Device Title
|
||||
Row() {
|
||||
Image($rawfile("icon/ic_message_back.svg"))
|
||||
.width($r("app.float.icon_side_length_medium"))
|
||||
.height($r("app.float.icon_side_length_medium"))
|
||||
Image($rawfile('icon/ic_message_back.svg'))
|
||||
.width($r('app.float.icon_side_length_medium'))
|
||||
.height($r('app.float.icon_side_length_medium'))
|
||||
.margin({
|
||||
left: $r("app.float.action_bar_margin_left")
|
||||
left: $r('app.float.action_bar_margin_left')
|
||||
})
|
||||
.onClick(() => {
|
||||
router.back()
|
||||
})
|
||||
|
||||
Row().width($r("app.float.space_16"))
|
||||
Row().width($r('app.float.space_16'))
|
||||
|
||||
Text($r("app.string.advanced"))
|
||||
.fontSize($r("app.float.action_bar_text_size"))
|
||||
Text($r('app.string.advanced'))
|
||||
.fontSize($r('app.float.action_bar_text_size'))
|
||||
.fontColor(Color.Black)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
|
||||
Row().width("100%").flexShrink(1)
|
||||
Row().width('100%').flexShrink(1)
|
||||
|
||||
Column() {
|
||||
MoreMenu()
|
||||
}
|
||||
.margin({ right: $r("app.float.action_bar_margin_right") })
|
||||
.margin({ right: $r('app.float.action_bar_margin_right') })
|
||||
}
|
||||
.width("100%")
|
||||
.height($r("app.float.action_bar_height"))
|
||||
.width('100%')
|
||||
.height($r('app.float.action_bar_height'))
|
||||
|
||||
Scroll() {
|
||||
GridRow({ columns: this.gridColumns, gutter: this.gridGutter }) {
|
||||
@ -160,8 +160,8 @@ struct AdvancedSettings {
|
||||
Column() {
|
||||
// Delivery Report
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.delivery_reports"),
|
||||
secondaryTitle: $r("app.string.delivery_reports_hint"),
|
||||
primaryTitle: $r('app.string.delivery_reports'),
|
||||
secondaryTitle: $r('app.string.delivery_reports_hint'),
|
||||
showBottomDivider: false,
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
this.deliveryReportsDialogCtrl.open();
|
||||
@ -169,7 +169,7 @@ struct AdvancedSettings {
|
||||
})
|
||||
// Automatically downloading MMs
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.auto_retrieve_mms"),
|
||||
primaryTitle: $r('app.string.auto_retrieve_mms'),
|
||||
// statusTitle: this.mAdvancedSettingsCtrl.autoRetrieveMmsSwitchInText,
|
||||
visibilityShow: Visibility.None,
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
@ -177,41 +177,41 @@ struct AdvancedSettings {
|
||||
}
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({
|
||||
top: $r("app.float.settings_item_padding_top"),
|
||||
bottom: $r("app.float.settings_item_padding_bottom"),
|
||||
left: $r("app.float.settings_item_padding_left"),
|
||||
right: $r("app.float.settings_item_padding_right")
|
||||
top: $r('app.float.settings_item_padding_top'),
|
||||
bottom: $r('app.float.settings_item_padding_bottom'),
|
||||
left: $r('app.float.settings_item_padding_left'),
|
||||
right: $r('app.float.settings_item_padding_right')
|
||||
})
|
||||
.border({
|
||||
radius: $r("app.float.settings_items_radius"),
|
||||
color: $r("sys.color.ohos_id_color_text_field_bg")
|
||||
radius: $r('app.float.settings_items_radius'),
|
||||
color: $r('sys.color.ohos_id_color_text_field_bg')
|
||||
})
|
||||
.backgroundColor($r("sys.color.ohos_id_color_text_field_bg"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_text_field_bg'))
|
||||
|
||||
// Setting items of the second group
|
||||
Column() {
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({
|
||||
top: $r("app.float.settings_item_padding_top"),
|
||||
bottom: $r("app.float.settings_item_padding_bottom"),
|
||||
left: $r("app.float.settings_item_padding_left"),
|
||||
right: $r("app.float.settings_item_padding_right")
|
||||
top: $r('app.float.settings_item_padding_top'),
|
||||
bottom: $r('app.float.settings_item_padding_bottom'),
|
||||
left: $r('app.float.settings_item_padding_left'),
|
||||
right: $r('app.float.settings_item_padding_right')
|
||||
})
|
||||
.border({
|
||||
radius: $r("app.float.settings_items_radius"),
|
||||
color: $r("sys.color.ohos_id_color_text_field_bg")
|
||||
radius: $r('app.float.settings_items_radius'),
|
||||
color: $r('sys.color.ohos_id_color_text_field_bg')
|
||||
})
|
||||
.backgroundColor($r("sys.color.ohos_id_color_text_field_bg"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_text_field_bg'))
|
||||
.visibility(Visibility.None)
|
||||
|
||||
// Setting items of the third group
|
||||
Column() {
|
||||
// SMSC
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.sms_center"),
|
||||
primaryTitle: $r('app.string.sms_center'),
|
||||
showBottomDivider: true,
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
this.mAdvancedSettingsCtrl.jumpToSmsCenterPage(1);
|
||||
@ -219,29 +219,29 @@ struct AdvancedSettings {
|
||||
})
|
||||
// Managing SIM Card Information
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.manage_sim_card_messages"),
|
||||
primaryTitle: $r('app.string.manage_sim_card_messages'),
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
this.mAdvancedSettingsCtrl.jumpToManageSimPage(1);
|
||||
}
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({
|
||||
top: $r("app.float.settings_item_padding_top"),
|
||||
bottom: $r("app.float.settings_item_padding_bottom"),
|
||||
left: $r("app.float.settings_item_padding_left"),
|
||||
right: $r("app.float.settings_item_padding_right")
|
||||
top: $r('app.float.settings_item_padding_top'),
|
||||
bottom: $r('app.float.settings_item_padding_bottom'),
|
||||
left: $r('app.float.settings_item_padding_left'),
|
||||
right: $r('app.float.settings_item_padding_right')
|
||||
})
|
||||
.border({
|
||||
radius: $r("app.float.settings_items_radius"),
|
||||
color: $r("sys.color.ohos_id_color_text_field_bg")
|
||||
radius: $r('app.float.settings_items_radius'),
|
||||
color: $r('sys.color.ohos_id_color_text_field_bg')
|
||||
})
|
||||
.backgroundColor($r("sys.color.ohos_id_color_text_field_bg"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_text_field_bg'))
|
||||
.visibility(Visibility.None)
|
||||
}
|
||||
.margin({
|
||||
top: $r("app.float.settings_items_margin_top"),
|
||||
bottom: $r("app.float.settings_items_margin_bottom")
|
||||
top: $r('app.float.settings_items_margin_top'),
|
||||
bottom: $r('app.float.settings_items_margin_bottom')
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -249,10 +249,10 @@ struct AdvancedSettings {
|
||||
.layoutWeight(1)
|
||||
.align(Alignment.Top)
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.padding({ left: $r("app.float.page_padding_left"), right: $r("app.float.page_padding_right") })
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.padding({ left: $r('app.float.page_padding_left'), right: $r('app.float.page_padding_right') })
|
||||
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,28 +270,28 @@ struct DeliveryReportsDialog {
|
||||
build() {
|
||||
Column() {
|
||||
Column() {
|
||||
Text($r("app.string.delivery_reports"))
|
||||
.width("100%")
|
||||
Text($r('app.string.delivery_reports'))
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.textAlign(TextAlign.Start)
|
||||
.fontSize(20)
|
||||
.fontColor($r("sys.color.ohos_id_color_foreground"))
|
||||
.fontColor($r('sys.color.ohos_id_color_foreground'))
|
||||
.lineHeight(28)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
Stack() {
|
||||
Text($r("app.string.sms"))
|
||||
Text($r('app.string.sms'))
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_foreground"))
|
||||
.fontColor($r('sys.color.ohos_id_color_foreground'))
|
||||
.lineHeight(22)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.align(Alignment.Start)
|
||||
.width('100%')
|
||||
Toggle({ type: ToggleType.Checkbox, isOn: this.isOnOfSms })
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(20)
|
||||
.selectedColor($r("sys.color.ohos_id_color_activated"))
|
||||
.selectedColor($r('sys.color.ohos_id_color_activated'))
|
||||
.align(Alignment.End)
|
||||
.onChange((isOn: boolean) => {
|
||||
this.isOnOfSms = isOn
|
||||
@ -301,22 +301,22 @@ struct DeliveryReportsDialog {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth(0.5)
|
||||
.width("100%")
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.width('100%')
|
||||
.color($r('sys.color.ohos_id_color_list_separator'))
|
||||
|
||||
Stack() {
|
||||
Text($r("app.string.mms"))
|
||||
Text($r('app.string.mms'))
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_foreground"))
|
||||
.fontColor($r('sys.color.ohos_id_color_foreground'))
|
||||
.lineHeight(22)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.align(Alignment.Start)
|
||||
.width('100%')
|
||||
Toggle({ type: ToggleType.Checkbox, isOn: this.isOnOfMms })
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(20)
|
||||
.selectedColor($r("sys.color.ohos_id_color_activated"))
|
||||
.selectedColor($r('sys.color.ohos_id_color_activated'))
|
||||
.align(Alignment.End)
|
||||
.onChange((isOn: boolean) => {
|
||||
this.isOnOfMms = isOn
|
||||
@ -332,15 +332,15 @@ struct DeliveryReportsDialog {
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Button() {
|
||||
Text($r("app.string.cancel"))
|
||||
Text($r('app.string.cancel'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_activated"))
|
||||
.fontColor($r('sys.color.ohos_id_color_activated'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.layoutWeight(1)
|
||||
.height(40)
|
||||
.onClick(() => {
|
||||
@ -348,17 +348,17 @@ struct DeliveryReportsDialog {
|
||||
this.cancel();
|
||||
})
|
||||
|
||||
Divider().vertical(true).strokeWidth(0.5).height(24).color($r("sys.color.ohos_id_color_list_separator"))
|
||||
Divider().vertical(true).strokeWidth(0.5).height(24).color($r('sys.color.ohos_id_color_list_separator'))
|
||||
Button() {
|
||||
Text($r("app.string.ok"))
|
||||
Text($r('app.string.ok'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_activated"))
|
||||
.fontColor($r('sys.color.ohos_id_color_activated'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.layoutWeight(1)
|
||||
.height(40)
|
||||
.onClick(() => {
|
||||
@ -366,12 +366,12 @@ struct DeliveryReportsDialog {
|
||||
this.confirm(this.isOnOfSms, this.isOnOfMms);
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.padding({ left: 16, right: 16, bottom: 16 })
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.borderRadius(16) // Customdialog need to set borderRadius
|
||||
.backgroundColor($r("sys.color.ohos_id_color_dialog_bg"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import LooseObject from "../../../data/LooseObject"
|
||||
import HiLog from "../../../utils/HiLog";
|
||||
import router from "@system.router";
|
||||
import prompt from "@system.prompt";
|
||||
import settingService from "../../../service/SettingService"
|
||||
import common from "../../../data/commonData";
|
||||
import LooseObject from '../../../data/LooseObject'
|
||||
import HiLog from '../../../utils/HiLog';
|
||||
import router from '@system.router';
|
||||
import prompt from '@system.prompt';
|
||||
import settingService from '../../../service/SettingService'
|
||||
import common from '../../../data/commonData';
|
||||
|
||||
const TAG = "AdvancedSettingsController";
|
||||
const TAG = 'AdvancedSettingsController';
|
||||
|
||||
export default class AdvancedSettingsController {
|
||||
private static sInstance: AdvancedSettingsController;
|
||||
@ -30,11 +30,11 @@ export default class AdvancedSettingsController {
|
||||
// Value of Delivery Report Switch
|
||||
deliveryReportSwitch: string = common.DELIVERY_REPORTS.DISABLED;
|
||||
// Delivery Report Text
|
||||
deliveryReportSwitchInText: Resource = $r("app.string.disabled");
|
||||
deliveryReportSwitchInText: Resource = $r('app.string.disabled');
|
||||
// Automatic MM Download Switch
|
||||
autoRetrieveMmsSwitch: string = common.AUTO_RETRIEVE_MMS.OFF;
|
||||
// Text for automatically downloading MMS messages
|
||||
autoRetrieveMmsSwitchInText: Resource | string = $r("app.string.off");
|
||||
autoRetrieveMmsSwitchInText: Resource | string = $r('app.string.off');
|
||||
// Cancel Sending Switch
|
||||
recallMessageSwitch: string = common.bool.FALSE;
|
||||
// Automatic Notification Deletion Switch
|
||||
@ -61,20 +61,20 @@ export default class AdvancedSettingsController {
|
||||
}
|
||||
|
||||
constructor() {
|
||||
HiLog.i(TAG, "constructor, start");
|
||||
HiLog.i(TAG, 'constructor, start');
|
||||
this.getAdvancedPageSwitchValue();
|
||||
}
|
||||
|
||||
onInit() {
|
||||
HiLog.i(TAG, "onInit, start");
|
||||
HiLog.i(TAG, 'onInit, start');
|
||||
}
|
||||
|
||||
onShow() {
|
||||
HiLog.i(TAG, "onShow, start");
|
||||
HiLog.i(TAG, 'onShow, start');
|
||||
}
|
||||
|
||||
getAdvancedPageSwitchValue() {
|
||||
HiLog.i(TAG, "getAdvancedPageSwitchValue, start");
|
||||
HiLog.i(TAG, 'getAdvancedPageSwitchValue, start');
|
||||
let that = this;
|
||||
settingService.getAdvancedPageSwitchValue(function (result) {
|
||||
if (result.code === common.int.SUCCESS) {
|
||||
@ -95,7 +95,7 @@ export default class AdvancedSettingsController {
|
||||
that.spnNameOfOneSimCard = switchValue.spnNameOfOneSimCard;
|
||||
}
|
||||
} else {
|
||||
HiLog.w(TAG, "getAdvancedPageSwitchValue, failed");
|
||||
HiLog.w(TAG, 'getAdvancedPageSwitchValue, failed');
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -103,19 +103,19 @@ export default class AdvancedSettingsController {
|
||||
returnDeliveryReportResultInText(intValue) {
|
||||
let tempValue;
|
||||
if (intValue == common.DELIVERY_REPORTS.DISABLED || intValue == '') {
|
||||
tempValue = $r("app.string.disabled");
|
||||
tempValue = $r('app.string.disabled');
|
||||
this.checkedValueOfSms = false;
|
||||
this.checkedValueOfMms = false;
|
||||
} else if (intValue == common.DELIVERY_REPORTS.SMS) {
|
||||
tempValue = $r("app.string.sms");
|
||||
tempValue = $r('app.string.sms');
|
||||
this.checkedValueOfSms = true;
|
||||
this.checkedValueOfMms = false;
|
||||
} else if (intValue == common.DELIVERY_REPORTS.MMS) {
|
||||
tempValue = $r("app.string.mms");
|
||||
tempValue = $r('app.string.mms');
|
||||
this.checkedValueOfSms = false;
|
||||
this.checkedValueOfMms = true;
|
||||
} else {
|
||||
tempValue = $r("app.string.sms_and_mms");
|
||||
tempValue = $r('app.string.sms_and_mms');
|
||||
this.checkedValueOfSms = true;
|
||||
this.checkedValueOfMms = true;
|
||||
}
|
||||
@ -126,11 +126,11 @@ export default class AdvancedSettingsController {
|
||||
returnAutoRetrieveMmsResultInText(intValue) {
|
||||
let tempValue;
|
||||
if (intValue == common.AUTO_RETRIEVE_MMS.OFF) {
|
||||
tempValue = $r("app.string.off");
|
||||
tempValue = $r('app.string.off');
|
||||
} else if (intValue == common.AUTO_RETRIEVE_MMS.NOT_WHEN_ROAMING) {
|
||||
tempValue = $r("app.string.not_when_roaming");
|
||||
tempValue = $r('app.string.not_when_roaming');
|
||||
} else {
|
||||
tempValue = $r("app.string.always");
|
||||
tempValue = $r('app.string.always');
|
||||
}
|
||||
this.autoRetrieveMmsSwitchInText = tempValue;
|
||||
}
|
||||
@ -140,7 +140,7 @@ export default class AdvancedSettingsController {
|
||||
}
|
||||
// Restore the default values on the settings page.
|
||||
restoreSettingPageSwitchValue() {
|
||||
HiLog.i(TAG, "restoreSettingPageSwitchValue");
|
||||
HiLog.i(TAG, 'restoreSettingPageSwitchValue');
|
||||
let that = this;
|
||||
settingService.restoreSwitchValue(function (result) {
|
||||
if (result.code === common.int.SUCCESS) {
|
||||
@ -151,9 +151,9 @@ export default class AdvancedSettingsController {
|
||||
that.recallMessageSwitch = common.bool.FALSE;
|
||||
that.autoDeleteInfoSwitch = common.bool.FALSE;
|
||||
that.tempAutoDeleteInfoSwitch = common.bool.FALSE;
|
||||
HiLog.i(TAG, "restoreSettingPageSwitchValue, success");
|
||||
HiLog.i(TAG, 'restoreSettingPageSwitchValue, success');
|
||||
} else {
|
||||
HiLog.w(TAG, "restoreSettingPageSwitchValue, failed");
|
||||
HiLog.w(TAG, 'restoreSettingPageSwitchValue, failed');
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -196,30 +196,30 @@ export default class AdvancedSettingsController {
|
||||
}
|
||||
// When the value of deliveryReportSwitch changes, this method is used to process the change.
|
||||
autoHandleDeliveryReportValueChange(newValue) {
|
||||
HiLog.i(TAG, "autoHandleDeliveryReportValueChange, newValue = " + newValue);
|
||||
HiLog.i(TAG, 'autoHandleDeliveryReportValueChange, newValue = ' + newValue);
|
||||
let messageCode = common.route.MESSAGE_CODE_UPDATE_DELIVERY_REPORTS_VALUE;
|
||||
let actionData: LooseObject = {};
|
||||
actionData.intValue = newValue;
|
||||
this.updateAdvancedPageSwitchValue(messageCode, actionData);
|
||||
}
|
||||
// Displaying the "Automatic Download MMS" dialog
|
||||
// Displaying the 'Automatic Download MMS' dialog
|
||||
showAutoRetrieveMmsDialog() {
|
||||
// this.$element("auto-retrieve-mms-dialog").show();
|
||||
// this.$element('auto-retrieve-mms-dialog').show();
|
||||
}
|
||||
// Click the corresponding option in the dialog box for automatically downloading MMs.
|
||||
clickDiv(idx) {
|
||||
this.autoRetrieveMmsSwitch = idx + common.string.EMPTY_STR;
|
||||
this.returnAutoRetrieveMmsResultInText(idx);
|
||||
// this.$element("auto-retrieve-mms-dialog").close();
|
||||
// this.$element('auto-retrieve-mms-dialog').close();
|
||||
this.autoHandleAutoRetrieveMmsValueChange(this.autoRetrieveMmsSwitch);
|
||||
}
|
||||
// Disable the automatic MM download dialog box.
|
||||
closeAutoRetrieveMmsDialog() {
|
||||
// this.$element("auto-retrieve-mms-dialog").close();
|
||||
// this.$element('auto-retrieve-mms-dialog').close();
|
||||
}
|
||||
// This method is used when the value of autoRetrieveMmsSwitch changes.
|
||||
autoHandleAutoRetrieveMmsValueChange(newValue) {
|
||||
HiLog.i(TAG, "autoHandleAutoRetrieveMmsValueChange, newValue = " + newValue);
|
||||
HiLog.i(TAG, 'autoHandleAutoRetrieveMmsValueChange, newValue = ' + newValue);
|
||||
let messageCode = common.route.MESSAGE_CODE_UPDATE_AUTO_RETRIEVE_MMS_VALUE;
|
||||
let actionData: LooseObject = {};
|
||||
actionData.intValue = newValue;
|
||||
@ -243,21 +243,21 @@ export default class AdvancedSettingsController {
|
||||
that.tempAutoDeleteInfoSwitch = e.checked;
|
||||
if (e.checked) {
|
||||
prompt.showDialog({
|
||||
title: $r("app.string.enable_auto_delete") + '',
|
||||
message: $r("app.string.enable_auto_delete_hint") + '',
|
||||
title: $r('app.string.enable_auto_delete') + '',
|
||||
message: $r('app.string.enable_auto_delete_hint') + '',
|
||||
buttons: [
|
||||
{
|
||||
text: $r("app.string.cancel") + '', color: "#007DFF"
|
||||
text: $r('app.string.cancel') + '', color: '#007DFF'
|
||||
},
|
||||
{
|
||||
text: $r("app.string.enable") + '', color: "#007DFF"
|
||||
text: $r('app.string.enable') + '', color: '#007DFF'
|
||||
}
|
||||
],
|
||||
success: function (data) {
|
||||
that.autoDeleteSuccess(data);
|
||||
},
|
||||
cancel: function () {
|
||||
HiLog.i(TAG, "autoDeleteInfo, cancel");
|
||||
HiLog.i(TAG, 'autoDeleteInfo, cancel');
|
||||
that.tempAutoDeleteInfoSwitch = common.bool.FALSE;
|
||||
that.autoDeleteInfoSwitch = common.bool.FALSE;
|
||||
}
|
||||
@ -278,7 +278,7 @@ export default class AdvancedSettingsController {
|
||||
}
|
||||
// This method is used when the value of autoDeleteInfoSwitch changes.
|
||||
autoHandleAutoDeleteInfoValueChange(newValue) {
|
||||
HiLog.i(TAG, "autoHandleAutoDeleteInfoValueChange, newValue = " + newValue);
|
||||
HiLog.i(TAG, 'autoHandleAutoDeleteInfoValueChange, newValue = ' + newValue);
|
||||
let messageCode = common.route.MESSAGE_CODE_UPDATE_AUTO_DELETE_INFO_MESSAGES_VALUE;
|
||||
let actionData: LooseObject = {};
|
||||
actionData.booleanValue = newValue;
|
||||
@ -290,7 +290,7 @@ export default class AdvancedSettingsController {
|
||||
return;
|
||||
}
|
||||
router.push({
|
||||
uri: "pages/sms_center/sms_center",
|
||||
uri: 'pages/sms_center/sms_center',
|
||||
params: {
|
||||
idx: index,
|
||||
countOfSim: this.simCount
|
||||
@ -303,7 +303,7 @@ export default class AdvancedSettingsController {
|
||||
return;
|
||||
}
|
||||
router.push({
|
||||
uri: "pages/manage_sim/manage_sim",
|
||||
uri: 'pages/manage_sim/manage_sim',
|
||||
params: {
|
||||
idx: index,
|
||||
countOfSim: this.simCount
|
||||
@ -314,9 +314,9 @@ export default class AdvancedSettingsController {
|
||||
updateAdvancedPageSwitchValue(messageCode, actionData) {
|
||||
settingService.updateSettingValue(messageCode, actionData, function (result) {
|
||||
if (result.code == common.int.SUCCESS) {
|
||||
HiLog.i(TAG, "updateAdvancedPageSwitchValue, success");
|
||||
HiLog.i(TAG, 'updateAdvancedPageSwitchValue, success');
|
||||
} else {
|
||||
HiLog.w(TAG, "updateAdvancedPageSwitchValue, failed");
|
||||
HiLog.w(TAG, 'updateAdvancedPageSwitchValue, failed');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import WantUtil from "../../../utils/WantUtil";
|
||||
import WantUtil from '../../../utils/WantUtil';
|
||||
@Entry
|
||||
@Component
|
||||
struct RingtoneSettings {
|
||||
@ -21,11 +21,11 @@ struct RingtoneSettings {
|
||||
}
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
Text("这是铃声设置界面")
|
||||
Text('这是铃声设置界面')
|
||||
.fontSize(50)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
@ -1,49 +1,49 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import DeviceUtil from "../../utils/DeviceUtil";
|
||||
import { MmsSimpleDialog } from "../../views/MmsDialogs";
|
||||
import { MoreMenu } from "../../views/MmsMenu";
|
||||
import router from "@system.router";
|
||||
import { SettingItemSwitch, SettingItemJump } from "../../views/SettingItem";
|
||||
import SettingsController from "./settingsController";
|
||||
import HiLog from "../../utils/HiLog";
|
||||
import WantUtil from "../../utils/WantUtil";
|
||||
import AdvancedSettingsController from "./advancedSettings/advancedSettingsController"
|
||||
import DeviceUtil from '../../utils/DeviceUtil';
|
||||
import { MmsSimpleDialog } from '../../views/MmsDialogs';
|
||||
import { MoreMenu } from '../../views/MmsMenu';
|
||||
import router from '@system.router';
|
||||
import { SettingItemSwitch, SettingItemJump } from '../../views/SettingItem';
|
||||
import SettingsController from './settingsController';
|
||||
import HiLog from '../../utils/HiLog';
|
||||
import WantUtil from '../../utils/WantUtil';
|
||||
import AdvancedSettingsController from './advancedSettings/advancedSettingsController'
|
||||
|
||||
const TAG = "Settings";
|
||||
const TAG = 'Settings';
|
||||
@Entry
|
||||
@Component
|
||||
struct Settings {
|
||||
@StorageLink("SettingsController") @Watch("changeSelectState") mSettingsCtrl:
|
||||
@StorageLink('SettingsController') @Watch('changeSelectState') mSettingsCtrl:
|
||||
SettingsController = SettingsController.getInstance()
|
||||
@StorageLink("AdvancedSettingsController") @Watch("changeSelectState") mAdvancedSettingsCtrl:
|
||||
@StorageLink('AdvancedSettingsController') @Watch('changeSelectState') mAdvancedSettingsCtrl:
|
||||
AdvancedSettingsController = AdvancedSettingsController.getInstance();
|
||||
private gridColumns: GridRowColumnOption = { sm: 4, md: 8, lg: 12 };
|
||||
private girdSpan: GridColColumnOption = { sm: 4, md: 6, lg: 8 };
|
||||
private gridColOffset: GridColColumnOption = { md: 1, lg: 2 };
|
||||
private gridGutter: string = "12vp";
|
||||
private gridGutter: string = '12vp';
|
||||
isEnhanceShow: Visibility = DeviceUtil.isTablet() ? Visibility.None : Visibility.Visible;
|
||||
private restoreDialog = new MmsSimpleDialog({
|
||||
message: $r("app.string.restore_all_default_settings"),
|
||||
message: $r('app.string.restore_all_default_settings'),
|
||||
primaryButton: {
|
||||
value: $r("app.string.cancel"),
|
||||
value: $r('app.string.cancel'),
|
||||
action: () => {
|
||||
}
|
||||
},
|
||||
secondaryButton: {
|
||||
value: $r("app.string.restore"),
|
||||
value: $r('app.string.restore'),
|
||||
action: () => {
|
||||
this.mSettingsCtrl.restoreSettingsPageSwitchValue();
|
||||
this.mAdvancedSettingsCtrl.restoreSettingPageSwitchValue();
|
||||
@ -56,7 +56,7 @@ struct Settings {
|
||||
|
||||
@Provide menuItems: Array<any> = [
|
||||
{
|
||||
value: $r("app.string.restore_default_settings"),
|
||||
value: $r('app.string.restore_default_settings'),
|
||||
action: () => {
|
||||
this.restoreDialog.show();
|
||||
},
|
||||
@ -112,32 +112,32 @@ struct Settings {
|
||||
Column() {
|
||||
// Top Device Title
|
||||
Row() {
|
||||
Image($rawfile("icon/ic_message_back.svg"))
|
||||
.width($r("app.float.icon_side_length_medium"))
|
||||
.height($r("app.float.icon_side_length_medium"))
|
||||
Image($rawfile('icon/ic_message_back.svg'))
|
||||
.width($r('app.float.icon_side_length_medium'))
|
||||
.height($r('app.float.icon_side_length_medium'))
|
||||
.margin({
|
||||
left: $r("app.float.action_bar_margin_left")
|
||||
left: $r('app.float.action_bar_margin_left')
|
||||
})
|
||||
.onClick(() => {
|
||||
router.back()
|
||||
})
|
||||
|
||||
Row().width($r("app.float.space_16"))
|
||||
Row().width($r('app.float.space_16'))
|
||||
|
||||
Text($r("app.string.settings"))
|
||||
.fontSize($r("app.float.action_bar_text_size"))
|
||||
Text($r('app.string.settings'))
|
||||
.fontSize($r('app.float.action_bar_text_size'))
|
||||
.fontColor(Color.Black)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
|
||||
Row().width("100%").flexShrink(1)
|
||||
Row().width('100%').flexShrink(1)
|
||||
|
||||
Column() {
|
||||
MoreMenu()
|
||||
}
|
||||
.margin({ right: $r("app.float.action_bar_margin_right") })
|
||||
.margin({ right: $r('app.float.action_bar_margin_right') })
|
||||
}
|
||||
.width("100%")
|
||||
.height($r("app.float.action_bar_height"))
|
||||
.width('100%')
|
||||
.height($r('app.float.action_bar_height'))
|
||||
|
||||
Scroll() {
|
||||
GridRow({ columns: this.gridColumns, gutter: this.gridGutter }) {
|
||||
@ -148,7 +148,7 @@ struct Settings {
|
||||
Column() {
|
||||
// Enhanced Information
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.enhanced_information"),
|
||||
primaryTitle: $r('app.string.enhanced_information'),
|
||||
visibilityShow: this.isEnhanceShow,
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
// The page for setting enhanced information is displayed.
|
||||
@ -157,32 +157,32 @@ struct Settings {
|
||||
|
||||
// Intelligent information
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.intelligent_information"),
|
||||
primaryTitle: $r('app.string.intelligent_information'),
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
// The ringtone setting page is displayed.
|
||||
}
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({
|
||||
top: $r("app.float.settings_item_padding_top"),
|
||||
bottom: $r("app.float.settings_item_padding_bottom"),
|
||||
left: $r("app.float.settings_item_padding_left"),
|
||||
right: $r("app.float.settings_item_padding_right")
|
||||
top: $r('app.float.settings_item_padding_top'),
|
||||
bottom: $r('app.float.settings_item_padding_bottom'),
|
||||
left: $r('app.float.settings_item_padding_left'),
|
||||
right: $r('app.float.settings_item_padding_right')
|
||||
})
|
||||
.border({
|
||||
radius: $r("app.float.settings_items_radius"),
|
||||
color: $r("sys.color.ohos_id_color_text_field_bg")
|
||||
radius: $r('app.float.settings_items_radius'),
|
||||
color: $r('sys.color.ohos_id_color_text_field_bg')
|
||||
})
|
||||
.backgroundColor($r("sys.color.ohos_id_color_text_field_bg"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_text_field_bg'))
|
||||
.visibility(Visibility.None)
|
||||
|
||||
// Setting items of the second group
|
||||
Column() {
|
||||
// Notification information integration
|
||||
SettingItemSwitch({
|
||||
primaryTitle: $r("app.string.archive_info_messages"),
|
||||
secondaryTitle: $r("app.string.archive_info_messages_hint"),
|
||||
primaryTitle: $r('app.string.archive_info_messages'),
|
||||
secondaryTitle: $r('app.string.archive_info_messages_hint'),
|
||||
isEnable: this.mSettingsCtrl.integrationSwitch,
|
||||
showBottomDivider: false,
|
||||
onChange: (isOn: boolean) => {
|
||||
@ -190,24 +190,24 @@ struct Settings {
|
||||
}
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({
|
||||
top: $r("app.float.settings_item_padding_top"),
|
||||
bottom: $r("app.float.settings_item_padding_bottom"),
|
||||
left: $r("app.float.settings_item_padding_left"),
|
||||
right: $r("app.float.settings_item_padding_right")
|
||||
top: $r('app.float.settings_item_padding_top'),
|
||||
bottom: $r('app.float.settings_item_padding_bottom'),
|
||||
left: $r('app.float.settings_item_padding_left'),
|
||||
right: $r('app.float.settings_item_padding_right')
|
||||
})
|
||||
.border({
|
||||
radius: $r("app.float.settings_items_radius"),
|
||||
color: $r("sys.color.ohos_id_color_text_field_bg")
|
||||
radius: $r('app.float.settings_items_radius'),
|
||||
color: $r('sys.color.ohos_id_color_text_field_bg')
|
||||
})
|
||||
.backgroundColor($r("sys.color.ohos_id_color_text_field_bg"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_text_field_bg'))
|
||||
|
||||
// Setting items of the third group
|
||||
Column() {
|
||||
// Message ringtone
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.message_tone"),
|
||||
primaryTitle: $r('app.string.message_tone'),
|
||||
showBottomDivider: true,
|
||||
visibilityShow: Visibility.None,
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
@ -217,30 +217,30 @@ struct Settings {
|
||||
})
|
||||
// Advanced
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.advanced"),
|
||||
primaryTitle: $r('app.string.advanced'),
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
// Go to the advanced settings screen.
|
||||
this.mSettingsCtrl.advancedSetting()
|
||||
}
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({
|
||||
top: $r("app.float.settings_item_padding_top"),
|
||||
bottom: $r("app.float.settings_item_padding_bottom"),
|
||||
left: $r("app.float.settings_item_padding_left"),
|
||||
right: $r("app.float.settings_item_padding_right")
|
||||
top: $r('app.float.settings_item_padding_top'),
|
||||
bottom: $r('app.float.settings_item_padding_bottom'),
|
||||
left: $r('app.float.settings_item_padding_left'),
|
||||
right: $r('app.float.settings_item_padding_right')
|
||||
})
|
||||
.margin({ top: 12 })
|
||||
.border({
|
||||
radius: $r("app.float.settings_items_radius"),
|
||||
color: $r("sys.color.ohos_id_color_text_field_bg")
|
||||
radius: $r('app.float.settings_items_radius'),
|
||||
color: $r('sys.color.ohos_id_color_text_field_bg')
|
||||
})
|
||||
.backgroundColor($r("sys.color.ohos_id_color_text_field_bg"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_text_field_bg'))
|
||||
}
|
||||
.margin({
|
||||
top: $r("app.float.settings_items_margin_top"),
|
||||
bottom: $r("app.float.settings_items_margin_bottom")
|
||||
top: $r('app.float.settings_items_margin_top'),
|
||||
bottom: $r('app.float.settings_items_margin_bottom')
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -248,9 +248,9 @@ struct Settings {
|
||||
.layoutWeight(1)
|
||||
.align(Alignment.Top)
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.padding({ left: $r("app.float.page_padding_left"), right: $r("app.float.page_padding_right") })
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.padding({ left: $r('app.float.page_padding_left'), right: $r('app.float.page_padding_right') })
|
||||
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))
|
||||
}
|
||||
}
|
@ -1,26 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import LooseObject from "../../data/LooseObject"
|
||||
import MmsBoolean from "../../data/MmsBoolean"
|
||||
import HiLog from "../../utils/HiLog";
|
||||
import router from "@system.router";
|
||||
import LooseObject from '../../data/LooseObject'
|
||||
import MmsBoolean from '../../data/MmsBoolean'
|
||||
import HiLog from '../../utils/HiLog';
|
||||
import router from '@system.router';
|
||||
// JS Common constants
|
||||
import common from "../../data/commonData";
|
||||
import settingService from "../../service/SettingService"
|
||||
import common from '../../data/commonData';
|
||||
import settingService from '../../service/SettingService'
|
||||
|
||||
const TAG = "SettingsController";
|
||||
const TAG = 'SettingsController';
|
||||
|
||||
export default class SettingsController {
|
||||
private static sInstance: SettingsController;
|
||||
@ -41,21 +41,21 @@ export default class SettingsController {
|
||||
}
|
||||
|
||||
constructor() {
|
||||
HiLog.i(TAG, "constructor, start");
|
||||
HiLog.i(TAG, 'constructor, start');
|
||||
this.getSettingPageSwitchValue();
|
||||
}
|
||||
|
||||
onInit() {
|
||||
HiLog.i(TAG, "onInit, start");
|
||||
HiLog.i(TAG, 'onInit, start');
|
||||
};
|
||||
|
||||
onShow() {
|
||||
HiLog.i(TAG, "onShow, start");
|
||||
HiLog.i(TAG, 'onShow, start');
|
||||
};
|
||||
|
||||
// Indicates whether to initialize the setting page.
|
||||
getSettingPageSwitchValue() {
|
||||
HiLog.i(TAG, "getSettingPageSwitchValue, start");
|
||||
HiLog.i(TAG, 'getSettingPageSwitchValue, start');
|
||||
let that = this;
|
||||
settingService.setOnSettingValueListener(function (result) {
|
||||
that.integrationSwitch.value = result.integrationSwitch;
|
||||
@ -82,7 +82,7 @@ export default class SettingsController {
|
||||
|
||||
// Malicious website selection
|
||||
maliciousWeb(e) {
|
||||
HiLog.i(TAG, "maliciousWeb, checked = " + e.checked);
|
||||
HiLog.i(TAG, 'maliciousWeb, checked = ' + e.checked);
|
||||
let messageCode = common.route.MESSAGE_CODE_UPDATE_MALICIOUS_WEBSITE_IDENTIFICATION_VALUE;
|
||||
let actionData: LooseObject = {};
|
||||
this.maliciousWebSwitch = e.checked;
|
||||
@ -96,12 +96,12 @@ export default class SettingsController {
|
||||
|
||||
// Go to the Message Ring page. Choose Settings > Sound and Vibration > Message Ring.
|
||||
jumpToMessageTonePage() {
|
||||
HiLog.i(TAG, "jumpToMessageTonePage")
|
||||
HiLog.i(TAG, 'jumpToMessageTonePage')
|
||||
};
|
||||
|
||||
// Display a contact's avatar
|
||||
showContact(e) {
|
||||
HiLog.i(TAG, "showContact, checked = " + e.checked);
|
||||
HiLog.i(TAG, 'showContact, checked = ' + e.checked);
|
||||
let messageCode = common.route.MESSAGE_CODE_UPDATE_SHOW_CONTACT_PROFILE_PICS_VALUE;
|
||||
let actionData: LooseObject = {};
|
||||
this.showContactSwitch = e.checked;
|
||||
@ -122,9 +122,9 @@ export default class SettingsController {
|
||||
that.maliciousWebSwitch = false;
|
||||
that.showContactSwitch = true;
|
||||
globalThis.needToUpdate = true;
|
||||
HiLog.i(TAG, "restoreSettingsPageSwitchValue, success");
|
||||
HiLog.i(TAG, 'restoreSettingsPageSwitchValue, success');
|
||||
} else {
|
||||
HiLog.w(TAG, "restoreSettingsPageSwitchValue, failed");
|
||||
HiLog.w(TAG, 'restoreSettingsPageSwitchValue, failed');
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -136,20 +136,20 @@ export default class SettingsController {
|
||||
|
||||
// Advanced page redirection
|
||||
advancedSetting() {
|
||||
HiLog.i(TAG, "advancedSetting")
|
||||
HiLog.i(TAG, 'advancedSetting')
|
||||
router.push({
|
||||
uri: "pages/settings/advancedSettings/advancedSettings"
|
||||
uri: 'pages/settings/advancedSettings/advancedSettings'
|
||||
});
|
||||
};
|
||||
|
||||
// Update Switch Value
|
||||
updateSettingPageSwitchValue(messageCode, actionData) {
|
||||
HiLog.i(TAG, "updateSettingPageSwitchValue, messageCode = " + messageCode);
|
||||
HiLog.i(TAG, 'updateSettingPageSwitchValue, messageCode = ' + messageCode);
|
||||
settingService.updateSettingValue(messageCode, actionData, function (result) {
|
||||
if (result.code == common.int.SUCCESS) {
|
||||
HiLog.i(TAG, "updateSettingPageSwitchValue, success");
|
||||
HiLog.i(TAG, 'updateSettingPageSwitchValue, success');
|
||||
} else {
|
||||
HiLog.w(TAG, "updateSettingPageSwitchValue, failed");
|
||||
HiLog.w(TAG, 'updateSettingPageSwitchValue, failed');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -1,22 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import TransmitMsgController from "./transmitMsgController";
|
||||
import DeviceUtil from "../../utils/DeviceUtil";
|
||||
import router from "@system.router";
|
||||
import { TransmitMsgDialog } from "../../views/MmsDialogs";
|
||||
import WantUtil from "../../utils/WantUtil";
|
||||
import TransmitMsgController from './transmitMsgController';
|
||||
import DeviceUtil from '../../utils/DeviceUtil';
|
||||
import router from '@system.router';
|
||||
import { TransmitMsgDialog } from '../../views/MmsDialogs';
|
||||
import WantUtil from '../../utils/WantUtil';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@ -24,8 +24,8 @@ export default struct TransmitMsg {
|
||||
@State mTransmitMsgCtrl: TransmitMsgController = TransmitMsgController.getInstance();
|
||||
@State gridColumns: number = DeviceUtil.isTablet() ? 12 : 4;
|
||||
@State gridSizeType: SizeType = DeviceUtil.isTablet() ? SizeType.LG : SizeType.SM;
|
||||
@State gridGutter: string = "24vp";
|
||||
@State gridMargin: string = "24vp";
|
||||
@State gridGutter: string = '24vp';
|
||||
@State gridMargin: string = '24vp';
|
||||
private dialogAlignment: DialogAlignment = DeviceUtil.isTablet() ? DialogAlignment.Center : DialogAlignment.Bottom;
|
||||
private dialogOffset: Offset = DeviceUtil.isTablet() ? { dx: 0, dy: 0 } : { dx: 0, dy: -12 };
|
||||
delDialogController: CustomDialogController = new CustomDialogController({
|
||||
@ -54,7 +54,7 @@ export default struct TransmitMsg {
|
||||
|
||||
onPageShow() {
|
||||
WantUtil.getWant();
|
||||
if(this.mTransmitMsgCtrl.DialogShow){
|
||||
if (this.mTransmitMsgCtrl.DialogShow) {
|
||||
this.delDialogController.open();
|
||||
}
|
||||
}
|
||||
@ -76,44 +76,44 @@ export default struct TransmitMsg {
|
||||
//Notification information
|
||||
Flex() {
|
||||
Row() {
|
||||
Image($rawfile("icon/ic_public_cancel.svg"))
|
||||
Image($rawfile('icon/ic_public_cancel.svg'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.onClick(() => {
|
||||
// Click Back to return to the unselected SMS state.
|
||||
router.back();
|
||||
})
|
||||
Text($r("app.string.transmitHeadText"))
|
||||
Text($r('app.string.transmitHeadText'))
|
||||
.margin({ left: 16 })
|
||||
.fontSize(20)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(56)
|
||||
}
|
||||
|
||||
//Select Contact
|
||||
Flex(){
|
||||
Column(){
|
||||
Flex() {
|
||||
Column() {
|
||||
Row() {
|
||||
Text($r("app.string.selectContacts"))
|
||||
.fontSize("16fp")
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
Text($r('app.string.selectContacts'))
|
||||
.fontSize('16fp')
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
Blank()
|
||||
Image($rawfile("icon/ic_next.svg"))
|
||||
.width($r("app.float.settings_item_next_image_width"))
|
||||
.height($r("app.float.settings_item_next_image_height"))
|
||||
Image($rawfile('icon/ic_next.svg'))
|
||||
.width($r('app.float.settings_item_next_image_width'))
|
||||
.height($r('app.float.settings_item_next_image_height'))
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.margin({ left: "4vp" })
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.margin({ left: '4vp' })
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.height("100%")
|
||||
}.height("48vp")
|
||||
.width("100%")
|
||||
.height('100%')
|
||||
}.height('48vp')
|
||||
.width('100%')
|
||||
.onClick(() => {
|
||||
//Go to Select Contact
|
||||
this.mTransmitMsgCtrl.jumpToSelectContacts();
|
||||
@ -122,43 +122,44 @@ export default struct TransmitMsg {
|
||||
//recent
|
||||
Flex() {
|
||||
Row() {
|
||||
Text($r("app.string.recently"))
|
||||
.fontSize("16fp")
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
}.height("48vp")
|
||||
Text($r('app.string.recently'))
|
||||
.fontSize('16fp')
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
}.height('48vp')
|
||||
}
|
||||
|
||||
List() {
|
||||
LazyForEach(this.mTransmitMsgCtrl.transmitMsgDataSource, (item, index) => {
|
||||
ListItem() {
|
||||
Row() {
|
||||
//avatar
|
||||
if(item.conversation.photoFirstName === '') {
|
||||
Image($rawfile("icon/ic_user_portrait.svg"))
|
||||
if (item.conversation.photoFirstName === '') {
|
||||
Image($rawfile('icon/ic_user_portrait.svg'))
|
||||
.objectFit(ImageFit.Fill)
|
||||
.width("40vp")
|
||||
.height("40vp")
|
||||
.clip(new Circle({ width: "40vp", height: "40vp" }))
|
||||
.width('40vp')
|
||||
.height('40vp')
|
||||
.clip(new Circle({ width: '40vp', height: '40vp' }))
|
||||
.backgroundColor(item.conversation.portraitColor)
|
||||
} else {
|
||||
Text(item.conversation.photoFirstName)
|
||||
.fontSize("30vp")
|
||||
.fontSize('30vp')
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor(Color.White)
|
||||
.height("40vp")
|
||||
.width("40vp")
|
||||
.height('40vp')
|
||||
.width('40vp')
|
||||
.textAlign(TextAlign.Center)
|
||||
.clip(new Circle({ width: "40vp", height: "40vp" }))
|
||||
.clip(new Circle({ width: '40vp', height: '40vp' }))
|
||||
.backgroundColor(item.conversation.portraitColor)
|
||||
}
|
||||
Text(item.conversation.name !== '' ? item.conversation.name : item.conversation.telephone)
|
||||
.fontSize("16vp")
|
||||
.fontSize('16vp')
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ left: 16 })
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(64)
|
||||
}
|
||||
.onClick( () => {
|
||||
.onClick(() => {
|
||||
this.mTransmitMsgCtrl.clickSendMessage(item)
|
||||
this.delDialogController.open();
|
||||
})
|
||||
@ -169,8 +170,8 @@ export default struct TransmitMsg {
|
||||
startMargin: 56,
|
||||
endMargin: 0
|
||||
})
|
||||
}.width("100%")
|
||||
.height("100%")
|
||||
}.width('100%')
|
||||
.height('100%')
|
||||
.useSizeType({
|
||||
xs: { span: 4, offset: 0 }, sm: { span: 4, offset: 0 },
|
||||
md: { span: 12, offset: 0 }, lg: { span: 12, offset: 0 }
|
||||
|
@ -1,14 +1,14 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -16,17 +16,17 @@
|
||||
|
||||
import router from '@ohos.router';
|
||||
|
||||
import LooseObject from "../../data/LooseObject"
|
||||
import LooseObject from '../../data/LooseObject'
|
||||
import ContactService from '../../service/ContactsService';
|
||||
import common from '../../data/commonData';
|
||||
import commonService from '../../service/CommonService'
|
||||
import ConversationListService from "../../service/ConversationListService";
|
||||
import AvatarColor from "../../model/common/AvatarColor";
|
||||
import DateUtil from "../../utils/DateUtil";
|
||||
import TransmitMsgDataSource from "../../model/TransmitMsgDataSource";
|
||||
import HiLog from "../../utils/HiLog";
|
||||
import ConversationListService from '../../service/ConversationListService';
|
||||
import AvatarColor from '../../model/common/AvatarColor';
|
||||
import DateUtil from '../../utils/DateUtil';
|
||||
import TransmitMsgDataSource from '../../model/TransmitMsgDataSource';
|
||||
import HiLog from '../../utils/HiLog';
|
||||
|
||||
const TAG = "TransmitMsgController"
|
||||
const TAG = 'TransmitMsgController'
|
||||
|
||||
export default class TransmitMsgController {
|
||||
private static sInstance: TransmitMsgController;
|
||||
@ -116,12 +116,12 @@ export default class TransmitMsgController {
|
||||
requestItem() {
|
||||
let count = this.page * this.limit;
|
||||
if (this.page === 0) {
|
||||
this.page++;
|
||||
this.queryAllMessages();
|
||||
this.page++;
|
||||
this.queryAllMessages();
|
||||
} else if (count < this.total && this.contactsList.length > (this.page - 1) * this.limit) {
|
||||
// The restriction on contactsList is to prevent multiple update requests during initialization.
|
||||
this.page++;
|
||||
this.queryAllMessages();
|
||||
// The restriction on contactsList is to prevent multiple update requests during initialization.
|
||||
this.page++;
|
||||
this.queryAllMessages();
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ export default class TransmitMsgController {
|
||||
obj.isDelShow = false;
|
||||
obj.itemLeft = 0;
|
||||
obj.photoFirstName = common.string.EMPTY_STR;
|
||||
if( obj.name !== common.string.EMPTY_STR && this.reg.test(obj.name.substring(0, 1))) {
|
||||
if (obj.name !== common.string.EMPTY_STR && this.reg.test(obj.name.substring(0, 1))) {
|
||||
obj.photoFirstName = obj.name.substring(0, 1).toUpperCase();
|
||||
}
|
||||
obj.portraitColor = AvatarColor.background.Color[Math.abs(parseInt(obj.threadId, 10)) % 6];
|
||||
@ -171,15 +171,16 @@ export default class TransmitMsgController {
|
||||
dealMmsListContent(item) {
|
||||
if (item.hasMms && item.hasAttachment) {
|
||||
if (item.content == common.string.EMPTY_STR) {
|
||||
item.content = $r("app.string.attachment_no_subject");
|
||||
item.content = $r('app.string.attachment_no_subject');
|
||||
} else {
|
||||
item.content = $r("app.string.attachment", item.content);
|
||||
item.content = $r('app.string.attachment', item.content);
|
||||
}
|
||||
}
|
||||
if (item.hasMms && !item.hasAttachment && item.content == common.string.EMPTY_STR) {
|
||||
item.content = $r("app.string.no_subject");
|
||||
item.content = $r('app.string.no_subject');
|
||||
}
|
||||
}
|
||||
|
||||
// A dialog box is displayed when you touch a recent contact.
|
||||
clickSendMessage(item) {
|
||||
this.contactName = item.conversation.name;
|
||||
@ -249,16 +250,16 @@ export default class TransmitMsgController {
|
||||
|
||||
transmit(): void {
|
||||
let params: LooseObject = {
|
||||
"threadId": this.threadId,
|
||||
"strContactsName": this.dialogMsg.contactsParam.contactName, //Contact Name
|
||||
"strContactsNumber": this.dialogMsg.contactsParam.telephone, //Mobile phone number
|
||||
"strContactsNumberFormat": this.dialogMsg.contactsParam.telephoneFormat, //Format the mobile number.
|
||||
"transmitFlag": true, //Send Flag
|
||||
"contactsPage": false, //Display Forwarding Dialog Box
|
||||
"mmsSource": this.mmsSource, //MMS list data
|
||||
"isSlideDetail": this.isSlideDetail,//Indicates whether the slide page is an MMS message.
|
||||
"transmitSource": this.transmitContentList,//List of contents forwarded by multiple messages
|
||||
"isContainerOriginSource": this.isChecked //Whether selected
|
||||
'threadId': this.threadId,
|
||||
'strContactsName': this.dialogMsg.contactsParam.contactName, //Contact Name
|
||||
'strContactsNumber': this.dialogMsg.contactsParam.telephone, //Mobile phone number
|
||||
'strContactsNumberFormat': this.dialogMsg.contactsParam.telephoneFormat, //Format the mobile number.
|
||||
'transmitFlag': true, //Send Flag
|
||||
'contactsPage': false, //Display Forwarding Dialog Box
|
||||
'mmsSource': this.mmsSource, //MMS list data
|
||||
'isSlideDetail': this.isSlideDetail, //Indicates whether the slide page is an MMS message.
|
||||
'transmitSource': this.transmitContentList, //List of contents forwarded by multiple messages
|
||||
'isContainerOriginSource': this.isChecked //Whether selected
|
||||
}
|
||||
router.replaceUrl({
|
||||
url: 'pages/conversation/conversation',
|
||||
|
@ -1,24 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import call from "@ohos.telephony.call";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import common from "../data/commonData";
|
||||
import LooseObject from "../data/LooseObject"
|
||||
import call from '@ohos.telephony.call';
|
||||
import HiLog from '../utils/HiLog';
|
||||
import common from '../data/commonData';
|
||||
import LooseObject from '../data/LooseObject'
|
||||
|
||||
const TAG = "CallService";
|
||||
const TAG = 'CallService';
|
||||
|
||||
export default {
|
||||
|
||||
@ -30,7 +30,7 @@ export default {
|
||||
*/
|
||||
call(telephone, callback) {
|
||||
if (telephone == null || telephone == common.string.EMPTY_STR) {
|
||||
HiLog.i(TAG, "telephone is null");
|
||||
HiLog.i(TAG, 'telephone is null');
|
||||
return;
|
||||
}
|
||||
let result: LooseObject = {};
|
||||
@ -39,7 +39,7 @@ export default {
|
||||
result.value = value;
|
||||
callback(result);
|
||||
}).catch((err) => {
|
||||
HiLog.e(TAG, "dial error: " + err.message);
|
||||
HiLog.e(TAG, 'dial error: ' + err.message);
|
||||
result.code = common.int.FAILURE;
|
||||
callback(result);
|
||||
});
|
||||
|
@ -1,27 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import common from "../data/commonData";
|
||||
import common from '../data/commonData';
|
||||
|
||||
export default {
|
||||
commonContactParam(actionData) {
|
||||
let str = {
|
||||
"bundleName": common.string.CONTACT_BUNDLE_NAME,
|
||||
"abilityName": common.string.CONTACT_ABILITY_NAME,
|
||||
"parameters": actionData,
|
||||
"entities": [
|
||||
'bundleName': common.string.CONTACT_BUNDLE_NAME,
|
||||
'abilityName': common.string.CONTACT_ABILITY_NAME,
|
||||
'parameters': actionData,
|
||||
'entities': [
|
||||
common.string.COMMON_ENTITIES
|
||||
]
|
||||
};
|
||||
@ -76,7 +76,7 @@ export default {
|
||||
if (content == common.string.EMPTY_STR) {
|
||||
item.content = secondContent;
|
||||
} else {
|
||||
item.content = content + "\n" + secondContent;
|
||||
item.content = content + '\n' + secondContent;
|
||||
}
|
||||
} else if (second.msgType == common.MSG_ITEM_TYPE.THEME && mmsParts.length === 3) {
|
||||
item.msgUriPath = first.msgUriPath;
|
||||
@ -86,7 +86,7 @@ export default {
|
||||
if (secondContent == common.string.EMPTY_STR) {
|
||||
item.content = thirdContent;
|
||||
} else {
|
||||
item.content = secondContent + "\n" + thirdContent;
|
||||
item.content = secondContent + '\n' + thirdContent;
|
||||
}
|
||||
} else {
|
||||
item.content = content;
|
||||
@ -145,8 +145,8 @@ export default {
|
||||
if (common.MSG_ITEM_TYPE.TEXT == msgType && item.content != common.string.EMPTY_STR) {
|
||||
flage = true;
|
||||
}
|
||||
if ((common.MSG_ITEM_TYPE.IMAGE == msgType || common.MSG_ITEM_TYPE.AUDIO == msgType
|
||||
|| common.MSG_ITEM_TYPE.VIDEO == msgType) && item.content != common.string.EMPTY_STR) {
|
||||
if ((common.MSG_ITEM_TYPE.IMAGE == msgType || common.MSG_ITEM_TYPE.AUDIO == msgType ||
|
||||
common.MSG_ITEM_TYPE.VIDEO == msgType) && item.content != common.string.EMPTY_STR) {
|
||||
flage = true;
|
||||
}
|
||||
}
|
||||
@ -192,8 +192,8 @@ export default {
|
||||
}
|
||||
for (let item of mmsSource) {
|
||||
let msgType = item.msgType;
|
||||
if (common.MSG_ITEM_TYPE.IMAGE == msgType || common.MSG_ITEM_TYPE.VIDEO == msgType
|
||||
|| common.MSG_ITEM_TYPE.AUDIO == msgType) {
|
||||
if (common.MSG_ITEM_TYPE.IMAGE == msgType || common.MSG_ITEM_TYPE.VIDEO == msgType ||
|
||||
common.MSG_ITEM_TYPE.AUDIO == msgType) {
|
||||
flage = true;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -19,7 +19,7 @@ import telephoneUtil from '../utils/TelephoneUtil';
|
||||
import LooseObject from '../data/LooseObject';
|
||||
import ContactsModel from '../model/ContactsModel';
|
||||
|
||||
const TAG = "ContactsService";
|
||||
const TAG = 'ContactsService';
|
||||
|
||||
export default class ContactsService {
|
||||
private static instance: ContactsService;
|
||||
@ -178,7 +178,7 @@ export default class ContactsService {
|
||||
this.queryContactDataSizeByCondition(actionData, res => {
|
||||
let isContactExist: boolean = false;
|
||||
if (res.code == common.int.FAILURE) {
|
||||
HiLog.e(TAG, "judgeProfileExit fail!");
|
||||
HiLog.e(TAG, 'judgeProfileExit fail!');
|
||||
callback(isContactExist);
|
||||
} else {
|
||||
if (res.abilityResult > 0) {
|
||||
@ -194,7 +194,7 @@ export default class ContactsService {
|
||||
for (let contact of contacts) {
|
||||
let item: LooseObject = {};
|
||||
item.contactName = contact.displayName;
|
||||
item.headImage = "icon/user_avatar_full_fill.svg";
|
||||
item.headImage = 'icon/user_avatar_full_fill.svg';
|
||||
item.telephone = contact.detailInfo;
|
||||
item.telephoneFormat = contact.detailInfo;
|
||||
item.select = false;
|
||||
|
@ -1,24 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import HiLog from "../utils/HiLog";
|
||||
import common from "../data/commonData";
|
||||
import telephoneUtil from "../utils/TelephoneUtil";
|
||||
import LooseObject from "../data/LooseObject"
|
||||
import HiLog from '../utils/HiLog';
|
||||
import common from '../data/commonData';
|
||||
import telephoneUtil from '../utils/TelephoneUtil';
|
||||
import LooseObject from '../data/LooseObject'
|
||||
|
||||
const TAG = "ContractService";
|
||||
const TAG = 'ContractService';
|
||||
|
||||
export default {
|
||||
|
||||
@ -30,13 +30,13 @@ export default {
|
||||
*/
|
||||
queryContact(actionData, callback) {
|
||||
// Obtain rawContractIds and query contacts.
|
||||
globalThis.DataWorker.sendRequest("queryContact", {
|
||||
globalThis.DataWorker.sendRequest('queryContact', {
|
||||
actionData: actionData,
|
||||
context: globalThis.mmsContext
|
||||
}, rawContractIds => {
|
||||
let result: LooseObject = {};
|
||||
actionData.contractIds = rawContractIds;
|
||||
globalThis.DataWorker.sendRequest("queryContactDataByIds", {
|
||||
globalThis.DataWorker.sendRequest('queryContactDataByIds', {
|
||||
actionData: actionData,
|
||||
context: globalThis.mmsContext
|
||||
}, contracts => {
|
||||
@ -57,7 +57,7 @@ export default {
|
||||
*/
|
||||
countContact(actionData, callback) {
|
||||
// Obtain rawContractIds and query contacts.
|
||||
globalThis.DataWorker.sendRequest("countContact", {
|
||||
globalThis.DataWorker.sendRequest('countContact', {
|
||||
actionData: actionData,
|
||||
context: globalThis.mmsContext
|
||||
}, count => {
|
||||
@ -79,7 +79,7 @@ export default {
|
||||
for (let contract of contracts) {
|
||||
let item: LooseObject = {};
|
||||
item.contactName = contract.displayName;
|
||||
item.headImage = "icon/user_avatar_full_fill.svg";
|
||||
item.headImage = 'icon/user_avatar_full_fill.svg';
|
||||
item.telephone = contract.detailInfo;
|
||||
item.telephoneFormat = contract.detailInfo;
|
||||
item.select = false;
|
||||
@ -133,7 +133,7 @@ export default {
|
||||
* @callback callback
|
||||
*/
|
||||
queryContactDataByTelephone(actionData, callback) {
|
||||
globalThis.DataWorker.sendRequest("queryContactDataByTelephone", {
|
||||
globalThis.DataWorker.sendRequest('queryContactDataByTelephone', {
|
||||
actionData: actionData,
|
||||
context: globalThis.mmsContext
|
||||
}, contracts => {
|
||||
@ -149,7 +149,7 @@ export default {
|
||||
*/
|
||||
searchContracts(actionData, callback) {
|
||||
let result: LooseObject = {};
|
||||
globalThis.DataWorker.sendRequest("searchContracts", {
|
||||
globalThis.DataWorker.sendRequest('searchContracts', {
|
||||
actionData: actionData,
|
||||
context: globalThis.mmsContext
|
||||
}, (res) =>{
|
||||
@ -165,7 +165,7 @@ export default {
|
||||
let searchContracts = []
|
||||
for (let item of contracts) {
|
||||
let searchContract: LooseObject = {};
|
||||
searchContract.headImage = "icon/user_avatar_full_fill.svg";
|
||||
searchContract.headImage = 'icon/user_avatar_full_fill.svg';
|
||||
searchContract.contactName = item.displayName;
|
||||
searchContract.telephone = item.detailInfo;
|
||||
searchContract.telephoneFormat = item.detailInfo;
|
||||
@ -181,7 +181,7 @@ export default {
|
||||
* @callback callback
|
||||
*/
|
||||
judgeIsExitProfile(actionData, callback) {
|
||||
globalThis.DataWorker.sendRequest("queryProfile", {
|
||||
globalThis.DataWorker.sendRequest('queryProfile', {
|
||||
actionData: actionData,
|
||||
context: globalThis.mmsContext
|
||||
}, res => {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import ConversationModel from "../model/ConversationModel";
|
||||
import common from "../data/commonData";
|
||||
import HiLog from "../utils//HiLog";
|
||||
import ConversationListService from "./ConversationListService";
|
||||
import telephoneUtils from "../utils/TelephoneUtil";
|
||||
import ContactsService from "./ContactsService";
|
||||
import LooseObject from "../data/LooseObject";
|
||||
import ConversationModel from '../model/ConversationModel';
|
||||
import common from '../data/commonData';
|
||||
import HiLog from '../utils//HiLog';
|
||||
import ConversationListService from './ConversationListService';
|
||||
import telephoneUtils from '../utils/TelephoneUtil';
|
||||
import ContactsService from './ContactsService';
|
||||
import LooseObject from '../data/LooseObject';
|
||||
|
||||
const TAG: string = "ConversationService";
|
||||
const TAG: string = 'ConversationService';
|
||||
|
||||
export default class ConversationService {
|
||||
private static instance: ConversationService;
|
||||
@ -150,7 +150,7 @@ export default class ConversationService {
|
||||
callback(result);
|
||||
});
|
||||
} else {
|
||||
HiLog.w(TAG, "queryMessageDetail, failed");
|
||||
HiLog.w(TAG, 'queryMessageDetail, failed');
|
||||
callback(result);
|
||||
}
|
||||
}, context);
|
||||
@ -167,7 +167,7 @@ export default class ConversationService {
|
||||
// Fields related to MMS messages
|
||||
result.msgType = 0;
|
||||
result.isFullScreenImg = true;
|
||||
result.read = item.isRead == 0 ? "0" : "1";
|
||||
result.read = item.isRead == 0 ? '0' : '1';
|
||||
if (item.msgState == 0) {
|
||||
result.sendStatus = common.int.SEND_MESSAGE_SUCCESS;
|
||||
} else if (item.msgState == 2) {
|
||||
@ -250,7 +250,7 @@ export default class ConversationService {
|
||||
let sendResults: Array<LooseObject> = actionData.sendResults;
|
||||
let isReceive: boolean = actionData.isReceive;
|
||||
if (sendResults.length == 0) {
|
||||
HiLog.w(TAG, "insertSessionAndDetail, sendResults.length == 0");
|
||||
HiLog.w(TAG, 'insertSessionAndDetail, sendResults.length == 0');
|
||||
return;
|
||||
}
|
||||
let param: LooseObject = this.dealSendResults(sendResults);
|
||||
@ -271,31 +271,31 @@ export default class ConversationService {
|
||||
unreadCount = 1;
|
||||
}
|
||||
let valueBucket: LooseObject = {
|
||||
"telephone": param.telephone,
|
||||
"content": param.content,
|
||||
"contacts_num": param.contactsNum,
|
||||
"sms_type": param.smsType,
|
||||
"unread_count": unreadCount,
|
||||
"sending_status": param.sendStatus,
|
||||
"has_draft": common.has_draft.NO,
|
||||
"time": param.timestamp,
|
||||
"message_count": 1,
|
||||
"has_mms": actionData.isMms ? common.has_mms.HAVE : common.has_mms.NO,
|
||||
"has_attachment": actionData.hasAttachment ? common.has_attachment.HAVE : common.has_attachment.NO
|
||||
'telephone': param.telephone,
|
||||
'content': param.content,
|
||||
'contacts_num': param.contactsNum,
|
||||
'sms_type': param.smsType,
|
||||
'unread_count': unreadCount,
|
||||
'sending_status': param.sendStatus,
|
||||
'has_draft': common.has_draft.NO,
|
||||
'time': param.timestamp,
|
||||
'message_count': 1,
|
||||
'has_mms': actionData.isMms ? common.has_mms.HAVE : common.has_mms.NO,
|
||||
'has_attachment': actionData.hasAttachment ? common.has_attachment.HAVE : common.has_attachment.NO
|
||||
}
|
||||
ConversationListService.getInstance().insertSession(valueBucket, sessionResult => {
|
||||
HiLog.i(TAG, "dealNoExistSession, insertSession callback");
|
||||
HiLog.i(TAG, 'dealNoExistSession, insertSession callback');
|
||||
if (sessionResult.code == common.int.FAILURE) {
|
||||
HiLog.e(TAG, "dealNoExistSession, insertSession fail!");
|
||||
HiLog.e(TAG, 'dealNoExistSession, insertSession fail!');
|
||||
callback(sessionResult);
|
||||
return;
|
||||
}
|
||||
// Invoke the SMS database to insert SMS messages.
|
||||
this.dealInsertMessageDetail(param, actionData, sessionResult.abilityResult, res => {
|
||||
let result: LooseObject = {
|
||||
"rowId": sessionResult.abilityResult,
|
||||
"initDatas": res.initDatas,
|
||||
"groupId": res.groupId
|
||||
'rowId': sessionResult.abilityResult,
|
||||
'initDatas': res.initDatas,
|
||||
'groupId': res.groupId
|
||||
}
|
||||
callback(result);
|
||||
}, context);
|
||||
@ -312,14 +312,14 @@ export default class ConversationService {
|
||||
hasDraft = 0;
|
||||
}
|
||||
let valueBucket: LooseObject = {
|
||||
"content": param.content,
|
||||
"unread_count": unreadCount,
|
||||
"time": new Date().getTime(),
|
||||
"sending_status": param.sendStatus,
|
||||
"has_draft": hasDraft,
|
||||
"message_count": (response.messageCount + 1),
|
||||
"has_attachment": actionData.hasAttachment ? 1 : 0,
|
||||
"has_mms": actionData.isMms ? 1 : 0,
|
||||
'content': param.content,
|
||||
'unread_count': unreadCount,
|
||||
'time': new Date().getTime(),
|
||||
'sending_status': param.sendStatus,
|
||||
'has_draft': hasDraft,
|
||||
'message_count': (response.messageCount + 1),
|
||||
'has_attachment': actionData.hasAttachment ? 1 : 0,
|
||||
'has_mms': actionData.isMms ? 1 : 0,
|
||||
}
|
||||
let sessionId: number = response.id;
|
||||
let condition: LooseObject = {};
|
||||
@ -328,9 +328,9 @@ export default class ConversationService {
|
||||
// Invoke the SMS database to insert SMS messages.
|
||||
this.dealInsertMessageDetail(param, actionData, sessionId, res => {
|
||||
let result: LooseObject = {
|
||||
"rowId": sessionId,
|
||||
"initDatas": res.initDatas,
|
||||
"groupId": res.groupId
|
||||
'rowId': sessionId,
|
||||
'initDatas': res.initDatas,
|
||||
'groupId': res.groupId
|
||||
}
|
||||
callback(result);
|
||||
}, context);
|
||||
@ -343,7 +343,7 @@ export default class ConversationService {
|
||||
if (res.code == common.int.SUCCESS) {
|
||||
maxGroupId = Number(res.abilityResult) + 1;
|
||||
} else {
|
||||
HiLog.w(TAG, "dealInsertMessageDetail, queryMaxGroupId failed");
|
||||
HiLog.w(TAG, 'dealInsertMessageDetail, queryMaxGroupId failed');
|
||||
callback(res);
|
||||
}
|
||||
this.insertMessageDetailByMaxGroupId(param, actionData, threadId, maxGroupId, result => {
|
||||
@ -363,8 +363,8 @@ export default class ConversationService {
|
||||
this.insertSmsMmsInfo(valueBucket, res => {
|
||||
count++;
|
||||
let initData: LooseObject = {
|
||||
"id": res.abilityResult,
|
||||
"telephone": sendResult.telephone
|
||||
'id': res.abilityResult,
|
||||
'telephone': sendResult.telephone
|
||||
};
|
||||
initDatas.push(initData);
|
||||
if (count == actionData.sendResults.length) {
|
||||
@ -377,26 +377,26 @@ export default class ConversationService {
|
||||
|
||||
private buildInsertSmsMmsRow(param, actionData, sendResult, threadId, maxGroupId): LooseObject {
|
||||
let valueBucket: LooseObject = {
|
||||
"slot_id": common.int.SIM_ONE,
|
||||
"receiver_number": common.string.EMPTY_STR,
|
||||
"sender_number": common.string.EMPTY_STR,
|
||||
"start_time": common.string.EMPTY_STR,
|
||||
"end_time": common.string.EMPTY_STR,
|
||||
"msg_type": common.MESSAGE_TYPE.NORMAL,
|
||||
"sms_type": common.sms_type.COMMON,
|
||||
"msg_title": common.string.EMPTY_STR,
|
||||
"msg_content": common.string.EMPTY_STR,
|
||||
"msg_state": common.int.SEND_MESSAGE_SENDING,
|
||||
"operator_service_number": common.string.EMPTY_STR,
|
||||
"msg_code": common.string.EMPTY_STR,
|
||||
"session_id": threadId,
|
||||
"is_lock": common.is_lock.NO,
|
||||
"is_read": common.is_read.UN_READ,
|
||||
"is_collect": common.is_collect.NOT_FAVORITE,
|
||||
"session_type": common.session_type.COMMON,
|
||||
"is_sender": common.is_sender.NO,
|
||||
"group_id": maxGroupId,
|
||||
"is_send_report": common.is_send_report.NO
|
||||
'slot_id': common.int.SIM_ONE,
|
||||
'receiver_number': common.string.EMPTY_STR,
|
||||
'sender_number': common.string.EMPTY_STR,
|
||||
'start_time': common.string.EMPTY_STR,
|
||||
'end_time': common.string.EMPTY_STR,
|
||||
'msg_type': common.MESSAGE_TYPE.NORMAL,
|
||||
'sms_type': common.sms_type.COMMON,
|
||||
'msg_title': common.string.EMPTY_STR,
|
||||
'msg_content': common.string.EMPTY_STR,
|
||||
'msg_state': common.int.SEND_MESSAGE_SENDING,
|
||||
'operator_service_number': common.string.EMPTY_STR,
|
||||
'msg_code': common.string.EMPTY_STR,
|
||||
'session_id': threadId,
|
||||
'is_lock': common.is_lock.NO,
|
||||
'is_read': common.is_read.UN_READ,
|
||||
'is_collect': common.is_collect.NOT_FAVORITE,
|
||||
'session_type': common.session_type.COMMON,
|
||||
'is_sender': common.is_sender.NO,
|
||||
'group_id': maxGroupId,
|
||||
'is_send_report': common.is_send_report.NO
|
||||
};
|
||||
if (sendResult.slotId != null) {
|
||||
valueBucket.slot_id = sendResult.slotId;
|
||||
@ -488,8 +488,8 @@ export default class ConversationService {
|
||||
let param: LooseObject = this.dealSendResults(sendResults);
|
||||
// Update the status of the session list.
|
||||
let valueBucket: LooseObject = {
|
||||
"sending_status": param.sendStatus,
|
||||
"content": param.content
|
||||
'sending_status': param.sendStatus,
|
||||
'content': param.content
|
||||
}
|
||||
ConversationListService.getInstance().updateSessionByCondition(actionData, valueBucket, null, null);
|
||||
// Update the status of the information list.
|
||||
@ -504,23 +504,23 @@ export default class ConversationService {
|
||||
}
|
||||
actionData.msgId = sendResult.id;
|
||||
let valueBucket: LooseObject = {
|
||||
"msg_state": actionData.sendStatus,
|
||||
'msg_state': actionData.sendStatus,
|
||||
};
|
||||
this.updateSmsMmsInfoByCondition(actionData, valueBucket, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
public saveImage(actionData, callback, context): void {
|
||||
callback("saveImage function to be developed!");
|
||||
callback('saveImage function to be developed!');
|
||||
}
|
||||
|
||||
public gotoShare(actionData, callback, context): void {
|
||||
callback("gotoShare function to be developed!");
|
||||
callback('gotoShare function to be developed!');
|
||||
}
|
||||
|
||||
public dealContactsName(telephones, actionData, resultList, callback, context): void {
|
||||
actionData.telephones = telephones;
|
||||
actionData.hasDelete = "0";
|
||||
actionData.hasDelete = '0';
|
||||
if (telephones.length == 0) {
|
||||
callback(resultList);
|
||||
}
|
||||
@ -550,7 +550,7 @@ export default class ConversationService {
|
||||
value.contactsNum = contactsNums.length;
|
||||
if (value.isFavorite) {
|
||||
let temp = JSON.parse(JSON.stringify(value));
|
||||
temp.icon = "/common/icon/icon_favorite.svg";
|
||||
temp.icon = '/common/icon/icon_favorite.svg';
|
||||
favoriteList.push(temp);
|
||||
value.isFavorite = false;
|
||||
}
|
||||
@ -570,7 +570,7 @@ export default class ConversationService {
|
||||
// Indicates the combination of multiple names. The names need to be displayed in combination.
|
||||
if (telephoneMap.has(map.telephone)) {
|
||||
map.name = telephoneMap.get(map.telephone);
|
||||
map.nameFormatter = map.name + "<" + map.telephoneFormat + ">";
|
||||
map.nameFormatter = map.name + '<' + map.telephoneFormat + '>';
|
||||
} else {
|
||||
map.nameFormatter = map.telephoneFormat;
|
||||
}
|
||||
@ -605,7 +605,7 @@ export default class ConversationService {
|
||||
if (res.code == common.int.SUCCESS) {
|
||||
callback(res.abilityResult);
|
||||
} else {
|
||||
HiLog.w(TAG, "statisticsUnreadNotify fail!");
|
||||
HiLog.w(TAG, 'statisticsUnreadNotify fail!');
|
||||
callback(0);
|
||||
}
|
||||
}, context);
|
||||
|
@ -1,28 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import WantAgent from "@ohos.app.ability.wantAgent";
|
||||
import Notification from "@ohos.notificationManager";
|
||||
import WantAgent from '@ohos.app.ability.wantAgent';
|
||||
import Notification from '@ohos.notificationManager';
|
||||
|
||||
import common from "../data/commonData";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import ConversationService from "./ConversationService";
|
||||
import ConversationListService from "../service/ConversationListService";
|
||||
import common from '../data/commonData';
|
||||
import HiLog from '../utils/HiLog';
|
||||
import ConversationService from './ConversationService';
|
||||
import ConversationListService from '../service/ConversationListService';
|
||||
|
||||
var notificationManager = globalThis.requireNapi("notificationManager");
|
||||
const label = "notification_";
|
||||
const TAG: string = "NotificationService";
|
||||
var notificationManager = globalThis.requireNapi('notificationManager');
|
||||
const label = 'notification_';
|
||||
const TAG: string = 'NotificationService';
|
||||
|
||||
export default class NotificationService {
|
||||
private static sInstance: NotificationService;
|
||||
@ -35,7 +35,7 @@ export default class NotificationService {
|
||||
}
|
||||
|
||||
constructor() {
|
||||
HiLog.i(TAG, "new start");
|
||||
HiLog.i(TAG, 'new start');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ export default class NotificationService {
|
||||
notificationRequest.id = actionData.msgId;
|
||||
notificationRequest.label = label + actionData.msgId;
|
||||
Notification.publish(notificationRequest);
|
||||
HiLog.i(TAG, "sendNotify finished");
|
||||
HiLog.i(TAG, 'sendNotify finished');
|
||||
});
|
||||
}
|
||||
|
||||
@ -76,19 +76,19 @@ export default class NotificationService {
|
||||
*/
|
||||
buildWantAgentInfo(actionData): any {
|
||||
let parameters = {
|
||||
pageFlag: "conversation",
|
||||
pageFlag: 'conversation',
|
||||
contactObjects: actionData.contactObjects
|
||||
};
|
||||
let wantAgentInfo = {
|
||||
wants: [
|
||||
{
|
||||
deviceId: "",
|
||||
deviceId: '',
|
||||
bundleName: common.string.BUNDLE_NAME,
|
||||
abilityName: common.string.ABILITY_NAME,
|
||||
action: "mms.event.notification",
|
||||
action: 'mms.event.notification',
|
||||
entities: [],
|
||||
type: "MIMETYPE",
|
||||
uri: "",
|
||||
type: 'MIMETYPE',
|
||||
uri: '',
|
||||
}
|
||||
],
|
||||
operationType: WantAgent.OperationType.START_ABILITY,
|
||||
@ -117,7 +117,7 @@ export default class NotificationService {
|
||||
wantAgent: '',
|
||||
slotType: Notification.SlotType.OTHER_TYPES,
|
||||
deliveryTime: new Date().getTime(),
|
||||
groupName: "MMS"
|
||||
groupName: 'MMS'
|
||||
};
|
||||
return notificationRequest;
|
||||
}
|
||||
@ -144,7 +144,7 @@ export default class NotificationService {
|
||||
cancelNotify(msgId, callback) {
|
||||
Notification.cancel(msgId, label + msgId, (err, data) => {
|
||||
if (err) {
|
||||
HiLog.w(TAG, "cancelNotify, error: " + JSON.stringify(err.message));
|
||||
HiLog.w(TAG, 'cancelNotify, error: ' + JSON.stringify(err.message));
|
||||
callback(common.int.FAILURE);
|
||||
}
|
||||
callback(common.int.SUCCESS);
|
||||
@ -155,7 +155,7 @@ export default class NotificationService {
|
||||
let promise = Notification.cancelAll();
|
||||
promise.then((ret) => {
|
||||
}).catch((err) => {
|
||||
HiLog.e(TAG, "cancelAllNotify, error: " + JSON.stringify(err.message));
|
||||
HiLog.e(TAG, 'cancelAllNotify, error: ' + JSON.stringify(err.message));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import sms from "@ohos.telephony.sms";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import common from "../data/commonData";
|
||||
import http from "@ohos.net.http";
|
||||
import sms from '@ohos.telephony.sms';
|
||||
import HiLog from '../utils/HiLog';
|
||||
import common from '../data/commonData';
|
||||
import http from '@ohos.net.http';
|
||||
|
||||
const TAG = "SendMsgService"
|
||||
const TAG = 'SendMsgService'
|
||||
|
||||
export default {
|
||||
|
||||
@ -37,7 +37,7 @@ export default {
|
||||
sendCallback: (err, value) => {
|
||||
let sendStatus: number = common.int.SEND_MESSAGE_FAILED;
|
||||
if (err) {
|
||||
HiLog.w(TAG, "sendMessage, sendCallback failed err: " + JSON.stringify(err.message));
|
||||
HiLog.w(TAG, 'sendMessage, sendCallback failed err: ' + JSON.stringify(err.message));
|
||||
sendStatus = common.int.SEND_MESSAGE_FAILED;
|
||||
} else {
|
||||
sendStatus = this.dealSendResult(value);
|
||||
@ -47,13 +47,13 @@ export default {
|
||||
},
|
||||
deliveryCallback: (err, value) => {
|
||||
if (err) {
|
||||
HiLog.w(TAG, "sendMessage, deliveryCallback failed err: " + JSON.stringify(err.message));
|
||||
HiLog.w(TAG, 'sendMessage, deliveryCallback failed err: ' + JSON.stringify(err.message));
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
HiLog.e(TAG, "sendMessage, sendMessage failed error: " + JSON.stringify(error));
|
||||
HiLog.e(TAG, 'sendMessage, sendMessage failed error: ' + JSON.stringify(error));
|
||||
callback(common.int.SEND_MESSAGE_FAILED);
|
||||
}
|
||||
},
|
||||
@ -74,9 +74,9 @@ export default {
|
||||
{
|
||||
method: http.RequestMethod.POST,
|
||||
header: {
|
||||
"Content-Type": "application/vnd.wap.mms-message",
|
||||
"Accept": "Accept",
|
||||
"Accept-Language": "Accept-Language"
|
||||
'Content-Type': 'application/vnd.wap.mms-message',
|
||||
'Accept': 'Accept',
|
||||
'Accept-Language': 'Accept-Language'
|
||||
},
|
||||
extraData: JSON.stringify(params),
|
||||
readTimeout: 60000,
|
||||
@ -84,7 +84,7 @@ export default {
|
||||
}, (err, data) => {
|
||||
let sendStatus;
|
||||
if (err) {
|
||||
HiLog.i(TAG, "sendMmsMessage, error: " + JSON.stringify(err.message));
|
||||
HiLog.i(TAG, 'sendMmsMessage, error: ' + JSON.stringify(err.message));
|
||||
sendStatus = common.int.SEND_MESSAGE_FAILED;
|
||||
} else {
|
||||
sendStatus = common.int.SEND_MESSAGE_SUCCESS;
|
||||
|
@ -1,27 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import SettingModel from "../model/SettingsModel";
|
||||
import SettingModel from '../model/SettingsModel';
|
||||
|
||||
let mSettingModel = new SettingModel();
|
||||
import HiLog from "../utils/HiLog";
|
||||
import common from "../data/commonData";
|
||||
import LooseObject from "../data/LooseObject"
|
||||
import MmsPreferences from "../utils/MmsPreferences";
|
||||
import HiLog from '../utils/HiLog';
|
||||
import common from '../data/commonData';
|
||||
import LooseObject from '../data/LooseObject'
|
||||
import MmsPreferences from '../utils/MmsPreferences';
|
||||
|
||||
const TAG = "SettingService";
|
||||
const TAG = 'SettingService';
|
||||
|
||||
export default {
|
||||
|
||||
@ -32,9 +32,9 @@ export default {
|
||||
*/
|
||||
setOnSettingValueListener(callback) {
|
||||
let result: LooseObject = {
|
||||
"integrationSwitch": false,
|
||||
"maliciousWebSwitch": false,
|
||||
"showContactSwitch": false,
|
||||
'integrationSwitch': false,
|
||||
'maliciousWebSwitch': false,
|
||||
'showContactSwitch': false,
|
||||
};
|
||||
mSettingModel.setOnSettingValueListener(settingValue => {
|
||||
if (settingValue.integrationSwitch === common.bool.TRUE || settingValue.integrationSwitch === '') {
|
||||
@ -68,43 +68,43 @@ export default {
|
||||
*/
|
||||
updateSettingValue(code, actionData, callback) {
|
||||
switch (code) {
|
||||
case common.route.MESSAGE_CODE_UPDATE_DELIVERY_REPORTS_VALUE:
|
||||
case common.route.MESSAGE_CODE_UPDATE_DELIVERY_REPORTS_VALUE:
|
||||
// Delivery Report
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_DELIVERY_REPORT_SWITCH,
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_DELIVERY_REPORT_SWITCH,
|
||||
actionData.intValue, callback);
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_AUTO_RETRIEVE_MMS_VALUE:
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_AUTO_RETRIEVE_MMS_VALUE:
|
||||
// Automatically downloading MMs
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_AUTO_RETRIEVE_SWITCH,
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_AUTO_RETRIEVE_SWITCH,
|
||||
actionData.intValue, callback);
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_RECALL_MESSAGES_VALUE:
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_RECALL_MESSAGES_VALUE:
|
||||
// Cancel Sending
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_RECALL_MESSAGE_SWITCH,
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_RECALL_MESSAGE_SWITCH,
|
||||
actionData.booleanValue, callback);
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_AUTO_DELETE_INFO_MESSAGES_VALUE:
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_AUTO_DELETE_INFO_MESSAGES_VALUE:
|
||||
// Automatically delete notification information
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_AUTO_DELETE_INFO_SWITCH,
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_AUTO_DELETE_INFO_SWITCH,
|
||||
actionData.booleanValue, callback);
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_ARCHIVE_INFO_MESSAGES_VALUE:
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_ARCHIVE_INFO_MESSAGES_VALUE:
|
||||
// Notification information integration
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_INTEGRATION_SWITCH,
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_INTEGRATION_SWITCH,
|
||||
actionData.booleanValue, callback);
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_MALICIOUS_WEBSITE_IDENTIFICATION_VALUE:
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_MALICIOUS_WEBSITE_IDENTIFICATION_VALUE:
|
||||
// Malicious Website Identification
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_MALICIOUS_WEB_SWITCH,
|
||||
actionData.booleanValue, callback);
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_SHOW_CONTACT_PROFILE_PICS_VALUE:
|
||||
break;
|
||||
case common.route.MESSAGE_CODE_UPDATE_SHOW_CONTACT_PROFILE_PICS_VALUE:
|
||||
// Display contact avatar
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_SHOW_CONTACT_SWITCH,
|
||||
mSettingModel.updateSwitchValue(common.string.KEY_OF_SHOW_CONTACT_SWITCH,
|
||||
actionData.booleanValue, callback);
|
||||
break;
|
||||
default:
|
||||
HiLog.w(TAG, "updateSettingValue, code is not exit");
|
||||
break;
|
||||
default:
|
||||
HiLog.w(TAG, 'updateSettingValue, code is not exit');
|
||||
}
|
||||
},
|
||||
|
||||
@ -126,9 +126,9 @@ export default {
|
||||
updateSmscNumber(actionData) {
|
||||
mSettingModel.updateSmscNumber(actionData, result => {
|
||||
if (result.code == common.int.SUCCESS) {
|
||||
HiLog.i(TAG, "updateSmscNumber, success");
|
||||
HiLog.i(TAG, 'updateSmscNumber, success');
|
||||
} else {
|
||||
HiLog.w(TAG, "updateSmscNumber, fail");
|
||||
HiLog.w(TAG, 'updateSmscNumber, fail');
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -143,7 +143,7 @@ export default {
|
||||
// The sharing API is not provided.
|
||||
mSettingModel.shareSmsEnterSelectedText(actionData, result => {
|
||||
if (result.code == common.int.SUCCESS) {
|
||||
HiLog.i(TAG, "shareSmsEnterSelectedText, success");
|
||||
HiLog.i(TAG, 'shareSmsEnterSelectedText, success');
|
||||
} else {
|
||||
}
|
||||
});
|
||||
@ -154,13 +154,13 @@ export default {
|
||||
*/
|
||||
getSettingFlagForConvListPage() {
|
||||
let result: LooseObject = {
|
||||
"isShowContactHeadIcon": false,
|
||||
"hasAggregate": false,
|
||||
"recallMessagesFlag": false,
|
||||
'isShowContactHeadIcon': false,
|
||||
'hasAggregate': false,
|
||||
'recallMessagesFlag': false,
|
||||
};
|
||||
mSettingModel.getSettingValue(settingValue => {
|
||||
if (settingValue.code === common.int.SUCCESS) {
|
||||
HiLog.i(TAG, "getSettingFlagForConvListPage, Success");
|
||||
HiLog.i(TAG, 'getSettingFlagForConvListPage, Success');
|
||||
if (settingValue.abilityResult.isShowContactHeadIcon === common.bool.TRUE ||
|
||||
settingValue.abilityResult.isShowContactHeadIcon === '') {
|
||||
result.isShowContactHeadIcon = true;
|
||||
@ -174,7 +174,7 @@ export default {
|
||||
result.recallMessagesFlag = true;
|
||||
}
|
||||
} else {
|
||||
HiLog.w(TAG, "getSettingFlagForConvListPage, fail");
|
||||
HiLog.w(TAG, 'getSettingFlagForConvListPage, fail');
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
@ -1,23 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import emitter from '@ohos.events.emitter';
|
||||
import cardModel from "../model/CardModel"
|
||||
import HiLog from "../utils/HiLog";
|
||||
import cardModel from '../model/CardModel'
|
||||
import HiLog from '../utils/HiLog';
|
||||
|
||||
const TAG: string = "SimCardService";
|
||||
const TAG: string = 'SimCardService';
|
||||
|
||||
class SimCardService {
|
||||
public SIM_STATE_CHANGE_EVENT: emitter.InnerEvent = cardModel.SIM_STATE_CHANGE_EVENT;
|
||||
|
@ -1,283 +1,284 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import common from "../data/commonData";
|
||||
import HiLog from "./HiLog";
|
||||
import common from '../data/commonData';
|
||||
import HiLog from './HiLog';
|
||||
|
||||
// Time constant
|
||||
const ONE_MINUTE_IN_MILLISECOND = 60000;
|
||||
const ONE_HOUR_IN_MILLISECOND = 3600000;
|
||||
|
||||
const TAG = "DateUtil";
|
||||
const TAG = 'DateUtil';
|
||||
|
||||
export default {
|
||||
|
||||
/**
|
||||
* Converts the timestamp of an item to a time (for the SMS message list).
|
||||
*
|
||||
* @param messageItem
|
||||
* @param is24HourTime
|
||||
* @return
|
||||
*/
|
||||
convertDateFormatForItem(messageItem, is24HourTime) {
|
||||
let now = new Date();
|
||||
let currentDate = {
|
||||
timeOfNow: now.getTime(),
|
||||
yearOfNow: now.getFullYear(),
|
||||
monthOfNow: now.getMonth() + 1,
|
||||
dayOfNow: now.getDate()
|
||||
};
|
||||
let timeMillisecond = messageItem.timeMillisecond;
|
||||
messageItem.time = this.convertTimeStampToTime(timeMillisecond, currentDate, is24HourTime);
|
||||
},
|
||||
/**
|
||||
* Converts the timestamp of an item to a time (for the SMS message list).
|
||||
*
|
||||
* @param messageItem
|
||||
* @param is24HourTime
|
||||
* @return
|
||||
*/
|
||||
convertDateFormatForItem(messageItem, is24HourTime) {
|
||||
let now = new Date();
|
||||
let currentDate = {
|
||||
timeOfNow: now.getTime(),
|
||||
yearOfNow: now.getFullYear(),
|
||||
monthOfNow: now.getMonth() + 1,
|
||||
dayOfNow: now.getDate()
|
||||
};
|
||||
let timeMillisecond = messageItem.timeMillisecond;
|
||||
messageItem.time = this.convertTimeStampToTime(timeMillisecond, currentDate, is24HourTime);
|
||||
},
|
||||
|
||||
/**
|
||||
* Converting a Timestamp to a Time (for SMS List)
|
||||
*
|
||||
* @param timeStampFromDb Timeline to be converted
|
||||
* @param currentDate Current Time
|
||||
* @param is24HourTime
|
||||
* @return
|
||||
*/
|
||||
convertTimeStampToTime(timeStampFromDb, currentDate, is24HourTime) {
|
||||
let sms = new Date(timeStampFromDb);
|
||||
let timeStampOfSms = sms.getTime();
|
||||
let yearOfSms = sms.getFullYear();
|
||||
let monthOfSms = sms.getMonth() + 1;
|
||||
let dayOfSms = sms.getDate();
|
||||
let hoursOfSms = sms.getHours();
|
||||
let minutesOfSms = sms.getMinutes();
|
||||
let diff = currentDate.timeOfNow - timeStampOfSms;
|
||||
if (currentDate.yearOfNow == yearOfSms && currentDate.monthOfNow == monthOfSms
|
||||
&& currentDate.dayOfNow == dayOfSms) {
|
||||
if (diff < ONE_MINUTE_IN_MILLISECOND) {
|
||||
return $r("app.string.justNow");
|
||||
} else if (diff < ONE_HOUR_IN_MILLISECOND) {
|
||||
return $r("app.string.minAgo", Math.floor(diff / ONE_MINUTE_IN_MILLISECOND));
|
||||
} else {
|
||||
let hoursOfSmsStr: string = '' + hoursOfSms;
|
||||
let minutesOfSmsStr: string = '' + minutesOfSms;
|
||||
if (hoursOfSms < 10) {
|
||||
hoursOfSmsStr = "0" + hoursOfSms;
|
||||
}
|
||||
if (minutesOfSms < 10) {
|
||||
minutesOfSmsStr = "0" + minutesOfSms;
|
||||
}
|
||||
if (is24HourTime) {
|
||||
return $r("app.string.hourAndMinute", hoursOfSmsStr, minutesOfSmsStr);
|
||||
} else {
|
||||
return this.timeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr);
|
||||
}
|
||||
}
|
||||
} else if (currentDate.yearOfNow == yearOfSms && currentDate.monthOfNow == monthOfSms
|
||||
&& currentDate.dayOfNow - dayOfSms == 1) {
|
||||
return $r("app.string.yesterday");
|
||||
} else if (currentDate.yearOfNow == yearOfSms) {
|
||||
return $r("app.string.monthDay", monthOfSms, dayOfSms);
|
||||
} else {
|
||||
return $r("app.string.yearMonthDay", yearOfSms, monthOfSms, dayOfSms);
|
||||
}
|
||||
},
|
||||
|
||||
timeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr) {
|
||||
let time: Resource = null;
|
||||
if (hoursOfSms <= 12) {
|
||||
time = this.morningTimeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr);
|
||||
} else {
|
||||
time = this.afterTimeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr);
|
||||
}
|
||||
return time;
|
||||
},
|
||||
|
||||
morningTimeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr) {
|
||||
let time: Resource = null;
|
||||
// 12-hour clock
|
||||
if (hoursOfSms < 1) {
|
||||
time = $r("app.string.postMidnight", 12 + '', minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 1 && hoursOfSms < 4) {
|
||||
time = $r("app.string.beforeDawn", hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 4 && hoursOfSms < 6) {
|
||||
time = $r("app.string.earlyMorning", hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 6 && hoursOfSms < 9) {
|
||||
time = $r("app.string.morning", hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 9 && hoursOfSms < 11) {
|
||||
time = $r("app.string.forenoon", hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 11 && hoursOfSms <= 12) {
|
||||
time = $r("app.string.preNoon", hoursOfSms + '', minutesOfSmsStr);
|
||||
}
|
||||
return time;
|
||||
},
|
||||
|
||||
afterTimeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr) {
|
||||
let time: Resource = null;
|
||||
if (hoursOfSms > 12 && hoursOfSms < 13) {
|
||||
time = $r("app.string.postNoon", hoursOfSms + '', minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 13 && hoursOfSms < 17) {
|
||||
time = $r("app.string.afternoon", (hoursOfSms - 12) + '', minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 17 && hoursOfSms < 19) {
|
||||
time = $r("app.string.towardEvening", (hoursOfSms - 12) + '', minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 19 && hoursOfSms < 23) {
|
||||
time = $r("app.string.evening", (hoursOfSms - 12) + '', minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 23) {
|
||||
time = $r("app.string.preMidnight", (hoursOfSms - 12) + '', minutesOfSmsStr);
|
||||
}
|
||||
return time;
|
||||
},
|
||||
|
||||
/**
|
||||
* Converting Time
|
||||
* @param messageItem
|
||||
* @param is24HourTime
|
||||
* @param that
|
||||
* @return
|
||||
*/
|
||||
convertTimeStampToDateWeek(messageItem, is24HourTime) {
|
||||
let now = new Date();
|
||||
let yearOfNow = now.getFullYear();
|
||||
let monthOfNow = now.getMonth() + 1;
|
||||
let dayOfNow = now.getDate();
|
||||
let timeMillisecond = messageItem.timeMillisecond;
|
||||
this.convertTimeStampToDate(messageItem, timeMillisecond, yearOfNow, monthOfNow, dayOfNow);
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the timestamp form to the date form.
|
||||
*/
|
||||
convertTimeStampToDate(messageItem, timeStampFromDb, yearOfNow, monthOfNow, dayOfNow) {
|
||||
let date: Resource = null;
|
||||
let sms = new Date(timeStampFromDb);
|
||||
let yearOfSms = sms.getFullYear();
|
||||
let monthOfSms = sms.getMonth() + 1;
|
||||
let dayOfSms = sms.getDate();
|
||||
let weekOfSms = sms.getDay();
|
||||
if (yearOfNow == yearOfSms && monthOfNow == monthOfSms && dayOfNow == dayOfSms) {
|
||||
date = $r("app.string.recentDateToday", '');
|
||||
} else if (yearOfNow == yearOfSms && monthOfNow == monthOfSms && dayOfNow - dayOfSms == 1) {
|
||||
date = $r("app.string.recentDateYesterday", '');
|
||||
} else if (yearOfNow == yearOfSms) {
|
||||
date = $r("app.string.monthDayDate", monthOfSms, dayOfSms, '');
|
||||
} else {
|
||||
date = $r("app.string.yearMonthDayDate", yearOfSms, monthOfSms, dayOfSms, '');
|
||||
}
|
||||
messageItem.date = date;
|
||||
messageItem.week = this.getWeek(weekOfSms);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get Week/Day of the Week
|
||||
* @param day
|
||||
* @param that
|
||||
* @return
|
||||
*/
|
||||
getWeek(day) {
|
||||
let week: Resource = null;
|
||||
switch (day) {
|
||||
case 0:
|
||||
week = $r("app.string.Sunday");
|
||||
break;
|
||||
case 1:
|
||||
week = $r("app.string.Monday");
|
||||
break;
|
||||
case 2:
|
||||
week = $r("app.string.Tuesday");
|
||||
break;
|
||||
case 3:
|
||||
week = $r("app.string.Wednesday");
|
||||
break;
|
||||
case 4:
|
||||
week = $r("app.string.Thursday");
|
||||
break;
|
||||
case 5:
|
||||
week = $r("app.string.Friday");
|
||||
break;
|
||||
case 6:
|
||||
week = $r("app.string.Saturday");
|
||||
break;
|
||||
|
||||
}
|
||||
return week;
|
||||
},
|
||||
|
||||
convertTimeStampDate(timeStampFromDb) {
|
||||
let date : Resource = null;
|
||||
let sms = new Date(Number(timeStampFromDb));
|
||||
let yearOfSms = sms.getFullYear();
|
||||
let monthOfSms = sms.getMonth() + 1;
|
||||
let dayOfSms = sms.getDate();
|
||||
let weekOfSms = sms.getDay();
|
||||
date = $r("app.string.yearMonthDayDate", yearOfSms, monthOfSms, dayOfSms, '');
|
||||
return date;
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* @param timeStampFromDb
|
||||
* @param is24HourTime
|
||||
* @param that
|
||||
* @return
|
||||
*/
|
||||
convertTimeStampTime(timeStampFromDb, is24HourTime) {
|
||||
let sms = new Date(Number(timeStampFromDb));
|
||||
let hoursOfSms = sms.getHours();
|
||||
let minutesOfSms = sms.getMinutes();
|
||||
let hoursOfSmsStr: string = hoursOfSms + '';
|
||||
let minutesOfSmsStr: string = minutesOfSms + '';
|
||||
/**
|
||||
* Converting a Timestamp to a Time (for SMS List)
|
||||
*
|
||||
* @param timeStampFromDb Timeline to be converted
|
||||
* @param currentDate Current Time
|
||||
* @param is24HourTime
|
||||
* @return
|
||||
*/
|
||||
convertTimeStampToTime(timeStampFromDb, currentDate, is24HourTime) {
|
||||
let sms = new Date(timeStampFromDb);
|
||||
let timeStampOfSms = sms.getTime();
|
||||
let yearOfSms = sms.getFullYear();
|
||||
let monthOfSms = sms.getMonth() + 1;
|
||||
let dayOfSms = sms.getDate();
|
||||
let hoursOfSms = sms.getHours();
|
||||
let minutesOfSms = sms.getMinutes();
|
||||
let diff = currentDate.timeOfNow - timeStampOfSms;
|
||||
if (currentDate.yearOfNow == yearOfSms && currentDate.monthOfNow ==
|
||||
monthOfSms && currentDate.dayOfNow == dayOfSms) {
|
||||
if (diff < ONE_MINUTE_IN_MILLISECOND) {
|
||||
return $r('app.string.justNow');
|
||||
} else if (diff < ONE_HOUR_IN_MILLISECOND) {
|
||||
return $r('app.string.minAgo', Math.floor(diff / ONE_MINUTE_IN_MILLISECOND));
|
||||
} else {
|
||||
let hoursOfSmsStr: string = '' + hoursOfSms;
|
||||
let minutesOfSmsStr: string = '' + minutesOfSms;
|
||||
if (hoursOfSms < 10) {
|
||||
hoursOfSmsStr = "0" + hoursOfSms;
|
||||
hoursOfSmsStr = '0' + hoursOfSms;
|
||||
}
|
||||
if (minutesOfSms < 10) {
|
||||
minutesOfSmsStr = "0" + minutesOfSms;
|
||||
minutesOfSmsStr = '0' + minutesOfSms;
|
||||
}
|
||||
if (is24HourTime) {
|
||||
// 24-hour clock
|
||||
return $r("app.string.hourAndMinute", hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
return this.timeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr);
|
||||
},
|
||||
|
||||
fullDate(item) {
|
||||
let timeOfSms: Resource = null;
|
||||
let fullDate: Resource = null;
|
||||
let sms = new Date(item.timeMillisecond);
|
||||
let yearOfSms = sms.getFullYear();
|
||||
let monthOfSms = sms.getMonth() + 1;
|
||||
let dayOfSms = sms.getDate();
|
||||
let hoursOfSms = sms.getHours();
|
||||
let minutesOfSms = sms.getMinutes();
|
||||
let hoursOfSmsStr: string = hoursOfSms + '';
|
||||
let minutesOfSmsStr: string = minutesOfSms + '';
|
||||
if (hoursOfSms > 12) {
|
||||
hoursOfSmsStr = "" + (hoursOfSms - 12);
|
||||
}
|
||||
if (minutesOfSms < 10) {
|
||||
minutesOfSmsStr = "0" + minutesOfSms;
|
||||
}
|
||||
if( hoursOfSms < 12) {
|
||||
timeOfSms = $r("app.string.forenoon", hoursOfSmsStr, minutesOfSmsStr);
|
||||
return $r('app.string.hourAndMinute', hoursOfSmsStr, minutesOfSmsStr);
|
||||
} else {
|
||||
timeOfSms = $r("app.string.afternoon", hoursOfSmsStr, minutesOfSmsStr);
|
||||
return this.timeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr);
|
||||
}
|
||||
fullDate = $r("app.string.yearMonthDayDate", yearOfSms, monthOfSms, dayOfSms, '');
|
||||
item.fullDate = fullDate;
|
||||
item.timeOfSms = timeOfSms;
|
||||
}
|
||||
} else if (currentDate.yearOfNow == yearOfSms && currentDate.monthOfNow ==
|
||||
monthOfSms && currentDate.dayOfNow - dayOfSms == 1) {
|
||||
return $r('app.string.yesterday');
|
||||
} else if (currentDate.yearOfNow == yearOfSms) {
|
||||
return $r('app.string.monthDay', monthOfSms, dayOfSms);
|
||||
} else {
|
||||
return $r('app.string.yearMonthDay', yearOfSms, monthOfSms, dayOfSms);
|
||||
}
|
||||
},
|
||||
|
||||
timeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr) {
|
||||
let time: Resource = null;
|
||||
if (hoursOfSms <= 12) {
|
||||
time = this.morningTimeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr);
|
||||
} else {
|
||||
time = this.afterTimeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr);
|
||||
}
|
||||
return time;
|
||||
},
|
||||
|
||||
morningTimeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr) {
|
||||
let time: Resource = null;
|
||||
// 12-hour clock
|
||||
if (hoursOfSms < 1) {
|
||||
time = $r('app.string.postMidnight', 12 + '', minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 1 && hoursOfSms < 4) {
|
||||
time = $r('app.string.beforeDawn', hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 4 && hoursOfSms < 6) {
|
||||
time = $r('app.string.earlyMorning', hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 6 && hoursOfSms < 9) {
|
||||
time = $r('app.string.morning', hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 9 && hoursOfSms < 11) {
|
||||
time = $r('app.string.forenoon', hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 11 && hoursOfSms <= 12) {
|
||||
time = $r('app.string.preNoon', hoursOfSms + '', minutesOfSmsStr);
|
||||
}
|
||||
return time;
|
||||
},
|
||||
|
||||
afterTimeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr) {
|
||||
let time: Resource = null;
|
||||
if (hoursOfSms > 12 && hoursOfSms < 13) {
|
||||
time = $r('app.string.postNoon', hoursOfSms + '', minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 13 && hoursOfSms < 17) {
|
||||
time = $r('app.string.afternoon', (hoursOfSms - 12) + '', minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 17 && hoursOfSms < 19) {
|
||||
time = $r('app.string.towardEvening', (hoursOfSms - 12) + '', minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 19 && hoursOfSms < 23) {
|
||||
time = $r('app.string.evening', (hoursOfSms - 12) + '', minutesOfSmsStr);
|
||||
}
|
||||
if (hoursOfSms >= 23) {
|
||||
time = $r('app.string.preMidnight', (hoursOfSms - 12) + '', minutesOfSmsStr);
|
||||
}
|
||||
return time;
|
||||
},
|
||||
|
||||
/**
|
||||
* Converting Time
|
||||
* @param messageItem
|
||||
* @param is24HourTime
|
||||
* @param that
|
||||
* @return
|
||||
*/
|
||||
convertTimeStampToDateWeek(messageItem, is24HourTime) {
|
||||
let now = new Date();
|
||||
let yearOfNow = now.getFullYear();
|
||||
let monthOfNow = now.getMonth() + 1;
|
||||
let dayOfNow = now.getDate();
|
||||
let timeMillisecond = messageItem.timeMillisecond;
|
||||
this.convertTimeStampToDate(messageItem, timeMillisecond, yearOfNow, monthOfNow, dayOfNow);
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the timestamp form to the date form.
|
||||
*/
|
||||
convertTimeStampToDate(messageItem, timeStampFromDb, yearOfNow, monthOfNow, dayOfNow) {
|
||||
let date: Resource = null;
|
||||
let sms = new Date(timeStampFromDb);
|
||||
let yearOfSms = sms.getFullYear();
|
||||
let monthOfSms = sms.getMonth() + 1;
|
||||
let dayOfSms = sms.getDate();
|
||||
let weekOfSms = sms.getDay();
|
||||
if (yearOfNow == yearOfSms && monthOfNow == monthOfSms && dayOfNow == dayOfSms) {
|
||||
date = $r('app.string.recentDateToday', '');
|
||||
} else if (yearOfNow == yearOfSms && monthOfNow == monthOfSms && dayOfNow - dayOfSms == 1) {
|
||||
date = $r('app.string.recentDateYesterday', '');
|
||||
} else if (yearOfNow == yearOfSms) {
|
||||
date = $r('app.string.monthDayDate', monthOfSms, dayOfSms, '');
|
||||
} else {
|
||||
date = $r('app.string.yearMonthDayDate', yearOfSms, monthOfSms, dayOfSms, '');
|
||||
}
|
||||
messageItem.date = date;
|
||||
messageItem.week = this.getWeek(weekOfSms);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get Week/Day of the Week
|
||||
* @param day
|
||||
* @param that
|
||||
* @return
|
||||
*/
|
||||
getWeek(day) {
|
||||
let week: Resource = null;
|
||||
switch (day) {
|
||||
case 0:
|
||||
week = $r('app.string.Sunday');
|
||||
break;
|
||||
case 1:
|
||||
week = $r('app.string.Monday');
|
||||
break;
|
||||
case 2:
|
||||
week = $r('app.string.Tuesday');
|
||||
break;
|
||||
case 3:
|
||||
week = $r('app.string.Wednesday');
|
||||
break;
|
||||
case 4:
|
||||
week = $r('app.string.Thursday');
|
||||
break;
|
||||
case 5:
|
||||
week = $r('app.string.Friday');
|
||||
break;
|
||||
case 6:
|
||||
week = $r('app.string.Saturday');
|
||||
break;
|
||||
|
||||
}
|
||||
return week;
|
||||
},
|
||||
|
||||
convertTimeStampDate(timeStampFromDb) {
|
||||
let date: Resource = null;
|
||||
let sms = new Date(Number(timeStampFromDb));
|
||||
let yearOfSms = sms.getFullYear();
|
||||
let monthOfSms = sms.getMonth() + 1;
|
||||
let dayOfSms = sms.getDate();
|
||||
let weekOfSms = sms.getDay();
|
||||
date = $r('app.string.yearMonthDayDate', yearOfSms, monthOfSms, dayOfSms, '');
|
||||
return date;
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* @param timeStampFromDb
|
||||
* @param is24HourTime
|
||||
* @param that
|
||||
* @return
|
||||
*/
|
||||
convertTimeStampTime(timeStampFromDb, is24HourTime) {
|
||||
let sms = new Date(Number(timeStampFromDb));
|
||||
let hoursOfSms = sms.getHours();
|
||||
let minutesOfSms = sms.getMinutes();
|
||||
let hoursOfSmsStr: string = hoursOfSms + '';
|
||||
let minutesOfSmsStr: string = minutesOfSms + '';
|
||||
if (hoursOfSms < 10) {
|
||||
hoursOfSmsStr = '0' + hoursOfSms;
|
||||
}
|
||||
if (minutesOfSms < 10) {
|
||||
minutesOfSmsStr = '0' + minutesOfSms;
|
||||
}
|
||||
if (is24HourTime) {
|
||||
// 24-hour clock
|
||||
return $r('app.string.hourAndMinute', hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
return this.timeTwelveHourSystem(hoursOfSms, minutesOfSmsStr, hoursOfSmsStr);
|
||||
},
|
||||
|
||||
fullDate(item) {
|
||||
let timeOfSms: Resource = null;
|
||||
let fullDate: Resource = null;
|
||||
let sms = new Date(item.timeMillisecond);
|
||||
let yearOfSms = sms.getFullYear();
|
||||
let monthOfSms = sms.getMonth() + 1;
|
||||
let dayOfSms = sms.getDate();
|
||||
let hoursOfSms = sms.getHours();
|
||||
let minutesOfSms = sms.getMinutes();
|
||||
let hoursOfSmsStr: string = hoursOfSms + '';
|
||||
let minutesOfSmsStr: string = minutesOfSms + '';
|
||||
if (hoursOfSms > 12) {
|
||||
hoursOfSmsStr = '' + (hoursOfSms - 12);
|
||||
}
|
||||
if (minutesOfSms < 10) {
|
||||
minutesOfSmsStr = '0' + minutesOfSms;
|
||||
}
|
||||
if (hoursOfSms < 12) {
|
||||
timeOfSms = $r('app.string.forenoon', hoursOfSmsStr, minutesOfSmsStr);
|
||||
} else {
|
||||
timeOfSms = $r('app.string.afternoon', hoursOfSmsStr, minutesOfSmsStr);
|
||||
}
|
||||
fullDate = $r('app.string.yearMonthDayDate', yearOfSms, monthOfSms, dayOfSms, '');
|
||||
item.fullDate = fullDate;
|
||||
item.timeOfSms = timeOfSms;
|
||||
}
|
||||
}
|
@ -1,21 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import deviceInfo from "@ohos.deviceInfo";
|
||||
import HiLog from "./HiLog";
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import HiLog from './HiLog';
|
||||
|
||||
const TAG = "DeviceUtil";
|
||||
const TAG = 'DeviceUtil';
|
||||
|
||||
export default class DeviceUtil {
|
||||
private static readonly DEVICE_TYPE = deviceInfo.deviceType;
|
||||
@ -33,12 +33,12 @@ export default class DeviceUtil {
|
||||
* smartVision:Smart Vision Devices
|
||||
*/
|
||||
static getDeviceType(): string {
|
||||
HiLog.i(TAG, "deviceType is " + this.DEVICE_TYPE)
|
||||
HiLog.i(TAG, 'deviceType is ' + this.DEVICE_TYPE)
|
||||
return this.DEVICE_TYPE;
|
||||
}
|
||||
|
||||
static isTablet(): boolean{
|
||||
let deviceType = DeviceUtil.getDeviceType()
|
||||
return deviceType === "tablet";
|
||||
return deviceType === 'tablet';
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -26,14 +26,14 @@
|
||||
*
|
||||
* @since 2022-02-18
|
||||
*/
|
||||
import Log from "@ohos.hilog";
|
||||
import Log from '@ohos.hilog';
|
||||
|
||||
const TAG = "MmsLog";
|
||||
const TAG = 'MmsLog';
|
||||
const DOMAIN = 0x0800;
|
||||
|
||||
export default class HiLog {
|
||||
|
||||
private static readonly COLON: string = ": ";
|
||||
private static readonly COLON: string = ': ';
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
@ -1,26 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import HiLog from "./HiLog";
|
||||
import mmsTable from "../data/tableData";
|
||||
import ohosDataRdb from "@ohos.data.rdb";
|
||||
import HiLog from './HiLog';
|
||||
import mmsTable from '../data/tableData';
|
||||
import ohosDataRdb from '@ohos.data.rdb';
|
||||
|
||||
const TAG = "MmsDatabaseHelper";
|
||||
const TAG = 'MmsDatabaseHelper';
|
||||
|
||||
export default class MmsDatabaseHelper {
|
||||
public static TABLE = {
|
||||
SESSION: "session"
|
||||
SESSION: 'session'
|
||||
};
|
||||
private static sInstance: MmsDatabaseHelper;
|
||||
private mRdbStore = null;
|
||||
@ -42,9 +42,9 @@ export default class MmsDatabaseHelper {
|
||||
{ name: mmsTable.DB.MMSSMS.config.name }, mmsTable.DB.MMSSMS.version);
|
||||
|
||||
await this.mRdbStore.executeSql(mmsTable.table.session, null);
|
||||
HiLog.i(TAG, "create session table finish");
|
||||
HiLog.i(TAG, 'create session table finish');
|
||||
} else {
|
||||
HiLog.i(TAG, " this.mRdbStore !== null ");
|
||||
HiLog.i(TAG, ' this.mRdbStore !== null ');
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ export default class MmsDatabaseHelper {
|
||||
if (this.mRdbStore !== null) {
|
||||
return await this.mRdbStore.query(predicates);
|
||||
} else {
|
||||
HiLog.w(TAG, "mRdbStore is null, query fail.");
|
||||
HiLog.w(TAG, 'mRdbStore is null, query fail.');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -70,14 +70,14 @@ export default class MmsDatabaseHelper {
|
||||
if (this.mRdbStore !== null) {
|
||||
let insertPromise = this.mRdbStore.insert(tableName, valueBucket);
|
||||
insertPromise.then((ret) => {
|
||||
HiLog.i(TAG, "insert, first done: " + rowId);
|
||||
HiLog.i(TAG, 'insert, first done: ' + rowId);
|
||||
rowId = ret;
|
||||
}).catch((err) => {
|
||||
HiLog.e(TAG, "insert, first fail: " + JSON.stringify(err.message));
|
||||
HiLog.e(TAG, 'insert, first fail: ' + JSON.stringify(err.message));
|
||||
})
|
||||
await insertPromise;
|
||||
} else {
|
||||
HiLog.w(TAG, "mRdbStore is null, insert fail.");
|
||||
HiLog.w(TAG, 'mRdbStore is null, insert fail.');
|
||||
}
|
||||
return rowId;
|
||||
}
|
||||
@ -91,9 +91,9 @@ export default class MmsDatabaseHelper {
|
||||
async update(predicates, valueBucket) {
|
||||
if (this.mRdbStore !== null) {
|
||||
let changedRows = await this.mRdbStore.update(valueBucket, predicates);
|
||||
HiLog.i(TAG, "update, changedRows=" + changedRows);
|
||||
HiLog.i(TAG, 'update, changedRows=' + changedRows);
|
||||
} else {
|
||||
HiLog.w(TAG, "mRdbStore is null, update fail.");
|
||||
HiLog.w(TAG, 'mRdbStore is null, update fail.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,9 +105,9 @@ export default class MmsDatabaseHelper {
|
||||
async deleteItem(predicates) {
|
||||
if (this.mRdbStore !== null) {
|
||||
let deletedRows = await this.mRdbStore.delete(predicates);
|
||||
HiLog.i(TAG, "deleteItem, deletedRows=" + deletedRows);
|
||||
HiLog.i(TAG, 'deleteItem, deletedRows=' + deletedRows);
|
||||
} else {
|
||||
HiLog.w(TAG, "mRdbStore is null, delete item fail.");
|
||||
HiLog.w(TAG, 'mRdbStore is null, delete item fail.');
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import common from "../data/commonData";
|
||||
import LooseObject from "../data/LooseObject";
|
||||
import HiLog from "./HiLog";
|
||||
import common from '../data/commonData';
|
||||
import LooseObject from '../data/LooseObject';
|
||||
import HiLog from './HiLog';
|
||||
|
||||
import createOrGet from "./SingleInstanceUtils";
|
||||
import preferences from "@ohos.data.preferences";
|
||||
import createOrGet from './SingleInstanceUtils';
|
||||
import preferences from '@ohos.data.preferences';
|
||||
|
||||
const TAG = "MmsPreferences";
|
||||
const TAG = 'MmsPreferences';
|
||||
|
||||
/**
|
||||
* Obtaining a Lightweight Preference Database Instance
|
||||
@ -78,7 +78,7 @@ class MmsPreferences {
|
||||
this.setValueToMap(key, value.toString());
|
||||
return value;
|
||||
} catch (err) {
|
||||
HiLog.i(TAG, "getValueFromPreferences(" + key + ") failed with err: " + JSON.stringify(err))
|
||||
HiLog.i(TAG, 'getValueFromPreferences(' + key + ') failed with err: ' + JSON.stringify(err))
|
||||
return common.string.EMPTY_STR;
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@ class MmsPreferences {
|
||||
this.setValueToMap(key, value.toString());
|
||||
return value;
|
||||
}).catch((err) => {
|
||||
HiLog.i(TAG, "asyncGetValueFromPreferences(" + key + ") failed with err: " + JSON.stringify(err))
|
||||
HiLog.i(TAG, 'asyncGetValueFromPreferences(' + key + ') failed with err: ' + JSON.stringify(err))
|
||||
return common.string.EMPTY_STR;
|
||||
});
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const TAG = "SingleInstanceHelper";
|
||||
const TAG = 'SingleInstanceHelper';
|
||||
|
||||
export default function createOrGet<T>(objectClass: { new(): T }, storageKey: string): T {
|
||||
if (!globalThis[storageKey]) {
|
||||
|
@ -1,20 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import HiLog from "../utils/HiLog";
|
||||
import HiLog from '../utils/HiLog';
|
||||
|
||||
const TAG: string = "StringUtil";
|
||||
const TAG: string = 'StringUtil';
|
||||
const NON_ALPHABET_REG: RegExp = /[^\x00-\x80]/g;
|
||||
|
||||
class StringUtil {
|
||||
|
@ -1,31 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import common from "../data/commonData";
|
||||
import HiLog from "./HiLog";
|
||||
import call from "@ohos.telephony.call";
|
||||
import common from '../data/commonData';
|
||||
import HiLog from './HiLog';
|
||||
import call from '@ohos.telephony.call';
|
||||
|
||||
const TAG = "TelephoneUtil";
|
||||
const TAG = 'TelephoneUtil';
|
||||
/**
|
||||
* log package tool class
|
||||
*/
|
||||
const infoMegTelephone = [
|
||||
"1065796709202", "1065502043202", "1065902090202", "1069055999202",
|
||||
"106579670915", "106550204315", "106590209015", "106905599915",
|
||||
"106", "400", "111", "100", "118", "116", "12306", "12329", "12345",
|
||||
"12122", "12321", "12580", "12520", "12583", "02512329", "053287003810",
|
||||
"1258319559899", "1019", "12583110086", "000000", "95", "96",
|
||||
'1065796709202', '1065502043202', '1065902090202', '1069055999202',
|
||||
'106579670915', '106550204315', '106590209015', '106905599915',
|
||||
'106', '400', '111', '100', '118', '116', '12306', '12329', '12345',
|
||||
'12122', '12321', '12580', '12520', '12583', '02512329', '053287003810',
|
||||
'1258319559899', '1019', '12583110086', '000000', '95', '96',
|
||||
];
|
||||
|
||||
export default {
|
||||
@ -54,9 +54,9 @@ export default {
|
||||
if (telephone == null || telephone == common.string.EMPTY_STR) {
|
||||
formatTelephone = common.string.EMPTY_STR;
|
||||
}
|
||||
if (formatTelephone.startsWith("+86")) {
|
||||
if (formatTelephone.startsWith('+86')) {
|
||||
formatTelephone = formatTelephone.substring(3);
|
||||
} else if(formatTelephone.startsWith("86")) {
|
||||
} else if(formatTelephone.startsWith('86')) {
|
||||
formatTelephone = formatTelephone.substring(2);
|
||||
}
|
||||
return formatTelephone;
|
||||
@ -152,7 +152,7 @@ export default {
|
||||
},
|
||||
async formatPhoneNumber(phoneNumber) {
|
||||
if (phoneNumber == null || phoneNumber === common.string.EMPTY_STR) {
|
||||
HiLog.w(TAG, "formatPhoneNumber, param is null");
|
||||
HiLog.w(TAG, 'formatPhoneNumber, param is null');
|
||||
return common.string.EMPTY_STR;
|
||||
}
|
||||
let promise = call.formatPhoneNumber(phoneNumber);
|
||||
@ -160,7 +160,7 @@ export default {
|
||||
promise.then((value) => {
|
||||
formatPhoneNumber = value;
|
||||
}).catch((err) => {
|
||||
HiLog.e(TAG, "formatPhoneNumber, error: " + JSON.stringify(err.message));
|
||||
HiLog.e(TAG, 'formatPhoneNumber, error: ' + JSON.stringify(err.message));
|
||||
});
|
||||
await promise;
|
||||
return formatPhoneNumber;
|
||||
|
@ -1,51 +1,50 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import router from "@system.router";
|
||||
import router from '@system.router';
|
||||
|
||||
import ContactService from "../service/ContactsService";
|
||||
import ConversationListService from "../service/ConversationListService";
|
||||
import common from "../data/commonData";
|
||||
import HiLog from "./HiLog";
|
||||
import ContactService from '../service/ContactsService';
|
||||
import ConversationListService from '../service/ConversationListService';
|
||||
import common from '../data/commonData';
|
||||
import HiLog from './HiLog';
|
||||
import LooseObject from '../data/LooseObject';
|
||||
|
||||
const TAG = "WantUtil";
|
||||
const TAG = 'WantUtil';
|
||||
|
||||
export default {
|
||||
|
||||
getWant() {
|
||||
HiLog.i(TAG, "getWant start");
|
||||
if(globalThis.abilityWant == null) {
|
||||
HiLog.i(TAG, 'getWant start');
|
||||
if (globalThis.abilityWant == null) {
|
||||
return;
|
||||
}
|
||||
let abilityWant = globalThis.abilityWant;
|
||||
globalThis.abilityWant = null;
|
||||
|
||||
if (abilityWant.hasOwnProperty("parameters")) {
|
||||
let parameters = abilityWant.parameters;
|
||||
let pageFlag = '';
|
||||
if (parameters.hasOwnProperty("pageFlag")) {
|
||||
pageFlag = parameters.pageFlag;
|
||||
HiLog.i(TAG, "pageFlag = " + pageFlag);
|
||||
}
|
||||
let contactParams = {}
|
||||
if (parameters.hasOwnProperty("contactObjects")) {
|
||||
contactParams = ContactService.getInstance().dealContactParams(parameters.contactObjects);
|
||||
}
|
||||
this.jump(pageFlag, contactParams);
|
||||
if (abilityWant.hasOwnProperty('parameters')) {
|
||||
let parameters = abilityWant.parameters;
|
||||
let pageFlag = '';
|
||||
if (parameters.hasOwnProperty('pageFlag')) {
|
||||
pageFlag = parameters.pageFlag;
|
||||
HiLog.i(TAG, 'pageFlag = ' + pageFlag);
|
||||
}
|
||||
let contactParams = {}
|
||||
if (parameters.hasOwnProperty('contactObjects')) {
|
||||
contactParams = ContactService.getInstance().dealContactParams(parameters.contactObjects);
|
||||
}
|
||||
this.jump(pageFlag, contactParams);
|
||||
}
|
||||
},
|
||||
|
||||
jump(pageFlag, contactParams) {
|
||||
@ -53,10 +52,10 @@ export default {
|
||||
uri: '',
|
||||
params: {}
|
||||
};
|
||||
HiLog.i(TAG, "want.pageFlag: " + pageFlag);
|
||||
HiLog.i(TAG, 'want.pageFlag: ' + pageFlag);
|
||||
switch (pageFlag) {
|
||||
case "conversation":
|
||||
result.uri = "pages/conversation/conversation";
|
||||
case 'conversation':
|
||||
result.uri = 'pages/conversation/conversation';
|
||||
if (contactParams) {
|
||||
result.params = contactParams;
|
||||
this.jumpIsNewPage(result, contactParams);
|
||||
|
@ -1,18 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import DeviceUtil from "../utils/DeviceUtil";
|
||||
import DeviceUtil from '../utils/DeviceUtil';
|
||||
|
||||
/**
|
||||
* Type of the dialog box: No title, 1 message, and 2 buttons
|
||||
@ -46,26 +46,26 @@ export struct DeleteDialog {
|
||||
build() {
|
||||
Column() {
|
||||
Text(this.msg)
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.margin({ bottom: 8 })
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.lineHeight(22)
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
if (this.hasLockMsg) {
|
||||
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||
Toggle({ type: ToggleType.Checkbox, isOn: this.isSelectLockMsg })
|
||||
.width("20vp")
|
||||
.height("20vp")
|
||||
.width('20vp')
|
||||
.height('20vp')
|
||||
.onChange((isOn: boolean) => {
|
||||
this.setSelectLockChange(isOn)
|
||||
})
|
||||
Text($r("app.string.msg_delete_dialog_cb_tip")).height("100%")
|
||||
Text($r('app.string.msg_delete_dialog_cb_tip')).height('100%')
|
||||
}
|
||||
.width("100%")
|
||||
.height("32vp")
|
||||
.width('100%')
|
||||
.height('32vp')
|
||||
.onClick((event?: ClickEvent) => {
|
||||
this.setSelectLock();
|
||||
})
|
||||
@ -76,15 +76,15 @@ export struct DeleteDialog {
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Button() {
|
||||
Text($r("app.string.cancel"))
|
||||
Text($r('app.string.cancel'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_floating_button_bg_normal"))
|
||||
.fontColor($r('sys.color.ohos_id_color_floating_button_bg_normal'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
@ -93,29 +93,29 @@ export struct DeleteDialog {
|
||||
|
||||
Divider()
|
||||
.vertical(true)
|
||||
.strokeWidth("1px")
|
||||
.height("20vp")
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.strokeWidth('1px')
|
||||
.height('20vp')
|
||||
.color($r('sys.color.ohos_id_color_list_separator'))
|
||||
Button() {
|
||||
Text($r("app.string.delete"))
|
||||
Text($r('app.string.delete'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_warning"))
|
||||
.fontColor($r('sys.color.ohos_id_color_warning'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
this.confirm();
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(40)
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({ left: 24, right: 24, top: 24, bottom: 16 })
|
||||
}
|
||||
}
|
||||
@ -139,29 +139,29 @@ export struct DelConversionDialog {
|
||||
build() {
|
||||
Column() {
|
||||
Text(this.msg)
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.margin({ bottom: 8 })
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.lineHeight(22)
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
Flex({
|
||||
direction: FlexDirection.Row,
|
||||
justifyContent: FlexAlign.SpaceEvenly,
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Button() {
|
||||
Text($r("app.string.cancel"))
|
||||
Text($r('app.string.cancel'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_floating_button_bg_normal"))
|
||||
.fontColor($r('sys.color.ohos_id_color_floating_button_bg_normal'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
@ -170,29 +170,29 @@ export struct DelConversionDialog {
|
||||
|
||||
Divider()
|
||||
.vertical(true)
|
||||
.strokeWidth("1px")
|
||||
.height("20vp")
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.strokeWidth('1px')
|
||||
.height('20vp')
|
||||
.color($r('sys.color.ohos_id_color_list_separator'))
|
||||
Button() {
|
||||
Text($r("app.string.delete"))
|
||||
Text($r('app.string.delete'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_warning"))
|
||||
.fontColor($r('sys.color.ohos_id_color_warning'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
this.confirm();
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(40)
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({ left: 24, right: 24, top: 24, bottom: 16 })
|
||||
}
|
||||
}
|
||||
@ -202,6 +202,7 @@ export class MmsSimpleDialog {
|
||||
private dialogGridCount: number = 4;
|
||||
private dialogAlignment: DialogAlignment = DeviceUtil.isTablet() ? DialogAlignment.Center : DialogAlignment.Bottom;
|
||||
private dialogOffset: Offset = DeviceUtil.isTablet() ? { dx: 0, dy: 0 } : { dx: 0, dy: -12 };
|
||||
|
||||
constructor(value: AlertDialogParamWithMms) {
|
||||
this.value = value;
|
||||
}
|
||||
@ -217,12 +218,12 @@ export class MmsSimpleDialog {
|
||||
primaryButton: {
|
||||
value: this.value.primaryButton.value,
|
||||
action: this.value.primaryButton.action,
|
||||
fontColor: $r("sys.color.ohos_id_color_activated")
|
||||
fontColor: $r('sys.color.ohos_id_color_activated')
|
||||
},
|
||||
secondaryButton: {
|
||||
value: this.value.secondaryButton.value,
|
||||
action: this.value.secondaryButton.action,
|
||||
fontColor: $r("sys.color.ohos_id_color_warning")
|
||||
fontColor: $r('sys.color.ohos_id_color_warning')
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -235,7 +236,6 @@ export struct SysSimpleExample {
|
||||
controller: CustomDialogController
|
||||
cancel: () => void
|
||||
confirm: () => void
|
||||
|
||||
value: AlertDialogParamWithMms;
|
||||
private dialogAlignment: DialogAlignment = DeviceUtil.isTablet() ? DialogAlignment.Center : DialogAlignment.Bottom;
|
||||
private dialogOffset: Offset = DeviceUtil.isTablet() ? { dx: 0, dy: 0 } : { dx: 0, dy: -12 };
|
||||
@ -246,27 +246,27 @@ export struct SysSimpleExample {
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({ top: 24, bottom: 8 })
|
||||
Flex({ justifyContent: FlexAlign.SpaceAround ,alignItems: ItemAlign.Center}) {
|
||||
Button($r("app.string.cancel"))
|
||||
Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) {
|
||||
Button($r('app.string.cancel'))
|
||||
.onClick(() => {
|
||||
this.controller.close()
|
||||
this.cancel()
|
||||
})
|
||||
.backgroundColor(0xffffff)
|
||||
.fontColor($r("sys.color.ohos_id_color_activated"))
|
||||
.fontColor($r('sys.color.ohos_id_color_activated'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.layoutWeight(1)
|
||||
Text("|").fontSize(16).fontColor(Color.Gray)
|
||||
Button($r("app.string.restore"))
|
||||
Text('|').fontSize(16).fontColor(Color.Gray)
|
||||
Button($r('app.string.restore'))
|
||||
.onClick(() => {
|
||||
this.controller.close()
|
||||
this.confirm()
|
||||
})
|
||||
.backgroundColor(0xffffff)
|
||||
.fontColor($r("sys.color.ohos_id_color_warning"))
|
||||
.fontColor($r('sys.color.ohos_id_color_warning'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.layoutWeight(1)
|
||||
}.margin({ bottom: 12 ,top:12})
|
||||
}.margin({ bottom: 12, top: 12 })
|
||||
}.borderRadius(24)
|
||||
}
|
||||
}
|
||||
@ -307,7 +307,6 @@ export struct CheckBoxDialog {
|
||||
* Title
|
||||
*/
|
||||
title: string | Resource;
|
||||
|
||||
/**
|
||||
* Option Collection
|
||||
*/
|
||||
@ -317,13 +316,13 @@ export struct CheckBoxDialog {
|
||||
Column() {
|
||||
// dialog title
|
||||
Text(this.title)
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.margin({ bottom: 8 })
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.lineHeight(22)
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
// item Checklist
|
||||
ForEach(this.itemList, (item, index) => {
|
||||
Flex({
|
||||
@ -333,12 +332,12 @@ export struct CheckBoxDialog {
|
||||
}) {
|
||||
Text(item.title)
|
||||
Toggle({ type: ToggleType.Checkbox, isOn: item.isOn })
|
||||
.width("20vp")
|
||||
.height("20vp")
|
||||
.width('20vp')
|
||||
.height('20vp')
|
||||
.enabled(false)
|
||||
}
|
||||
.width("100%")
|
||||
.height("32vp")
|
||||
.width('100%')
|
||||
.height('32vp')
|
||||
.onClick(item.onClick)
|
||||
}, (item, index) => index.toString())
|
||||
// OK and Cancel Buttons
|
||||
@ -348,42 +347,42 @@ export struct CheckBoxDialog {
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Button() {
|
||||
Text($r("app.string.cancel"))
|
||||
Text($r('app.string.cancel'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_floating_button_bg_normal"))
|
||||
.fontColor($r('sys.color.ohos_id_color_floating_button_bg_normal'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
this.cancel();
|
||||
})
|
||||
}.backgroundColor($r("sys.color.ohos_id_color_background_transparent")).layoutWeight(1)
|
||||
}.backgroundColor($r('sys.color.ohos_id_color_background_transparent')).layoutWeight(1)
|
||||
|
||||
Divider()
|
||||
.vertical(true)
|
||||
.strokeWidth("1px")
|
||||
.height("20vp")
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.strokeWidth('1px')
|
||||
.height('20vp')
|
||||
.color($r('sys.color.ohos_id_color_list_separator'))
|
||||
Button() {
|
||||
Text($r("app.string.ok"))
|
||||
Text($r('app.string.ok'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_floating_button_bg_normal"))
|
||||
.fontColor($r('sys.color.ohos_id_color_floating_button_bg_normal'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
this.confirm();
|
||||
})
|
||||
}.backgroundColor($r("sys.color.ohos_id_color_background_transparent")).layoutWeight(1)
|
||||
}.backgroundColor($r('sys.color.ohos_id_color_background_transparent')).layoutWeight(1)
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(40)
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({ left: 24, right: 24, top: 24, bottom: 16 })
|
||||
}
|
||||
}
|
||||
@ -404,106 +403,108 @@ export struct TransmitMsgDialog {
|
||||
* Message content
|
||||
*/
|
||||
msg: object | Resource | any;
|
||||
|
||||
isChecked: boolean = true;
|
||||
|
||||
changeValue?: () => void;
|
||||
|
||||
clickChecked?: () => void;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }){
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
alignItems: ItemAlign.Start,
|
||||
justifyContent: FlexAlign.Start
|
||||
}) {
|
||||
// Title
|
||||
Column() {
|
||||
if(this.msg.contactsParam.contactsNum > 1) {
|
||||
if (this.msg.contactsParam.contactsNum > 1) {
|
||||
Text() {
|
||||
Span($r("app.string.contentSentTo"))
|
||||
Span($r('app.string.contentSentTo'))
|
||||
.fontSize(20)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
Span(this.msg.contactsParam.contactName == "" ?
|
||||
Span(this.msg.contactsParam.contactName == '' ?
|
||||
this.msg.contactsParam.telephoneFormatSplit :
|
||||
this.msg.contactsParam.contactNameSplit)
|
||||
.fontSize(20)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
Span($r('app.string.including'))
|
||||
.fontSize(20)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
Span(this.msg.contactsParam.contactsNum)
|
||||
.fontSize(20)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
Span($r('app.string.people'))
|
||||
.fontSize(20)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
} else {
|
||||
Text() {
|
||||
Span($r("app.string.contentSentTo"))
|
||||
Span($r('app.string.contentSentTo'))
|
||||
.fontSize(20)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
Span(this.msg.contactsParam.contactName == '' ?
|
||||
this.msg.contactsParam.telephoneFormat :
|
||||
this.msg.contactsParam.contactName)
|
||||
.fontSize(20)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
}
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
|
||||
// Forwarded content
|
||||
Column(){
|
||||
Column() {
|
||||
List() {
|
||||
ForEach(this.msg.transmitContentList, item => {
|
||||
ListItem() {
|
||||
if( item.msgShowType == 0 || item.msgShowType == 4){
|
||||
if (item.msgShowType == 0 || item.msgShowType == 4) {
|
||||
Flex() {
|
||||
if( item.msgUriPath != '' && (item.msgType==1 || item.msgType == 2)) {
|
||||
if (item.msgUriPath != '' && (item.msgType == 1 || item.msgType == 2)) {
|
||||
Image($rawfile(item.msgUriPath))
|
||||
.width('100%')
|
||||
.height(150)
|
||||
} else if( item.msgUriPath != '' && item.msgType == 5) {
|
||||
Image($rawfile("icon/msg_contacts.svg"))
|
||||
} else if (item.msgUriPath != '' && item.msgType == 5) {
|
||||
Image($rawfile('icon/msg_contacts.svg'))
|
||||
.height(48)
|
||||
.width(48)
|
||||
.margin({left: 10, right: 10})
|
||||
.margin({ left: 10, right: 10 })
|
||||
Flex() {
|
||||
Text(item.msgUriPath)
|
||||
.align(Alignment.Center)
|
||||
if(item.audioTime != '') {
|
||||
if (item.audioTime != '') {
|
||||
Text(item.audioTime)
|
||||
.align(Alignment.Center)
|
||||
}
|
||||
}
|
||||
.padding(5)
|
||||
.margin({right: 40})
|
||||
} else if(item.content != '') {
|
||||
if(this.isChecked || (!this.isChecked && item.isMsm)) {
|
||||
.margin({ right: 40 })
|
||||
} else if (item.content != '') {
|
||||
if (this.isChecked || (!this.isChecked && item.isMsm)) {
|
||||
Column() {
|
||||
Column() {
|
||||
Text(this.msg.transmitContent)
|
||||
Text(item.contentInfo)
|
||||
}
|
||||
|
||||
Column() {
|
||||
Text(item.content)
|
||||
.fontSize(16)
|
||||
.margin({ top: 5})
|
||||
.margin({ top: 5 })
|
||||
}
|
||||
}
|
||||
.padding({ top: 20 })
|
||||
.width('100%')
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
|
||||
} else if(!this.isChecked && !item.isMsm) {
|
||||
} else if (!this.isChecked && !item.isMsm) {
|
||||
TextArea({
|
||||
text: item.content
|
||||
})
|
||||
@ -513,12 +514,12 @@ export struct TransmitMsgDialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(item.msgShowType == 1 || item.msgShowType == 2) {
|
||||
} else if (item.msgShowType == 1 || item.msgShowType == 2) {
|
||||
Flex() {
|
||||
Image($rawfile("icon/ppt.svg"))
|
||||
Image($rawfile('icon/ppt.svg'))
|
||||
.width('100%')
|
||||
.height(150)
|
||||
if(item.content != '') {
|
||||
if (item.content != '') {
|
||||
Text(item.content)
|
||||
}
|
||||
}
|
||||
@ -527,9 +528,9 @@ export struct TransmitMsgDialog {
|
||||
.borderRadius(15)
|
||||
} else {
|
||||
Flex() {
|
||||
if(item.content != '') {
|
||||
if (item.content != '') {
|
||||
Text(item.content)
|
||||
.margin({ top: 10, left: 30, bottom: 10})
|
||||
.margin({ top: 10, left: 30, bottom: 10 })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -539,38 +540,42 @@ export struct TransmitMsgDialog {
|
||||
}
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
}
|
||||
}
|
||||
|
||||
Flex({ justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button() {
|
||||
Text($r("app.string.cancel"))
|
||||
Text($r('app.string.cancel'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_floating_button_bg_normal"))
|
||||
.fontColor($r('sys.color.ohos_id_color_floating_button_bg_normal'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
this.cancel();
|
||||
})
|
||||
|
||||
Divider().vertical(true).strokeWidth("1px").height("20vp").color($r("sys.color.ohos_id_color_list_separator"))
|
||||
Divider()
|
||||
.vertical(true)
|
||||
.strokeWidth('1px')
|
||||
.height('20vp')
|
||||
.color($r('sys.color.ohos_id_color_list_separator'))
|
||||
Button() {
|
||||
Text($r("app.string.msg_transmit"))
|
||||
Text($r('app.string.msg_transmit'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_warning"))
|
||||
.fontColor($r('sys.color.ohos_id_color_warning'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.layoutWeight(1)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
@ -578,8 +583,8 @@ export struct TransmitMsgDialog {
|
||||
})
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(200)
|
||||
.padding({ left: 24, right: 24, top: 24, bottom:40 })
|
||||
.padding({ left: 24, right: 24, top: 24, bottom: 40 })
|
||||
}
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import LooseObject from "../data/LooseObject";
|
||||
import LooseObject from '../data/LooseObject';
|
||||
|
||||
@Component
|
||||
export struct MmsListItem {
|
||||
@ -41,51 +41,51 @@ export struct MmsListItem {
|
||||
//SMS message type. 0: common; 1: notification
|
||||
if (this.item.conversation.smsType === 0) {
|
||||
if (this.item.conversation.photoFirstName === '') {
|
||||
Image($rawfile("icon/ic_user_portrait.svg"))
|
||||
Image($rawfile('icon/ic_user_portrait.svg'))
|
||||
.objectFit(ImageFit.Fill)
|
||||
.width("40vp")
|
||||
.height("40vp")
|
||||
.clip(new Circle({ width: "40vp", height: "40vp" }))
|
||||
.width('40vp')
|
||||
.height('40vp')
|
||||
.clip(new Circle({ width: '40vp', height: '40vp' }))
|
||||
.backgroundColor(this.item.conversation.portraitColor)
|
||||
} else {
|
||||
Text(this.item.conversation.photoFirstName)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_headline8"))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_headline8'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor(Color.White)
|
||||
.height("40vp")
|
||||
.width("40vp")
|
||||
.height('40vp')
|
||||
.width('40vp')
|
||||
.textAlign(TextAlign.Center)
|
||||
.clip(new Circle({ width: "40vp", height: "40vp" }))
|
||||
.clip(new Circle({ width: '40vp', height: '40vp' }))
|
||||
.backgroundColor(this.item.conversation.portraitColor)
|
||||
}
|
||||
} else {
|
||||
Image($rawfile(this.item.conversation.icon))
|
||||
.objectFit(ImageFit.Fill)
|
||||
.width("40vp")
|
||||
.height("40vp")
|
||||
.width('40vp')
|
||||
.height('40vp')
|
||||
}
|
||||
if (this.item.conversation.countOfUnread > 0) {
|
||||
Text(this.item.conversation.countOfUnread < 100 ?
|
||||
this.item.conversation.countOfUnread.toString() : "99+")
|
||||
this.item.conversation.countOfUnread.toString() : '99+')
|
||||
.fontSize(10)
|
||||
.align(Alignment.Center)
|
||||
.padding({ left: 5, right: 5 })
|
||||
.height(20)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_badge_red"))
|
||||
.fontColor($r("sys.color.ohos_id_color_background"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_badge_red'))
|
||||
.fontColor($r('sys.color.ohos_id_color_background'))
|
||||
.zIndex(2)
|
||||
.position({ x: "60%", y: "-10%" })
|
||||
.position({ x: '60%', y: '-10%' })
|
||||
.border({
|
||||
width: 2,
|
||||
color: $r("sys.color.ohos_id_color_background"),
|
||||
color: $r('sys.color.ohos_id_color_background'),
|
||||
radius: 50
|
||||
})
|
||||
}
|
||||
}
|
||||
.width("40vp")
|
||||
.height("40vp")
|
||||
.width('40vp')
|
||||
.height('40vp')
|
||||
.onClick(this.onClickHead)
|
||||
}.height("100%").justifyContent(FlexAlign.Center)
|
||||
}.height('100%').justifyContent(FlexAlign.Center)
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,47 +97,47 @@ export struct MmsListItem {
|
||||
//Phone number or first name
|
||||
Text(this.item.conversation.name != '' ? this.item.conversation.name :
|
||||
this.item.conversation.telephoneFormat)
|
||||
.fontSize($r("sys.float.ohos_id_text_size_body1"))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.maxLines(1)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Text().width(16)
|
||||
//Date Time
|
||||
Text(this.item.conversation.time)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_tertiary"))
|
||||
.fontSize("12fp")
|
||||
.fontColor($r('sys.color.ohos_id_color_text_tertiary'))
|
||||
.fontSize('12fp')
|
||||
.maxLines(1)
|
||||
.flexShrink(0)
|
||||
}.width("100%").height(22)
|
||||
}.width('100%').height(22)
|
||||
|
||||
//Content Abbreviations for Latest News
|
||||
Row() {
|
||||
//Whether the latest message has not been sent successfully. If yes,
|
||||
if (this.item.conversation.sendingFailed && !(this.item.conversation.isDraft)) {
|
||||
Text($r("app.string.messageSendFailed"))
|
||||
.fontSize("12fp")
|
||||
.fontColor($r("sys.color.ohos_id_color_warning"))
|
||||
Text($r('app.string.messageSendFailed'))
|
||||
.fontSize('12fp')
|
||||
.fontColor($r('sys.color.ohos_id_color_warning'))
|
||||
} else {
|
||||
//If it's not
|
||||
Row() {
|
||||
Text() {
|
||||
if (this.item.conversation.isDraft) {
|
||||
Span($r("app.string.draft"))
|
||||
.fontSize("14fp")
|
||||
Span($r('app.string.draft'))
|
||||
.fontSize('14fp')
|
||||
.fontColor(Color.Red)
|
||||
}
|
||||
//If no, and the number of unread messages is greater than 1.
|
||||
if (!this.item.conversation.isDraft &&
|
||||
this.item.conversation.countOfUnread > 1) {
|
||||
Span($r("app.string.multiUnread", this.item.conversation.countOfUnread))
|
||||
.fontSize("14fp")
|
||||
.fontColor($r("sys.color.ohos_id_color_help_tip_bg"))
|
||||
Span($r('app.string.multiUnread', this.item.conversation.countOfUnread))
|
||||
.fontSize('14fp')
|
||||
.fontColor($r('sys.color.ohos_id_color_help_tip_bg'))
|
||||
}
|
||||
//Content Abbreviations for Latest News
|
||||
Span(this.item.conversation.content.replace(/[\r\n]/g, " "))
|
||||
.fontSize("14fp")
|
||||
.fontColor($r("sys.color.ohos_id_color_text_tertiary"))
|
||||
Span(this.item.conversation.content.replace(/[\r\n]/g, ' '))
|
||||
.fontSize('14fp')
|
||||
.fontColor($r('sys.color.ohos_id_color_text_tertiary'))
|
||||
}
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
@ -146,28 +146,28 @@ export struct MmsListItem {
|
||||
}
|
||||
.alignSelf(ItemAlign.Start)
|
||||
.alignItems(VerticalAlign.Top)
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(19)
|
||||
.margin({ top: "2vp" })
|
||||
}.width("100%")
|
||||
.height("100%")
|
||||
.margin({ top: '2vp' })
|
||||
}.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.height("100%")
|
||||
.padding({ left: "12vp" })
|
||||
.height('100%')
|
||||
.padding({ left: '12vp' })
|
||||
|
||||
//CheckBox
|
||||
if (this.isMultipleSelectState) {
|
||||
Toggle({ type: ToggleType.Checkbox, isOn: this.item.conversation.isCbChecked })
|
||||
.width("20vp")
|
||||
.height("20vp")
|
||||
.selectedColor($r("sys.color.ohos_id_color_activated"))
|
||||
.width('20vp')
|
||||
.height('20vp')
|
||||
.selectedColor($r('sys.color.ohos_id_color_activated'))
|
||||
.hitTestBehavior(HitTestMode.None)
|
||||
}
|
||||
}
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.offset({
|
||||
x: this.item.conversation.itemLeft
|
||||
})
|
||||
@ -179,27 +179,27 @@ export struct MmsListItem {
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
if (this.item.conversation.countOfUnread > 0) {
|
||||
Image($rawfile("icon/msg_done.svg"))
|
||||
Image($rawfile('icon/msg_done.svg'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
.onClick(this.onClickFirstSlipBtn)
|
||||
}
|
||||
Image($rawfile("icon/msg_delete.svg"))
|
||||
Image($rawfile('icon/msg_delete.svg'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
.onClick(this.onClickSecondSlipBtn)
|
||||
}
|
||||
.width(this.item.conversation.countOfUnread > 0 ? 128 : 80)
|
||||
.height("100%")
|
||||
.height('100%')
|
||||
.flexShrink(0)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background'))
|
||||
.offset({
|
||||
x: this.item.conversation.itemLeft
|
||||
})
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.gesture(PanGesture({
|
||||
direction: this.item.conversation.isDelShow ? PanDirection.Right : PanDirection.Left
|
||||
})
|
||||
|
@ -1,18 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import DeviceUtil from "../utils/DeviceUtil";
|
||||
import DeviceUtil from '../utils/DeviceUtil';
|
||||
|
||||
/**
|
||||
* Custom pop-up menu buttons
|
||||
@ -20,14 +20,15 @@ import DeviceUtil from "../utils/DeviceUtil";
|
||||
@Component
|
||||
export struct MoreMenu {
|
||||
@StorageLink('curBp') curBp: string = 'sm'
|
||||
@Consume menuItems:Array<any>;
|
||||
private menuImage: Resource = $rawfile("icon/ic_public_more.svg");
|
||||
@Consume menuItems: Array<any>;
|
||||
private menuImage: Resource = $rawfile('icon/ic_public_more.svg');
|
||||
private placement: Placement = Placement.Bottom;
|
||||
private defaultColor: Resource = $r("sys.color.ohos_id_color_dialog_bg");
|
||||
private defaultColor: Resource = $r('sys.color.ohos_id_color_dialog_bg');
|
||||
private menuText: Resource = null;
|
||||
private menuTextColor: Resource = $r("sys.color.ohos_id_color_text_primary");
|
||||
private menuTextColor: Resource = $r('sys.color.ohos_id_color_text_primary');
|
||||
|
||||
@Builder PopupBuilder() {
|
||||
@Builder
|
||||
PopupBuilder() {
|
||||
Column() {
|
||||
List() {
|
||||
ForEach(this.menuItems, (item, index) => {
|
||||
@ -36,17 +37,17 @@ export struct MoreMenu {
|
||||
Text(item.value)
|
||||
.fontSize(16)
|
||||
.lineHeight(21)
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(48)
|
||||
.padding({ left: 12, right: 12 })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor(item.enabled ? $r("sys.color.ohos_id_color_text_primary") :
|
||||
$r("sys.color.ohos_id_color_text_tertiary"))
|
||||
.fontColor(item.enabled ? $r('sys.color.ohos_id_color_text_primary') :
|
||||
$r('sys.color.ohos_id_color_text_tertiary'))
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.height(48)
|
||||
.borderRadius(16)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_foreground_contrary'))
|
||||
.onClick(() => {
|
||||
if (item.enabled) {
|
||||
item.action();
|
||||
@ -58,7 +59,7 @@ export struct MoreMenu {
|
||||
.listDirection(Axis.Vertical) // Arrange Direction
|
||||
.divider({
|
||||
strokeWidth: 0.5,
|
||||
color: $r("sys.color.ohos_id_color_list_separator"),
|
||||
color: $r('sys.color.ohos_id_color_list_separator'),
|
||||
startMargin: 12,
|
||||
endMargin: 12
|
||||
}) // Demarcation line between each row
|
||||
@ -82,9 +83,9 @@ export struct MoreMenu {
|
||||
.lineHeight(14)
|
||||
.fontColor(this.menuTextColor)
|
||||
.margin({ top: 3 })
|
||||
.fontSize($r("sys.float.ohos_id_text_size_caption"))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_caption'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r("sys.color.ohos_id_color_toolbar_text"))
|
||||
.fontColor($r('sys.color.ohos_id_color_toolbar_text'))
|
||||
}
|
||||
}
|
||||
.bindMenu(this.PopupBuilder)
|
||||
|
@ -1,19 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import MmsPreferences from "../utils/MmsPreferences";
|
||||
import common from "../data/commonData";
|
||||
import MmsPreferences from '../utils/MmsPreferences';
|
||||
import common from '../data/commonData';
|
||||
|
||||
/**
|
||||
* Custom multi-SimCard pop-up menu
|
||||
@ -26,7 +26,8 @@ export struct MultiSimCardMenu {
|
||||
private telephoneNumberOfSim1: string = MmsPreferences.getInstance().getTelephoneNumberOfSim1();
|
||||
private telephoneNumberOfSim2: string = MmsPreferences.getInstance().getTelephoneNumberOfSim2();
|
||||
|
||||
@Builder PopupBuilder() {
|
||||
@Builder
|
||||
PopupBuilder() {
|
||||
Column() {
|
||||
List() {
|
||||
ListItem() {
|
||||
@ -39,21 +40,22 @@ export struct MultiSimCardMenu {
|
||||
Text(this.spnOfSim1)
|
||||
.fontSize('16vp')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.padding({ left: 2 })
|
||||
}
|
||||
|
||||
Text(this.telephoneNumberOfSim1)
|
||||
.padding({ left: 19, top: 2 })
|
||||
.fontSize('14vp')
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.padding({ left: 16 })
|
||||
.width('100%')
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.width('100%')
|
||||
.height('64vp')
|
||||
.onClick(() => {
|
||||
@ -61,6 +63,7 @@ export struct MultiSimCardMenu {
|
||||
MmsPreferences.getInstance().setValueToMap(common.string.KEY_OF_SELECTED_SLOTID, this.slotId);
|
||||
})
|
||||
}
|
||||
|
||||
ListItem() {
|
||||
Button({ type: ButtonType.Normal }) {
|
||||
Column() {
|
||||
@ -71,21 +74,22 @@ export struct MultiSimCardMenu {
|
||||
Text(this.spnOfSim2)
|
||||
.fontSize('16vp')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.padding({ left: 2 })
|
||||
}
|
||||
|
||||
Text(this.telephoneNumberOfSim2)
|
||||
.padding({ left: 19, top: 2 })
|
||||
.fontSize('14vp')
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.padding({ left: 16 })
|
||||
.width('100%')
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.width('100%')
|
||||
.height('64vp')
|
||||
.onClick(() => {
|
||||
@ -97,7 +101,7 @@ export struct MultiSimCardMenu {
|
||||
.listDirection(Axis.Vertical)
|
||||
.divider({
|
||||
strokeWidth: 0.5,
|
||||
color: $r("sys.color.ohos_id_color_list_separator"),
|
||||
color: $r('sys.color.ohos_id_color_list_separator'),
|
||||
startMargin: 17,
|
||||
endMargin: 17
|
||||
})
|
||||
@ -111,10 +115,10 @@ export struct MultiSimCardMenu {
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Image(this.slotId == 0 ? $rawfile("icon/ic_message_card1.svg") : $rawfile("icon/ic_message_card2.svg"))
|
||||
Image(this.slotId == 0 ? $rawfile('icon/ic_message_card1.svg') : $rawfile('icon/ic_message_card2.svg'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Image($rawfile("icon/ic_public_spinner.svg"))
|
||||
Image($rawfile('icon/ic_public_spinner.svg'))
|
||||
.width(12)
|
||||
.height(24)
|
||||
}
|
||||
|
@ -1,95 +1,96 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import MmsBoolean from "../data/MmsBoolean"
|
||||
import MmsBoolean from '../data/MmsBoolean'
|
||||
|
||||
/**
|
||||
* Options: dual title, 1 switch
|
||||
*/
|
||||
@Component
|
||||
export struct SettingItemSwitch {
|
||||
primaryTitle: string | Resource;
|
||||
secondaryTitle?: string | Resource;
|
||||
@ObjectLink isEnable: MmsBoolean;
|
||||
showBottomDivider ?: boolean = false;
|
||||
visibilityShow ?: Visibility = Visibility.Visible;
|
||||
onChange: (isOn: boolean) => void;
|
||||
primaryTitle: string | Resource;
|
||||
secondaryTitle?: string | Resource;
|
||||
@ObjectLink isEnable: MmsBoolean;
|
||||
showBottomDivider ?: boolean = false;
|
||||
visibilityShow ?: Visibility = Visibility.Visible;
|
||||
onChange: (isOn: boolean) => void;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({
|
||||
direction: FlexDirection.Row,
|
||||
justifyContent: FlexAlign.SpaceBetween,
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
justifyContent: FlexAlign.Center,
|
||||
alignItems: ItemAlign.Start
|
||||
}) {
|
||||
Text(this.primaryTitle)
|
||||
.height($r("app.float.settings_item_primary_title_height"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontSize($r("app.float.settings_item_primary_title_font_size"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
build() {
|
||||
Column() {
|
||||
Flex({
|
||||
direction: FlexDirection.Row,
|
||||
justifyContent: FlexAlign.SpaceBetween,
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
justifyContent: FlexAlign.Center,
|
||||
alignItems: ItemAlign.Start
|
||||
}) {
|
||||
Text(this.primaryTitle)
|
||||
.height($r('app.float.settings_item_primary_title_height'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontSize($r('app.float.settings_item_primary_title_font_size'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
|
||||
if (this.secondaryTitle != undefined) {
|
||||
Text(this.secondaryTitle)
|
||||
.height($r("app.float.settings_item_secondary_title_height"))
|
||||
.margin({ top: $r("app.float.settings_item_title_space") })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize($r("app.float.settings_item_secondary_title_font_size"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_tertiary"))
|
||||
}
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
Toggle({ type: ToggleType.Switch, isOn: this.isEnable.value })
|
||||
.width($r("app.float.settings_item_switch_width"))
|
||||
.offset({ x: 4, y: 0 })
|
||||
.selectedColor($r("sys.color.ohos_id_color_activated"))
|
||||
.onChange((isOn: boolean) => {
|
||||
if (typeof isOn === "number") {
|
||||
let newIsOn: number = isOn;
|
||||
switch (newIsOn) {
|
||||
case 1:
|
||||
isOn = true;
|
||||
break;
|
||||
case 0:
|
||||
isOn = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.onChange(isOn);
|
||||
})
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
if (this.showBottomDivider) {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth(1)
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.lineCap(LineCapStyle.Round)
|
||||
}
|
||||
if (this.secondaryTitle != undefined) {
|
||||
Text(this.secondaryTitle)
|
||||
.height($r('app.float.settings_item_secondary_title_height'))
|
||||
.margin({ top: $r('app.float.settings_item_title_space') })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize($r('app.float.settings_item_secondary_title_font_size'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_tertiary'))
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.height(this.secondaryTitle != undefined ? $r("app.float.settings_item_height_2") :
|
||||
$r("app.float.settings_item_height_1"))
|
||||
.visibility(this.visibilityShow)
|
||||
.layoutWeight(1)
|
||||
|
||||
Toggle({ type: ToggleType.Switch, isOn: this.isEnable.value })
|
||||
.width($r('app.float.settings_item_switch_width'))
|
||||
.offset({ x: 4, y: 0 })
|
||||
.selectedColor($r('sys.color.ohos_id_color_activated'))
|
||||
.onChange((isOn: boolean) => {
|
||||
if (typeof isOn === 'number') {
|
||||
let newIsOn: number = isOn;
|
||||
switch (newIsOn) {
|
||||
case 1:
|
||||
isOn = true;
|
||||
break;
|
||||
case 0:
|
||||
isOn = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.onChange(isOn);
|
||||
})
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
if (this.showBottomDivider) {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth(1)
|
||||
.color($r('sys.color.ohos_id_color_list_separator'))
|
||||
.lineCap(LineCapStyle.Round)
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height(this.secondaryTitle != undefined ? $r('app.float.settings_item_height_2') :
|
||||
$r('app.float.settings_item_height_1'))
|
||||
.visibility(this.visibilityShow)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,71 +98,71 @@ export struct SettingItemSwitch {
|
||||
*/
|
||||
@Component
|
||||
export struct SettingItemJump {
|
||||
primaryTitle: string | Resource;
|
||||
secondaryTitle ?: string | Resource;
|
||||
@Consume statusTitle : Resource;
|
||||
showBottomDivider ?: boolean = false;
|
||||
visibilityShow ?: Visibility = Visibility.Visible;
|
||||
OnClick: (event?: ClickEvent) => void;
|
||||
primaryTitle: string | Resource;
|
||||
secondaryTitle ?: string | Resource;
|
||||
@Consume statusTitle: Resource;
|
||||
showBottomDivider ?: boolean = false;
|
||||
visibilityShow ?: Visibility = Visibility.Visible;
|
||||
OnClick: (event?: ClickEvent) => void;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({
|
||||
direction: FlexDirection.Row,
|
||||
justifyContent: FlexAlign.SpaceBetween,
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
justifyContent: FlexAlign.Center,
|
||||
alignItems: ItemAlign.Start
|
||||
}) {
|
||||
Text(this.primaryTitle)
|
||||
.height($r("app.float.settings_item_primary_title_height"))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontSize($r("app.float.settings_item_primary_title_font_size"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
build() {
|
||||
Column() {
|
||||
Flex({
|
||||
direction: FlexDirection.Row,
|
||||
justifyContent: FlexAlign.SpaceBetween,
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
justifyContent: FlexAlign.Center,
|
||||
alignItems: ItemAlign.Start
|
||||
}) {
|
||||
Text(this.primaryTitle)
|
||||
.height($r('app.float.settings_item_primary_title_height'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontSize($r('app.float.settings_item_primary_title_font_size'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
|
||||
if (this.secondaryTitle != undefined) {
|
||||
Text(this.secondaryTitle)
|
||||
.height($r("app.float.settings_item_secondary_title_height"))
|
||||
.margin({ top: $r("app.float.settings_item_title_space") })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize($r("app.float.settings_item_secondary_title_font_size"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_tertiary"))
|
||||
}
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
Row() {
|
||||
if (this.statusTitle != undefined) {
|
||||
Text(this.statusTitle)
|
||||
.height($r("app.float.settings_item_secondary_title_height"))
|
||||
.margin({ right: $r("app.float.settings_item_status_title_margin_right") })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize($r("app.float.settings_item_secondary_title_font_size"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
}
|
||||
|
||||
Image($rawfile("icon/ic_next.svg"))
|
||||
.width($r("app.float.settings_item_next_image_width"))
|
||||
.height($r("app.float.settings_item_next_image_height"))
|
||||
}
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.onClick(this.OnClick)
|
||||
|
||||
if (this.showBottomDivider) {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth(1)
|
||||
.color($r("sys.color.ohos_id_color_list_separator"))
|
||||
.lineCap(LineCapStyle.Round)
|
||||
}
|
||||
if (this.secondaryTitle != undefined) {
|
||||
Text(this.secondaryTitle)
|
||||
.height($r('app.float.settings_item_secondary_title_height'))
|
||||
.margin({ top: $r('app.float.settings_item_title_space') })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize($r('app.float.settings_item_secondary_title_font_size'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_tertiary'))
|
||||
}
|
||||
}
|
||||
.width("100%")
|
||||
.height(this.secondaryTitle != undefined ? $r("app.float.settings_item_height_2") :
|
||||
$r("app.float.settings_item_height_1"))
|
||||
.visibility(this.visibilityShow)
|
||||
.layoutWeight(1)
|
||||
|
||||
Row() {
|
||||
if (this.statusTitle != undefined) {
|
||||
Text(this.statusTitle)
|
||||
.height($r('app.float.settings_item_secondary_title_height'))
|
||||
.margin({ right: $r('app.float.settings_item_status_title_margin_right') })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontSize($r('app.float.settings_item_secondary_title_font_size'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
}
|
||||
|
||||
Image($rawfile('icon/ic_next.svg'))
|
||||
.width($r('app.float.settings_item_next_image_width'))
|
||||
.height($r('app.float.settings_item_next_image_height'))
|
||||
}
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.onClick(this.OnClick)
|
||||
|
||||
if (this.showBottomDivider) {
|
||||
Divider()
|
||||
.vertical(false)
|
||||
.strokeWidth(1)
|
||||
.color($r('sys.color.ohos_id_color_list_separator'))
|
||||
.lineCap(LineCapStyle.Round)
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height(this.secondaryTitle != undefined ? $r('app.float.settings_item_height_2') :
|
||||
$r('app.float.settings_item_height_1'))
|
||||
.visibility(this.visibilityShow)
|
||||
}
|
||||
}
|
@ -1,22 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import ReceiveController from "./receiveController"
|
||||
import ConversationController from "../../pages/conversation/conversationController"
|
||||
import HiLog from "../../utils/HiLog";
|
||||
import ReceiveController from './receiveController'
|
||||
import ConversationController from '../../pages/conversation/conversationController'
|
||||
import HiLog from '../../utils/HiLog';
|
||||
|
||||
const TAG = "Receive";
|
||||
const TAG = 'Receive';
|
||||
|
||||
@Component
|
||||
export struct Receive {
|
||||
@ -30,7 +30,7 @@ export struct Receive {
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
HiLog.i(TAG,"aboutToDisappear")
|
||||
HiLog.i(TAG,'aboutToDisappear')
|
||||
this.mReceiveController.onBackPress();
|
||||
}
|
||||
|
||||
@ -38,13 +38,13 @@ export struct Receive {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) {
|
||||
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
|
||||
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
Text($r("app.string.putAddresser"))
|
||||
Text($r('app.string.putAddresser'))
|
||||
.maxLines(1)
|
||||
.lineHeight($r("app.float.addressee_line_height"))
|
||||
.fontSize($r("app.float.addressee_font_size"))
|
||||
.fontColor($r("sys.color.ohos_id_color_text_secondary"))
|
||||
.lineHeight($r('app.float.addressee_line_height'))
|
||||
.fontSize($r('app.float.addressee_font_size'))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.flexShrink(0)
|
||||
Flex({ wrap: FlexWrap.NoWrap, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) {
|
||||
// If a contact is selected
|
||||
@ -52,7 +52,7 @@ export struct Receive {
|
||||
if (this.mReceiveController.selectContacts.length > 0) {
|
||||
ForEach(this.mReceiveController.selectContacts, (item, index) => {
|
||||
Row() {
|
||||
if (item.contactName == "" || item.contactName == null) {
|
||||
if (item.contactName == '' || item.contactName == null) {
|
||||
Text(item.telephoneFormat)
|
||||
.textAlign(TextAlign.Center)
|
||||
.maxLines(1)
|
||||
@ -60,7 +60,7 @@ export struct Receive {
|
||||
.fontSize(12)
|
||||
.flexShrink(1)
|
||||
}
|
||||
if (item.contactName != "" && item.contactName != null) {
|
||||
if (item.contactName != '' && item.contactName != null) {
|
||||
Text(item.contactName)
|
||||
.textAlign(TextAlign.Center)
|
||||
.maxLines(1)
|
||||
@ -69,7 +69,7 @@ export struct Receive {
|
||||
.flexShrink(1)
|
||||
}
|
||||
if (item.select) {
|
||||
Image($rawfile("icon/ic_public_cancel.svg"))
|
||||
Image($rawfile('icon/ic_public_cancel.svg'))
|
||||
.width(16)
|
||||
.height(16)
|
||||
.flexShrink(1)
|
||||
@ -77,7 +77,7 @@ export struct Receive {
|
||||
}
|
||||
.padding({ left: 8, right: 8 })
|
||||
.margin(8)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_component_normal"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_component_normal'))
|
||||
.borderRadius(24)
|
||||
.height(28)
|
||||
.alignItems(VerticalAlign.Center)
|
||||
@ -91,9 +91,9 @@ export struct Receive {
|
||||
}
|
||||
Flex() {
|
||||
TextArea({ text: this.mReceiveController.myText })
|
||||
.caretColor($r("sys.color.ohos_id_color_focused_outline"))
|
||||
.placeholderColor($r("sys.color.ohos_id_color_text_hint"))
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background_transparent"))
|
||||
.caretColor($r('sys.color.ohos_id_color_focused_outline'))
|
||||
.placeholderColor($r('sys.color.ohos_id_color_text_hint'))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background_transparent'))
|
||||
.focusable(true)
|
||||
.flexShrink(1)
|
||||
.onChange((value) => {
|
||||
@ -115,14 +115,14 @@ export struct Receive {
|
||||
}
|
||||
else {
|
||||
Text(this.mReceiveController.strSelectContact)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary_activated"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(16)
|
||||
.lineHeight(22)
|
||||
.maxLines(1)
|
||||
.textAlign(TextAlign.Start)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({ top: 12, bottom: 12 })
|
||||
.onClick(() => {
|
||||
this.mReceiveController.myContactClick();
|
||||
@ -131,11 +131,11 @@ export struct Receive {
|
||||
}
|
||||
.flexShrink(1)
|
||||
}
|
||||
.flexBasis("auto")
|
||||
.flexBasis('auto')
|
||||
.flexShrink(1)
|
||||
|
||||
// Contact icon on the right
|
||||
Image($rawfile("icon/ic_about.svg"))
|
||||
Image($rawfile('icon/ic_about.svg'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.onClick(() => {
|
||||
@ -147,8 +147,8 @@ export struct Receive {
|
||||
|
||||
}
|
||||
.constraintSize({ minHeight: 56, maxHeight:200 })
|
||||
.backgroundColor($r("sys.color.ohos_id_color_background"))
|
||||
.borderRadius($r("app.float.settings_items_radius"))
|
||||
.backgroundColor($r('sys.color.ohos_id_color_background'))
|
||||
.borderRadius($r('app.float.settings_items_radius'))
|
||||
.padding({ left: 12, right: 12 })
|
||||
|
||||
Column() {
|
||||
@ -159,12 +159,12 @@ export struct Receive {
|
||||
ForEach(this.mReceiveController.contacts, (item, index) => {
|
||||
ListItem() {
|
||||
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
|
||||
Image($rawfile("icon/ic_user_portrait.svg"))
|
||||
Image($rawfile('icon/ic_user_portrait.svg'))
|
||||
.objectFit(ImageFit.Fill)
|
||||
.width("40vp")
|
||||
.height("40vp")
|
||||
.clip(new Circle({ width: "40vp", height: "40vp" }))
|
||||
.backgroundColor($r("app.color.ic_user_head_color"))
|
||||
.width('40vp')
|
||||
.height('40vp')
|
||||
.clip(new Circle({ width: '40vp', height: '40vp' }))
|
||||
.backgroundColor($r('app.color.ic_user_head_color'))
|
||||
.onClick(() => {
|
||||
this.mReceiveController.titleBarAvatar(index)
|
||||
})
|
||||
@ -177,13 +177,13 @@ export struct Receive {
|
||||
if (item.contactName != '' || item.contactName != null) {
|
||||
Text(item.contactName)
|
||||
.fontSize(16)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||
.maxLines(1)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
}
|
||||
Text(item.telephoneFormat)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_tertiary"))
|
||||
.fontColor($r('sys.color.ohos_id_color_text_tertiary'))
|
||||
.fontSize(14)
|
||||
.maxLines(1)
|
||||
.margin({ top: 4 })
|
||||
@ -206,14 +206,14 @@ export struct Receive {
|
||||
.edgeEffect(EdgeEffect.Spring) // Sliding to the edge has no effect
|
||||
.divider({
|
||||
strokeWidth: 1,
|
||||
color: $r("sys.color.ohos_id_color_list_separator"),
|
||||
color: $r('sys.color.ohos_id_color_list_separator'),
|
||||
startMargin: 52,
|
||||
endMargin: 0
|
||||
}) // Demarcation line between each row
|
||||
}
|
||||
}.padding({ left: 12, right: 12, bottom: 56 })
|
||||
}
|
||||
.width("100%")
|
||||
.width('100%')
|
||||
.padding({ left: 12, right: 12 })
|
||||
}
|
||||
}
|
@ -1,27 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import prompt from "@system.prompt";
|
||||
import prompt from '@system.prompt';
|
||||
|
||||
import HiLog from "../../utils/HiLog";
|
||||
import common from "../../data/commonData";
|
||||
import ContactsService from "../../service/ContactsService";
|
||||
import commonService from "../../service/CommonService"
|
||||
import commonCtrl from "../../pages/conversation/common"
|
||||
import LooseObject from "../../data/LooseObject"
|
||||
import HiLog from '../../utils/HiLog';
|
||||
import common from '../../data/commonData';
|
||||
import ContactsService from '../../service/ContactsService';
|
||||
import commonService from '../../service/CommonService'
|
||||
import commonCtrl from '../../pages/conversation/common'
|
||||
import LooseObject from '../../data/LooseObject'
|
||||
|
||||
const TAG = "ReceiveController";
|
||||
const TAG = 'ReceiveController';
|
||||
|
||||
export default class ReceiveController {
|
||||
private static sInstance: ReceiveController;
|
||||
@ -39,7 +39,7 @@ export default class ReceiveController {
|
||||
// true Show Search List
|
||||
isShowSearch: boolean = true;
|
||||
strSelectContact: string = '';
|
||||
styleTextarea: string = "select-contact-textarea";
|
||||
styleTextarea: string = 'select-contact-textarea';
|
||||
hasBlur: boolean = false;
|
||||
// List pagination, number of pages
|
||||
page: number = 0;
|
||||
@ -56,7 +56,7 @@ export default class ReceiveController {
|
||||
}
|
||||
|
||||
onInit(call) {
|
||||
HiLog.i(TAG, "onInit()")
|
||||
HiLog.i(TAG, 'onInit()')
|
||||
this.selectContacts = this.commonCtrl.paramContact.transmitContacts;
|
||||
if (this.selectContacts.length > 0) {
|
||||
let that = this;
|
||||
@ -76,10 +76,10 @@ export default class ReceiveController {
|
||||
}
|
||||
|
||||
InputTextClear() {
|
||||
this.myText = "";
|
||||
this.myText = '';
|
||||
this.setInputStatus(true);
|
||||
this.commonCtrl.paramContact.transmitContacts = [];
|
||||
HiLog.i(TAG,"InputTextClear")
|
||||
HiLog.i(TAG,'InputTextClear')
|
||||
}
|
||||
|
||||
requestItem() {
|
||||
@ -107,7 +107,7 @@ export default class ReceiveController {
|
||||
this.contacts = response;
|
||||
this.contactsTemp = this.contacts.slice(0);
|
||||
} else {
|
||||
HiLog.w(TAG, "queryContacts, fail");
|
||||
HiLog.w(TAG, 'queryContacts, fail');
|
||||
}
|
||||
}, null);
|
||||
// Number of statistics
|
||||
@ -119,7 +119,7 @@ export default class ReceiveController {
|
||||
}
|
||||
|
||||
searchContacts(textValue, callback) {
|
||||
HiLog.i(TAG, "searchContacts start");
|
||||
HiLog.i(TAG, 'searchContacts start');
|
||||
let actionData = {
|
||||
telephone: textValue,
|
||||
};
|
||||
@ -127,7 +127,7 @@ export default class ReceiveController {
|
||||
if (res.code == common.int.SUCCESS) {
|
||||
this.contacts = res.abilityResult;
|
||||
} else {
|
||||
HiLog.w(TAG, "searchContacts fail");
|
||||
HiLog.w(TAG, 'searchContacts fail');
|
||||
}
|
||||
callback(res.code);
|
||||
}, null);
|
||||
@ -138,10 +138,10 @@ export default class ReceiveController {
|
||||
try {
|
||||
this.contacts = this.contactsTemp.filter((contact) => {
|
||||
if (contact.contactName && contact.contactName.toLowerCase().search(textValue) != -1) {
|
||||
HiLog.i(TAG, "filterContacts, contactName");
|
||||
HiLog.i(TAG, 'filterContacts, contactName');
|
||||
return true;
|
||||
} else if (contact.telephone && contact.telephone.toLowerCase().search(textValue) != -1) {
|
||||
HiLog.i(TAG, "filterContacts, telephone");
|
||||
HiLog.i(TAG, 'filterContacts, telephone');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -166,7 +166,7 @@ export default class ReceiveController {
|
||||
}
|
||||
|
||||
checkReceive(call) {
|
||||
HiLog.i(TAG, "checkReceive, isInputStatus: " + this.isInputStatus);
|
||||
HiLog.i(TAG, 'checkReceive, isInputStatus: ' + this.isInputStatus);
|
||||
if (this.myText.trim() == common.string.EMPTY_STR) {
|
||||
this.strSelectContact = this.setShowContactName();
|
||||
this.isShowSearch = false;
|
||||
@ -181,7 +181,7 @@ export default class ReceiveController {
|
||||
for (let index in this.contacts) {
|
||||
let contact = this.contacts[index];
|
||||
if (contact.telephone == that.myText) {
|
||||
selectContact.headImage = "icon/user_avatar_full_fill.svg";
|
||||
selectContact.headImage = 'icon/user_avatar_full_fill.svg';
|
||||
selectContact.contactName = contact.contactName;
|
||||
selectContact.telephone = contact.telephone;
|
||||
selectContact.telephoneFormat = contact.telephone;
|
||||
@ -197,28 +197,28 @@ export default class ReceiveController {
|
||||
selectContact.telephoneFormat = that.myText;
|
||||
selectContact.select = false;
|
||||
}
|
||||
HiLog.i(TAG, "checkReceive, isPhoneNumber yes");
|
||||
HiLog.i(TAG, 'checkReceive, isPhoneNumber yes');
|
||||
this.selectContacts.push(selectContact);
|
||||
this.refresh = !this.refresh;
|
||||
this.setInputStatus(false);
|
||||
this.isShowSearch = false;
|
||||
this.setContactValue(call);
|
||||
} else {
|
||||
HiLog.i(TAG, "checkReceive, isPhoneNumber no");
|
||||
HiLog.i(TAG, 'checkReceive, isPhoneNumber no');
|
||||
prompt.showToast({
|
||||
// Invalid Recipient
|
||||
// @ts-ignore
|
||||
message: $r("app.string.invalid_receive", this.myText),
|
||||
message: $r('app.string.invalid_receive', this.myText),
|
||||
duration: 1000,
|
||||
});
|
||||
this.myText = "";
|
||||
this.myText = '';
|
||||
this.isShowSearch = true;
|
||||
this.setContactValue(call);
|
||||
}
|
||||
}
|
||||
|
||||
searchChange(text, call) {
|
||||
HiLog.d(TAG, "searchChange, start");
|
||||
HiLog.d(TAG, 'searchChange, start');
|
||||
if (this.checkSingle()) {
|
||||
this.setInputStatus(false);
|
||||
this.isShowSearch = false;
|
||||
@ -226,11 +226,11 @@ export default class ReceiveController {
|
||||
}
|
||||
this.myText = text;
|
||||
if (!this.isInputStatus) {
|
||||
HiLog.w(TAG, "searchChange, isInputStatus false");
|
||||
HiLog.w(TAG, 'searchChange, isInputStatus false');
|
||||
return;
|
||||
}
|
||||
this.searchContacts(this.myText, code => {
|
||||
if (code == common.int.SUCCESS && this.myText.trim() != "") {
|
||||
if (code == common.int.SUCCESS && this.myText.trim() != '') {
|
||||
this.setContactValue(call);
|
||||
this.dealSearchData();
|
||||
this.setContactValue(call);
|
||||
@ -241,7 +241,7 @@ export default class ReceiveController {
|
||||
}
|
||||
|
||||
dealSearchData() {
|
||||
if (this.myText.trim() == "") {
|
||||
if (this.myText.trim() == '') {
|
||||
this.contacts = this.contactsTemp.slice(0);
|
||||
} else {
|
||||
let textValue = this.myText.trim().toLowerCase();
|
||||
@ -267,11 +267,11 @@ export default class ReceiveController {
|
||||
if (this.checkSingle()) {
|
||||
return;
|
||||
}
|
||||
if (curItem != undefined && curItem.telephone != undefined && curItem.telephone.toString().trim() == "") {
|
||||
if (curItem != undefined && curItem.telephone != undefined && curItem.telephone.toString().trim() == '') {
|
||||
prompt.showToast({
|
||||
// Invalid Recipient
|
||||
// @ts-ignore
|
||||
message: $r("app.string.invalid_receive", this.myText),
|
||||
message: $r('app.string.invalid_receive', this.myText),
|
||||
duration: 1000,
|
||||
});
|
||||
return;
|
||||
@ -281,11 +281,11 @@ export default class ReceiveController {
|
||||
if (item.telephone == undefined || curItem.telephone == undefined) {
|
||||
return;
|
||||
}
|
||||
HiLog.w(TAG, "addContact");
|
||||
HiLog.w(TAG, 'addContact');
|
||||
return item.telephone != curItem.telephone
|
||||
});
|
||||
this.contacts.splice(index, 1);
|
||||
HiLog.i(TAG, "addContact, length: " + this.selectContacts.length);
|
||||
HiLog.i(TAG, 'addContact, length: ' + this.selectContacts.length);
|
||||
this.myText = '';
|
||||
if (this.selectContacts.length == 1) {
|
||||
this.setInputStatus(false);
|
||||
@ -296,7 +296,7 @@ export default class ReceiveController {
|
||||
this.isShowSearch = true;
|
||||
this.setContactValue(call);
|
||||
}
|
||||
HiLog.i(TAG, "addContact, isInputStatus: " + this.isInputStatus);
|
||||
HiLog.i(TAG, 'addContact, isInputStatus: ' + this.isInputStatus);
|
||||
}
|
||||
|
||||
setShowContactName() {
|
||||
@ -305,50 +305,50 @@ export default class ReceiveController {
|
||||
}
|
||||
let myName = this.selectContacts[0]?.contactName?.trim();
|
||||
if (!myName) {
|
||||
myName = ""
|
||||
myName = ''
|
||||
}
|
||||
let telephone = this.selectContacts[0]?.telephone
|
||||
if (telephone === undefined || telephone === null) {
|
||||
HiLog.e(TAG, "setShowContactName fail");
|
||||
HiLog.e(TAG, 'setShowContactName fail');
|
||||
return '';
|
||||
}
|
||||
if (!this.isPhoneNumber(telephone)) {
|
||||
myName = telephone.replace(new RegExp(/e|-|#|\*|\./, "g"), common.string.EMPTY_STR);
|
||||
myName = telephone.replace(new RegExp(/e|-|#|\*|\./, 'g'), common.string.EMPTY_STR);
|
||||
} else {
|
||||
if (myName == "") {
|
||||
if (myName == '') {
|
||||
myName = telephone;
|
||||
}
|
||||
}
|
||||
if (this.selectContacts.length >= 2) {
|
||||
// name and other numbers
|
||||
return $r("app.string.and_others", myName, this.selectContacts.length - 1)
|
||||
return $r('app.string.and_others', myName, this.selectContacts.length - 1)
|
||||
} else {
|
||||
return myName
|
||||
}
|
||||
}
|
||||
|
||||
myContactFocus() {
|
||||
HiLog.i(TAG, "myContactFocus, start");
|
||||
HiLog.i(TAG, 'myContactFocus, start');
|
||||
this.myText = common.string.EMPTY_STR;
|
||||
this.setInputStatus(true);
|
||||
this.isShowSearch = true;
|
||||
}
|
||||
|
||||
myContactClick() {
|
||||
HiLog.i(TAG, "myContactClick, start");
|
||||
HiLog.i(TAG, 'myContactClick, start');
|
||||
if (!this.isInputStatus) {
|
||||
this.myText = common.string.EMPTY_STR;
|
||||
this.setInputStatus(true);
|
||||
this.isShowSearch = true;
|
||||
// The TextArea control does not support focus.
|
||||
// this.$element("receiveTxt").focus({
|
||||
// this.$element('receiveTxt').focus({
|
||||
// focus: true
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
nameClick(idx, call) {
|
||||
HiLog.i(TAG, "click-->" + idx);
|
||||
HiLog.i(TAG, 'click-->' + idx);
|
||||
if (this.selectContacts[idx] == null || this.selectContacts[idx] == undefined) {
|
||||
return;
|
||||
}
|
||||
@ -357,7 +357,7 @@ export default class ReceiveController {
|
||||
// Deleted items are added to the collection to be searched.
|
||||
this.contactsTemp.push(item);
|
||||
if (item[0] != undefined && item[0].telephoneFormat != undefined &&
|
||||
item[0].telephoneFormat.toString().trim() != "") {
|
||||
item[0].telephoneFormat.toString().trim() != '') {
|
||||
this.contacts.push(item[0]);
|
||||
}
|
||||
this.refresh = !this.refresh;
|
||||
@ -388,7 +388,7 @@ export default class ReceiveController {
|
||||
let str = commonService.commonContactParam(actionData);
|
||||
globalThis.mmsContext.startAbility(str).then((data) => {
|
||||
}).catch((error) => {
|
||||
HiLog.i(TAG, "jumpToContact failed");
|
||||
HiLog.i(TAG, 'jumpToContact failed');
|
||||
});
|
||||
}
|
||||
// Switching to the Contacts app
|
||||
@ -408,7 +408,7 @@ export default class ReceiveController {
|
||||
}
|
||||
for (let element of params) {
|
||||
let selectContact: LooseObject = {};
|
||||
selectContact.headImage = "icon/user_avatar_full_fill.svg";
|
||||
selectContact.headImage = 'icon/user_avatar_full_fill.svg';
|
||||
selectContact.contactName = element.contactName;
|
||||
selectContact.telephone = element.telephone;
|
||||
selectContact.telephoneFormat = element.telephone;
|
||||
@ -470,7 +470,7 @@ export default class ReceiveController {
|
||||
prompt.showToast({
|
||||
// Invalid Recipient
|
||||
// @ts-ignore
|
||||
message: "只支持单个收件人",
|
||||
message: '只支持单个收件人',
|
||||
duration: 1000,
|
||||
});
|
||||
return true;
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -24,7 +24,7 @@ import ConversationModel from '../model/ConversationModel';
|
||||
import ConversationListModel from '../model/ConversationListModel';
|
||||
import HiLog from '../utils/HiLog';
|
||||
|
||||
const TAG = "DataWorkerWrapper"
|
||||
const TAG = 'DataWorkerWrapper'
|
||||
|
||||
export default class DataWorkerWrapper extends WorkerWrapper {
|
||||
private static sInstance: DataWorkerWrapper = null;
|
||||
@ -34,9 +34,9 @@ export default class DataWorkerWrapper extends WorkerWrapper {
|
||||
}
|
||||
|
||||
static getInstance() {
|
||||
HiLog.i(TAG, "getInstance in.");
|
||||
HiLog.i(TAG, 'getInstance in.');
|
||||
if (DataWorkerWrapper.sInstance == null || DataWorkerWrapper.sInstance.mWorker == null) {
|
||||
HiLog.i(TAG, "make DataWorkerWrapper.");
|
||||
HiLog.i(TAG, 'make DataWorkerWrapper.');
|
||||
DataWorkerWrapper.sInstance = new DataWorkerWrapper();
|
||||
}
|
||||
return DataWorkerWrapper.sInstance;
|
||||
@ -49,11 +49,8 @@ export default class DataWorkerWrapper extends WorkerWrapper {
|
||||
|
||||
export class DataWorkerTask extends WorkerTask {
|
||||
private static sInstance: DataWorkerTask = null;
|
||||
|
||||
private mContactsModel: ContactsModel = new ContactsModel();
|
||||
|
||||
private mConversationModel: ConversationModel = new ConversationModel();
|
||||
|
||||
private mConversationListModel: ConversationListModel = new ConversationListModel();
|
||||
|
||||
private constructor(workerPort: ThreadWorkerGlobalScope) {
|
||||
@ -61,7 +58,7 @@ export class DataWorkerTask extends WorkerTask {
|
||||
}
|
||||
|
||||
static getInstance(workerPort: ThreadWorkerGlobalScope) {
|
||||
HiLog.i(TAG, "getInstance in.");
|
||||
HiLog.i(TAG, 'getInstance in.');
|
||||
if (DataWorkerTask.sInstance == null || DataWorkerTask.sInstance.workerPort == null) {
|
||||
DataWorkerTask.sInstance = new DataWorkerTask(workerPort);
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ThreadWorkerGlobalScope, MessageEvents } from '@ohos.worker';
|
||||
import DataWorkerWrapper, { DataWorkerTask } from "./DataWorkerWrapper"
|
||||
import WorkerWrapper, { WorkerMessage } from "./base/WorkerWrapper"
|
||||
import WorkerTask from "./base/WorkerTask"
|
||||
import DataWorkerWrapper, { DataWorkerTask } from './DataWorkerWrapper'
|
||||
import WorkerWrapper, { WorkerMessage } from './base/WorkerWrapper'
|
||||
import WorkerTask from './base/WorkerTask'
|
||||
import HiLog from '../utils/HiLog';
|
||||
|
||||
const TAG = "WorkFactory"
|
||||
const TAG = 'WorkFactory'
|
||||
|
||||
export enum WorkerType {
|
||||
DataWorker,
|
||||
@ -39,10 +39,10 @@ export default class WorkFactory {
|
||||
HiLog.i(TAG, `getTask in ${WorkerType[type]}.`)
|
||||
let task: WorkerTask = null;
|
||||
if (type == WorkerType.DataWorker) {
|
||||
HiLog.w(TAG, "getTask " + type);
|
||||
HiLog.w(TAG, 'getTask ' + type);
|
||||
task = DataWorkerTask.getInstance(workerPort);
|
||||
}
|
||||
HiLog.w(TAG, "getTask end")
|
||||
HiLog.w(TAG, 'getTask end')
|
||||
return task;
|
||||
}
|
||||
|
||||
@ -56,10 +56,10 @@ export default class WorkFactory {
|
||||
HiLog.i(TAG, `getWorker in ${WorkerType[type]}.`)
|
||||
let worker: WorkerWrapper = null;
|
||||
if (type == WorkerType.DataWorker) {
|
||||
HiLog.w(TAG, "getWorker " + type)
|
||||
HiLog.w(TAG, 'getWorker ' + type)
|
||||
worker = DataWorkerWrapper.getInstance();
|
||||
}
|
||||
HiLog.w(TAG, "getWorker end")
|
||||
HiLog.w(TAG, 'getWorker end')
|
||||
return worker;
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
@ -15,10 +15,10 @@
|
||||
|
||||
import worker, { ThreadWorkerGlobalScope, MessageEvents, ErrorEvent } from '@ohos.worker';
|
||||
import HiLog from '../../utils/HiLog';
|
||||
import WorkFactory from "../WorkFactory"
|
||||
import WorkFactory from '../WorkFactory'
|
||||
|
||||
var workerPort: ThreadWorkerGlobalScope = worker.workerPort;
|
||||
const TAG = "Worker";
|
||||
const TAG = 'Worker';
|
||||
/**
|
||||
* Defines the event handler to be called when the worker thread receives a message sent by the host thread.
|
||||
* The event handler is executed in the worker thread.
|
||||
@ -26,13 +26,13 @@ const TAG = "Worker";
|
||||
* @param e message data
|
||||
*/
|
||||
workerPort.onmessage = function (e: MessageEvents) {
|
||||
HiLog.w(TAG, "onmessage");
|
||||
if (e.data) {
|
||||
let task = WorkFactory.getTask(workerPort, e)
|
||||
task?.onmessage(e);
|
||||
} else {
|
||||
HiLog.w(TAG, `onmessage ${JSON.stringify(e)} not allow`)
|
||||
}
|
||||
HiLog.w(TAG, 'onmessage');
|
||||
if (e.data) {
|
||||
let task = WorkFactory.getTask(workerPort, e)
|
||||
task?.onmessage(e);
|
||||
} else {
|
||||
HiLog.w(TAG, `onmessage ${JSON.stringify(e)} not allow`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ workerPort.onmessage = function (e: MessageEvents) {
|
||||
* @param e message data
|
||||
*/
|
||||
workerPort.onmessageerror = function (e: MessageEvents) {
|
||||
HiLog.w(TAG, "onmessageerror" + JSON.stringify(e));
|
||||
HiLog.w(TAG, 'onmessageerror' + JSON.stringify(e));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,5 +53,5 @@ workerPort.onmessageerror = function (e: MessageEvents) {
|
||||
* @param e error message
|
||||
*/
|
||||
workerPort.onerror = function (e: ErrorEvent) {
|
||||
HiLog.w(TAG, "onerror" + JSON.stringify(e));
|
||||
HiLog.w(TAG, 'onerror' + JSON.stringify(e));
|
||||
}
|
@ -1,60 +1,61 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { WorkerMessage } from "./WorkerWrapper"
|
||||
import { WorkerMessage } from './WorkerWrapper'
|
||||
import { ThreadWorkerGlobalScope, MessageEvents } from '@ohos.worker';
|
||||
import HiLog from '../../utils/HiLog';
|
||||
import buffer from "@ohos.buffer"
|
||||
import buffer from '@ohos.buffer'
|
||||
|
||||
const TAG = 'WorkerTask'
|
||||
|
||||
const TAG = "WorkerTask"
|
||||
/*
|
||||
* WorkerTask
|
||||
*
|
||||
* Work sub thread task
|
||||
*/
|
||||
export abstract class WorkerTask {
|
||||
workerPort: ThreadWorkerGlobalScope
|
||||
workerPort: ThreadWorkerGlobalScope
|
||||
|
||||
constructor(workerPort: ThreadWorkerGlobalScope) {
|
||||
HiLog.i(TAG, `WorkerTask constructor`)
|
||||
this.workerPort = workerPort;
|
||||
constructor(workerPort: ThreadWorkerGlobalScope) {
|
||||
HiLog.i(TAG, `WorkerTask constructor`)
|
||||
this.workerPort = workerPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the event handler to be called when the worker thread receives a message sent by the host thread.
|
||||
* The event handler is executed in the worker thread.
|
||||
*
|
||||
* @param e message data
|
||||
*/
|
||||
public onmessage(message: MessageEvents) {
|
||||
let data = <WorkerMessage> message.data
|
||||
HiLog.i(TAG, `onmessage ${data.request}`)
|
||||
try {
|
||||
this.runInWorker(data.request, (v) => {
|
||||
HiLog.i(TAG, 'runInWorker callback in')
|
||||
data.param = v;
|
||||
const str = JSON.stringify(data)
|
||||
let buf = buffer.from(str).buffer;
|
||||
this.workerPort.postMessage(buf, [buf]);
|
||||
}, data.param);
|
||||
} catch (err) {
|
||||
HiLog.e(TAG, 'runInWorker err = ' + JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the event handler to be called when the worker thread receives a message sent by the host thread.
|
||||
* The event handler is executed in the worker thread.
|
||||
*
|
||||
* @param e message data
|
||||
*/
|
||||
public onmessage(message: MessageEvents) {
|
||||
let data = <WorkerMessage> message.data
|
||||
HiLog.i(TAG, `onmessage ${data.request}`)
|
||||
try {
|
||||
this.runInWorker(data.request, (v) => {
|
||||
HiLog.i(TAG, "runInWorker callback in")
|
||||
data.param = v;
|
||||
const str = JSON.stringify(data)
|
||||
let buf = buffer.from(str).buffer;
|
||||
this.workerPort.postMessage(buf, [buf]);
|
||||
}, data.param);
|
||||
} catch (err) {
|
||||
HiLog.e(TAG, 'runInWorker err = ' + JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract runInWorker(request: string, callBack: (v?: any) => void, param?: any);
|
||||
public abstract runInWorker(request: string, callBack: (v?: any) => void, param?: any);
|
||||
}
|
||||
|
||||
export default WorkerTask;
|
@ -1,30 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { WorkerType } from "../WorkFactory"
|
||||
import { WorkerType } from '../WorkFactory'
|
||||
import worker from '@ohos.worker';
|
||||
import HiLog from '../../utils/HiLog';
|
||||
import buffer from "@ohos.buffer"
|
||||
import buffer from '@ohos.buffer'
|
||||
|
||||
const TAG = "WorkerWrapper"
|
||||
const TAG = 'WorkerWrapper'
|
||||
|
||||
export class WorkerMessage {
|
||||
request: string;
|
||||
callBackId: number;
|
||||
type?: WorkerType;
|
||||
param?: any;
|
||||
request: string;
|
||||
callBackId: number;
|
||||
type?: WorkerType;
|
||||
param?: any;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -33,91 +33,91 @@ export class WorkerMessage {
|
||||
* Processes sending tasks to workers and receiving work processing results.
|
||||
*/
|
||||
export abstract class WorkerWrapper {
|
||||
protected mWorker: worker.ThreadWorker = null;
|
||||
private callBacks: Map<string, (result?: any) => void> = new Map();
|
||||
private requestIndex: number = 0;
|
||||
protected mWorker: worker.ThreadWorker = null;
|
||||
private callBacks: Map<string, (result?: any) => void> = new Map();
|
||||
private requestIndex: number = 0;
|
||||
|
||||
constructor() {
|
||||
this.initWorker();
|
||||
constructor() {
|
||||
this.initWorker();
|
||||
}
|
||||
|
||||
async initWorker() {
|
||||
HiLog.i(TAG, `WorkerWrapper initWorker ${WorkerType[this.getWorkerType()]}`)
|
||||
let initWorker = await new worker.ThreadWorker('entry/ets/workers/base/Worker.ts', {
|
||||
name: WorkerType[this.getWorkerType()]
|
||||
});
|
||||
let that = this;
|
||||
initWorker.onexit = function (message) {
|
||||
HiLog.w(TAG, 'onexit')
|
||||
that.mWorker = null;
|
||||
}
|
||||
|
||||
async initWorker() {
|
||||
HiLog.i(TAG, `WorkerWrapper initWorker ${WorkerType[this.getWorkerType()]}`)
|
||||
let initWorker = await new worker.ThreadWorker("entry/ets/workers/base/Worker.ts", {
|
||||
name: WorkerType[this.getWorkerType()]
|
||||
});
|
||||
let that = this;
|
||||
initWorker.onexit = function (message) {
|
||||
HiLog.w(TAG, "onexit")
|
||||
that.mWorker = null;
|
||||
}
|
||||
initWorker.onerror = function (e) {
|
||||
HiLog.w(TAG, "onerror:" + JSON.stringify(e))
|
||||
}
|
||||
initWorker.onmessageerror = function (e) {
|
||||
HiLog.w(TAG, "onmessageerror:" + JSON.stringify(e))
|
||||
}
|
||||
initWorker.onmessage = function (message) {
|
||||
const buff = <ArrayBuffer> message.data;
|
||||
const str = buffer.from(buff).toString();
|
||||
let data = <WorkerMessage> JSON.parse(str)
|
||||
HiLog.i(TAG, `onmessage ${data.request}`)
|
||||
const key = that.getCallBackKey(data);
|
||||
if (that.callBacks.has(key)) {
|
||||
HiLog.i(TAG, `onmessage notify result.`)
|
||||
const callback = that.callBacks.get(key);
|
||||
if (callback) {
|
||||
callback(data.param);
|
||||
}
|
||||
that.callBacks.delete(key);
|
||||
}
|
||||
}
|
||||
this.mWorker = initWorker;
|
||||
HiLog.i(TAG, `WorkerWrapper initWorker end`)
|
||||
initWorker.onerror = function (e) {
|
||||
HiLog.w(TAG, 'onerror:' + JSON.stringify(e))
|
||||
}
|
||||
|
||||
public abstract getWorkerType(): WorkerType;
|
||||
|
||||
/**
|
||||
* SendRequest to worker thread.
|
||||
*
|
||||
* @param {string} request the request worker to do
|
||||
* @param {Object} requestData request param Data
|
||||
* @param {Object} callBack Call back from worker
|
||||
*/
|
||||
public async sendRequest(request: string, requestData?: any, callBack?: (result?: any) => void) {
|
||||
HiLog.i(TAG, "sendRequest in " + request)
|
||||
if (this.mWorker) {
|
||||
const message = {
|
||||
request: request,
|
||||
callBackId: this.requestIndex,
|
||||
type: this.getWorkerType(),
|
||||
param: requestData
|
||||
}
|
||||
if (callBack) {
|
||||
this.callBacks.set(this.getCallBackKey(message), callBack);
|
||||
}
|
||||
this.mWorker?.postMessage(message);
|
||||
HiLog.d(TAG, `${this.getWorkerType()} ${request} send succ!`);
|
||||
this.requestIndex++;
|
||||
} else {
|
||||
HiLog.w(TAG, `${this.getWorkerType()} ${request} send fail, worker has been closed!`);
|
||||
initWorker.onmessageerror = function (e) {
|
||||
HiLog.w(TAG, 'onmessageerror:' + JSON.stringify(e))
|
||||
}
|
||||
initWorker.onmessage = function (message) {
|
||||
const buff = <ArrayBuffer> message.data;
|
||||
const str = buffer.from(buff).toString();
|
||||
let data = <WorkerMessage> JSON.parse(str)
|
||||
HiLog.i(TAG, `onmessage ${data.request}`)
|
||||
const key = that.getCallBackKey(data);
|
||||
if (that.callBacks.has(key)) {
|
||||
HiLog.i(TAG, `onmessage notify result.`)
|
||||
const callback = that.callBacks.get(key);
|
||||
if (callback) {
|
||||
callback(data.param);
|
||||
}
|
||||
that.callBacks.delete(key);
|
||||
}
|
||||
}
|
||||
this.mWorker = initWorker;
|
||||
HiLog.i(TAG, `WorkerWrapper initWorker end`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Close close worker thread.
|
||||
*/
|
||||
public close() {
|
||||
HiLog.i(TAG, `${this.getWorkerType()} worker close!`);
|
||||
this.mWorker.terminate();
|
||||
this.mWorker = null;
|
||||
this.callBacks.clear();
|
||||
}
|
||||
public abstract getWorkerType(): WorkerType;
|
||||
|
||||
private getCallBackKey(message: WorkerMessage): string {
|
||||
return message.request + message.callBackId;
|
||||
/**
|
||||
* SendRequest to worker thread.
|
||||
*
|
||||
* @param {string} request the request worker to do
|
||||
* @param {Object} requestData request param Data
|
||||
* @param {Object} callBack Call back from worker
|
||||
*/
|
||||
public async sendRequest(request: string, requestData?: any, callBack?: (result?: any) => void) {
|
||||
HiLog.i(TAG, 'sendRequest in ' + request)
|
||||
if (this.mWorker) {
|
||||
const message = {
|
||||
request: request,
|
||||
callBackId: this.requestIndex,
|
||||
type: this.getWorkerType(),
|
||||
param: requestData
|
||||
}
|
||||
if (callBack) {
|
||||
this.callBacks.set(this.getCallBackKey(message), callBack);
|
||||
}
|
||||
this.mWorker?.postMessage(message);
|
||||
HiLog.d(TAG, `${this.getWorkerType()} ${request} send succ!`);
|
||||
this.requestIndex++;
|
||||
} else {
|
||||
HiLog.w(TAG, `${this.getWorkerType()} ${request} send fail, worker has been closed!`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close close worker thread.
|
||||
*/
|
||||
public close() {
|
||||
HiLog.i(TAG, `${this.getWorkerType()} worker close!`);
|
||||
this.mWorker.terminate();
|
||||
this.mWorker = null;
|
||||
this.callBacks.clear();
|
||||
}
|
||||
|
||||
private getCallBackKey(message: WorkerMessage): string {
|
||||
return message.request + message.callBackId;
|
||||
}
|
||||
}
|
||||
|
||||
export default WorkerWrapper;
|
Loading…
Reference in New Issue
Block a user