mirror of
https://gitee.com/openharmony/applications_mms
synced 2024-11-23 07:39:46 +00:00
commit
dbae337776
@ -3,7 +3,7 @@
|
||||
"bundleName": "com.ohos.mms",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"versionName": "1.0.4.011",
|
||||
"icon": "$media:smsmms",
|
||||
"label": "$string:app_name",
|
||||
"distributedNotificationEnabled": true
|
||||
|
@ -5,6 +5,9 @@
|
||||
"targets": [
|
||||
{
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"name": "ohosTest",
|
||||
}
|
||||
]
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import AbilityStage from "@ohos.app.ability.AbilityStage"
|
||||
import notification from "@ohos.notification";
|
||||
import AbilityStage from "@ohos.app.ability.UIAbility"
|
||||
import notification from "@ohos.notificationManager";
|
||||
import HiLog from "../utils/HiLog";
|
||||
|
||||
const TAG = "MyAbilityStage"
|
||||
@ -8,7 +8,7 @@ export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
HiLog.i(TAG, "AbilityStage onCreate");
|
||||
globalThis.AbilityStageConstant = this.context;
|
||||
notification.enableNotification({
|
||||
notification.setNotificationEnable({
|
||||
bundle: "com.ohos.mms"
|
||||
}, true, (err, data) => {
|
||||
if (err) {
|
||||
|
@ -10,7 +10,7 @@ const TAG = "app";
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
HiLog.i(TAG, "Ability onCreate com.ohos.mms version: 1.0.0.32");
|
||||
HiLog.i(TAG, "Ability onCreate com.ohos.mms version: 1.0.0.34");
|
||||
globalThis.mmsContext = this.context;
|
||||
globalThis.abilityWant = want;
|
||||
globalThis.MmsDatabaseHelper = new MmsDatabaseHelper();
|
||||
|
@ -513,8 +513,7 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
}
|
||||
|
||||
async insertMmsPart(stringValue) {
|
||||
//由于数据库切换stage模型未完成,需对acquireDataAbilityHelper接口做入侵式修改
|
||||
let dataAbilityHelper = particleAbility.acquireDataAbilityHelper(this.context, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(this.context, common.string.URI_MESSAGE_LOG);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_MMS_PART;
|
||||
dataAbilityHelper.insert(managerUri, stringValue).then(data => {
|
||||
}).catch(error => {
|
||||
@ -526,7 +525,7 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
async insertMessageDetailRdb(actionData, callback) {
|
||||
// Obtains the DataAbilityHelper object.
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
let dataAbilityHelper = particleAbility.acquireDataAbilityHelper(this.context, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(this.context, common.string.URI_MESSAGE_LOG);
|
||||
let promise = dataAbilityHelper.insert(managerUri, actionData.stringValue);
|
||||
await promise.then(data => {
|
||||
callback(data);
|
||||
@ -581,13 +580,13 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
|
||||
// Get the largest groupId
|
||||
async queryMaxGroupIdDb(actionData, callback) {
|
||||
let dataAbilityHelper = particleAbility.acquireDataAbilityHelper(this.context, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(this.context, common.string.URI_MESSAGE_LOG);
|
||||
let resultColumns = [
|
||||
"maxGroupId"
|
||||
];
|
||||
let condition = new ohosDataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_MAX_GROUP;
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition).then( resultSet => {
|
||||
dataAbilityHelper.query(managerUri, condition, resultColumns).then( resultSet => {
|
||||
let result: LooseObject = {};
|
||||
while (resultSet.goToNextRow()) {
|
||||
result.maxGroupId = resultSet.getString(0);
|
||||
@ -673,13 +672,13 @@ export default class MmsStaticSubscriber extends StaticSubscriberExtensionAbilit
|
||||
mmsTable.contactDataColumns.displayName,
|
||||
];
|
||||
let contactDataAbilityHelper =
|
||||
particleAbility.acquireDataAbilityHelper(this.context, common.string.URI_ROW_CONTACTS);
|
||||
let condition = new ohosDataAbility.DataAbilityPredicates();
|
||||
await dataShare.createDataShareHelper(this.context, common.string.URI_ROW_CONTACTS);
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let contactDataUri = common.string.URI_ROW_CONTACTS + common.string.CONTACT_DATA_URI;
|
||||
condition.in(mmsTable.contactDataColumns.detailInfo, telephones);
|
||||
condition.and();
|
||||
condition.equalTo(mmsTable.contactDataColumns.typeId, "5");
|
||||
contactDataAbilityHelper.query(contactDataUri, resultColumns, condition).then(resultSet => {
|
||||
contactDataAbilityHelper.query(contactDataUri, condition, resultColumns).then(resultSet => {
|
||||
let contracts = [];
|
||||
while (resultSet.goToNextRow()) {
|
||||
let contract = {
|
||||
|
@ -143,6 +143,7 @@ export default {
|
||||
// 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",
|
||||
// Events for Subscribing to Notifications usual.event.SMS_RECEIVE_COMPLETED
|
||||
SUBSCRIBER_EVENT: "usual.event.SMS_RECEIVE_COMPLETED",
|
||||
// Receiving and forwarding
|
||||
@ -150,7 +151,7 @@ export default {
|
||||
// MMS message receiving event
|
||||
MMS_SUBSCRIBER_EVENT: "usual.event.MMS_RECEIVE_COMPLETED",
|
||||
// Contact database
|
||||
URI_ROW_CONTACTS: "dataability:///com.ohos.contactsdataability",
|
||||
URI_ROW_CONTACTS: "datashare:///com.ohos.contactsdataability",
|
||||
// Contact Information
|
||||
CONTACT_DATA_URI: "/contacts/contact_data",
|
||||
// Business Card Contact
|
||||
@ -160,7 +161,7 @@ export default {
|
||||
// Contact Information
|
||||
CONTACT_URI: "/contacts/contact",
|
||||
// SMS database
|
||||
URI_MESSAGE_LOG: "dataability:///com.ohos.smsmmsability",
|
||||
URI_MESSAGE_LOG: "datashare:///com.ohos.smsmmsability",
|
||||
// Querying SMs
|
||||
URI_MESSAGE_INFO_TABLE: "/sms_mms/sms_mms_info",
|
||||
// Statistic
|
||||
@ -274,5 +275,13 @@ export default {
|
||||
PPT_IMAGE_HEIGHT: 220,
|
||||
DISTANCE: 20,
|
||||
TOTAL_HEIGHT: 650
|
||||
}
|
||||
},
|
||||
LOCAL_SPN_CHINA: {
|
||||
// TELECOM
|
||||
TELECOM: "中国电信",
|
||||
// MOBILE
|
||||
MOBILE: "中国移动",
|
||||
// UNICOM
|
||||
UNICOM: "中国联通",
|
||||
},
|
||||
}
|
@ -59,6 +59,7 @@ export default {
|
||||
// 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
|
||||
|
@ -22,6 +22,18 @@ import telephonySMS from "@ohos.telephony.sms";
|
||||
import telephonySim from "@ohos.telephony.sim";
|
||||
|
||||
const TAG = "CardModel";
|
||||
// The SIM card status is unknown
|
||||
const SIM_STATE_UNKNOWN: number = 0;
|
||||
// Indicates that the SIM card is in the not present state, that is, no SIM card is inserted in the card slot.
|
||||
const SIM_STATE_NOT_PRESENT: number = 1;
|
||||
// Indicates that the SIM card is locked, that is, the SIM card is locked by a PIN, PUK, or network lock.
|
||||
const SIM_STATE_LOCKED: number = 2;
|
||||
// Indicates that the SIM card is in the not ready state, that is, the SIM card is in place but not working.
|
||||
const SIM_STATE_NOT_READY: number = 3;
|
||||
// Indicates that the SIM card is in the ready state, that is, the SIM card is in place and working properly.
|
||||
const SIM_STATE_READY: number = 4;
|
||||
// Indicates that the SIM card is loaded, that is, the SIM card is in place and all card files are loaded.
|
||||
const SIM_STATE_LOADED: number = 5;
|
||||
|
||||
export default class CardModel extends BaseModel {
|
||||
getSimSpn() {
|
||||
@ -105,7 +117,10 @@ export default class CardModel extends BaseModel {
|
||||
});
|
||||
}
|
||||
|
||||
getSimCardNum() {
|
||||
/**
|
||||
* Get the number of sim card.
|
||||
*/
|
||||
getSimCardNum():void {
|
||||
telephonySim.hasSimCard(common.int.SIM_ONE, (error, value) => {
|
||||
if (error) {
|
||||
HiLog.e(TAG, "getSimCardNum, SIM_ONE error: " + JSON.stringify(error.message));
|
||||
@ -124,8 +139,10 @@ export default class CardModel extends BaseModel {
|
||||
});
|
||||
}
|
||||
|
||||
getSimTelephoneNumber() {
|
||||
HiLog.i(TAG, "get sim telephone number start");
|
||||
/**
|
||||
* Get the telephoneNumber from sim1 and sim2.
|
||||
*/
|
||||
getSimTelephoneNumber():void {
|
||||
telephonySim.getSimTelephoneNumber(common.int.SIM_ONE, (error, value) => {
|
||||
if (error) {
|
||||
HiLog.e(TAG, "get SIM_ONE telephone number error: " + JSON.stringify(error.message));
|
||||
|
@ -18,27 +18,27 @@ import common from "../data/commonData";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import mmsTable from "../data/tableData";
|
||||
import LooseObject from "../data/LooseObject"
|
||||
import featureAbility from "@ohos.ability.featureAbility";
|
||||
import dataAbility from "@ohos.data.dataAbility";
|
||||
|
||||
import dataShare from "@ohos.data.dataShare";
|
||||
import dataSharePredicates from "@ohos.data.dataSharePredicates";
|
||||
|
||||
const TAG = "ContactsModel";
|
||||
|
||||
export default class ContactsModel extends BaseModel {
|
||||
async queryContactDataByIds(actionData, callback) {
|
||||
//由于数据库切换stage模型未完成,需对acquireDataAbilityHelper接口做入侵式修改
|
||||
let dataHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_ROW_CONTACTS);
|
||||
let dataHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_ROW_CONTACTS);
|
||||
let resultColumns = [
|
||||
mmsTable.contactDataColumns.detailInfo,
|
||||
mmsTable.contactDataColumns.displayName,
|
||||
];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let contactDataUri = common.string.URI_ROW_CONTACTS + common.string.CONTACT_DATA_URI;
|
||||
condition.in(mmsTable.contactDataColumns.contactId, actionData.contractIds);
|
||||
condition.and();
|
||||
condition.equalTo(mmsTable.contactDataColumns.typeId, "5");
|
||||
condition.and();
|
||||
condition.equalTo(mmsTable.contactDataColumns.hasDelete, "0");
|
||||
dataHelper.query(contactDataUri, resultColumns, condition).then(resultSet => {
|
||||
dataHelper.query(contactDataUri, condition, resultColumns).then(resultSet => {
|
||||
callback(this.dealResultSet(resultSet));
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "queryContactDataByIds, error: " + JSON.stringify(error.message));
|
||||
@ -46,20 +46,20 @@ export default class ContactsModel extends BaseModel {
|
||||
}
|
||||
|
||||
async queryContactDataByTelephone(actionData, callback) {
|
||||
let telephoneDataHelp = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext,
|
||||
common.string.URI_ROW_CONTACTS);
|
||||
let telephoneDataHelp = await dataShare.createDataShareHelper(globalThis.mmsContext,
|
||||
common.string.URI_ROW_CONTACTS);
|
||||
let resultColumns = [
|
||||
mmsTable.contactDataColumns.detailInfo,
|
||||
mmsTable.contactDataColumns.displayName,
|
||||
];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let contactDataUri = common.string.URI_ROW_CONTACTS + common.string.CONTACT_DATA_URI;
|
||||
condition.in(mmsTable.contactDataColumns.detailInfo, actionData.telephones);
|
||||
condition.and();
|
||||
condition.equalTo(mmsTable.contactDataColumns.typeId, "5");
|
||||
condition.and();
|
||||
condition.equalTo(mmsTable.contactDataColumns.hasDelete, "0");
|
||||
telephoneDataHelp.query(contactDataUri, resultColumns, condition).then(resultSet => {
|
||||
telephoneDataHelp.query(contactDataUri, condition, resultColumns).then(resultSet => {
|
||||
callback(this.dealResultSet(resultSet));
|
||||
}).catch(error => {
|
||||
HiLog.e(TAG, "queryContactDataByTelephone, error: " + JSON.stringify(error.message));
|
||||
@ -79,17 +79,16 @@ export default class ContactsModel extends BaseModel {
|
||||
}
|
||||
|
||||
async queryContact(actionData, callback) {
|
||||
let DAHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_ROW_CONTACTS);
|
||||
let DAHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_ROW_CONTACTS);
|
||||
let resultColumns = [
|
||||
mmsTable.contactColumns.id
|
||||
];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let rawContactUri = common.string.URI_ROW_CONTACTS + common.string.CONTACT_URI;
|
||||
let offset = (actionData.page - 1) * actionData.limit;
|
||||
condition.limitAs(actionData.limit)
|
||||
condition.limit(actionData.limit, offset)
|
||||
.orderByDesc(mmsTable.contactColumns.lastestContactedTime)
|
||||
.offsetAs(offset);
|
||||
DAHelper.query(rawContactUri, resultColumns, condition).then(resultSet => {
|
||||
DAHelper.query(rawContactUri, condition, resultColumns).then(resultSet => {
|
||||
let rawContactIds = [];
|
||||
while (resultSet.goToNextRow()) {
|
||||
rawContactIds.push(resultSet.getString(0));
|
||||
@ -101,14 +100,14 @@ export default class ContactsModel extends BaseModel {
|
||||
}
|
||||
|
||||
async countContact(actionData, callback) {
|
||||
let DAHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_ROW_CONTACTS);
|
||||
let DAHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_ROW_CONTACTS);
|
||||
let resultColumns = [
|
||||
mmsTable.contactColumns.id
|
||||
];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let rawContactUri = common.string.URI_ROW_CONTACTS + common.string.CONTACT_URI;
|
||||
condition.orderByDesc(mmsTable.contactColumns.lastestContactedTime);
|
||||
DAHelper.query(rawContactUri, resultColumns, condition).then(resultSet => {
|
||||
DAHelper.query(rawContactUri, condition, resultColumns).then(resultSet => {
|
||||
let count = 0;
|
||||
while (resultSet.goToNextRow()) {
|
||||
count++;
|
||||
@ -120,13 +119,13 @@ export default class ContactsModel extends BaseModel {
|
||||
}
|
||||
|
||||
async searchContracts(actionData, callback) {
|
||||
let searchDataHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext,
|
||||
let searchDataHelper = await dataShare.createDataShareHelper(globalThis.mmsContext,
|
||||
common.string.URI_ROW_CONTACTS);
|
||||
let resultColumns = [
|
||||
mmsTable.searchContactView.detailInfo,
|
||||
mmsTable.searchContactView.displayName
|
||||
];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let searchContactsUri = common.string.URI_ROW_CONTACTS + common.string.CONTACT_SEARCHE;
|
||||
condition.equalTo(mmsTable.searchContactView.contentType, "phone")
|
||||
.beginWrap()
|
||||
@ -134,7 +133,7 @@ export default class ContactsModel extends BaseModel {
|
||||
.or()
|
||||
.contains(mmsTable.searchContactView.detailInfo, actionData.telephone)
|
||||
.endWrap();
|
||||
searchDataHelper.query(searchContactsUri, resultColumns, condition).then(resultSet => {
|
||||
searchDataHelper.query(searchContactsUri, condition, resultColumns).then(resultSet => {
|
||||
let contracts = this.dealResultSet(resultSet);
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, contracts));
|
||||
}).catch(error => {
|
||||
@ -150,13 +149,13 @@ export default class ContactsModel extends BaseModel {
|
||||
*/
|
||||
async queryProfile(actionData, callback) {
|
||||
HiLog.i(TAG, "queryProfile start ");
|
||||
let DAHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_ROW_CONTACTS);
|
||||
let DAHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_ROW_CONTACTS);
|
||||
let resultColumns = [
|
||||
mmsTable.contactDataColumns.id,
|
||||
];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let contactDataUri = common.string.URI_ROW_CONTACTS + common.string.PROFILE_DATA_URI;
|
||||
DAHelper.query(contactDataUri, resultColumns, condition).then(resultSet => {
|
||||
DAHelper.query(contactDataUri, condition, resultColumns).then(resultSet => {
|
||||
let count = 0;
|
||||
while (resultSet.goToNextRow()) {
|
||||
count++;
|
||||
|
@ -15,14 +15,15 @@
|
||||
|
||||
import BaseModel from "./BaseModel";
|
||||
import common from "../data/commonData";
|
||||
import dataAbility from "@ohos.data.dataAbility";
|
||||
import mmsTable from "../data/tableData";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import LooseObject from "../data/LooseObject"
|
||||
import MmsDatabaseHelper from "../utils/MmsDatabaseHelper";
|
||||
import featureAbility from "@ohos.ability.featureAbility";
|
||||
import ohosDataRdb from "@ohos.data.rdb";
|
||||
|
||||
import dataShare from "@ohos.data.dataShare";
|
||||
import dataSharePredicates from "@ohos.data.dataSharePredicates";
|
||||
|
||||
const TAG = "ConversationListModel";
|
||||
|
||||
export default class ConversationListModel extends BaseModel {
|
||||
@ -132,16 +133,15 @@ export default class ConversationListModel extends BaseModel {
|
||||
} else {
|
||||
mmsContext = globalThis.mmsContext;
|
||||
}
|
||||
//由于数据库切换stage模型未完成,需对acquireDataAbilityHelper接口做入侵式修改
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let resultColumns = [
|
||||
"totalListCount",
|
||||
"unreadCount",
|
||||
"unreadTotalOfInfo"
|
||||
];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_UNREAD_COUNT;
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition, (err, resultSet) => {
|
||||
let dataShareHelper = await dataShare.createDataShareHelper(mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataShareHelper.query(managerUri, condition, resultColumns, (err, resultSet) => {
|
||||
let result: LooseObject = {};
|
||||
while (resultSet.goToNextRow()) {
|
||||
result.totalListCount = resultSet.getString(0);
|
||||
|
@ -20,8 +20,9 @@ import mmsTable from "../data/tableData";
|
||||
// log Tools
|
||||
import HiLog from "../utils/HiLog"
|
||||
import LooseObject from "../data/LooseObject"
|
||||
import featureAbility from "@ohos.ability.featureAbility";
|
||||
import dataAbility from "@ohos.data.dataAbility";
|
||||
|
||||
import dataShare from "@ohos.data.dataShare";
|
||||
import dataSharePredicates from "@ohos.data.dataSharePredicates";
|
||||
|
||||
const TAG = "ConversationModel";
|
||||
|
||||
@ -29,12 +30,11 @@ let morkDataModel = new MorkDataModel();
|
||||
|
||||
export default class ConversationModel extends BaseModel {
|
||||
async queryMessageDetail(actionData, callback) {
|
||||
//由于数据库切换stage模型未完成,需对acquireDataAbilityHelper接口做入侵式修改
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
var resultColumns = this.buildResultColumns();
|
||||
let condition = this.buildQueryCondition(actionData);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition).then(resultSet => {
|
||||
dataAbilityHelper.query(managerUri, condition, resultColumns).then(resultSet => {
|
||||
let resultList = [];
|
||||
if( !resultSet.goToFirstRow() ) {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultList));
|
||||
@ -65,7 +65,7 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
|
||||
buildQueryCondition(actionData) {
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
if (actionData.isDraft != null && actionData.isDraft) {
|
||||
condition.equalTo(mmsTable.messageInfo.groupId, actionData.groupId);
|
||||
condition.equalTo(mmsTable.messageInfo.msgState, actionData.sendStatus);
|
||||
@ -93,6 +93,7 @@ export default class ConversationModel extends BaseModel {
|
||||
buildBaseColumns() {
|
||||
var resultColumns = [
|
||||
mmsTable.messageInfo.msgId,
|
||||
mmsTable.messageInfo.slotId,
|
||||
// Recipient Mobile Number
|
||||
mmsTable.messageInfo.receiverNumber,
|
||||
mmsTable.messageInfo.senderNumber,
|
||||
@ -131,9 +132,9 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
|
||||
async searchSmsMessageByContent(actionData, callback) {
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
var resultColumns = this.buildSearchResultColums();
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.like(mmsTable.messageInfo.msgContent, "%" + actionData.content + "%");
|
||||
condition.equalTo(mmsTable.messageInfo.msgType, 0);
|
||||
if (actionData.numberType != null) {
|
||||
@ -141,7 +142,7 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
let resultList = [];
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition).then(resultSet => {
|
||||
dataAbilityHelper.query(managerUri, condition, resultColumns).then(resultSet => {
|
||||
while (resultSet.goToNextRow()) {
|
||||
let result: LooseObject = {};
|
||||
this.dealBaseColumsData(result, resultSet);
|
||||
@ -171,6 +172,7 @@ export default class ConversationModel extends BaseModel {
|
||||
|
||||
dealBaseColumsData(result, resultSet) {
|
||||
result.msgId = resultSet.getString(resultSet.getColumnIndex("msg_id"));
|
||||
result.slotId = resultSet.getString(resultSet.getColumnIndex("slot_id"));
|
||||
result.receiverNumber = resultSet.getString(resultSet.getColumnIndex("receiver_number"));
|
||||
result.senderNumber = resultSet.getString(resultSet.getColumnIndex("sender_number"));
|
||||
result.startTime = resultSet.getString(resultSet.getColumnIndex("start_time"));
|
||||
@ -184,7 +186,8 @@ export default class ConversationModel extends BaseModel {
|
||||
|
||||
async insertMessageDetail(actionData, callback) {
|
||||
HiLog.i(TAG, "insertMessageDetail, start")
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
//TODO
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataAbilityHelper.insert(managerUri, actionData.stringValue).then(data => {
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, data));
|
||||
@ -195,15 +198,15 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
|
||||
async updateLock(actionData, callback) {
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
var groupIds = this.groupIdToString(actionData.groupIds);
|
||||
var condition = new dataAbility.DataAbilityPredicates();
|
||||
var condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.in(mmsTable.messageInfo.groupId, groupIds);
|
||||
var stringValue = {
|
||||
"is_lock": actionData.hasLock,
|
||||
};
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataAbilityHelper.update(managerUri, stringValue, condition).then((data) => {
|
||||
dataAbilityHelper.update(managerUri, condition, stringValue).then((data) => {
|
||||
callback(this.encapsulateReturnCode(common.int.SUCCESS));
|
||||
}).catch((err) => {
|
||||
HiLog.e(TAG, "updateLock, err: " + JSON.stringify(err.message));
|
||||
@ -220,15 +223,15 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
|
||||
async updateCollect(actionData, callback) {
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
var groupIds = this.groupIdToString(actionData.groupIds);
|
||||
var condition = new dataAbility.DataAbilityPredicates();
|
||||
var condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.in(mmsTable.messageInfo.groupId, groupIds);
|
||||
var stringValue = {
|
||||
"is_collect": actionData.hasCollect,
|
||||
};
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataAbilityHelper.update(managerUri, stringValue, condition).then((data) => {
|
||||
dataAbilityHelper.update(managerUri, condition, stringValue).then((data) => {
|
||||
callback(this.encapsulateReturnCode(common.int.SUCCESS));
|
||||
}).catch((err) => {
|
||||
HiLog.e(TAG, "updateCollect, err: " + JSON.stringify(err.message));
|
||||
@ -237,18 +240,18 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
|
||||
async deleteMessageByIds(actionData) {
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
var msgIds = actionData.msgIds;
|
||||
var condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.in(mmsTable.messageInfo.msgId, msgIds);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataAbilityHelper.delete(managerUri, condition);
|
||||
}
|
||||
|
||||
async deleteMessageByGroupIds(actionData) {
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
var groupIds = this.groupIdToString(actionData.groupIds);
|
||||
var condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.in(mmsTable.messageInfo.groupId, groupIds);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataAbilityHelper.delete(managerUri, condition).then((data) => {
|
||||
@ -258,13 +261,13 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
|
||||
async deleteMessageBySessionIds(actionData) {
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let threadIds = [];
|
||||
for (let id of actionData.threadIds) {
|
||||
let threadId = id + common.string.EMPTY_STR;
|
||||
threadIds.push(threadId);
|
||||
}
|
||||
var condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.in(mmsTable.messageInfo.sessionId, threadIds);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataAbilityHelper.delete(managerUri, condition).then((data) => {
|
||||
@ -274,9 +277,9 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
|
||||
async deleteMessageBySessionIdsAndLock(actionData) {
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let threadIds = this.groupIdToString(actionData.threadIds);
|
||||
var condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.equalTo(mmsTable.messageInfo.isLock, actionData.hasLock);
|
||||
condition.in(mmsTable.messageInfo.sessionId, threadIds);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
@ -287,15 +290,15 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
|
||||
async updateById(actionData, callback) {
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
var msgId = actionData.msgId;
|
||||
var condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.equalTo(mmsTable.messageInfo.msgId, msgId);
|
||||
var stringValue = {
|
||||
"msg_state": actionData.sendStatus,
|
||||
};
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataAbilityHelper.update(managerUri, stringValue, condition).then((data) => {
|
||||
dataAbilityHelper.update(managerUri, condition, stringValue).then((data) => {
|
||||
HiLog.i(TAG, "updateById, end");
|
||||
callback(this.encapsulateReturnCode(common.int.SUCCESS));
|
||||
}).catch((err) => {
|
||||
@ -305,26 +308,26 @@ export default class ConversationModel extends BaseModel {
|
||||
}
|
||||
|
||||
async markAllAsRead(actionData) {
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let threadIds = [];
|
||||
for (let id of actionData.threadIds) {
|
||||
let threadId = id + common.string.EMPTY_STR;
|
||||
threadIds.push(threadId);
|
||||
}
|
||||
var condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.in(mmsTable.messageInfo.sessionId, threadIds);
|
||||
var stringValue = {
|
||||
"is_read": actionData.hasRead
|
||||
};
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
dataAbilityHelper.update(managerUri, stringValue, condition).then((data) => {
|
||||
dataAbilityHelper.update(managerUri, condition, stringValue).then((data) => {
|
||||
}).catch((err) => {
|
||||
HiLog.e(TAG, "markAllAsRead, err: " + JSON.stringify(err.message));
|
||||
});
|
||||
}
|
||||
|
||||
async markAllToRead(actionData) {
|
||||
var condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.equalTo(mmsTable.messageInfo.isRead, 0);
|
||||
condition.equalTo(mmsTable.messageInfo.smsType, actionData.smsType);
|
||||
var stringValue = {
|
||||
@ -332,8 +335,8 @@ export default class ConversationModel extends BaseModel {
|
||||
};
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.update(managerUri, stringValue, condition).then((data) => {
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.update(managerUri, condition, stringValue).then((data) => {
|
||||
}).catch((err) => {
|
||||
HiLog.e(TAG, "markAllToRead, err: " + JSON.stringify(err.message));
|
||||
});
|
||||
@ -343,11 +346,12 @@ export default class ConversationModel extends BaseModel {
|
||||
let resultColumns = [
|
||||
"maxGroupId"
|
||||
];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_MAX_GROUP;
|
||||
// condition.orderByAsc(mmsTable.messageInfo.groupId);
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition, (err, resultSet) => {
|
||||
//TODO
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, condition, resultColumns, (err, resultSet) => {
|
||||
HiLog.i(TAG, "queryMaxGroupId, query callback");
|
||||
let result: LooseObject = {};
|
||||
while (resultSet.goToNextRow()) {
|
||||
@ -383,13 +387,13 @@ export default class ConversationModel extends BaseModel {
|
||||
mmsTable.messageInfo.msgId,
|
||||
mmsTable.messageInfo.sessionId
|
||||
];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.lessThan(mmsTable.messageInfo.endTime, lastTime);
|
||||
condition.equalTo(mmsTable.messageInfo.smsType, actionData.numberType);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition).then((resultSet) => {
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, condition, resultColumns).then((resultSet) => {
|
||||
let mmsList = [];
|
||||
while (resultSet.goToNextRow()) {
|
||||
let item: LooseObject = {};
|
||||
@ -411,7 +415,7 @@ export default class ConversationModel extends BaseModel {
|
||||
} else {
|
||||
mmsContext = globalThis.mmsContext;
|
||||
}
|
||||
var condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.equalTo(mmsTable.messageInfo.isRead, 0);
|
||||
condition.equalTo(mmsTable.messageInfo.smsType, 1);
|
||||
let resultColumns = [
|
||||
@ -419,8 +423,8 @@ export default class ConversationModel extends BaseModel {
|
||||
];
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition).then((resultSet) => {
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, condition, resultColumns).then((resultSet) => {
|
||||
let count = 0;
|
||||
while (resultSet.goToNextRow()) {
|
||||
count++;
|
||||
@ -434,12 +438,12 @@ export default class ConversationModel extends BaseModel {
|
||||
|
||||
async searchMmsPartByContent(actionData, callback) {
|
||||
let resultColumns = this.buildMmsPartResultColumns();
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.like(mmsTable.mmsPart.content, "%" + actionData.content + "%");
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_MMS_PART;
|
||||
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition).then(resultSet => {
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, condition, resultColumns).then(resultSet => {
|
||||
let resultList = this.dealMmsPartResult(resultSet);
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultList));
|
||||
}).catch(error => {
|
||||
@ -450,12 +454,12 @@ export default class ConversationModel extends BaseModel {
|
||||
|
||||
async queryMmsPart(actionData, callback) {
|
||||
var resultColumns = this.buildMmsPartResultColumns();
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.in(mmsTable.mmsPart.msgId, actionData.msgIds);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_MMS_PART;
|
||||
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition).then(resultSet => {
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, condition, resultColumns).then(resultSet => {
|
||||
let resultList = this.dealMmsPartResult(resultSet);
|
||||
callback(this.encapsulateReturnResult(common.int.SUCCESS, resultList));
|
||||
}).catch(error => {
|
||||
@ -497,11 +501,11 @@ export default class ConversationModel extends BaseModel {
|
||||
|
||||
async deleteMmsPartByGroupIds(actionData) {
|
||||
let groupIds = this.groupIdToString(actionData.groupIds);
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
condition.in(mmsTable.mmsPart.groupId, groupIds);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_MMS_PART;
|
||||
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.delete(managerUri, condition).then((data) => {
|
||||
}).catch((err) => {
|
||||
HiLog.e(TAG, "deleteMmsPartByGroupIds, err: " + JSON.stringify(err.message));
|
||||
@ -519,7 +523,7 @@ export default class ConversationModel extends BaseModel {
|
||||
async insertMmsPart(actionData, stringValue, callback) {
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_MMS_PART;
|
||||
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.insert(managerUri, stringValue).then(data => {
|
||||
callback(this.encapsulateReturnResult(data, common.int.SUCCESS));
|
||||
}).catch(error => {
|
||||
@ -530,13 +534,13 @@ export default class ConversationModel extends BaseModel {
|
||||
|
||||
async queryMessageLockBySessionId(actionData, callback) {
|
||||
var resultColumns = [mmsTable.messageInfo.isLock];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let sessionId = actionData.threadId + common.string.EMPTY_STR;
|
||||
condition.equalTo(mmsTable.messageInfo.sessionId, sessionId);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition).then(resultSet => {
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, condition, resultColumns).then(resultSet => {
|
||||
let lockStatus = [];
|
||||
while (resultSet.goToNextRow()) {
|
||||
let result: LooseObject = {};
|
||||
@ -552,13 +556,13 @@ export default class ConversationModel extends BaseModel {
|
||||
|
||||
async queryGroupIdBySessionId(actionData, callback) {
|
||||
var resultColumns = [mmsTable.messageInfo.groupId];
|
||||
let condition = new dataAbility.DataAbilityPredicates();
|
||||
let condition = new dataSharePredicates.DataSharePredicates();
|
||||
let threadIds = this.groupIdToString(actionData.threadIds);
|
||||
condition.in(mmsTable.messageInfo.sessionId, threadIds);
|
||||
let managerUri = common.string.URI_MESSAGE_LOG + common.string.URI_MESSAGE_INFO_TABLE;
|
||||
|
||||
let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, resultColumns, condition).then(resultSet => {
|
||||
let dataAbilityHelper = await dataShare.createDataShareHelper(globalThis.mmsContext, common.string.URI_MESSAGE_LOG);
|
||||
dataAbilityHelper.query(managerUri, condition, resultColumns).then(resultSet => {
|
||||
let groupIds = [];
|
||||
resultSet.goToFirstRow();
|
||||
do {
|
||||
|
@ -20,6 +20,7 @@ import DeviceUtil from "../../utils/DeviceUtil";
|
||||
import { Receive } from "../../views/receive/receive";
|
||||
import LooseObject from "../../data/LooseObject";
|
||||
import { MoreMenu } from "../../views/MmsMenu";
|
||||
import { MultiSimCardMenu } from '../../views/MultiSimCardMenu';
|
||||
import Common from "./common";
|
||||
import router from "@system.router";
|
||||
import WantUtil from "../../utils/WantUtil";
|
||||
@ -31,18 +32,19 @@ export struct Conversation {
|
||||
@StorageLink('curBp') curBp: string = 'sm'
|
||||
@State mConversationCtrl: ConversationController = ConversationController.getInstance();
|
||||
@State mCommonCtrl: Common = Common.getInstance();
|
||||
@State slotId: number = this.mConversationCtrl.getSelectedSlotId();
|
||||
private gridColumns: GridRowColumnOption = { sm: 4, md: 8, lg: 12 };
|
||||
private timeGirdSpan: GridColColumnOption = { sm: 4, md: 8, lg: 12 };
|
||||
private messageGirdSpan: GridColColumnOption = { sm: 4, md: 6, lg: 8 };
|
||||
private gridColOffset: GridColColumnOption = { sm: 0, md: 2, lg: 4 };
|
||||
private gridGutter: string = "24vp";
|
||||
private dialogGridCount: number = 4;
|
||||
private menuItems: Array<any> = [
|
||||
@Provide menuItems: Array<any> = [
|
||||
{
|
||||
value: $r("app.string.delete"),
|
||||
action: () => {
|
||||
this.mConversationCtrl.longPressMore(0);
|
||||
if (this.mConversationCtrl.mmsList.length == 1) {
|
||||
if(this.mConversationCtrl.mmsList.length == 1) {
|
||||
this.delConversionController.open();
|
||||
}
|
||||
},
|
||||
@ -267,9 +269,7 @@ export struct Conversation {
|
||||
})
|
||||
Blank().width($r("app.float.space_16"))
|
||||
Column() {
|
||||
MoreMenu({
|
||||
menuItems: this.menuItems
|
||||
})
|
||||
MoreMenu()
|
||||
}
|
||||
}
|
||||
.flexShrink(0)
|
||||
@ -702,16 +702,29 @@ export struct Conversation {
|
||||
Blank().width(16)
|
||||
|
||||
Row() {
|
||||
Row() {
|
||||
Image(this.mConversationCtrl.slotId == 0 ? $rawfile("icon/ic_message_card1.svg")
|
||||
: $rawfile("icon/ic_message_card2.svg"))
|
||||
.width(22)
|
||||
.height(22)
|
||||
Image($rawfile("icon/icon_down.svg"))
|
||||
.width(16)
|
||||
.height(22)
|
||||
}.visibility(this.mConversationCtrl.cardImage ? Visibility.Visible : Visibility.None)
|
||||
|
||||
MultiSimCardMenu ({
|
||||
cardImage: this.mConversationCtrl.cardImage,
|
||||
slotId: this.slotId,
|
||||
multiSimCardItems: [{
|
||||
img: $rawfile('icon/icon_mms_sim_card_1.svg'),
|
||||
operator: this.mConversationCtrl.spnOfSim1,
|
||||
mobileNumber: this.mConversationCtrl.telephonyNumberOfSim1,
|
||||
action: () => {
|
||||
this.slotId = 0;
|
||||
this.mConversationCtrl.slotId = 0;
|
||||
this.mConversationCtrl.setSelectedSlotId(0);
|
||||
}
|
||||
},{
|
||||
img: $rawfile('icon/icon_mms_sim_card_2.svg'),
|
||||
operator: this.mConversationCtrl.spnOfSim2,
|
||||
mobileNumber: this.mConversationCtrl.telephonyNumberOfSim2,
|
||||
action: () => {
|
||||
this.slotId = 1;
|
||||
this.mConversationCtrl.slotId = 1;
|
||||
this.mConversationCtrl.setSelectedSlotId(1);
|
||||
}
|
||||
}]
|
||||
})
|
||||
Row() {
|
||||
TextArea({
|
||||
placeholder: $r("app.string.msg_note_mms"),
|
||||
|
@ -87,10 +87,16 @@ export default class ConversationController {
|
||||
curSize: number = 0;
|
||||
// Recording Start Time
|
||||
startRecordTime: number = 0;
|
||||
// Whether the SIM card is contained
|
||||
haveSimCard: boolean = false;
|
||||
// Display Card Icon
|
||||
cardImage: boolean = false;
|
||||
// spn of sim1
|
||||
spnOfSim1: string = '';
|
||||
// spn of sim2
|
||||
spnOfSim2: string = '';
|
||||
// telephony number of sim1
|
||||
telephonyNumberOfSim1: string = '';
|
||||
// telephony number of sim2
|
||||
telephonyNumberOfSim2: string = '';
|
||||
// Airplane mode
|
||||
isFlightMode: boolean = false;
|
||||
// Information Attachment Size Tips
|
||||
@ -229,7 +235,7 @@ export default class ConversationController {
|
||||
mmsDateSet: Set<any> = new Set();
|
||||
photoFirstName: string = '';
|
||||
portraitColor: string = '';
|
||||
reg: string = /^[a-zA-Z]+$/;
|
||||
reg: RegExp = /^[a-zA-Z]+$/;
|
||||
scroller: Scroller = new Scroller();
|
||||
|
||||
static getInstance() {
|
||||
@ -255,13 +261,17 @@ export default class ConversationController {
|
||||
});
|
||||
this.scroller.scrollToIndex(this.mmsList.length - 1)
|
||||
}
|
||||
this.initSimCardData();
|
||||
}
|
||||
|
||||
onShow() {
|
||||
HiLog.i(TAG, "onShow");
|
||||
this.addSimChangeListener();
|
||||
// Determine whether a phone card is inserted.
|
||||
this.getSimState();
|
||||
if (MmsPreferences.getInstance().isMultiSimCardEnabled()) {
|
||||
this.cardImage = true;
|
||||
this.getMultiSimCardData();
|
||||
} else {
|
||||
this.cardImage = false;
|
||||
}
|
||||
// Check whether the Send button can be clicked.
|
||||
this.judgeSendBtnCanClicked();
|
||||
// // Obtains the status of canceling sending.
|
||||
@ -285,6 +295,41 @@ export default class ConversationController {
|
||||
// this.dataFromPick();
|
||||
}
|
||||
|
||||
getMultiSimCardData():void {
|
||||
// spn of sim1
|
||||
this.spnOfSim1 = this.getLocalSpnBySlotId(common.int.SIM_ONE);
|
||||
// spn of sim2
|
||||
this.spnOfSim2 = this.getLocalSpnBySlotId(common.int.SIM_TWO);
|
||||
// telephony number of sim1
|
||||
this.telephonyNumberOfSim1 = MmsPreferences.getInstance().getValueFromMap(common.string.KEY_OF_SIM_0_NUMBER,
|
||||
common.string.EMPTY_STR);
|
||||
// telephony number of sim2
|
||||
this.telephonyNumberOfSim2 = MmsPreferences.getInstance().getValueFromMap(common.string.KEY_OF_SIM_1_NUMBER,
|
||||
common.string.EMPTY_STR);
|
||||
}
|
||||
|
||||
getLocalSpnBySlotId(slotId:number) {
|
||||
let spn: string = common.string.EMPTY_STR;
|
||||
if (slotId == common.int.SIM_ONE) {
|
||||
spn = MmsPreferences.getInstance().getValueFromMap(common.string.KEY_OF_SIM_0_SPN, common.string.EMPTY_STR);
|
||||
} else if (slotId == common.int.SIM_TWO) {
|
||||
spn = MmsPreferences.getInstance().getValueFromMap(common.string.KEY_OF_SIM_1_SPN, common.string.EMPTY_STR);
|
||||
} else {
|
||||
HiLog.i(TAG, "getLocalSpnBySlotId, invalid slotId: " + slotId);
|
||||
return spn;
|
||||
}
|
||||
|
||||
let localSpn: string = spn;
|
||||
if (common.SPN_CHINA.MOBILE == spn) {
|
||||
localSpn = common.LOCAL_SPN_CHINA.MOBILE;
|
||||
} else if (common.SPN_CHINA.TELECOM == spn) {
|
||||
localSpn = common.LOCAL_SPN_CHINA.TELECOM;
|
||||
} else if (common.SPN_CHINA.UNICOM == spn) {
|
||||
localSpn = common.LOCAL_SPN_CHINA.UNICOM;
|
||||
}
|
||||
return localSpn;
|
||||
}
|
||||
|
||||
onHide() {
|
||||
HiLog.i(TAG, "onHide");
|
||||
this.unSubscribeDetail();
|
||||
@ -296,13 +341,19 @@ export default class ConversationController {
|
||||
HiLog.e(TAG, "getSimState, SIM_ONE error: " + JSON.stringify(err.message));
|
||||
} else {
|
||||
HiLog.i(TAG, "getSimState, SIM_ONE value: " + value);
|
||||
if (value == 0 || value == 1 || value == undefined) {
|
||||
this.haveSimCard = false;
|
||||
} else {
|
||||
this.haveSimCard = true;
|
||||
}
|
||||
let isSimCardExist:string = this.judgeSimCardExistBySimState(value);
|
||||
MmsPreferences.getInstance().setValueForSwitch(common.string.KEY_OF_SIM_0_EXIST_FLAG, isSimCardExist);
|
||||
this.initSendTip();
|
||||
}
|
||||
});
|
||||
telephonySim.getSimState(common.int.SIM_TWO, (err, value) => {
|
||||
if (err) {
|
||||
HiLog.e(TAG, "getSimState, SIM_TWO error: " + JSON.stringify(err.message));
|
||||
} else {
|
||||
HiLog.i(TAG, "getSimState, SIM_TWO value: " + value);
|
||||
let isSimCardExist:string = this.judgeSimCardExistBySimState(value);
|
||||
MmsPreferences.getInstance().setValueForSwitch(common.string.KEY_OF_SIM_1_EXIST_FLAG, isSimCardExist);
|
||||
this.initSendTip();
|
||||
HiLog.i(TAG, "haveSimCard1 = " + this.haveSimCard);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -312,17 +363,18 @@ export default class ConversationController {
|
||||
observer.on("simStateChange", {
|
||||
slotId: common.int.SIM_ONE
|
||||
}, data => {
|
||||
let simState = data.state;
|
||||
let isEffective: boolean;
|
||||
HiLog.i(TAG, "addSimChangeListener simState = " + simState);
|
||||
if (simState == 0 || simState == 1 || simState == undefined) {
|
||||
isEffective = false;
|
||||
} else {
|
||||
isEffective = true;
|
||||
}
|
||||
HiLog.i(TAG, "simState is = " + isEffective);
|
||||
MmsPreferences.getInstance().setValueForSwitch(common.string.KEY_OF_SIM_0_EXIST_FLAG, isEffective);
|
||||
this.haveSimCard = isEffective;
|
||||
HiLog.i(TAG, "addSimChangeListener sim1State = " + data.state);
|
||||
let isSimCardExist:string = this.judgeSimCardExistBySimState(data.state);
|
||||
MmsPreferences.getInstance().setValueForSwitch(common.string.KEY_OF_SIM_0_EXIST_FLAG, isSimCardExist);
|
||||
this.initSendTip();
|
||||
});
|
||||
|
||||
observer.on("simStateChange", {
|
||||
slotId: common.int.SIM_TWO
|
||||
}, data => {
|
||||
HiLog.i(TAG, "addSimChangeListener sim2State = " + data.state);
|
||||
let isSimCardExist:string = this.judgeSimCardExistBySimState(data.state);
|
||||
MmsPreferences.getInstance().setValueForSwitch(common.string.KEY_OF_SIM_1_EXIST_FLAG, isSimCardExist);
|
||||
this.initSendTip();
|
||||
});
|
||||
}
|
||||
@ -371,6 +423,15 @@ export default class ConversationController {
|
||||
this.slideDurations = arr;
|
||||
}
|
||||
|
||||
initSimCardData() {
|
||||
try {
|
||||
this.addSimChangeListener();
|
||||
this.getSimState();
|
||||
} catch(err) {
|
||||
HiLog.e(TAG,`Sim err = ${JSON.stringify(err)}`)
|
||||
}
|
||||
}
|
||||
|
||||
release() {
|
||||
this.textValue = '';
|
||||
this.receiveContactValue = '';
|
||||
@ -746,7 +807,7 @@ export default class ConversationController {
|
||||
let routerParams: LooseObject = router.getParams();
|
||||
if (routerParams.transmitFlag) {
|
||||
this.threadId = routerParams.threadId;
|
||||
this.slotId = common.int.SIM_ONE;
|
||||
//this.slotId = common.int.SIM_ONE;
|
||||
this.contactsNum = this.contactsNum;
|
||||
this.strContactsName = routerParams.strContactsName;
|
||||
this.strContactsNumber = routerParams.strContactsNumber;
|
||||
@ -765,7 +826,7 @@ export default class ConversationController {
|
||||
if(isSlideDetail) {
|
||||
// Indicates whether the currently edited message is an MMS message.
|
||||
this.isEditMms = true;
|
||||
this.mmsTransmitSend();
|
||||
//this.mmsTransmitSend();
|
||||
} else {
|
||||
this.generalTransmitSend();
|
||||
}
|
||||
@ -805,7 +866,7 @@ export default class ConversationController {
|
||||
// Initialize the data to be sent.
|
||||
this.initSendSms(content, msgUriPath, isMms, mmsSource);
|
||||
let actionData = {
|
||||
slotId: common.int.SIM_ONE,
|
||||
slotId: this.slotId,
|
||||
destinationHost: this.strContactsNumber,
|
||||
content: content,
|
||||
isEditMms: isMms
|
||||
@ -1320,7 +1381,7 @@ export default class ConversationController {
|
||||
// If the content is a draft, the draft content needs to be displayed.
|
||||
if (this.isDraft) {
|
||||
this.textValue = this.draftContent;
|
||||
this.canSendMessage = this.haveSimCard;
|
||||
this.canSendMessage = conversationService.judgeHasSimCard();
|
||||
// this.judgeFullScreenSend(this.textValue);
|
||||
}
|
||||
}
|
||||
@ -1383,8 +1444,8 @@ export default class ConversationController {
|
||||
this.msgSendTip = common.string.EMPTY_STR;
|
||||
return;
|
||||
} else {
|
||||
this.canSendMessage = this.haveSimCard && !this.isFlightMode;
|
||||
HiLog.i(TAG, "setSmsTip, canSendMessage=" + this.canSendMessage + ", haveSimCard=" + this.haveSimCard);
|
||||
this.canSendMessage = conversationService.judgeHasSimCard() && !this.isFlightMode;
|
||||
HiLog.i(TAG, "setSmsTip, canSendMessage=" + this.canSendMessage);
|
||||
}
|
||||
if (this.isNewMsg) {
|
||||
this.setCanSendMsgStatus();
|
||||
@ -2065,7 +2126,7 @@ export default class ConversationController {
|
||||
}
|
||||
// Check whether the sending icon can be highlighted.
|
||||
judgeSendBtnCanClicked() {
|
||||
if (this.haveSimCard &&
|
||||
if (conversationService.judgeHasSimCard() &&
|
||||
(this.mmsEditList.length != 0 ||
|
||||
this.textValue != common.string.EMPTY_STR ||
|
||||
this.textareaDatasource.length !== 0)) {
|
||||
@ -2098,6 +2159,7 @@ export default class ConversationController {
|
||||
|
||||
subscriberCallBack(err, data) {
|
||||
HiLog.i(TAG, "subscriberCallBack, start");
|
||||
globalThis.needToUpdate = true;
|
||||
// Receiving SMS Updates
|
||||
setTimeout(() => {
|
||||
this.queryMessageDetail(this.strContactsNumber, this.threadId, () => {
|
||||
@ -2399,6 +2461,7 @@ export default class ConversationController {
|
||||
let receiveContactValue = selectContacts.length > 0 ? common.string.EMPTY_STR : receiverData.contactValue;
|
||||
let hasBlur = receiverData.hasBlur;
|
||||
let telephone = common.string.EMPTY_STR;
|
||||
this.textValue = common.string.EMPTY_STR;
|
||||
this.setCanSendMessage(selectContacts, receiveContactValue)
|
||||
if (hasBlur && receiveContactValue != common.string.EMPTY_STR) {
|
||||
let index = -1;
|
||||
@ -2459,9 +2522,50 @@ export default class ConversationController {
|
||||
this.canSendMessage = false;
|
||||
}
|
||||
} else if ((selectContacts.length != 0 || receiveContactValue != common.string.EMPTY_STR)
|
||||
&& this.haveSimCard) {
|
||||
&& conversationService.judgeHasSimCard()) {
|
||||
this.canSendMessage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Judge sim card exist by sim state.
|
||||
*
|
||||
* @param simState
|
||||
*/
|
||||
judgeSimCardExistBySimState(simState:number):string {
|
||||
let isSimCardExist:string = common.bool.FALSE;
|
||||
if (simState == 0 || simState == 1 || simState == undefined) {
|
||||
isSimCardExist = common.bool.FALSE;
|
||||
} else {
|
||||
isSimCardExist = common.bool.TRUE;
|
||||
}
|
||||
return isSimCardExist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set selected slotId of sim card.
|
||||
*
|
||||
* @param slotId
|
||||
*/
|
||||
setSelectedSlotId(slotId:number):void {
|
||||
if (slotId != undefined) {
|
||||
MmsPreferences.getInstance().setValueForSwitch(common.string.KEY_OF_SELECTED_SLOTID, slotId.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get selected slotId of sim card.
|
||||
*/
|
||||
getSelectedSlotId():number {
|
||||
try {
|
||||
let slotId: number = parseInt(MmsPreferences.getInstance().getValueFromMap(
|
||||
common.string.KEY_OF_SELECTED_SLOTID, common.int.SIM_ONE.toString()));
|
||||
return slotId;
|
||||
} catch (e) {
|
||||
HiLog.e(TAG, 'getSelectedSlotId exception: ' + JSON.stringify(e));
|
||||
return common.int.SIM_ONE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -30,9 +30,33 @@ export default struct ConversationList {
|
||||
private dialogGridCount: number = 4;
|
||||
delDialogController: CustomDialogController = null;
|
||||
@State mIsMultipleSelectState: boolean = false;
|
||||
@Provide menuItems:any = [];
|
||||
|
||||
changeSelectState() {
|
||||
this.mIsMultipleSelectState = this.mConListCtrl.isMultipleSelectState;
|
||||
this.menuItems = [
|
||||
{
|
||||
value: $r("app.string.delete"),
|
||||
action: () => {
|
||||
this.mConListCtrl.showMultipleSelectView();
|
||||
},
|
||||
enabled: 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
|
||||
}
|
||||
@ -104,29 +128,7 @@ export default struct ConversationList {
|
||||
})
|
||||
})
|
||||
Column() {
|
||||
MoreMenu({
|
||||
menuItems: [
|
||||
{
|
||||
value: $r("app.string.delete"),
|
||||
action: () => {
|
||||
this.mConListCtrl.showMultipleSelectView();
|
||||
},
|
||||
enabled: 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
|
||||
}
|
||||
]
|
||||
})
|
||||
MoreMenu()
|
||||
}
|
||||
.margin({ left: $r("app.float.action_bar_space") })
|
||||
} else {
|
||||
@ -157,7 +159,7 @@ export default struct ConversationList {
|
||||
}.margin({ top: 8 })
|
||||
|
||||
// Unread Message
|
||||
Text($r("app.string.unread_messages", this.mConListCtrl.unreadTotal))
|
||||
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)
|
||||
|
@ -129,7 +129,8 @@ export default class ConversationListController {
|
||||
page: number = 0;
|
||||
// List pagination, quantity
|
||||
limit: number = 0;
|
||||
reg: string = /^[a-zA-Z]+$/;
|
||||
reg: RegExp = /^[a-zA-Z]+$/;
|
||||
delItem: number;
|
||||
// conversation list adapters
|
||||
conversationListDataSource: ConversationListDataSource = new ConversationListDataSource();
|
||||
|
||||
@ -478,6 +479,7 @@ export default class ConversationListController {
|
||||
}
|
||||
|
||||
deleteDialogCancel() {
|
||||
this.messageList[this.delItem].isCbChecked = false;
|
||||
// Cancel Ejection
|
||||
if (this.isSelectLockMsg) {
|
||||
this.isSelectLockMsg = false;
|
||||
@ -588,7 +590,7 @@ export default class ConversationListController {
|
||||
this.page++;
|
||||
this.queryAllMessages();
|
||||
} else {
|
||||
Hilog.i(TAG, "isLoading");
|
||||
HiLog.i(TAG, "isLoading");
|
||||
}
|
||||
}
|
||||
|
||||
@ -660,7 +662,6 @@ export default class ConversationListController {
|
||||
this.isSelectLockMsg = e.checked;
|
||||
}
|
||||
|
||||
|
||||
// Querying All Lists
|
||||
queryAllMessages() {
|
||||
HiLog.i(TAG, "queryAllMessages, start");
|
||||
@ -682,10 +683,8 @@ export default class ConversationListController {
|
||||
HiLog.i(TAG, "querySessionList code=" + result.code);
|
||||
if (result.code == common.int.SUCCESS) {
|
||||
let res = this.buildSessionList(result);
|
||||
if (res.length != 0) {
|
||||
this.messageList = this.messageList.concat(res);
|
||||
this.conversationListDataSource.refresh(this.messageList);
|
||||
}
|
||||
this.messageList = this.messageList.concat(res);
|
||||
this.conversationListDataSource.refresh(this.messageList);
|
||||
this.total = result.total;
|
||||
this.hasNoOrdinaryMsg = this.total == 0 ? true : false;
|
||||
this.hasInfoMsg = result.hasInfoMsg;
|
||||
@ -846,6 +845,7 @@ export default class ConversationListController {
|
||||
}
|
||||
|
||||
deleteAction(idx) {
|
||||
this.delItem = idx;
|
||||
let element = this.messageList[idx];
|
||||
this.strMsgDeleteDialogTip = $r("app.string.msg_delete_dialog_tip1");
|
||||
element.isCbChecked = true;
|
||||
|
@ -88,9 +88,9 @@ struct Index {
|
||||
*/
|
||||
async onPageShow() {
|
||||
WantUtil.getWant();
|
||||
await MmsPreferences.getInstance().initPreferences();
|
||||
this.mIndexCtrl.onShow();
|
||||
this.mConListCtrl.onShow();
|
||||
await MmsPreferences.getInstance().initPreferences();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,7 @@ import WantUtil from "../../utils/WantUtil";
|
||||
export default struct InfoMsg {
|
||||
@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";
|
||||
@ -56,7 +57,7 @@ export default struct InfoMsg {
|
||||
offset: this.dialogOffset,
|
||||
gridCount: this.dialogGridCount
|
||||
})
|
||||
private menuItems: Array<any> = [
|
||||
@Provide menuItems: Array<any> = [
|
||||
{
|
||||
value: $r("app.string.delete"),
|
||||
action: () => {
|
||||
@ -76,6 +77,7 @@ export default struct InfoMsg {
|
||||
|
||||
changeSelectState() {
|
||||
this.mIsMultipleSelectState = this.mInfoMsgCtrl.isMultipleSelectState
|
||||
this.misShowContactHeadIcon = this.mInfoMsgCtrl.isShowContactHeadIcon
|
||||
// @ts-ignore
|
||||
this.forceCompleteRerender(true) // recusvise
|
||||
}
|
||||
@ -217,13 +219,13 @@ export default struct InfoMsg {
|
||||
Stack({ alignContent: Alignment.Top }) {
|
||||
Column() {
|
||||
List({ initialIndex: 0 }) {
|
||||
LazyForEach(this.mInfoMsgCtrl.conversationListDataSource, (item, index) => {
|
||||
//A real list of information
|
||||
if (this.mInfoMsgCtrl.isSearchStatus) {
|
||||
if (this.mInfoMsgCtrl.isSearchStatus) {
|
||||
LazyForEach(this.mInfoMsgCtrl.conversationListDataSource, (item, index) => {
|
||||
//A real list of information
|
||||
ListItem() {
|
||||
MmsListItem({
|
||||
item: item,
|
||||
isShowHead: this.mInfoMsgCtrl.isShowContactHeadIcon,
|
||||
isShowHead: this.misShowContactHeadIcon,
|
||||
isMultipleSelectState: this.mIsMultipleSelectState,
|
||||
onClickHead: (event: ClickEvent) => {
|
||||
this.mInfoMsgCtrl.clickToGroupDetail(item.index);
|
||||
@ -258,11 +260,13 @@ export default struct InfoMsg {
|
||||
.width("100%")
|
||||
.height("64vp")
|
||||
.alignSelf(ItemAlign.Start)
|
||||
}
|
||||
}, item => JSON.stringify(item))
|
||||
}, item => JSON.stringify(item))
|
||||
}
|
||||
}
|
||||
.align(Alignment.Top)
|
||||
.cachedCount(this.mInfoMsgCtrl.limit)
|
||||
.edgeEffect(EdgeEffect.Spring)
|
||||
.width("100%")
|
||||
.divider({
|
||||
strokeWidth: 1,
|
||||
startMargin: this.mInfoMsgCtrl.isShowContactHeadIcon ? 52 : 12,
|
||||
@ -394,7 +398,6 @@ export default struct InfoMsg {
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
MoreMenu({
|
||||
menuItems: this.menuItems,
|
||||
menuText: $r("app.string.more")
|
||||
})
|
||||
}
|
||||
@ -414,6 +417,6 @@ export default struct InfoMsg {
|
||||
.height("100%")
|
||||
}
|
||||
}
|
||||
.margin({ left: this.gridMargin, right: this.gridMargin })
|
||||
.margin({ left: this.gridMargin })
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ import WantUtil from "../../../utils/WantUtil";
|
||||
@Entry
|
||||
@Component
|
||||
struct AdvancedSettings {
|
||||
@State mAdvancedSettingsCtrl: AdvancedSettingsController = AdvancedSettingsController.getInstance();
|
||||
@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 };
|
||||
@ -45,7 +45,7 @@ struct AdvancedSettings {
|
||||
}
|
||||
}
|
||||
});
|
||||
private menuItems: Array<any> = [
|
||||
@Provide menuItems: Array<any> = [
|
||||
{
|
||||
value: $r("app.string.restore_default_settings"),
|
||||
action: () => {
|
||||
@ -54,6 +54,10 @@ struct AdvancedSettings {
|
||||
enabled: true
|
||||
}
|
||||
];
|
||||
@Provide statusTitle: Resource = this.mAdvancedSettingsCtrl.deliveryReportSwitchInText;
|
||||
changeSelectState(){
|
||||
this.statusTitle = this.mAdvancedSettingsCtrl.deliveryReportSwitchInText
|
||||
}
|
||||
deliveryReportsDialogCtrl: CustomDialogController = new CustomDialogController({
|
||||
builder: DeliveryReportsDialog({
|
||||
cancel: () => {
|
||||
@ -134,9 +138,7 @@ struct AdvancedSettings {
|
||||
Row().width("100%").flexShrink(1)
|
||||
|
||||
Column() {
|
||||
MoreMenu({
|
||||
menuItems: this.menuItems
|
||||
})
|
||||
MoreMenu()
|
||||
}
|
||||
.margin({ right: $r("app.float.action_bar_margin_right") })
|
||||
}
|
||||
@ -154,7 +156,6 @@ struct AdvancedSettings {
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.delivery_reports"),
|
||||
secondaryTitle: $r("app.string.delivery_reports_hint"),
|
||||
statusTitle: this.mAdvancedSettingsCtrl.deliveryReportSwitchInText,
|
||||
showBottomDivider: false,
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
this.deliveryReportsDialogCtrl.open();
|
||||
@ -163,7 +164,7 @@ struct AdvancedSettings {
|
||||
// Automatically downloading MMs
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.auto_retrieve_mms"),
|
||||
statusTitle: this.mAdvancedSettingsCtrl.autoRetrieveMmsSwitchInText,
|
||||
// statusTitle: this.mAdvancedSettingsCtrl.autoRetrieveMmsSwitchInText,
|
||||
visibilityShow: Visibility.None,
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
this.mAdvancedSettingsCtrl.showAutoRetrieveMmsDialog();
|
||||
@ -240,6 +241,7 @@ struct AdvancedSettings {
|
||||
}
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.align(Alignment.Top)
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
@ -285,15 +287,14 @@ struct DeliveryReportsDialog {
|
||||
Toggle({ type: ToggleType.Checkbox, isOn: this.isOnOfSms })
|
||||
.width(20)
|
||||
.height(20)
|
||||
.enabled(false)
|
||||
.offset({ x: 16, y: 0 })
|
||||
.selectedColor($r("sys.color.ohos_id_color_activated"))
|
||||
.onChange((isOn: boolean) => {
|
||||
this.isOnOfSms = isOn
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.height(48)
|
||||
.onClick((event: ClickEvent) => {
|
||||
this.isOnOfSms = !this.isOnOfSms;
|
||||
})
|
||||
|
||||
Divider()
|
||||
.vertical(false)
|
||||
@ -315,15 +316,14 @@ struct DeliveryReportsDialog {
|
||||
Toggle({ type: ToggleType.Checkbox, isOn: this.isOnOfMms })
|
||||
.width(20)
|
||||
.height(20)
|
||||
.enabled(false)
|
||||
.offset({ x: 16, y: 0 })
|
||||
.selectedColor($r("sys.color.ohos_id_color_activated"))
|
||||
.onChange((isOn: boolean) => {
|
||||
this.isOnOfMms = isOn
|
||||
})
|
||||
}
|
||||
.width("100%")
|
||||
.height(48)
|
||||
.onClick((event: ClickEvent) => {
|
||||
this.isOnOfMms = !this.isOnOfMms;
|
||||
})
|
||||
|
||||
}
|
||||
.padding({ left: 24, right: 24, bottom: 9 })
|
||||
|
@ -30,7 +30,7 @@ export default class AdvancedSettingsController {
|
||||
// Value of Delivery Report Switch
|
||||
deliveryReportSwitch: string = common.DELIVERY_REPORTS.DISABLED;
|
||||
// Delivery Report Text
|
||||
deliveryReportSwitchInText: Resource | string = $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
|
||||
@ -51,6 +51,7 @@ export default class AdvancedSettingsController {
|
||||
firstSpnNameOfTwoSimCard: string = '';
|
||||
// If there are two cards, the carrier name of card 2 is the name of card 2.
|
||||
secondSpnNameOfTwoSimCard: string = '';
|
||||
refresh: boolean = false;
|
||||
|
||||
static getInstance() {
|
||||
if (AdvancedSettingsController.sInstance == null) {
|
||||
@ -101,7 +102,7 @@ export default class AdvancedSettingsController {
|
||||
// Returns the text version of the delivery report result based on an integer value
|
||||
returnDeliveryReportResultInText(intValue) {
|
||||
let tempValue;
|
||||
if (intValue == common.DELIVERY_REPORTS.DISABLED) {
|
||||
if (intValue == common.DELIVERY_REPORTS.DISABLED || intValue == '') {
|
||||
tempValue = $r("app.string.disabled");
|
||||
this.checkedValueOfSms = false;
|
||||
this.checkedValueOfMms = false;
|
||||
@ -119,6 +120,7 @@ export default class AdvancedSettingsController {
|
||||
this.checkedValueOfMms = true;
|
||||
}
|
||||
this.deliveryReportSwitchInText = tempValue;
|
||||
this.refresh = !this.refresh;
|
||||
}
|
||||
// Returns the text version of the delivery report result based on an integer value
|
||||
returnAutoRetrieveMmsResultInText(intValue) {
|
||||
|
@ -45,7 +45,7 @@ struct Settings {
|
||||
}
|
||||
}
|
||||
});
|
||||
private menuItems: Array<any> = [
|
||||
@Provide menuItems: Array<any> = [
|
||||
{
|
||||
value: $r("app.string.restore_default_settings"),
|
||||
action: () => {
|
||||
@ -54,6 +54,7 @@ struct Settings {
|
||||
enabled: true
|
||||
}
|
||||
];
|
||||
@Provide statusTitle: Resource = $r("app.string.enabled");
|
||||
|
||||
/**
|
||||
* The function executes after a new instance of the custom component is created and before its build function
|
||||
@ -122,9 +123,7 @@ struct Settings {
|
||||
Row().width("100%").flexShrink(1)
|
||||
|
||||
Column() {
|
||||
MoreMenu({
|
||||
menuItems: this.menuItems
|
||||
})
|
||||
MoreMenu()
|
||||
}
|
||||
.margin({ right: $r("app.float.action_bar_margin_right") })
|
||||
}
|
||||
@ -141,7 +140,6 @@ struct Settings {
|
||||
// Enhanced Information
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.enhanced_information"),
|
||||
statusTitle: $r("app.string.enabled"),
|
||||
visibilityShow: this.isEnhanceShow,
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
// The page for setting enhanced information is displayed.
|
||||
@ -151,7 +149,6 @@ struct Settings {
|
||||
// Intelligent information
|
||||
SettingItemJump({
|
||||
primaryTitle: $r("app.string.intelligent_information"),
|
||||
statusTitle: $r("app.string.enabled"),
|
||||
OnClick: (event?: ClickEvent) => {
|
||||
// The ringtone setting page is displayed.
|
||||
}
|
||||
@ -240,6 +237,7 @@ struct Settings {
|
||||
}
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.align(Alignment.Top)
|
||||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
|
@ -67,6 +67,9 @@ export default class SettingsController {
|
||||
// Notification information integration
|
||||
integration(isOn: boolean) {
|
||||
let messageCode = common.route.MESSAGE_CODE_UPDATE_ARCHIVE_INFO_MESSAGES_VALUE;
|
||||
if (this.integrationSwitch.value != isOn) {
|
||||
globalThis.needToUpdate = true;
|
||||
}
|
||||
let actionData: LooseObject = {};
|
||||
this.integrationSwitch.value = isOn;
|
||||
if (this.integrationSwitch.value) {
|
||||
@ -118,6 +121,7 @@ export default class SettingsController {
|
||||
that.integrationSwitch.value = true;
|
||||
that.maliciousWebSwitch = false;
|
||||
that.showContactSwitch = true;
|
||||
globalThis.needToUpdate = true;
|
||||
HiLog.i(TAG, "restoreSettingsPageSwitchValue, success");
|
||||
} else {
|
||||
HiLog.w(TAG, "restoreSettingsPageSwitchValue, failed");
|
||||
|
@ -88,7 +88,7 @@ export default class TransmitMsgController {
|
||||
// MMS list data
|
||||
mmsSource: Array<any> = [];
|
||||
transmitItemSources: Array<any> = [];
|
||||
reg: string = /^[a-zA-Z]+$/;
|
||||
reg: RegExp = /^[a-zA-Z]+$/;
|
||||
dialogMsg: LooseObject = {};
|
||||
DialogShow: false;
|
||||
transmitMsgDataSource: TransmitMsgDataSource = new TransmitMsgDataSource();
|
||||
|
@ -92,7 +92,7 @@ export default {
|
||||
} else {
|
||||
result.sendStatus = common.int.SEND_DRAFT;
|
||||
}
|
||||
result.subId = 0;
|
||||
result.subId = item.slotId;
|
||||
result.timeMillisecond = item.startTime;
|
||||
result.isMsm = item.msgType == 0 ? false : true;
|
||||
result.isCbChecked = false;
|
||||
|
@ -18,6 +18,7 @@ import common from "../data/commonData";
|
||||
import HiLog from "../utils/HiLog";
|
||||
import conversationService from "./ConversationService";
|
||||
|
||||
var notificationManager = globalThis.requireNapi("notificationManager");
|
||||
const label = "notification_";
|
||||
const TAG = "NotificationService";
|
||||
|
||||
@ -50,6 +51,10 @@ export default class NotificationService {
|
||||
notificationRequest.id = actionData.msgId;
|
||||
notificationRequest.label = label + actionData.msgId;
|
||||
notificationRequest.badgeNumber = Number(actionData.unreadTotal);
|
||||
if(Number(actionData.unreadTotal) >= 0){
|
||||
HiLog.i(TAG, `unreadTotal is: ${Number(actionData.unreadTotal)}`)
|
||||
notificationManager.setBadgeNumber(Number(actionData.unreadTotal));
|
||||
}
|
||||
Notification.publish(notificationRequest);
|
||||
HiLog.i(TAG, "sendNotify finished");
|
||||
});
|
||||
|
@ -37,13 +37,13 @@ export default {
|
||||
showContactSwitch: false,
|
||||
};
|
||||
mSettingModel.setOnSettingValueListener(settingValue => {
|
||||
if (settingValue.integrationSwitch === common.bool.TRUE) {
|
||||
if (settingValue.integrationSwitch === common.bool.TRUE || settingValue.integrationSwitch === '') {
|
||||
result.integrationSwitch = true;
|
||||
}
|
||||
if (settingValue.maliciousWebSwitch === common.bool.TRUE) {
|
||||
if (settingValue.maliciousWebSwitch === common.bool.TRUE || settingValue.integrationSwitch === '') {
|
||||
result.maliciousWebSwitch = true;
|
||||
}
|
||||
if (settingValue.showContactSwitch === common.bool.TRUE) {
|
||||
if (settingValue.showContactSwitch === common.bool.TRUE || settingValue.integrationSwitch === '') {
|
||||
result.showContactSwitch = true;
|
||||
}
|
||||
});
|
||||
@ -161,13 +161,16 @@ export default {
|
||||
mSettingModel.getSettingValue(settingValue => {
|
||||
if (settingValue.code === common.int.SUCCESS) {
|
||||
HiLog.i(TAG, "getSettingFlagForConvListPage, Success");
|
||||
if (settingValue.abilityResult.isShowContactHeadIcon === common.bool.TRUE) {
|
||||
if (settingValue.abilityResult.isShowContactHeadIcon === common.bool.TRUE ||
|
||||
settingValue.abilityResult.isShowContactHeadIcon === '') {
|
||||
result.isShowContactHeadIcon = true;
|
||||
}
|
||||
if (settingValue.abilityResult.hasAggregate == common.bool.TRUE) {
|
||||
if (settingValue.abilityResult.hasAggregate == common.bool.TRUE ||
|
||||
settingValue.abilityResult.hasAggregate === '') {
|
||||
result.hasAggregate = true;
|
||||
}
|
||||
if (settingValue.abilityResult.recallMessagesFlag == common.bool.TRUE) {
|
||||
if (settingValue.abilityResult.recallMessagesFlag == common.bool.TRUE ||
|
||||
settingValue.abilityResult.recallMessagesFlag === '') {
|
||||
result.recallMessagesFlag = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -68,7 +68,15 @@ export default {
|
||||
initSimCardNum() {
|
||||
cardModel.getSimCardNum();
|
||||
},
|
||||
|
||||
delSimMessage(actionData) {
|
||||
cardModel.delSimMessage(actionData);
|
||||
},
|
||||
|
||||
/**
|
||||
* Obtains the telephoneNumber from SIM cards.
|
||||
*/
|
||||
getSimTelephoneNumber() {
|
||||
cardModel.getSimTelephoneNumber();
|
||||
}
|
||||
}
|
@ -14,229 +14,282 @@
|
||||
*/
|
||||
|
||||
import common from "../data/commonData";
|
||||
import dataStorage from "@ohos.data.storage";
|
||||
import featureAbility from "@ohos.ability.featureAbility";
|
||||
import LooseObject from "../data/LooseObject";
|
||||
import HiLog from "./HiLog";
|
||||
|
||||
import createOrGet from "./SingleInstanceUtils";
|
||||
import preferences from "@ohos.data.preferences";
|
||||
|
||||
const TAG = "MmsPreferences";
|
||||
|
||||
/**
|
||||
* Obtaining a Lightweight Preference Database Instance
|
||||
*/
|
||||
export default class MmsPreferences {
|
||||
class MmsPreferences {
|
||||
private static sInstance: MmsPreferences;
|
||||
private mPref = null;
|
||||
private static sMap = new Map<string, string>();
|
||||
private preferences: preferences.Preferences = undefined;
|
||||
private static readonly PREFERENCES_Mms_FORM_STORE = 'MmsStore'
|
||||
|
||||
static getInstance() {
|
||||
getInstance():MmsPreferences {
|
||||
if (MmsPreferences.sInstance == null) {
|
||||
MmsPreferences.sInstance = new MmsPreferences();
|
||||
}
|
||||
return MmsPreferences.sInstance;
|
||||
}
|
||||
|
||||
async initPreferences() {
|
||||
if (this.mPref == null) {
|
||||
let context = globalThis.mmsContext;
|
||||
let path = await context.getFilesDir();
|
||||
this.mPref = await dataStorage.getStorage(path + common.string.PATH_OF_PREFERENCES);
|
||||
HiLog.i(TAG, "init preferences finish");
|
||||
public async initPreferences(): Promise<void> {
|
||||
if (this.preferences != undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.preferences = await preferences.getPreferences(globalThis.mmsContext,
|
||||
MmsPreferences.PREFERENCES_Mms_FORM_STORE);
|
||||
HiLog.i(TAG, `initPreferences sucess`);
|
||||
this.initMapData();
|
||||
} catch (err) {
|
||||
HiLog.i(TAG, `initPreferences err ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtaining Values
|
||||
*
|
||||
* @param {string} key value
|
||||
* Init data to map
|
||||
*/
|
||||
getValue(key) {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(key, common.string.EMPTY_STR);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + key + " fail.");
|
||||
initMapData() {
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_INTEGRATION_SWITCH);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_MALICIOUS_WEB_SWITCH);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_SHOW_CONTACT_SWITCH);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_DELIVERY_REPORT_SWITCH);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_AUTO_RETRIEVE_SWITCH);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_RECALL_MESSAGE_SWITCH);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_AUTO_DELETE_INFO_SWITCH);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_SIM_0_EXIST_FLAG);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_SIM_1_EXIST_FLAG);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_SIM_0_SPN);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_NEW_SIM_0_SMSC);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_NEW_SIM_1_SMSC);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_SIM_0_NUMBER);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_SIM_1_NUMBER);
|
||||
this.asyncGetValueFromPreferences(common.string.KEY_OF_SELECTED_SLOTID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value from preferences
|
||||
*/
|
||||
async getValueFromPreferences(key:string) {
|
||||
if (this.preferences == undefined) {
|
||||
HiLog.i(TAG, `getValueFromPreferences preferences is undefined`);
|
||||
return common.string.EMPTY_STR;
|
||||
}
|
||||
try {
|
||||
let value = await this.preferences.get(key, common.string.EMPTY_STR);
|
||||
HiLog.i(TAG, "getValueFromPreferences(" + key + "):" + value);
|
||||
this.setValueToMap(key, value.toString());
|
||||
return value;
|
||||
} catch (err) {
|
||||
HiLog.i(TAG, "getValueFromPreferences(" + key + ") failed with err: " + JSON.stringify(err))
|
||||
return common.string.EMPTY_STR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Async get value from preferences
|
||||
*/
|
||||
async asyncGetValueFromPreferences(key:string):Promise<string> {
|
||||
if (this.preferences == undefined) {
|
||||
HiLog.i(TAG, `asyncGetValueByKeyFromPreferences preferences is undefined`);
|
||||
return common.string.EMPTY_STR;
|
||||
}
|
||||
let getPromise = this.preferences.get(key, common.string.EMPTY_STR);
|
||||
getPromise.then((value) => {
|
||||
HiLog.i(TAG, "asyncGetValueFromPreferences(" + key + "):" + value);
|
||||
this.setValueToMap(key, value.toString());
|
||||
return value;
|
||||
}).catch((err) => {
|
||||
HiLog.i(TAG, "asyncGetValueFromPreferences(" + key + ") failed with err: " + JSON.stringify(err))
|
||||
return common.string.EMPTY_STR;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the value of the notification integration switch.
|
||||
*/
|
||||
getValueOfIntegrationSwitch() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_INTEGRATION_SWITCH, common.bool.TRUE);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_INTEGRATION_SWITCH + " fail.");
|
||||
return common.bool.TRUE;
|
||||
}
|
||||
getValueOfIntegrationSwitch():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_INTEGRATION_SWITCH, common.bool.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the value of the malicious URL identification switch.
|
||||
*/
|
||||
getValueOfMaliciousWebSwitch() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_MALICIOUS_WEB_SWITCH, common.bool.FALSE);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_MALICIOUS_WEB_SWITCH + " fail.");
|
||||
return common.bool.FALSE;
|
||||
}
|
||||
getValueOfMaliciousWebSwitch():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_MALICIOUS_WEB_SWITCH, common.bool.FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the value of the switch for displaying contact avatars.
|
||||
*/
|
||||
getValueOfShowContactSwitch() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_SHOW_CONTACT_SWITCH, common.bool.TRUE);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_SHOW_CONTACT_SWITCH + " fail.");
|
||||
return common.bool.TRUE;
|
||||
}
|
||||
getValueOfShowContactSwitch():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_SHOW_CONTACT_SWITCH, common.bool.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the value of the delivery report switch.
|
||||
*/
|
||||
getValueOfDeliveryReportSwitch() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_DELIVERY_REPORT_SWITCH, common.DELIVERY_REPORTS.DISABLED);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_DELIVERY_REPORT_SWITCH + " fail.");
|
||||
return common.DELIVERY_REPORTS.DISABLED;
|
||||
}
|
||||
getValueOfDeliveryReportSwitch():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_DELIVERY_REPORT_SWITCH, common.DELIVERY_REPORTS.DISABLED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the value of the function of automatically downloading MMS messages.
|
||||
*/
|
||||
getValueOfAutoRetrieveMmsSwitch() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_AUTO_RETRIEVE_SWITCH,
|
||||
common.AUTO_RETRIEVE_MMS.NOT_WHEN_ROAMING);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_AUTO_RETRIEVE_SWITCH + " fail.");
|
||||
return common.AUTO_RETRIEVE_MMS.NOT_WHEN_ROAMING;
|
||||
}
|
||||
getValueOfAutoRetrieveMmsSwitch():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_AUTO_RETRIEVE_SWITCH,
|
||||
common.AUTO_RETRIEVE_MMS.NOT_WHEN_ROAMING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the value of the send cancel switch.
|
||||
*/
|
||||
getValueOfRecallMessageSwitch() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_RECALL_MESSAGE_SWITCH, common.bool.FALSE);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_RECALL_MESSAGE_SWITCH + " fail.");
|
||||
return common.bool.FALSE;
|
||||
}
|
||||
getValueOfRecallMessageSwitch():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_RECALL_MESSAGE_SWITCH, common.bool.FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the value of the automatic deletion notification switch.
|
||||
*/
|
||||
getValueOfAutoDeleteInfoSwitch() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_AUTO_DELETE_INFO_SWITCH, common.bool.FALSE);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_AUTO_DELETE_INFO_SWITCH + " fail.");
|
||||
return common.bool.FALSE;
|
||||
}
|
||||
getValueOfAutoDeleteInfoSwitch():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_AUTO_DELETE_INFO_SWITCH, common.bool.FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the number of SIM cards.
|
||||
*/
|
||||
getCountOfSim() {
|
||||
getCountOfSim():number {
|
||||
let count = 0;
|
||||
if (this.getSim1ExistFlag() === common.bool.TRUE) {
|
||||
if (this.getValueFromMap(common.string.KEY_OF_SIM_0_EXIST_FLAG, common.bool.FALSE) === common.bool.TRUE) {
|
||||
count++;
|
||||
}
|
||||
if (this.getSim2ExistFlag() == common.bool.TRUE) {
|
||||
if (this.getValueFromMap(common.string.KEY_OF_SIM_1_EXIST_FLAG, common.bool.FALSE) === common.bool.TRUE) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the multicard is in place
|
||||
*/
|
||||
isMultiSimCardEnabled():boolean {
|
||||
if (this.getCountOfSim() === common.int.SIM_COUNT) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether SIM card 1 exists.
|
||||
*/
|
||||
getSim1ExistFlag() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_SIM_0_EXIST_FLAG, common.bool.FALSE);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_SIM_0_EXIST_FLAG + " fail.");
|
||||
return common.bool.FALSE;
|
||||
}
|
||||
getSim1ExistFlag():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_SIM_0_EXIST_FLAG, common.bool.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether SIM card 2 exists.
|
||||
*/
|
||||
getSim2ExistFlag() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_SIM_1_EXIST_FLAG, common.bool.FALSE);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_SIM_1_EXIST_FLAG + " fail.");
|
||||
return common.bool.FALSE;
|
||||
}
|
||||
getSim2ExistFlag():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_SIM_1_EXIST_FLAG, common.bool.FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the carrier name of SIM card 1.
|
||||
*/
|
||||
getSpnOfSim1() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_SIM_0_SPN, common.string.EMPTY_STR);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_SIM_0_SPN + " fail.");
|
||||
return common.string.EMPTY_STR;
|
||||
}
|
||||
getSpnOfSim1():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_SIM_0_SPN, common.string.EMPTY_STR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the carrier name of SIM card 2.
|
||||
*/
|
||||
getSpnOfSim2() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_SIM_1_SPN, common.string.EMPTY_STR);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_SIM_1_SPN + " fail.");
|
||||
return common.string.EMPTY_STR;
|
||||
}
|
||||
getSpnOfSim2():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_SIM_1_SPN, common.string.EMPTY_STR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the new SMSC number of SIM card 1. If the number has been changed,
|
||||
*/
|
||||
getNewSmscOfSim1() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_NEW_SIM_0_SMSC, common.string.EMPTY_STR);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_NEW_SIM_0_SMSC + " fail.");
|
||||
return common.string.EMPTY_STR;
|
||||
}
|
||||
getNewSmscOfSim1():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_NEW_SIM_0_SMSC, common.string.EMPTY_STR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the new SMSC number of SIM card 2. If the number has been changed,
|
||||
*/
|
||||
getNewSmscOfSim2() {
|
||||
if (this.mPref !== null) {
|
||||
return this.mPref.getSync(common.string.KEY_OF_NEW_SIM_1_SMSC, common.string.EMPTY_STR);
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, get " + common.string.KEY_OF_NEW_SIM_1_SMSC + " fail.");
|
||||
return common.string.EMPTY_STR;
|
||||
}
|
||||
getNewSmscOfSim2():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_NEW_SIM_1_SMSC, common.string.EMPTY_STR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a value for
|
||||
* Obtain the telephone number of SIM card 1.
|
||||
*/
|
||||
setValueForSwitch(keyOfSwitch, valueOfSwitch) {
|
||||
if (this.mPref !== null) {
|
||||
this.mPref.putSync(keyOfSwitch, valueOfSwitch);
|
||||
this.mPref.flushSync();
|
||||
} else {
|
||||
HiLog.w(TAG, "mPref is null, set " + keyOfSwitch + " fail.");
|
||||
}
|
||||
getTelephoneNumberOfSim1():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_SIM_0_NUMBER, common.string.EMPTY_STR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the telephone number of SIM card 2.
|
||||
*/
|
||||
getTelephoneNumberOfSim2():string {
|
||||
return this.getValueFromMap(common.string.KEY_OF_SIM_1_NUMBER, common.string.EMPTY_STR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a value to preferences
|
||||
*
|
||||
* @param keyOfSwitch
|
||||
* @param valueOfSwitch
|
||||
*/
|
||||
setValueForSwitch(keyOfSwitch: string, valueOfSwitch: string): void {
|
||||
this.setValueToMap(keyOfSwitch, valueOfSwitch);
|
||||
if (this.preferences == undefined) {
|
||||
HiLog.i(TAG, `setValueForSwitch preferences is undefined`);
|
||||
return
|
||||
}
|
||||
let putPromise = this.preferences.put(keyOfSwitch, valueOfSwitch);
|
||||
putPromise.then(() => {
|
||||
HiLog.i(TAG, "setValueForSwitch key: " + keyOfSwitch + ",value: " + valueOfSwitch + " success");
|
||||
this.preferences.flush();
|
||||
}).catch((err) => {
|
||||
HiLog.i(TAG, `setValueForSwitch failed with err: ${err}`);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value from map by key
|
||||
*
|
||||
* @param key
|
||||
* @param defaultValue
|
||||
*/
|
||||
getValueFromMap(key: string, defaultValue: string): string {
|
||||
let value = MmsPreferences.sMap.get(key);
|
||||
if (value == undefined || value == null) {
|
||||
value = defaultValue;
|
||||
}
|
||||
HiLog.i(TAG, "getValueFromMap key: " + key + ",value: " + value);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set key-value to map
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
setValueToMap(key: string, value: string): void {
|
||||
HiLog.i(TAG, "setValueToMap key: " + key + ",value: " + value);
|
||||
MmsPreferences.sMap.set(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
let dataStore = createOrGet(MmsPreferences, TAG);
|
||||
|
||||
export default dataStore as MmsPreferences;
|
22
entry/src/main/ets/utils/SingleInstanceUtils.ts
Normal file
22
entry/src/main/ets/utils/SingleInstanceUtils.ts
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* 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,
|
||||
* 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";
|
||||
|
||||
export default function createOrGet<T>(objectClass: { new(): T }, storageKey: string): T {
|
||||
if (!globalThis[storageKey]) {
|
||||
globalThis[storageKey] = new objectClass();
|
||||
}
|
||||
return globalThis[storageKey];
|
||||
}
|
@ -20,7 +20,7 @@ import DeviceUtil from "../utils/DeviceUtil";
|
||||
@Component
|
||||
export struct MoreMenu {
|
||||
@StorageLink('curBp') curBp: string = 'sm'
|
||||
private menuItems: Array<any>;
|
||||
@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");
|
||||
|
90
entry/src/main/ets/views/MultiSimCardMenu.ets
Normal file
90
entry/src/main/ets/views/MultiSimCardMenu.ets
Normal file
@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* 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,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Custom multi-SimCard pop-up menu
|
||||
*/
|
||||
@Component
|
||||
export struct MultiSimCardMenu {
|
||||
@Prop slotId: number;
|
||||
private cardImage: boolean;
|
||||
private multiSimCardItems: Array<any>;
|
||||
|
||||
@Builder PopupBuilder() {
|
||||
Column() {
|
||||
List() {
|
||||
ForEach(this.multiSimCardItems, (item, index) => {
|
||||
ListItem() {
|
||||
Button({type: ButtonType.Normal}) {
|
||||
Column(){
|
||||
Row() {
|
||||
Image(item.img)
|
||||
.width(15)
|
||||
.height(18)
|
||||
Text(item.operator)
|
||||
.fontSize('16vp')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r("sys.color.ohos_id_color_text_primary"))
|
||||
.padding({ left: 2 })
|
||||
}
|
||||
Text(item.mobileNumber)
|
||||
.padding({ left: 19, top: 2 })
|
||||
.fontSize('14vp')
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.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"))
|
||||
.width('100%')
|
||||
.height('64vp')
|
||||
.onClick(() => {
|
||||
item.action();
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
.listDirection(Axis.Vertical)
|
||||
.divider({
|
||||
strokeWidth: 0.5,
|
||||
color: $r("sys.color.ohos_id_color_list_separator"),
|
||||
startMargin: 17,
|
||||
endMargin: 17
|
||||
})
|
||||
.edgeEffect(EdgeEffect.Spring)
|
||||
.chainAnimation(false)
|
||||
.width('170vp')
|
||||
.height('136vp')
|
||||
.borderRadius(16)
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
if (this.cardImage) {
|
||||
Row() {
|
||||
Image(this.slotId == 0 ? $rawfile("icon/ic_message_card1.svg") : $rawfile("icon/ic_message_card2.svg"))
|
||||
.width(22)
|
||||
.height(22)
|
||||
Image($rawfile("icon/icon_down.svg"))
|
||||
.width(16)
|
||||
.height(22)
|
||||
}
|
||||
.bindMenu(this.PopupBuilder)
|
||||
}
|
||||
}
|
||||
}
|
@ -99,7 +99,7 @@ export struct SettingItemSwitch {
|
||||
export struct SettingItemJump {
|
||||
primaryTitle: string | Resource;
|
||||
secondaryTitle ?: string | Resource;
|
||||
private statusTitle ?: string | Resource = "";
|
||||
@Consume statusTitle : Resource;
|
||||
showBottomDivider ?: boolean = false;
|
||||
visibilityShow ?: Visibility = Visibility.Visible;
|
||||
OnClick: (event?: ClickEvent) => void;
|
||||
|
@ -51,7 +51,6 @@ export struct Receive {
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.fontSize(12)
|
||||
.flexShrink(1)
|
||||
.constraintSize({ minWidth: 50 })
|
||||
}
|
||||
if (item.contactName != "" && item.contactName != null) {
|
||||
Text(item.contactName)
|
||||
@ -60,7 +59,6 @@ export struct Receive {
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.fontSize(12)
|
||||
.flexShrink(1)
|
||||
.constraintSize({ minWidth: 50 })
|
||||
}
|
||||
if (item.select) {
|
||||
Image($rawfile("icon/ic_public_cancel.svg"))
|
||||
@ -75,7 +73,7 @@ export struct Receive {
|
||||
.borderRadius(24)
|
||||
.height(28)
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.constraintSize({ maxWidth: item.select ? 236 : 220 ,minWidth: 60})
|
||||
.constraintSize({ maxWidth: item.select ? 244 : 228 ,minWidth: 68})
|
||||
.onClick(() => {
|
||||
this.mReceiveController.nameClick(index, (receiverData) => {
|
||||
this.mConversationController.setReceiveContactValue(receiverData);
|
||||
|
@ -258,7 +258,7 @@ export default class ReceiveController {
|
||||
if (this.checkSingle()) {
|
||||
return;
|
||||
}
|
||||
if (curItem.telephone.toString().trim() == "") {
|
||||
if (curItem != undefined && curItem.telephone != undefined && curItem.telephone.toString().trim() == "") {
|
||||
prompt.showToast({
|
||||
// Invalid Recipient
|
||||
// @ts-ignore
|
||||
@ -333,7 +333,8 @@ export default class ReceiveController {
|
||||
let item = this.selectContacts.splice(idx, 1);
|
||||
// Deleted items are added to the collection to be searched.
|
||||
this.contactsTemp.push(item);
|
||||
if (item[0].telephoneFormat.toString().trim() != "") {
|
||||
if (item[0] != undefined && item[0].telephoneFormat != undefined &&
|
||||
item[0].telephoneFormat.toString().trim() != "") {
|
||||
this.contacts.push(item[0]);
|
||||
}
|
||||
this.refresh = !this.refresh;
|
||||
|
@ -11,6 +11,10 @@
|
||||
{
|
||||
"name": "ic_user_head_color",
|
||||
"value": "#99007dff"
|
||||
},
|
||||
{
|
||||
"name": "light_background_color",
|
||||
"value": "#19000000"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>SD1</title>
|
||||
<defs>
|
||||
<path d="M10.009,0.666666667 L14,4.65666667 L14,12.6666667 C14,14.139426 12.8060927,15.3333333 11.3333333,15.3333333 L4.66666667,15.3333333 C3.19390733,15.3333333 2,14.139426 2,12.6666667 L2,3.33333333 C2,1.860574 3.19390733,0.666666667 4.66666667,0.666666667 L10.009,0.666666667 Z M9,4 L7.82264151,4 L6.33333333,5.18032787 L6.33333333,6.90710383 L7.57106918,5.93442623 L7.57106918,12 L9,12 L9,4 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="SD1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill-opacity="0.4" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>SD2</title>
|
||||
<defs>
|
||||
<path d="M10.009,0.666666667 L14,4.65666667 L14,12.6666667 C14,14.139426 12.8060927,15.3333333 11.3333333,15.3333333 L4.66666667,15.3333333 C3.19390733,15.3333333 2,14.139426 2,12.6666667 L2,3.33333333 C2,1.860574 3.19390733,0.666666667 4.66666667,0.666666667 L10.009,0.666666667 Z M8.09264305,4 C6.95912807,4 6.27247956,4.67615897 6.03269755,6.0296275 L6.03269755,6.0296275 L7.30790191,6.72726401 C7.38769949,6.26933218 7.47489295,5.93796443 7.56948229,5.7339278 C7.66368237,5.52989117 7.78746594,5.42787286 7.9400545,5.42787286 C8.04904632,5.42787286 8.12884391,5.47811496 8.17983651,5.57821564 C8.23043986,5.67869984 8.25613079,5.83632964 8.25613079,6.05072151 C8.25613079,6.33721655 8.20163488,6.62332806 8.09264305,6.9098231 C7.98365123,7.19631814 7.77267419,7.62586893 7.46049046,8.19847548 L7.46049046,8.19847548 L6,10.8509516 L6,12 L10,12 L10,10.6254375 L7.85286104,10.6254375 L8.79019074,8.8431852 C9.1969638,8.06270675 9.47839626,7.46862266 9.63487738,7.06016588 C9.79096925,6.65247615 9.86920981,6.25130639 9.86920981,5.85742365 C9.86920981,5.29210413 9.72207084,4.84107579 9.42779292,4.50433865 C9.13351499,4.16798504 8.68820553,4 8.09264305,4 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="SD2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#64BB5C" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in New Issue
Block a user