@ -65,6 +65,18 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "simcardmanagement",
|
||||
"srcPath": "./simcardmanagement",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"applyToProducts": [
|
||||
"default"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import Ability from '@ohos.app.ability.UIAbility'
|
||||
import Window from '@ohos.window'
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
import { closeKVStore } from '../common/utils/KvManager'
|
||||
|
||||
const TAG = "MainAbility";
|
||||
|
||||
@ -11,6 +12,7 @@ export default class MainAbility extends Ability {
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
closeKVStore();
|
||||
LogUtils.i(TAG, "onDestroy")
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,67 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
import LogUtils from '../utils/LogUtils'
|
||||
|
||||
const TAG = "HeadComponent"
|
||||
|
||||
/**
|
||||
* head custom component
|
||||
*/
|
||||
@Component
|
||||
export default struct HeadComponent {
|
||||
@State isTouch: boolean = false;
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Stack({ alignContent: Alignment.Center }) {
|
||||
Image($r('app.media.ic_back'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
}
|
||||
.margin({ right: 16 })
|
||||
.backgroundColor(this.isTouch ? $r('app.color.color_E3E3E3_grey') : $r('app.color.color_00000000_transparent'))
|
||||
.onClick(() => {
|
||||
globalThis.settingsAbilityContext?.terminateSelf().then((data) => {
|
||||
LogUtils.i(TAG, "terminateSelfCallBack");
|
||||
});
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouch = false;
|
||||
}
|
||||
});
|
||||
|
||||
Text($r('app.string.mobile_data'))
|
||||
.fontSize(20)
|
||||
.lineHeight(33)
|
||||
.fontFamily('HarmonyHeiTi-Bold')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('app.color.font_color_182431'))
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({ top: 13, bottom: 15 });
|
||||
}
|
||||
.width("100%")
|
||||
.padding({ left: 12 })
|
||||
.height(56)
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.align(Alignment.Start)
|
||||
}
|
||||
}
|
@ -0,0 +1,206 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
import publiccontent from '../publiccontent'
|
||||
import router from '@system.router';
|
||||
import call from '@ohos.telephony.call';
|
||||
import { enableCellularDataRoaming, disableCellularDataRoaming } from '../../../model/mobileDataStatus';
|
||||
import { setCache } from '../../utils/KvManager';
|
||||
import LogUtils from '../../utils/LogUtils'
|
||||
|
||||
const TAG = "ListItem"
|
||||
|
||||
@Component
|
||||
export default struct listItem {
|
||||
@Prop isCard: boolean;
|
||||
@Prop isBtn: boolean;
|
||||
@Prop isDisabled: boolean;
|
||||
@Prop LastOne: boolean;
|
||||
@Prop Controlswitch: boolean;
|
||||
@State title: any = '';
|
||||
@State describe: any = '';
|
||||
@Prop isSupport: boolean;
|
||||
@State titleopacity: boolean = false;
|
||||
@Prop isCon: number;
|
||||
@State ceshi: boolean = true;
|
||||
dialogTitle: string = '';
|
||||
radio_state_enable5g = 'RADIO_STATE_ENABLE5G';
|
||||
recordTypeDialog: CustomDialogController = new CustomDialogController({
|
||||
builder: dataRomingDialog({ isCon: this.isCon, isMsg: $Controlswitch }),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: false,
|
||||
offset: { dx: 0, dy: -10 }
|
||||
})
|
||||
|
||||
clickHandle() {
|
||||
if (this.isCon == 6) {
|
||||
router.push({
|
||||
uri: 'pages/senior'
|
||||
})
|
||||
};
|
||||
if (this.isCon === 5) {
|
||||
router.push({
|
||||
uri: 'pages/availableNetwork'
|
||||
})
|
||||
};
|
||||
if (this.isCon == 2) {
|
||||
router.push({
|
||||
uri: 'pages/apnPages'
|
||||
})
|
||||
};
|
||||
};
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Row({}) {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text(this.title)
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor('#000')
|
||||
.opacity(this.Controlswitch ? 0.9 : 0.6)
|
||||
.visibility(this.isSupport ? Visibility.None : Visibility.Visible)
|
||||
.letterSpacing(1)
|
||||
.lineHeight(22)
|
||||
.textAlign(TextAlign.Start)
|
||||
Text(this.describe)
|
||||
.margin({ top: 2 })
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.fontSize(14)
|
||||
.fontColor('#555')
|
||||
.opacity(0.6)
|
||||
.lineHeight(19)
|
||||
.letterSpacing(1)
|
||||
.visibility(this.describe == '' ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
.width('100%')
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.margin({ right: 26 })
|
||||
.onClick(() => {
|
||||
LogUtils.i(TAG, "onclick clickHandle")
|
||||
this.clickHandle()
|
||||
})
|
||||
.enabled(this.isDisabled)
|
||||
|
||||
Image($r('app.media.right'))
|
||||
.width(16)
|
||||
.height(18)
|
||||
.visibility(!this.isBtn ? Visibility.Visible : Visibility.None)
|
||||
Toggle({ type: ToggleType.Switch, isOn: this.Controlswitch })
|
||||
.width(36)
|
||||
.height(20)
|
||||
.enabled(this.isDisabled)
|
||||
.onChange((isOn: boolean) => {
|
||||
this.Controlswitch = !this.Controlswitch;
|
||||
if (this.isCon == 1) {
|
||||
setCache(this.radio_state_enable5g, isOn);
|
||||
}
|
||||
if (this.Controlswitch && this.isCon == 0) {
|
||||
this.dialogTitle = this.title;
|
||||
this.recordTypeDialog.open();
|
||||
} else if (this.Controlswitch == false && this.isCon == 0) {
|
||||
disableCellularDataRoaming().then((data) => {
|
||||
LogUtils.i(TAG, "disableCellularDataRoaming:then" + JSON.stringify(data))
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "disableCellularDataRoaming:catch" + JSON.stringify(error))
|
||||
});
|
||||
}
|
||||
if (this.isCon == 22 && this.Controlswitch) {
|
||||
call.enableImsSwitch(0);
|
||||
} else if (this.isCon == 22 && this.Controlswitch == false) {
|
||||
call.disableImsSwitch(0);
|
||||
}
|
||||
})
|
||||
.visibility(this.isBtn ? Visibility.Visible : Visibility.None)
|
||||
}.visibility(this.isSupport ? Visibility.None : Visibility.Visible)
|
||||
}
|
||||
}
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"))
|
||||
.opacity(this.isDisabled ? 1 : 0.4)
|
||||
.margin({ top: 10, bottom: this.isSupport ? 5 : 11 })
|
||||
.onClick(() => {
|
||||
if (!this.isDisabled) {
|
||||
return;
|
||||
} else {
|
||||
this.clickHandle();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
struct dataRomingDialog {
|
||||
controller: CustomDialogController;
|
||||
isCon: number;
|
||||
@Link isMsg: boolean;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Column() {
|
||||
Text($r('app.string.mobile_data_tips'))
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.height(56)
|
||||
.align(Alignment.Center)
|
||||
Text($r('app.string.mobile_data_turn_on_data_roaming'))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.textAlign(TextAlign.Start)
|
||||
.height(56)
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.letterSpacing(3)
|
||||
.visibility(this.isCon == 0 ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
|
||||
Flex({ justifyContent: FlexAlign.SpaceAround }) {
|
||||
Text(publiccontent.strings.cancel)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonnyHeiTi")
|
||||
.lineHeight(21)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
.fontSize(16)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
this.isMsg = false;
|
||||
})
|
||||
Divider().vertical(true).height(1).strokeWidth(1).lineCap(LineCapStyle.Round).opacity(0.5)
|
||||
|
||||
Text(publiccontent.strings.confirm)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonnyHeiTi")
|
||||
.lineHeight(21)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
.fontSize(16)
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
this.isMsg = true;
|
||||
enableCellularDataRoaming().then((data) => {
|
||||
LogUtils.i(TAG, "enableCellularDataRoaming:then" + JSON.stringify(data))
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "enableCellularDataRoaming:catch" + JSON.stringify(error))
|
||||
});
|
||||
})
|
||||
}
|
||||
.margin({ top: 18 })
|
||||
}
|
||||
.height(183)
|
||||
.padding({ left: 24, right: 24 })
|
||||
.borderRadius(20)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
export default {
|
||||
"strings": {
|
||||
"mobileData": $r('app.string.mobile_data'),
|
||||
"general": $r('app.string.mobile_data_general'),
|
||||
"dataUsageFeesMayApply": $r('app.string.mobile_data_charges'),
|
||||
"dataRoaming": $r('app.string.mobile_data_dataRoaming'),
|
||||
"enableDataWhileRoaming": $r('app.string.mobile_data_enableDataWhileRoaming'),
|
||||
"notice": $r('app.string.mobile_data_tips'),
|
||||
"dataRoamingAsk": $r('app.string.mobile_data_turn_on_data_roaming'),
|
||||
"cancel": $r('app.string.cancel_space'),
|
||||
"confirm":$r('app.string.confim_space'),
|
||||
"netFive": $r('app.string.mobile_data_netFive'),
|
||||
"voCall": $r('app.string.mobile_data_volte'),
|
||||
"accessPointNamesAPN": $r('app.string.mobile_data_accessPointNamesAPN'),
|
||||
"sim1": $r('app.string.mobile_data_card1'),
|
||||
"sim2": $r('app.string.mobile_data_card2'),
|
||||
"preferredNetworkMode": $r('app.string.mobile_data_networkMode'),
|
||||
"networkProvider": $r('app.string.mobile_data_networkProvider'),
|
||||
"fiveAuto": $r('app.string.mobile_data_fiveAuto'),
|
||||
"fourAuto": $r('app.string.mobile_data_fourAuto'),
|
||||
"threeAuto": $r('app.string.mobile_data_threeAuto'),
|
||||
"twoOnly": $r('app.string.mobile_data_twoOnly'),
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
@Component
|
||||
export struct SubHeader {
|
||||
@State titleContent: any = '';
|
||||
@Prop subTitleContent: string;
|
||||
|
||||
titleContenet() {
|
||||
return this.titleContenet()
|
||||
}
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Text(this.titleContent)
|
||||
.fontSize(14)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Text(this.subTitleContent)
|
||||
.fontSize(14)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
.width("100%")
|
||||
.height(48)
|
||||
.alignItems(VerticalAlign.Bottom)
|
||||
.padding({
|
||||
bottom: 9,
|
||||
top: 19.5,
|
||||
left: $r('sys.float.ohos_id_card_margin_start'),
|
||||
right: $r("sys.float.ohos_id_card_margin_end")
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: mobileData constants
|
||||
*/
|
||||
|
||||
const ON_SIM_STATE_UPDATE_PULL = '1';
|
||||
const ON_SIM_STATE_UPDATE_INSERT = '4';
|
||||
|
||||
const networkStateObj = {
|
||||
NETWORK_FIVE: 0,
|
||||
NETWORK_FOUR: 4,
|
||||
NETWORK_THREE: 6,
|
||||
NETWORK_TWO: 1
|
||||
};
|
||||
|
||||
const simStateObj = {
|
||||
SIM_STATE_UNKNOWN: 0,
|
||||
SIM_STATE_NOT_PRESENT: 1,
|
||||
SIM_STATE_LOCKED: 2,
|
||||
SIM_STATE_NOT_READY: 3,
|
||||
SIM_STATE_READY: 4,
|
||||
SIM_STATE_LOADED: 5
|
||||
};
|
||||
const MOBILE_DATA_STATUS = {
|
||||
DATA_STATE_UNKNOWN: -1,
|
||||
DATA_STATE_DISCONNECTED: 0,
|
||||
DATA_STATE_CONNECTING: 1,
|
||||
DATA_STATE_CONNECTED: 2,
|
||||
DATA_STATE_SUSPENDED: 3
|
||||
}
|
||||
|
||||
export {
|
||||
networkStateObj,
|
||||
simStateObj,
|
||||
ON_SIM_STATE_UPDATE_PULL,
|
||||
ON_SIM_STATE_UPDATE_INSERT,
|
||||
MOBILE_DATA_STATUS
|
||||
};
|
27
mobiledatasettings/src/main/ets/common/model/api.ets
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: SIM card,mobile data,Card Status,Operators so
|
||||
*/
|
||||
|
||||
import sim from '@ohos.telephony.sim';
|
||||
import telephonyData from '@ohos.telephony.data';
|
||||
import observer from '@ohos.telephony.observer';
|
||||
import radio from '@ohos.telephony.radio';
|
||||
|
||||
export { sim, telephonyData, radio, observer };
|
||||
|
||||
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: Move data interface call
|
||||
*/
|
||||
|
||||
import { telephonyData } from './api';
|
||||
import radio from '@ohos.telephony.radio';
|
||||
import LogUtils from '../utils/LogUtils'
|
||||
|
||||
const TAG = "getCellularDataRomingEnabledApi"
|
||||
/**
|
||||
* Whether to enable cellular data roaming
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function isCellularDataRoamingEnabled(slotId = 0) {
|
||||
return telephonyData.isCellularDataRoamingEnabled(slotId);
|
||||
}
|
||||
|
||||
export function getSupportNetwork(slotId = 0) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
let isSupported = radio.isNrSupported();
|
||||
LogUtils.i(TAG, "getSupportNetwork success data:" + JSON.stringify(isSupported))
|
||||
resolve(isSupported);
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getSupportNetwork success catch:" + JSON.stringify(error))
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Enabling Data Roaming
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function enableCellularDataRoaming(slotId = 0) {
|
||||
return telephonyData.enableCellularDataRoaming(slotId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enabling Data Roaming
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function disableCellularDataRoaming(slotId = 0) {
|
||||
return telephonyData.disableCellularDataRoaming(slotId);
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: Network mode interface
|
||||
*/
|
||||
import {radio} from './api';
|
||||
import LogUtils from '../utils/LogUtils'
|
||||
|
||||
const TAG = "getPreferredNetworkModelApi"
|
||||
|
||||
/**
|
||||
* Get the preferred network mode
|
||||
*
|
||||
* @param {string} val - card The slot id
|
||||
* @return {Promise} promise object
|
||||
*/
|
||||
export function getPreferredNetwork(val) {
|
||||
return new Promise((resolve) => {
|
||||
radio.getPreferredNetwork(val).then((res) => {
|
||||
LogUtils.i(TAG, "getPreferredNetwork success data then:" + JSON.stringify(res))
|
||||
resolve(res);
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, "getPreferredNetwork success catch:" + JSON.stringify(err))
|
||||
});
|
||||
});
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: Obtaining card status
|
||||
*/
|
||||
|
||||
import { sim } from './api';
|
||||
import LogUtils from '../utils/LogUtils'
|
||||
|
||||
const TAG = "GetSimStateApi"
|
||||
|
||||
/**
|
||||
* Get cardOne status
|
||||
*
|
||||
* @param {number} slotId - return card The slot id
|
||||
* @return {Promise} promise object
|
||||
*/
|
||||
export function getSimStateCardOne(slotId = 0) {
|
||||
if (sim.getSimState) {
|
||||
return sim.getSimState(slotId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cardTwo status
|
||||
*
|
||||
* @param {string} slotId - card The slot id
|
||||
* @return {Promise} promise object
|
||||
*/
|
||||
export function getSimStateCardTwo(slotId = 1) {
|
||||
if (sim.getSimState) {
|
||||
return sim.getSimState(slotId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: Interface for obtaining the card number
|
||||
*/
|
||||
|
||||
import { sim } from './api';
|
||||
|
||||
/**
|
||||
* Get cardOnePhoneNumber
|
||||
*
|
||||
* @param {number} slotId - Returns the id
|
||||
* @return {Promise} promise object
|
||||
*/
|
||||
export function getSimCardOnePhoneNumber(slotId = 0) {
|
||||
if (sim.getSimTelephoneNumber) {
|
||||
return sim.getSimTelephoneNumber(slotId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cardTwoPhoneNumber
|
||||
*
|
||||
* @param {number} slotId - card The slot id
|
||||
* @return {Promise} promise object
|
||||
*/
|
||||
export function getSimCardTwoPhoneNumber(slotId = 1) {
|
||||
if (sim.getSimTelephoneNumber) {
|
||||
return sim.getSimTelephoneNumber(slotId);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: Network mode interface
|
||||
*/
|
||||
import { radio } from './api';
|
||||
import LogUtils from '../utils/LogUtils'
|
||||
|
||||
const TAG = "setPreferredNetworkModelApi"
|
||||
|
||||
/**
|
||||
* Set the preferred network mode
|
||||
*
|
||||
* @param {string} slotId - card The slot id
|
||||
* @param {number} auto - card The slot id
|
||||
* @return {Promise} promise object
|
||||
*/
|
||||
export function setPreferredNetwork(slotId, auto) {
|
||||
return new Promise((resolve) => {
|
||||
radio.setPreferredNetwork(slotId, auto).then((res) => {
|
||||
LogUtils.i(TAG, "setPreferredNetwork success data then:" + JSON.stringify(res))
|
||||
resolve(res);
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, "setPreferredNetwork catch:" + JSON.stringify(err))
|
||||
});
|
||||
});
|
||||
}
|
140
mobiledatasettings/src/main/ets/common/utils/KvManager.ets
Normal file
@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
import distributedKVStore from '@ohos.data.distributedKVStore'
|
||||
import LogUtils from '../utils/LogUtils'
|
||||
|
||||
const TAG = "KVManager"
|
||||
|
||||
/**
|
||||
* Distributed database Basic configuration
|
||||
*/
|
||||
let kvManager: any = AppStorage.Get("kvManager")
|
||||
const options = {
|
||||
createIfMissing: true,
|
||||
encrypt: false,
|
||||
backup: false,
|
||||
autoSync: true,
|
||||
kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION,
|
||||
securityLevel: distributedKVStore.SecurityLevel.S2,
|
||||
};
|
||||
|
||||
/**
|
||||
* Distributed database Basic configuration
|
||||
*/
|
||||
const kvManagerConfig = {
|
||||
context: globalThis.settingsAbilityContext,
|
||||
bundleName: 'com.example.callui',
|
||||
userInfo: {
|
||||
userId: '0',
|
||||
userType: 0
|
||||
}
|
||||
};
|
||||
|
||||
function createKVManager() {
|
||||
try {
|
||||
LogUtils.i(TAG, "succeeded in creating KVManager")
|
||||
kvManager = distributedKVStore.createKVManager(kvManagerConfig);
|
||||
AppStorage.SetOrCreate("kvManager", kvManager)
|
||||
} catch(e) {
|
||||
LogUtils.i(TAG, "Failed to create KVManager.code is " + JSON.stringify(e.code) + " message is : " + JSON.stringify(e.message))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a database instance
|
||||
*
|
||||
* @param {Function} callback - Callback
|
||||
*/
|
||||
function getKVStore(callback) {
|
||||
if (kvManager == undefined) {
|
||||
createKVManager();
|
||||
}
|
||||
kvManager.getKVStore('storeId', options).then((store) => {
|
||||
callback(store);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Distributed database Set up storage
|
||||
*
|
||||
* @param {string} key - storage key
|
||||
* @param {string} value - storage value
|
||||
*/
|
||||
export function setCache(key, value) {
|
||||
getKVStore(
|
||||
(store) => {
|
||||
store.put(key, value).then((data) => {
|
||||
LogUtils.i(TAG, `put success key ${key}, value: ${value}:` + JSON.stringify(data))
|
||||
if (key === 'pinRemainingTime') {
|
||||
getCache(key, (data) => {
|
||||
LogUtils.i(TAG, `getCache success key ${key}: ` + JSON.stringify(data))
|
||||
});
|
||||
}
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, 'put err: ' + JSON.stringify(err));
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Distributed database Get up storage
|
||||
*
|
||||
* @param {string} key - storage key
|
||||
* @param {Function} callback - Callback
|
||||
*/
|
||||
export function getCache(key, callback) {
|
||||
getKVStore((store) => {
|
||||
store.get(key).then((data) => {
|
||||
callback(data);
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, 'getCache err: ' + JSON.stringify(err));
|
||||
callback(null, err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Distributed database Get up storage
|
||||
*
|
||||
* @param {string} key - storage key
|
||||
* @param {Function} callback - Callback
|
||||
*/
|
||||
export function deleteCache(key, callback) {
|
||||
getKVStore((store) => {
|
||||
store.delete(key).then((data) => {
|
||||
callback(data);
|
||||
}).catch((err) => {
|
||||
callback(null, err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Distributed database close storage
|
||||
*/
|
||||
export function closeKVStore() {
|
||||
getKVStore((store) => {
|
||||
kvManager.closeKVStore("appId", "storeId", function (err, data) {
|
||||
if (err != undefined) {
|
||||
LogUtils.e(TAG, `Fail to close KVStore code is ${err.code}, message is ${err.message} `)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
98
mobiledatasettings/src/main/ets/model/mobileDataStatus.ets
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
import telephonyData from '@ohos.telephony.data';
|
||||
import radio from '@ohos.telephony.radio';
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
|
||||
const TAG = "mobileDataStatus"
|
||||
|
||||
/**
|
||||
* Get cellular data status
|
||||
*
|
||||
* @return {Promise} promise object
|
||||
*/
|
||||
export function getCellularDataState() {
|
||||
if (telephonyData.getCellularDataState) {
|
||||
return telephonyData.getCellularDataState();
|
||||
}
|
||||
}
|
||||
|
||||
export function getOperatorName(slotId = 0) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
radio.getOperatorName(slotId, (error, value) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "getOperatorName error:" + JSON.stringify(error))
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "getOperatorName value:" + JSON.stringify(value))
|
||||
resolve(value);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getOperatorName catch:" + JSON.stringify(error))
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable mobile data
|
||||
*
|
||||
* @return {Promise} promise object
|
||||
*/
|
||||
export function enableCellularData() {
|
||||
if (telephonyData.enableCellularData) {
|
||||
return telephonyData.enableCellularData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* disableCellularData mobile data
|
||||
*
|
||||
* @return {Promise} promise object
|
||||
*/
|
||||
export function disableCellularData() {
|
||||
if (telephonyData.disableCellularData) {
|
||||
return telephonyData.disableCellularData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to enable cellular data roaming
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function getCellularDataRoaming(slotId = 0) {
|
||||
return telephonyData.isCellularDataRoamingEnabled(slotId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enabling Data Roaming
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function enableCellularDataRoaming(slotId = 0) {
|
||||
return telephonyData.enableCellularDataRoaming(slotId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enabling Data Roaming
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function disableCellularDataRoaming(slotId = 0) {
|
||||
return telephonyData.disableCellularDataRoaming(slotId);
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: registerSimStateApi
|
||||
*/
|
||||
import observer from '@ohos.telephony.observer';
|
||||
import LogUtils from '../common/utils/LogUtils';
|
||||
import sim from '@ohos.telephony.sim';
|
||||
|
||||
const TAG = "registerSimStateAPi"
|
||||
|
||||
/**
|
||||
* Monitor the SIM card status
|
||||
*
|
||||
* @param {function} callBack - call-back
|
||||
* @param {string} slotId - card The slot id
|
||||
*/
|
||||
export function registerSimStateChange(slotId, callBack) {
|
||||
return observer.on('simStateChange', {
|
||||
slotId: slotId
|
||||
}, (callStateInfo) => {
|
||||
LogUtils.i(TAG, "registerSimStateChange: then " + JSON.stringify(callStateInfo))
|
||||
callBack(callStateInfo);
|
||||
return callStateInfo
|
||||
});
|
||||
}
|
||||
|
||||
export function getMaxSimCount() {
|
||||
return sim.getMaxSimCount();
|
||||
}
|
@ -16,150 +16,468 @@
|
||||
/**
|
||||
* @file: Mobile Network Home page
|
||||
*/
|
||||
import telephonyData from '@ohos.telephony.data';
|
||||
import telephonyObserver from '@ohos.telephony.observer';
|
||||
import telephonySim from '@ohos.telephony.sim';
|
||||
import publiccontent from '../common/components/publiccontent';
|
||||
import item from '../common/components/listItem/listItem';
|
||||
import call from '@ohos.telephony.call';
|
||||
import { registerSimStateChange, getMaxSimCount } from '../model/registerSimStateApi'
|
||||
import { getSimStateCardOne, getSimStateCardTwo } from '../common/model/getSimStateApi';
|
||||
import { getSimCardOnePhoneNumber, getSimCardTwoPhoneNumber } from '../common/model/getSimTelephoneNumberApi';
|
||||
import {
|
||||
isCellularDataRoamingEnabled,
|
||||
enableCellularDataRoaming,
|
||||
disableCellularDataRoaming,
|
||||
getSupportNetwork
|
||||
} from '../common/model/getCellularDataRoamingEnabledApi';
|
||||
import { setPreferredNetwork } from '../common/model/setPreferredNetworkApi';
|
||||
import { getPreferredNetwork } from '../common/model/getPreferredNetworkModeApi';
|
||||
import {
|
||||
getCellularDataState,
|
||||
enableCellularData,
|
||||
disableCellularData,
|
||||
getOperatorName
|
||||
} from '../model/mobileDataStatus';
|
||||
import { MOBILE_DATA_STATUS } from '../common/constant/moblieDataConst';
|
||||
import HeadComponent from '../common/components/headComponent'
|
||||
import { SubHeader } from '../common/components/subHeader'
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
|
||||
const TAG = "MobileDataSettings:";
|
||||
const TAG = "Index"
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State isDataOn: boolean = false;
|
||||
@State isDataEnable: boolean = false;
|
||||
scroller: Scroller = new Scroller();
|
||||
@State byValueWLMS: any = publiccontent.strings.fourAuto;
|
||||
@State publicheader: any = publiccontent.strings.mobileData;
|
||||
@State isLoading: boolean = true;
|
||||
@State simState: string = '';
|
||||
@State moisBtn: boolean = true;
|
||||
@State isBtn: boolean = true;
|
||||
@State gqBtn: boolean = true;
|
||||
@State moislastone: boolean = true;
|
||||
@State isSupport: boolean = true;
|
||||
@State mobileDataDisabled: boolean = false;
|
||||
@State mobileDataDisabled2: boolean = false;
|
||||
// Mobile data switch
|
||||
@State isDataEnable: boolean = true;
|
||||
// Data roaming switch
|
||||
@State DataRoamSwitch: boolean = false;
|
||||
// HD call switch
|
||||
@State volteSwitch: boolean = false;
|
||||
// Card I status
|
||||
@State simStateStatusCardOne: boolean = true;
|
||||
// Card 2 status
|
||||
@State simStateStatusCardTwo: boolean = false;
|
||||
@State ControlswitchWLMS: boolean = false;
|
||||
@State slotId: number = 0;
|
||||
@State dialogTitle: any = publiccontent.strings.preferredNetworkMode;
|
||||
setCache_cun_name = 'DISTRIBUTEDDATA_CUN_NAME';
|
||||
setCache_wl_name = 'SETCACHE_WL_NAME';
|
||||
@State enable5g: boolean = false;
|
||||
@State enableISM: boolean = false;
|
||||
@State enableISM2: boolean = false;
|
||||
@State TelephoneNumber: string = '';
|
||||
@State TelephoneNumber2?: string = '';
|
||||
@State ceshi: boolean = false;
|
||||
|
||||
aboutToAppear(): void {
|
||||
LogUtils.i(TAG, "aboutToAppear");
|
||||
telephonyObserver.on("simStateChange", (simStateData) => {
|
||||
if (!simStateData) {
|
||||
return;
|
||||
}
|
||||
LogUtils.i(TAG, "simStateChange simState: " + simStateData.state);
|
||||
this.updateDataEnableState(simStateData.state);
|
||||
});
|
||||
}
|
||||
|
||||
onPageShow(): void {
|
||||
LogUtils.i(TAG, "onPageShow 3333");
|
||||
telephonySim.getSimState(0).then((simState) => {
|
||||
LogUtils.i(TAG, "onPageShow simState: " + simState);
|
||||
this.updateDataEnableState(simState);
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "onPageShow getSimState error: " + error);
|
||||
});
|
||||
}
|
||||
|
||||
aboutToDisappear(): void {
|
||||
LogUtils.i(TAG, "aboutToDisappear");
|
||||
telephonyObserver.off("simStateChange");
|
||||
}
|
||||
|
||||
terminateAbility(): void {
|
||||
LogUtils.i(TAG, "onclick back")
|
||||
globalThis.settingsAbilityContext?.terminateSelf().then((data) => {
|
||||
LogUtils.i(TAG, "mobiledatasettings terminateSelfCallBack");
|
||||
});
|
||||
}
|
||||
|
||||
private updateDataEnableState(simState) {
|
||||
if (simState == telephonySim.SimState.SIM_STATE_NOT_PRESENT) {
|
||||
this.isDataEnable = false;
|
||||
this.isDataOn = false;
|
||||
} else {
|
||||
this.isDataEnable = true;
|
||||
telephonyData.isCellularDataEnabled().then((dataEnable) => {
|
||||
LogUtils.i(TAG, "updateDataEnableState isCellularDataEnabled: " + dataEnable);
|
||||
this.isDataOn = dataEnable;
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "updateDataEnableState isCellularDataEnabled error: " + error);
|
||||
});
|
||||
/**
|
||||
* Get network mode
|
||||
*
|
||||
* @param {Object} slotId - call slotId
|
||||
*/
|
||||
async getPreferredNetwork(slotId) {
|
||||
const res = await getPreferredNetwork(this.slotId);
|
||||
if (res == 0) {
|
||||
this.byValueWLMS = $r('app.string.mobile_data_5g');
|
||||
} else if (res == 5) {
|
||||
this.byValueWLMS = $r("app.string.mobile_data_4g");
|
||||
} else if (res == 6) {
|
||||
this.byValueWLMS = $r("app.string.mobile_data_3g");
|
||||
} else if (res == 1) {
|
||||
this.byValueWLMS = $r("app.string.mobile_data_2g");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface is used to obtain sim cardOne status
|
||||
*/
|
||||
getSimStateDataCardOne() {
|
||||
getSimStateCardOne().then((res: any) => {
|
||||
LogUtils.i(TAG, "getSimStateData Card1 :success " + JSON.stringify(res))
|
||||
const simState = {
|
||||
SIM_STATE_UNKNOWN: 0,
|
||||
SIM_STATE_NOT_PRESENT: 1,
|
||||
SIM_STATE_LOCKED: 2,
|
||||
SIM_STATE_NOT_READY: 3,
|
||||
SIM_STATE_READY: 4,
|
||||
SIM_STATE_LOADED: 5
|
||||
};
|
||||
this.simState = res;
|
||||
if (res == simState.SIM_STATE_LOADED || res == simState.SIM_STATE_READY) {
|
||||
this.simStateStatusCardOne = true;
|
||||
} else {
|
||||
this.simStateStatusCardOne = false;
|
||||
}
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, 'getSimStateData Card1 :console.error() ' + JSON.stringify(err.message));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface is used to obtain sim cardTwo status
|
||||
*/
|
||||
getSimStateDataCardTwo() {
|
||||
getSimStateCardTwo().then((res: any) => {
|
||||
LogUtils.i(TAG, "getSimState Card2 :success " + JSON.stringify(res));
|
||||
const simState = {
|
||||
SIM_STATE_UNKNOWN: 0,
|
||||
SIM_STATE_NOT_PRESENT: 1,
|
||||
SIM_STATE_LOCKED: 2,
|
||||
SIM_STATE_NOT_READY: 3,
|
||||
SIM_STATE_READY: 4,
|
||||
SIM_STATE_LOADED: 5
|
||||
};
|
||||
if (res == simState.SIM_STATE_LOADED || res == simState.SIM_STATE_READY) {
|
||||
this.simStateStatusCardTwo = true;
|
||||
} else {
|
||||
this.simStateStatusCardTwo = false;
|
||||
}
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, 'getSimState Card2 :console.error() ' + JSON.stringify(err.message));
|
||||
});
|
||||
}
|
||||
|
||||
getSupportNetwork(slotId) {
|
||||
getSupportNetwork(slotId).then((res) => {
|
||||
if (res) {
|
||||
this.isSupport = true;
|
||||
} else {
|
||||
this.isSupport = false;
|
||||
}
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mobile phone number
|
||||
*/
|
||||
getSimCardOnePhoneNumber() {
|
||||
getSimCardOnePhoneNumber().then((res) => {
|
||||
LogUtils.i(TAG, "getSimTelephoneNumber card1 other success" + JSON.stringify(res));
|
||||
this.TelephoneNumber = res
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, "getSimTelephoneNumber card1 other catch" + JSON.stringify(err));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mobile phone number
|
||||
*/
|
||||
getSimCardTwoPhoneNumber() {
|
||||
getSimCardTwoPhoneNumber().then((res) => {
|
||||
LogUtils.i(TAG, "getSimTelephoneNumber card2 other success" + JSON.stringify(res));
|
||||
this.TelephoneNumber2 = res;
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, "getSimTelephoneNumber card2 other catch" + JSON.stringify(err));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mobile data on or off
|
||||
*/
|
||||
getCellularDataState() {
|
||||
getCellularDataState().then((data) => {
|
||||
if (data == MOBILE_DATA_STATUS.DATA_STATE_CONNECTED) {
|
||||
/**
|
||||
* Gets the status of the mobile data
|
||||
*/
|
||||
enableCellularData().then((data) => {
|
||||
LogUtils.i(TAG, "enableCellularData success" + JSON.stringify(data));
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "enableCellularData catch" + JSON.stringify(error));
|
||||
});
|
||||
this.isDataEnable = true;
|
||||
} else if (data == MOBILE_DATA_STATUS.DATA_STATE_DISCONNECTED || data == MOBILE_DATA_STATUS.DATA_STATE_UNKNOWN) {
|
||||
this.isDataEnable = false;
|
||||
/**
|
||||
* Gets the status of the disableCellularData
|
||||
*/
|
||||
disableCellularData().then((data) => {
|
||||
LogUtils.i(TAG, "disableCellularData success" + JSON.stringify(data));
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "disableCellularData error" + JSON.stringify(error));
|
||||
});
|
||||
}
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "disableCellularData catch" + JSON.stringify(error));
|
||||
});
|
||||
}
|
||||
|
||||
addRegisterSimStateChange(slotId) {
|
||||
registerSimStateChange(slotId, async () => {
|
||||
this.getCellularDataRoamingEnabled();
|
||||
this.getSimStateDataCardOne();
|
||||
this.getSimStateDataCardTwo();
|
||||
this.getPreferredNetwork(slotId);
|
||||
this.getSupportNetwork(slotId);
|
||||
this.getSimCardOnePhoneNumber();
|
||||
this.getSimCardTwoPhoneNumber();
|
||||
this.getCellularDataState();
|
||||
})
|
||||
}
|
||||
|
||||
isImsSwitchEnabled(slotId) {
|
||||
call.isImsSwitchEnabled(slotId).then((res: any) => {
|
||||
if (slotId) {
|
||||
this.enableISM2 = res;
|
||||
} else {
|
||||
this.enableISM = res;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
LogUtils.i(TAG, "aboutToAppear")
|
||||
if (getMaxSimCount() == 2) {
|
||||
this.addRegisterSimStateChange(1);
|
||||
this.isImsSwitchEnabled(1);
|
||||
this.getSimStateDataCardTwo();
|
||||
}
|
||||
this.addRegisterSimStateChange(0);
|
||||
//Get data roaming status
|
||||
this.getCellularDataRoamingEnabled();
|
||||
//Get HD call status
|
||||
this.isImsSwitchEnabled(0);
|
||||
this.getSimStateDataCardOne();
|
||||
//Get network mode
|
||||
this.getPreferredNetwork(this.slotId);
|
||||
getOperatorName().then((res) => {
|
||||
})
|
||||
this.getSupportNetwork(this.slotId);
|
||||
//card number acquire
|
||||
this.getSimCardOnePhoneNumber();
|
||||
this.getSimCardTwoPhoneNumber();
|
||||
this.getCellularDataState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set network mode
|
||||
*/
|
||||
radioChange(slotId, v) {
|
||||
const res = setPreferredNetwork(slotId, v);
|
||||
LogUtils.i(TAG, "radioChange res:" + JSON.stringify(res));
|
||||
}
|
||||
|
||||
getCellularDataRoamingEnabled() {
|
||||
isCellularDataRoamingEnabled().then((res) => {
|
||||
if (!res) {
|
||||
this.DataRoamSwitch = false;
|
||||
disableCellularDataRoaming().then((data) => {
|
||||
LogUtils.i(TAG, "disableCellularDataRoaming success: then" + JSON.stringify(data));
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "disableCellularDataRoaming error" + JSON.stringify(error));
|
||||
});
|
||||
} else {
|
||||
this.DataRoamSwitch = true;
|
||||
enableCellularDataRoaming().then((data) => {
|
||||
LogUtils.i(TAG, "enableCellularDataRoaming success: then" + JSON.stringify(data));
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "enableCellularDataRoaming error" + JSON.stringify(error));
|
||||
});
|
||||
}
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, "enableCellularDataRoaming catch:" + JSON.stringify(err));
|
||||
});
|
||||
}
|
||||
|
||||
build() {
|
||||
GridRow({ columns: { sm: 4, md: 8, lg: 12 }, gutter: { x: 12 } }) {
|
||||
GridCol({ span: { sm: 4, md: 8, lg: 8 }, offset: { sm: 0, md: 1, lg: 2 } }) {
|
||||
Row() {
|
||||
Image($r("app.media.ic_back"))
|
||||
.height(24)
|
||||
.width(24)
|
||||
.margin({ top: 2, bottom: 2, right: 16 })
|
||||
.onClick(() => {
|
||||
this.terminateAbility();
|
||||
})
|
||||
|
||||
Text($r("app.string.mobile_data"))
|
||||
.height(28)
|
||||
.lineHeight(28)
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor('#182431')
|
||||
}
|
||||
.width("100%")
|
||||
.height(56)
|
||||
.padding({
|
||||
left: 12,
|
||||
top: 14,
|
||||
bottom: 14
|
||||
})
|
||||
.margin({ bottom: 8 })
|
||||
}
|
||||
|
||||
GridCol({ span: { sm: 4, md: 6, lg: 8 }, offset: { sm: 0, md: 1, lg: 4 } }) {
|
||||
Flex({
|
||||
direction: FlexDirection.Row,
|
||||
alignItems: ItemAlign.Center,
|
||||
justifyContent: FlexAlign.SpaceBetween
|
||||
}) {
|
||||
Column() {
|
||||
Column() {
|
||||
Text($r("app.string.mobile_data"))
|
||||
.height(22)
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor('#182431')
|
||||
.margin({ bottom: 2 })
|
||||
|
||||
Text($r("app.string.mobile_data_charges"))
|
||||
.height(19)
|
||||
.fontSize(14)
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontColor('#182431')
|
||||
.opacity(0.6)
|
||||
}
|
||||
.margin({ left: 12 })
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
HeadComponent();
|
||||
|
||||
Toggle({ type: ToggleType.Switch, isOn: this.isDataOn })
|
||||
.onChange((isOn: boolean) => {
|
||||
if (isOn) {
|
||||
telephonyData.enableCellularData()
|
||||
.then((data) => {
|
||||
Stack({ alignContent: Alignment.TopStart }) {
|
||||
Scroll(this.scroller) {
|
||||
Column() {
|
||||
SubHeader({ titleContent: $r('app.string.mobile_data_general'), subTitleContent: '' });
|
||||
|
||||
Flex({
|
||||
direction: FlexDirection.Row,
|
||||
justifyContent: FlexAlign.SpaceBetween,
|
||||
alignItems: ItemAlign.Center
|
||||
}) {
|
||||
Column() {
|
||||
Row() {
|
||||
Text($r('app.string.mobile_data'))
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.lineHeight(22)
|
||||
.fontColor($r('app.color.font_color_182431'))
|
||||
.opacity(this.isDataEnable ? 0.9 : 0.6)
|
||||
}
|
||||
|
||||
Row() {
|
||||
Text($r('app.string.mobile_data_charges'))
|
||||
.fontSize(14)
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.fontColor('#555')
|
||||
.opacity(0.6)
|
||||
.lineHeight(19)
|
||||
.maxLines(2)
|
||||
}
|
||||
.margin({ top: 2, right: 26 })
|
||||
}
|
||||
.opacity(this.simStateStatusCardOne ? 1 : 0.4)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
|
||||
Toggle({ type: ToggleType.Switch, isOn: this.isDataEnable })
|
||||
.width(36)
|
||||
.height(20)
|
||||
.enabled(this.simStateStatusCardOne)
|
||||
.opacity(this.simStateStatusCardOne ? 1 : 0.4)
|
||||
.onChange((isOn: boolean) => {
|
||||
this.isDataEnable = !this.isDataEnable
|
||||
if (this.isDataEnable == false) {
|
||||
disableCellularData().then((data) => {
|
||||
LogUtils.i(TAG, "disableCellularData: then" + JSON.stringify(data))
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "disableCellularData: catch" + JSON.stringify(error))
|
||||
});
|
||||
} else {
|
||||
enableCellularData().then((data) => {
|
||||
LogUtils.i(TAG, "enableCellularData: then" + JSON.stringify(data))
|
||||
}).catch((error) => {
|
||||
LogUtils.i(TAG, "enableCellularData: catch" + JSON.stringify(error))
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 4,
|
||||
bottom: 4
|
||||
})
|
||||
.catch((error) => {
|
||||
.height(90)
|
||||
.width("100%")
|
||||
.borderRadius(24)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"))
|
||||
|
||||
SubHeader({
|
||||
titleContent: $r('app.string.mobile_data_card1'),
|
||||
subTitleContent: this.TelephoneNumber
|
||||
});
|
||||
} else {
|
||||
telephonyData.disableCellularData()
|
||||
.then((data) => {
|
||||
|
||||
Column() {
|
||||
item({
|
||||
isBtn: this.moisBtn,
|
||||
LastOne: this.moislastone,
|
||||
Controlswitch: this.DataRoamSwitch,
|
||||
title: $r('app.string.mobile_data_dataRoaming'),
|
||||
describe: $r('app.string.mobile_data_enableDataWhileRoaming'),
|
||||
isDisabled: this.simStateStatusCardOne,
|
||||
isCard: true,
|
||||
isSupport: false,
|
||||
isCon: 0,
|
||||
})
|
||||
Divider()
|
||||
.strokeWidth(0.5)
|
||||
.color("#E3E3E3")
|
||||
.lineCap(LineCapStyle.Round)
|
||||
.margin({ right: '2%' })
|
||||
|
||||
item({
|
||||
isBtn: this.gqBtn,
|
||||
LastOne: this.moislastone,
|
||||
Controlswitch: this.enableISM,
|
||||
title: $r('app.string.mobile_data_volte'),
|
||||
describe: $r('app.string.mobile_data_confirmation_function'),
|
||||
isDisabled: this.simStateStatusCardOne,
|
||||
isSupport: false,
|
||||
isCard: true,
|
||||
isCon: 22,
|
||||
})
|
||||
}
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 4,
|
||||
bottom: 4
|
||||
})
|
||||
.catch((error) => {
|
||||
.width("100%")
|
||||
.borderRadius(24)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"))
|
||||
|
||||
SubHeader({
|
||||
titleContent: $r('app.string.mobile_data_card2'),
|
||||
subTitleContent: this.TelephoneNumber2
|
||||
});
|
||||
|
||||
Column() {
|
||||
item({
|
||||
isBtn: this.moisBtn,
|
||||
LastOne: this.moislastone,
|
||||
Controlswitch: this.mobileDataDisabled2,
|
||||
title: $r('app.string.mobile_data_dataRoaming'),
|
||||
describe: $r('app.string.mobile_data_enableDataWhileRoaming'),
|
||||
isDisabled: this.simStateStatusCardTwo,
|
||||
isSupport: false,
|
||||
isCard: true,
|
||||
isCon: 0,
|
||||
})
|
||||
Divider()
|
||||
.strokeWidth(0.5)
|
||||
.color("#E3E3E3")
|
||||
.lineCap(LineCapStyle.Round)
|
||||
.margin({ right: '2%' })
|
||||
item({
|
||||
isBtn: this.gqBtn,
|
||||
LastOne: this.moislastone,
|
||||
Controlswitch: this.enableISM2,
|
||||
title: $r('app.string.mobile_data_volte'),
|
||||
describe: $r('app.string.mobile_data_confirmation_function'),
|
||||
isDisabled: this.simStateStatusCardTwo,
|
||||
isSupport: false,
|
||||
isCard: true,
|
||||
isCon: 22,
|
||||
})
|
||||
}
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 4,
|
||||
bottom: 4
|
||||
})
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 4,
|
||||
bottom: 4
|
||||
})
|
||||
.width("100%")
|
||||
.borderRadius(24)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"))
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
}
|
||||
})
|
||||
.height(20)
|
||||
.width(36)
|
||||
.margin({ right: 12 })
|
||||
.enabled(this.isDataEnable)
|
||||
}
|
||||
}
|
||||
.useSizeType({
|
||||
sm: { span: 4, offset: 0 },
|
||||
md: { span: 6, offset: 1 },
|
||||
lg: { span: 8, offset: 2 }
|
||||
})
|
||||
}
|
||||
.height(72)
|
||||
.width('100%')
|
||||
.backgroundColor('#FFFFFF')
|
||||
.borderRadius(25)
|
||||
.visibility(this.isLoading ? Visibility.Visible : Visibility.Hidden)
|
||||
}
|
||||
}
|
||||
.padding({ left: 12, right: 12 })
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F1F3F5')
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
}
|
||||
}
|
@ -36,6 +36,9 @@
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.SET_TELEPHONY_STATE"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_TELEPHONY_STATE"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -51,6 +51,9 @@
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.SET_TELEPHONY_STATE"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_TELEPHONY_STATE"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -3,6 +3,18 @@
|
||||
{
|
||||
"name": "white",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "font_color_182431",
|
||||
"value": "#182431"
|
||||
},
|
||||
{
|
||||
"name": "color_E3E3E3_grey",
|
||||
"value": "#E3E3E3"
|
||||
},
|
||||
{
|
||||
"name": "color_00000000_transparent",
|
||||
"value": "#00000000"
|
||||
}
|
||||
]
|
||||
}
|
@ -11,6 +11,142 @@
|
||||
{
|
||||
"name": "mobile_data_charges",
|
||||
"value": "After activation, the charges incurred are charged by the operator"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_general",
|
||||
"value": "Be in common use"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_cancel",
|
||||
"value": "cancel"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_card1",
|
||||
"value": "Card 1 network"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_card2",
|
||||
"value": "Card 2 network"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_network",
|
||||
"value": "Network"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_dataRoaming",
|
||||
"value": "Data roaming"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_enableDataWhileRoaming",
|
||||
"value": "Enable data service during roaming"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_netFive",
|
||||
"value": "Enable 5G"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_accessPointNamesAPN",
|
||||
"value": "Access Point Name APN"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_networkProvider",
|
||||
"value": "Network operator"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_chooseNetworkProvider",
|
||||
"value": "Manual or automatic selection"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_more",
|
||||
"value": "Senior"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_fiveAuto",
|
||||
"value": "5G/4G/3G/2G Auto Select"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_fourAuto",
|
||||
"value": "4G/3G/2G Auto Select"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_threeAuto",
|
||||
"value": "3G/2G Auto Select"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_twoOnly",
|
||||
"value": "2G only"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_automaticRecognition",
|
||||
"value": "Automatic recognition"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_preferredNetwork",
|
||||
"value": "Preferred network"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_closeAutoSelect",
|
||||
"value": "Turn off automatic selection"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_whetherToClose",
|
||||
"value": "After closing, the operator selected manually will be used for registration, and other operators will not be selected automatically. This may cause the network service to be unavailable. Close?"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_networkMode",
|
||||
"value": "Network mode"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_apnOpen",
|
||||
"value": "APN ON"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_apnName",
|
||||
"value": "Name"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_notSet",
|
||||
"value": "Not set"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_volte",
|
||||
"value": "VoLTE HD call"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_confirmation_function",
|
||||
"value": "Confirm to the operator that this function is enabled before enabling, otherwise normal calls may be affected"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_5g",
|
||||
"value": "5G/4G/3G/2G automatic selection"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_4g",
|
||||
"value": "4G/3G/2G automatic selection"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_3g",
|
||||
"value": "3G/2G automatic selection"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_2g",
|
||||
"value": "2G only"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_tips",
|
||||
"value": "be careful"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_turn_on_data_roaming",
|
||||
"value": "Enabling data roaming may incur roaming charges. Open?"
|
||||
},
|
||||
{
|
||||
"name": "cancel_space",
|
||||
"value": "cancel"
|
||||
},
|
||||
{
|
||||
"name": "confim_space",
|
||||
"value": "Confim"
|
||||
}
|
||||
]
|
||||
}
|
BIN
mobiledatasettings/src/main/resources/base/media/Refresh.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
mobiledatasettings/src/main/resources/base/media/back.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
mobiledatasettings/src/main/resources/base/media/cancel_icon.png
Normal file
After Width: | Height: | Size: 948 B |
BIN
mobiledatasettings/src/main/resources/base/media/del.png
Normal file
After Width: | Height: | Size: 992 B |
After Width: | Height: | Size: 1.4 KiB |
BIN
mobiledatasettings/src/main/resources/base/media/icon.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
mobiledatasettings/src/main/resources/base/media/img.png
Normal file
After Width: | Height: | Size: 668 B |
BIN
mobiledatasettings/src/main/resources/base/media/img_1.png
Normal file
After Width: | Height: | Size: 461 B |
After Width: | Height: | Size: 1.2 KiB |
BIN
mobiledatasettings/src/main/resources/base/media/more_icon.png
Normal file
After Width: | Height: | Size: 549 B |
BIN
mobiledatasettings/src/main/resources/base/media/next_icon.png
Normal file
After Width: | Height: | Size: 656 B |
16
mobiledatasettings/src/main/resources/base/media/radio.svg
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg t="1632644753604"
|
||||
class="icon"
|
||||
viewBox="0 0 1024 1024"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="4713"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<style type="text/css"></style>
|
||||
</defs>
|
||||
<path
|
||||
d="M512 853.333333c188.522667 0 341.333333-152.810667 341.333333-341.333333S700.522667 170.666667 512 170.666667 170.666667 323.477333 170.666667 512s152.810667 341.333333 341.333333 341.333333z m0 42.666667c-212.074667 0-384-171.925333-384-384S299.925333 128 512 128s384 171.925333 384 384-171.925333 384-384 384z"
|
||||
fill="#333333"
|
||||
p-id="4714"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 800 B |
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg t="1632644807118"
|
||||
class="icon"
|
||||
viewBox="0 0 1024 1024"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="5200"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<style type="text/css"></style>
|
||||
</defs>
|
||||
<path
|
||||
d="M512 106.667A405.333 405.333 0 1 1 106.667 512 405.333 405.333 0 0 1 512 106.667m0-64A469.333 469.333 0 1 0 981.333 512 469.333 469.333 0 0 0 512 42.667z"
|
||||
p-id="5201"
|
||||
fill="#1296db"></path>
|
||||
<path
|
||||
d="M311.253 512a200.747 200.747 0 1 0 401.707 0 200.747 200.747 0 0 0-401.707 0z"
|
||||
p-id="5202"
|
||||
fill="#1296db"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 797 B |
BIN
mobiledatasettings/src/main/resources/base/media/right.png
Normal file
After Width: | Height: | Size: 656 B |
@ -10,7 +10,143 @@
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_charges",
|
||||
"value": "启用后,产生的费用由运营商收取"
|
||||
"value": "启用后,产生的流量将由运营商收取相应费用"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_general",
|
||||
"value": "通用"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_cancel",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_card1",
|
||||
"value": "卡 1 网络 "
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_card2",
|
||||
"value": "卡 2 网络 "
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_network",
|
||||
"value": "网络"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_dataRoaming",
|
||||
"value": "数据漫游"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_enableDataWhileRoaming",
|
||||
"value": "漫游时开启数据业务"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_netFive",
|
||||
"value": "启用 5G"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_accessPointNamesAPN",
|
||||
"value": "接入点名称 (APN)"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_networkProvider",
|
||||
"value": "网络运营商"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_chooseNetworkProvider",
|
||||
"value": "手动或自动选择"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_more",
|
||||
"value": "高级"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_fiveAuto",
|
||||
"value": "5G/4G/3G/2G 自动选择"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_fourAuto",
|
||||
"value": "4G/3G/2G 自动选择"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_threeAuto",
|
||||
"value": "3G/2G 自动选择"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_twoOnly",
|
||||
"value": "仅 2G"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_automaticRecognition",
|
||||
"value": "自动识别"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_preferredNetwork",
|
||||
"value": "首选网络:"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_closeAutoSelect",
|
||||
"value": "关闭自动选择"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_whetherToClose",
|
||||
"value": "关闭后,将使用手动选择的运营商注册,不会自动选择其他运营商。这可能导致网络服务不可用。是否关闭?"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_networkMode",
|
||||
"value": "网络模式"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_apnOpen",
|
||||
"value": "APN 已开启"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_apnName",
|
||||
"value": "名称"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_notSet",
|
||||
"value": "未设置"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_volte",
|
||||
"value": "VoLTE高清通话"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_confirmation_function",
|
||||
"value": "启用前应向运营商确认已开通此功能,否则可能影响正常通话"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_5g",
|
||||
"value": "5G/4G/3G/2G 自动选择"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_4g",
|
||||
"value": "4G/3G/2G 自动选择"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_3g",
|
||||
"value": "3G/2G 自动选择"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_2g",
|
||||
"value": "仅 2G"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_tips",
|
||||
"value": "注意"
|
||||
},
|
||||
{
|
||||
"name": "mobile_data_turn_on_data_roaming",
|
||||
"value": "开启数据漫游可能产生漫游费。是否开启?"
|
||||
},
|
||||
{
|
||||
"name": "cancel_space",
|
||||
"value": "取 消"
|
||||
},
|
||||
{
|
||||
"name": "confim_space",
|
||||
"value": "确 定"
|
||||
}
|
||||
]
|
||||
}
|
4
simcardmanagement/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/node_modules
|
||||
/.preview
|
||||
/build
|
||||
/.cxx
|
31
simcardmanagement/build-profile.json5
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
{
|
||||
"apiType": 'stageMode',
|
||||
"buildOption": {
|
||||
},
|
||||
"entryModules": [
|
||||
"callui"
|
||||
],
|
||||
"targets": [
|
||||
{
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"name": "ohosTest",
|
||||
}
|
||||
]
|
||||
}
|
2
simcardmanagement/hvigorfile.js
Normal file
@ -0,0 +1,2 @@
|
||||
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
|
||||
module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks
|
14
simcardmanagement/package.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"license": "ISC",
|
||||
"devDependencies": {},
|
||||
"name": "simcardmanagement",
|
||||
"ohos": {
|
||||
"org": "huawei",
|
||||
"directoryLevel": "module",
|
||||
"buildTool": "hvigor"
|
||||
},
|
||||
"description": "example description",
|
||||
"repository": {},
|
||||
"version": "1.0.0",
|
||||
"dependencies": {}
|
||||
}
|
10
simcardmanagement/src/main/ets/Application/MyAbilityStage.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import AbilityStage from "@ohos.app.ability.AbilityStage"
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
|
||||
const TAG = "MyAbilityStage";
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
LogUtils.i(TAG, "onWindowStageDestroy")
|
||||
}
|
||||
}
|
46
simcardmanagement/src/main/ets/MainAbility/MainAbility.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import Ability from '@ohos.app.ability.UIAbility'
|
||||
import Window from '@ohos.window'
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
import { closeKVStore } from '../common/utils/KvManager'
|
||||
|
||||
const TAG = "MainAbility";
|
||||
|
||||
export default class MainAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
LogUtils.i(TAG, "onCreate");
|
||||
globalThis.simCardAbilityContext = this.context;
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
LogUtils.i(TAG, "onDestroy");
|
||||
closeKVStore();
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage: Window.WindowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
LogUtils.i(TAG, "onWindowStageCreate");
|
||||
|
||||
windowStage.loadContent('pages/index', (err, data) => {
|
||||
if (err.code) {
|
||||
LogUtils.e(TAG, 'Failed to load the content. Cause:' + JSON.stringify(err));
|
||||
return;
|
||||
}
|
||||
LogUtils.e(TAG, 'Succeeded in loading the content. Data: ' + JSON.stringify(data));
|
||||
});
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
// Main window is destroyed, release UI related resources
|
||||
LogUtils.i(TAG, "onWindowStageDestroy");
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
// Ability has brought to foreground
|
||||
LogUtils.i(TAG, "onForeground");
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
// Ability has back to background
|
||||
LogUtils.i(TAG, "onBackground");
|
||||
}
|
||||
}
|
57
simcardmanagement/src/main/ets/common/components/back.ets
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
import router from '@system.router';
|
||||
|
||||
@Component
|
||||
export default struct Back {
|
||||
@State head: string = '';
|
||||
@State isChange: boolean = false;
|
||||
@State isShow: boolean = false;
|
||||
@State isShow2: boolean = false;
|
||||
|
||||
deleteClick() {
|
||||
this.isChange = !this.isChange;
|
||||
};
|
||||
|
||||
build() {
|
||||
Flex({ alignContent: FlexAlign.Center }) {
|
||||
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
|
||||
Image($r('app.media.back'))
|
||||
.width('40vp')
|
||||
.height('40vp')
|
||||
.margin({ right: '10vp' })
|
||||
.onClick(() => {
|
||||
router.back();
|
||||
})
|
||||
Text(this.head)
|
||||
.fontSize('32vp')
|
||||
.fontWeight(500)
|
||||
}
|
||||
.width('100%')
|
||||
}.padding({ left: '24vp', top: '24vp' })
|
||||
.width('100%')
|
||||
.backgroundColor('#fff')
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
};
|
||||
|
||||
onPageShow() {
|
||||
};
|
||||
|
||||
onPageHide() {
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,644 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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 Licensef 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.
|
||||
*/
|
||||
import { setCache, getCache, deleteCache } from '../utils/KvManager'
|
||||
import UpdataInfo from './dialog/upDataInfo'
|
||||
import StopSim from './dialog/stopSim'
|
||||
import EditSimInfo from './dialog/editSimInfo'
|
||||
import simServiceProxy from '../../model/simServiceProxy'
|
||||
import radioServiceProxy from '../../model/radioServiceProxy'
|
||||
import { registerSimStateChange, getMaxSimCount } from '../../model/registerSimStateApi'
|
||||
import dataServiceProxy from '../../model/dataServiceProxy';
|
||||
import LogUtils from '../../common/utils/LogUtils'
|
||||
|
||||
const TAG = "cardInformation"
|
||||
|
||||
@Component
|
||||
export default struct eSimSet {
|
||||
@State list: any = [
|
||||
{
|
||||
id: 0,
|
||||
title: $r('app.string.sim_card_one_no_space'),
|
||||
isOpened: true,
|
||||
disabled: true,
|
||||
name: $r('app.string.sim_null_character'),
|
||||
info: ''
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: $r('app.string.sim_card_two_no_space'),
|
||||
isOpened: true,
|
||||
disabled: true,
|
||||
name: $r('app.string.sim_null_character'),
|
||||
info: ''
|
||||
}
|
||||
];
|
||||
/* @State eSimCard: any =
|
||||
{
|
||||
title: '卡2',
|
||||
subTitle: 'eSIM',
|
||||
name: '添加eSIM',
|
||||
info: '2G/3G/4G/5G'
|
||||
};*/
|
||||
@State flowCardId: number = 1;
|
||||
@State phone1Number: string = '';
|
||||
@State phone2Number: string = '';
|
||||
@State title: any = '';
|
||||
@State curEditList : any = [];
|
||||
@State isSimCardClosed: boolean = true;
|
||||
@State simName: string = '';
|
||||
@State phoneNumber: string = '';
|
||||
@State simId: string = '';
|
||||
@State index: number = 0;
|
||||
@State storage: any = [];
|
||||
@State isChange: boolean = true;
|
||||
@State diaLing: number = 0;
|
||||
@State upisChange: boolean = true;
|
||||
@State isCancel: boolean = false;
|
||||
@State isCard: boolean = true;
|
||||
@Link isCardChange: boolean;
|
||||
@State listIndex: number = 0;
|
||||
@State upDataTitle: any = '';
|
||||
@State card1: boolean = true;
|
||||
@State card2: boolean = true;
|
||||
@State isStop1: boolean = true;
|
||||
@State isStop2: boolean = true;
|
||||
@Link simCardStop: boolean;
|
||||
@Link changeCard: boolean;
|
||||
@Link isCardChange2: boolean;
|
||||
@Link defaultSetString: any;
|
||||
timer = null;
|
||||
SIM_CARD_DEFAULT = 'sim_card_management_card_default_call';
|
||||
SIM_CARD_INFO = 'sim_card_management_storage_card_info';
|
||||
SIM_CARD_KEYWORD = 'sim_card_keyword';
|
||||
SIM_CARD_INFO2 = 'sim_card_management_storage_card_info2';
|
||||
SIM_CARD_Change = 'sim_card_management_card_change_boolean';
|
||||
SIM_CARD_STOP = 'sim_card_management_card_stop_boolean';
|
||||
SIM_CARD_DATA = 'sim_card_management_storage_card_data';
|
||||
SIM_LIST_DISABLED = 'sim_card_management_list_disabled';
|
||||
SIM_LIST_DISABLED2 = 'sim_card_management_list_disabled2';
|
||||
SIM_NAME1 = 'sim_card_name1';
|
||||
SIM_NAME2 = 'sim_card_name2';
|
||||
SIM_phoneNumber1 = 'sim_card_phoneNumber1';
|
||||
SIM_phoneNumber2 = 'sim_card_phoneNumber2';
|
||||
editSimInfo: CustomDialogController = new CustomDialogController({
|
||||
builder: EditSimInfo({ curEditList: this.curEditList, phoneNumber: $phoneNumber,
|
||||
action: (simName, curEditList, phoneNumber) => {
|
||||
if (curEditList.id === 0) {
|
||||
if (simName !== 'null') {
|
||||
this.list[0].name = simName;
|
||||
} else {
|
||||
this.getNetName(0);
|
||||
};
|
||||
if (phoneNumber !== 'null') {
|
||||
this.phone1Number = phoneNumber;
|
||||
} else {
|
||||
this.getPhoneNumber(0);
|
||||
};
|
||||
} else {
|
||||
if (simName !== 'null') {
|
||||
this.list[1].name = simName;
|
||||
} else {
|
||||
this.getNetName(1);
|
||||
};
|
||||
if (phoneNumber !== null) {
|
||||
this.phone2Number = phoneNumber;
|
||||
} else {
|
||||
this.getPhoneNumber(1);
|
||||
};
|
||||
}
|
||||
this.isChange = !this.isChange;
|
||||
} }),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: false,
|
||||
offset: { dx: 0, dy: -30 }
|
||||
})
|
||||
stopSim: CustomDialogController = new CustomDialogController({
|
||||
builder: StopSim({ curEditList: this.curEditList, title: this.title, isChange: $isChange, cancel: (isChange) => {
|
||||
this.isCancel = true;
|
||||
if (this.curEditList.id === 0) {
|
||||
this.list[0].isOpened = true;
|
||||
} else {
|
||||
this.list[1].isOpened = true;
|
||||
};
|
||||
this.simCardStop = isChange
|
||||
},
|
||||
action: (stop) => {
|
||||
this.defaultSetString = $r('app.string.sim_null_character');
|
||||
if (this.curEditList.id === 0) {
|
||||
setCache(this.SIM_CARD_Change, 1);
|
||||
this.setSimActive(0, false)
|
||||
this.list[0].name = $r('app.string.sim_not_enabled');
|
||||
this.isStop1 = false;
|
||||
this.isStop2 = true;
|
||||
this.changeCard = false;
|
||||
this.isCardChange = false
|
||||
} else {
|
||||
this.changeCard = true;
|
||||
this.setSimActive(1, false)
|
||||
this.list[1].name = $r('app.string.sim_not_enabled');
|
||||
this.isStop1 = true;
|
||||
this.isStop2 = false;
|
||||
this.isCardChange = true;
|
||||
};
|
||||
}
|
||||
}),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: false,
|
||||
offset: { dx: 0, dy: -30 }
|
||||
})
|
||||
updataInfo: CustomDialogController = new CustomDialogController({
|
||||
builder: UpdataInfo({ title: this.upDataTitle, isChange: this.upisChange }),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: false,
|
||||
offset: { dx: 0, dy: -30 }
|
||||
})
|
||||
|
||||
edit(item) {
|
||||
LogUtils.i(TAG, "onclick edit this.title:" + JSON.stringify(item.title))
|
||||
this.title = item.title;
|
||||
this.curEditList = item;
|
||||
if (item.id === 0) {
|
||||
if (this.phone1Number) {
|
||||
this.phoneNumber = this.phone1Number;
|
||||
} else {
|
||||
this.getNetName(0);
|
||||
}
|
||||
} else {
|
||||
if (this.phone2Number) {
|
||||
this.phoneNumber = this.phone2Number;
|
||||
} else {
|
||||
this.getNetName(1)
|
||||
}
|
||||
};
|
||||
this.editSimInfo.open();
|
||||
}
|
||||
|
||||
stopCard(item, boolean) {
|
||||
this.simCardStop = boolean;
|
||||
if (!boolean) {
|
||||
};
|
||||
this.upisChange = boolean;
|
||||
};
|
||||
|
||||
UpdataInfo(v) {
|
||||
clearTimeout(this.timer);
|
||||
this.upisChange = v;
|
||||
this.updataInfo.open();
|
||||
this.timer = setTimeout(() => {
|
||||
this.updataInfo.close();
|
||||
}, 15000)
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the customized mobile phone number set by the user
|
||||
*/
|
||||
getShowNumber(slotId) {
|
||||
simServiceProxy.getShowNumber(slotId).then((res: any) => {
|
||||
if (!slotId) {
|
||||
if (res === 'null') {
|
||||
this.getPhoneNumber(0)
|
||||
} else {
|
||||
if (slotId) {
|
||||
this.phone2Number = res;
|
||||
} else {
|
||||
this.phone1Number = res;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (res === 'null') {
|
||||
this.getPhoneNumber(1)
|
||||
} else {
|
||||
if (slotId) {
|
||||
this.phone2Number = res;
|
||||
} else {
|
||||
this.phone1Number = res;
|
||||
}
|
||||
}
|
||||
};
|
||||
}).catch((err) => {
|
||||
this.getPhoneNumber(slotId);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom operator name set by the user -- success
|
||||
*/
|
||||
getShowName(slotId) {
|
||||
simServiceProxy.getShowName(slotId).then((res) => {
|
||||
if (!slotId) {
|
||||
if (res === 'null') {
|
||||
this.getNetName(0)
|
||||
} else {
|
||||
this.list[slotId].name = res;
|
||||
}
|
||||
} else {
|
||||
if (res === 'null') {
|
||||
this.getNetName(1)
|
||||
} else {
|
||||
this.list[slotId].name = res;
|
||||
}
|
||||
};
|
||||
this.isChange = !this.isChange;
|
||||
}).catch((err) => {
|
||||
this.getNetName(slotId)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get card slot operator name
|
||||
*/
|
||||
getNetName(slotId) {
|
||||
radioServiceProxy.getOperatorName(slotId).then((res: string) => {
|
||||
if (!slotId) {
|
||||
this.list[slotId].name = res;
|
||||
} else {
|
||||
this.list[slotId].name = res;
|
||||
}
|
||||
this.isChange = !this.isChange
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether there is a card
|
||||
*/
|
||||
hasSimCard(slotId) {
|
||||
simServiceProxy.hasSimCard(slotId).then((res: boolean) => {
|
||||
this.isSimCardClosed = res;
|
||||
this.isChange = !this.isChange;
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get card status
|
||||
*/
|
||||
async getSimState(slotId) {
|
||||
this.getSupportNetwork(slotId);
|
||||
this.hasSimCard(slotId);
|
||||
this.isSimActive(slotId);
|
||||
simServiceProxy.getSimState(slotId).then((res: number) => {
|
||||
if (![4, 5].indexOf(res)) {
|
||||
this.list[slotId].disabled = true;
|
||||
this.list[slotId].isOpened = true;
|
||||
this.getShowName(slotId);
|
||||
this.getShowNumber(slotId);
|
||||
} else if (![2, 3].indexOf(res)) {
|
||||
this.list[slotId].name = $r('app.string.sim_no_service');
|
||||
this.list[slotId].isOpened = false;
|
||||
this.getShowNumber(slotId);
|
||||
} else if (![1].indexOf(res) && !this.isSimCardClosed) {
|
||||
this.list[slotId].name = $r('app.string.sim_no_card_inserted');
|
||||
this.list[slotId].isOpened = false;
|
||||
if (slotId) {
|
||||
this.phone2Number = '';
|
||||
} else {
|
||||
this.phone1Number = '';
|
||||
}
|
||||
this.list[slotId].disabled = false;
|
||||
this.list[slotId].info = '4G/3G/2G';
|
||||
} else if (![-1].indexOf(res)) {
|
||||
this.list[slotId].info = '4G/3G/2G';
|
||||
this.list[slotId].disabled = false;
|
||||
this.list[slotId].isOpened = false;
|
||||
this.list[slotId].isOpened = false;
|
||||
if (slotId) {
|
||||
this.phone2Number = '';
|
||||
} else {
|
||||
this.phone1Number = '';
|
||||
}
|
||||
this.list[slotId].name = $r('app.string.sim_no_card_inserted');
|
||||
}
|
||||
this.isChange = !this.isChange;
|
||||
this.updataInfo.close();
|
||||
clearTimeout(this.timer)
|
||||
}).catch((err) => {
|
||||
this.list[slotId].name = $r('app.string.sim_no_card_inserted');
|
||||
if (slotId) {
|
||||
this.phone2Number = '';
|
||||
} else {
|
||||
this.phone1Number = '';
|
||||
}
|
||||
this.list[slotId].disabled = false;
|
||||
this.list[slotId].isOpened = false;
|
||||
this.list[slotId].info = '4G/3G/2G';
|
||||
this.simCardStop = false;
|
||||
});
|
||||
this.isChange = !this.isChange;
|
||||
}
|
||||
|
||||
onInit() {
|
||||
this.getSimState(0);
|
||||
this.getSimState(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the phone number of sim card
|
||||
*/
|
||||
getPhoneNumber(slotId) {
|
||||
simServiceProxy.getSimTelephoneNumber(slotId).then((res: string) => {
|
||||
if (!slotId) {
|
||||
this.phone1Number = res;
|
||||
} else {
|
||||
this.phone2Number = res;
|
||||
}
|
||||
}).catch((err) => {
|
||||
this.phone2Number = '';
|
||||
})
|
||||
}
|
||||
|
||||
setSimActive(slotId, bool) {
|
||||
simServiceProxy.setSimActive(slotId, bool).then((res) => {
|
||||
if (bool) {
|
||||
this.getShowName(slotId);
|
||||
} else {
|
||||
this.list[slotId].name = $r('app.string.sim_not_enabled');
|
||||
this.list[slotId].info = '4G/3G/2G';
|
||||
}
|
||||
this.updataInfo.close();
|
||||
clearTimeout(this.timer);
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the sim card is activated
|
||||
*/
|
||||
isSimActive(slotId) {
|
||||
simServiceProxy.isSimActive(slotId).then((res) => {
|
||||
if (!res && this.isSimCardClosed) {
|
||||
this.list[slotId].isOpened = false;
|
||||
this.list[slotId].name = $r('app.string.sim_not_enabled');
|
||||
this.list[slotId].info = '4G/3G/2G';
|
||||
}
|
||||
}).catch((err) => {
|
||||
this.list[slotId].isOpened = false;
|
||||
})
|
||||
}
|
||||
|
||||
getSupportNetwork(slotId) {
|
||||
radioServiceProxy.getSupportNetwork(slotId).then((res) => {
|
||||
if (res) {
|
||||
this.list[slotId].info = '5G/4G/3G/2G';
|
||||
} else {
|
||||
this.list[slotId].info = '4G/3G/2G';
|
||||
}
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default voice
|
||||
*/
|
||||
getDefaultVoiceSlotId() {
|
||||
simServiceProxy.getDefaultVoiceSlotId().then((res: number) => {
|
||||
this.diaLing = res;
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default voice
|
||||
*/
|
||||
setDefaultVoiceSlotId(slotId) {
|
||||
simServiceProxy.setDefaultVoiceSlotId(slotId).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
addRegisterSimStateChange(slotId) {
|
||||
registerSimStateChange(slotId, async () => {
|
||||
this.getSimState(slotId);
|
||||
this.isChange = !this.isChange
|
||||
})
|
||||
}
|
||||
|
||||
setDefaultDataSlotId(slotId) {
|
||||
dataServiceProxy.setDefaultDataSlotId(slotId)
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
this.onInit();
|
||||
if (getMaxSimCount() === 2) {
|
||||
this.addRegisterSimStateChange(1);
|
||||
}
|
||||
this.addRegisterSimStateChange(0);
|
||||
this.isChange = !this.isChange;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
|
||||
Row() {
|
||||
Stack() {
|
||||
Image($r('app.media.phone')).width(62).height(42)
|
||||
Text(this.list[0].title).fontSize('12vp').fontColor('#333333')
|
||||
.align(Alignment.Start)
|
||||
.lineHeight(21)
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
}
|
||||
|
||||
Column() {
|
||||
Text(this.list[0].name).fontSize('16vp').margin({
|
||||
bottom: 2
|
||||
}).fontFamily("HarmonyHeiTi").fontWeight(FontWeight.Medium)
|
||||
.lineHeight(22)
|
||||
Text(this.phone1Number).fontColor('#555').fontSize('14vp').margin({ bottom: this.phone2Number ? 0 : 2 })
|
||||
.lineHeight(19).fontFamily("HarmonyHeiTi").fontWeight(FontWeight.Regular)
|
||||
Text(this.list[0].info).fontColor(this.isChange ? '#555' : '#555').fontSize('14vp')
|
||||
.lineHeight(19).fontFamily("HarmonyHeiTi").fontWeight(FontWeight.Regular)
|
||||
}
|
||||
.margin({ left: 16 })
|
||||
|
||||
Image($r('app.media.redact')).width('15vp').height('15vp')
|
||||
.onClick(() => {
|
||||
this.edit(this.list[0])
|
||||
}).margin({ left: 20 }).enabled(this.list[0].isOpened)
|
||||
}
|
||||
|
||||
Row() {
|
||||
Toggle({ type: ToggleType.Switch, isOn: this.list[0].isOpened })
|
||||
.width(36)
|
||||
.height(20)
|
||||
.onChange((isOn: boolean) => {
|
||||
LogUtils.i(TAG, "onclick toggle card one")
|
||||
this.getDefaultVoiceSlotId();
|
||||
this.list[0].isOpened = !this.list[0].isOpened;
|
||||
this.upDataTitle = this.list[0].title;
|
||||
if (!this.list[0].isOpened) {
|
||||
if (this.diaLing == 0) {
|
||||
this.setDefaultVoiceSlotId(-1)
|
||||
this.setDefaultDataSlotId(1)
|
||||
this.defaultSetString = $r('app.string.not_set');
|
||||
}
|
||||
}
|
||||
if (this.list[1].isOpened) {
|
||||
if (!this.list[0].isOpened) {
|
||||
if (this.isCardChange) {
|
||||
this.title = $r('app.string.sim_card_one_no_space');
|
||||
this.curEditList = this.list[0];
|
||||
this.setDefaultDataSlotId(1);
|
||||
this.stopSim.open();
|
||||
this.stopCard(this.list[0], false);
|
||||
};
|
||||
};
|
||||
};
|
||||
if (this.list[0].isOpened && this.list[1].isOpened) {
|
||||
this.UpdataInfo(true);
|
||||
this.setSimActive(0, true)
|
||||
this.stopCard(this.list[0], true);
|
||||
}
|
||||
if (!this.list[0].isOpened && this.list[1].isOpened && !this.isCardChange) {
|
||||
this.setDefaultDataSlotId(1)
|
||||
this.UpdataInfo(false);
|
||||
this.setSimActive(0, false)
|
||||
this.stopCard(this.list[0], false);
|
||||
}
|
||||
if (this.list[0].isOpened && !this.list[1].isOpened) {
|
||||
this.UpdataInfo(true);
|
||||
this.setSimActive(0, true)
|
||||
this.changeCard = true;
|
||||
} else if (!this.list[0].isOpened && !this.list[1].isOpened) {
|
||||
this.UpdataInfo(false);
|
||||
this.isCardChange = false;
|
||||
this.setDefaultDataSlotId(1)
|
||||
this.setSimActive(0, false)
|
||||
this.list[0].name = $r('app.string.sim_not_enabled');
|
||||
this.stopCard(this.list[0], false);
|
||||
} else if (!this.list[0].isOpened || !this.list[1].isOpened) {
|
||||
this.stopCard(this.list[0], false);
|
||||
}
|
||||
this.isChange = !this.isChange;
|
||||
})
|
||||
}
|
||||
}
|
||||
.opacity(this.list[0].isOpened ? 1 : 0.4)
|
||||
.enabled(this.list[0].disabled)
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 12,
|
||||
bottom: 12
|
||||
})
|
||||
.height(104)
|
||||
.width("100%")
|
||||
.borderRadius($r('app.float.radius_24'))
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"))
|
||||
|
||||
|
||||
Column() {
|
||||
}
|
||||
.height(16)
|
||||
.width("100%")
|
||||
|
||||
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
|
||||
Row() {
|
||||
Stack() {
|
||||
Image($r('app.media.phone')).width(62).height(42)
|
||||
Text(this.list[1].title).fontSize('12vp').fontColor('#333333')
|
||||
.align(Alignment.Start)
|
||||
.lineHeight(21)
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
}
|
||||
|
||||
Column() {
|
||||
Text(this.list[1].name).fontSize('16vp').margin({ bottom: 2 })
|
||||
.fontFamily("HarmonyHeiTi").fontWeight(FontWeight.Medium)
|
||||
.lineHeight(22)
|
||||
Text(this.phone2Number).fontColor('#555').fontSize('14vp').margin({ bottom: this.phone2Number ? 0 : 2 })
|
||||
.lineHeight(19).fontFamily("HarmonyHeiTi").fontWeight(FontWeight.Regular)
|
||||
Text(this.list[1].info).fontColor(this.isChange ? '#555' : '#555').fontSize('14vp')
|
||||
.lineHeight(19).fontFamily("HarmonyHeiTi").fontWeight(FontWeight.Regular)
|
||||
}
|
||||
.margin({ left: 16 })
|
||||
|
||||
Image($r('app.media.redact')).width('15vp').height('15vp')
|
||||
.onClick(() => {
|
||||
this.edit(this.list[1]);
|
||||
}).margin({ left: 20 }).enabled(this.list[1].isOpened)
|
||||
}
|
||||
|
||||
Row() {
|
||||
Toggle({ type: ToggleType.Switch, isOn: this.list[1].isOpened })
|
||||
.width(36)
|
||||
.height(20)
|
||||
.onChange((isOn: boolean) => {
|
||||
LogUtils.i(TAG, "onclick toggle card two")
|
||||
this.getDefaultVoiceSlotId();
|
||||
this.list[1].isOpened = !this.list[1].isOpened;
|
||||
this.upDataTitle = this.list[1].title;
|
||||
if (!this.list[1].isOpened) {
|
||||
if (this.diaLing == 0) {
|
||||
this.setDefaultDataSlotId(0)
|
||||
this.setDefaultVoiceSlotId(-1)
|
||||
this.defaultSetString = $r('app.string.not_set');
|
||||
}
|
||||
}
|
||||
if (this.list[0].isOpened) {
|
||||
if (!this.list[1].isOpened) {
|
||||
if (!this.isCardChange) {
|
||||
this.setDefaultDataSlotId(0)
|
||||
this.title = $r('app.string.sim_card_two_no_space');
|
||||
this.curEditList = this.list[1];
|
||||
this.stopSim.open();
|
||||
this.stopCard(this.list[1], false);
|
||||
};
|
||||
};
|
||||
};
|
||||
if (this.list[0].isOpened && this.list[1].isOpened) {
|
||||
this.UpdataInfo(true);
|
||||
this.setSimActive(1, true);
|
||||
this.stopCard(this.list[1], true);
|
||||
}
|
||||
if (this.list[0].isOpened && !this.list[1].isOpened && this.isCardChange) {
|
||||
this.setDefaultDataSlotId(0)
|
||||
this.UpdataInfo(false);
|
||||
this.setSimActive(1, false);
|
||||
this.stopCard(this.list[1], false);
|
||||
}
|
||||
if (!this.list[0].isOpened && this.list[1].isOpened) {
|
||||
this.UpdataInfo(true);
|
||||
this.setSimActive(1, true);
|
||||
this.changeCard = true;
|
||||
} else if (!this.list[0].isOpened && !this.list[1].isOpened) {
|
||||
this.setDefaultDataSlotId(0)
|
||||
this.UpdataInfo(false);
|
||||
this.isCardChange = false;
|
||||
this.setSimActive(1, false);
|
||||
this.list[1].name = $r('app.string.sim_not_enabled');
|
||||
this.stopCard(this.list[1], false);
|
||||
} else if (!this.list[0].isOpened || !this.list[1].isOpened) {
|
||||
this.stopCard(this.list[1], false);
|
||||
}
|
||||
this.isChange = !this.isChange;
|
||||
})
|
||||
}
|
||||
}
|
||||
.opacity(this.list[1].isOpened ? 1 : 0.4)
|
||||
.enabled(this.list[1].disabled)
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 12,
|
||||
bottom: 12
|
||||
})
|
||||
.width("100%")
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"))
|
||||
.borderRadius($r('app.float.radius_24'))
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DefaultCard component
|
||||
*/
|
||||
@Component
|
||||
export default struct DefaultCard {
|
||||
@State cardTextBackgrounColor: string = " #0A59F7";
|
||||
@State cardName: any = "";
|
||||
@State cardTextColor: string = "#FFFFFF"
|
||||
|
||||
build() {
|
||||
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||
Text(this.cardName)
|
||||
.fontSize(14)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.lineHeight(16)
|
||||
.fontColor(this.cardTextColor)
|
||||
.align(Alignment.Center)
|
||||
}
|
||||
.width(65)
|
||||
.height(28)
|
||||
.borderRadius(50)
|
||||
.backgroundColor(this.cardTextBackgrounColor)
|
||||
}
|
||||
}
|
@ -0,0 +1,212 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
import { setCache, getCache } from '../../utils/KvManager'
|
||||
import simServiceProxy from '../../../model/simServiceProxy'
|
||||
import LogUtils from '../../../common/utils/LogUtils'
|
||||
|
||||
const TAG = "DefaultDialCard:"
|
||||
|
||||
@CustomDialog
|
||||
export default struct DefaultDialCard {
|
||||
controller: CustomDialogController;
|
||||
action: (cardname) => void;
|
||||
@State changeDefault: boolean = true;
|
||||
@State changeCard1: boolean = false;
|
||||
@State changeCard2: boolean = false;
|
||||
@State phoneNumber1: string = '';
|
||||
@State phoneNumber2: string = '';
|
||||
@State defaultSetCard: any = '';
|
||||
SIM_CARD_DEFAULT = 'sim_card_management_card_default_call';
|
||||
SIM_CARD_KEYWORD = 'sim_card_keyword';
|
||||
|
||||
/**
|
||||
* Get the phone number of sim card
|
||||
*/
|
||||
getPhoneNumber(slotId) {
|
||||
simServiceProxy.getSimTelephoneNumber(slotId).then((res: string) => {
|
||||
if (!slotId) {
|
||||
this.phoneNumber1 = res;
|
||||
} else {
|
||||
this.phoneNumber2 = res;
|
||||
}
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the customized mobile phone number set by the user
|
||||
*/
|
||||
getShowNumber(slotId) {
|
||||
simServiceProxy.getShowNumber(slotId).then((res: string) => {
|
||||
if (res !== 'null') {
|
||||
if (!slotId) {
|
||||
this.phoneNumber1 = res;
|
||||
} else {
|
||||
this.phoneNumber2 = res;
|
||||
}
|
||||
} else {
|
||||
this.getPhoneNumber(slotId)
|
||||
}
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default voice
|
||||
*/
|
||||
getDefaultVoiceSlotId() {
|
||||
simServiceProxy.getDefaultVoiceSlotId().then((res: string) => {
|
||||
if (res == '0') {
|
||||
this.changeCard1 = true;
|
||||
this.changeCard2 = false;
|
||||
this.changeDefault = false;
|
||||
} else if (res == '1') {
|
||||
this.changeCard1 = false;
|
||||
this.changeCard2 = true;
|
||||
this.changeDefault = false;
|
||||
} else {
|
||||
this.changeCard1 = false;
|
||||
this.changeCard2 = false;
|
||||
this.changeDefault = true;
|
||||
}
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default voice
|
||||
*/
|
||||
setDefaultVoiceSlotId(slotId) {
|
||||
simServiceProxy.setDefaultVoiceSlotId(slotId).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
LogUtils.i(TAG, "aboutToAppear:")
|
||||
this.getShowNumber(0);
|
||||
this.getShowNumber(1);
|
||||
this.getDefaultVoiceSlotId()
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({ direction: FlexDirection.Column }) {
|
||||
Text($r('app.string.default_dial_card'))
|
||||
.fontSize('20vp')
|
||||
.fontColor('rgba(0, 0, 0, 0.9)')
|
||||
.textAlign(TextAlign.Start)
|
||||
.lineHeight(56)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.align(Alignment.Start)
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Text($r('app.string.not_set')).fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.align(Alignment.Center | Alignment.Start)
|
||||
.lineHeight(21)
|
||||
Image(this.changeDefault ? $r('app.media.ic_Radiobtn_on') : $r('app.media.ic_Radiobtn_off')).height(24).width(24)
|
||||
}.height(48)
|
||||
.onClick(() => {
|
||||
this.action($r('app.string.not_set'));
|
||||
this.setDefaultVoiceSlotId(-1)
|
||||
this.changeCard1 = false;
|
||||
this.changeCard2 = false;
|
||||
this.changeDefault = true;
|
||||
this.controller.close();
|
||||
})
|
||||
|
||||
Divider().vertical(false).strokeWidth(0.5).color('#ccc')
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text($r('app.string.card_1'))
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.align(Alignment.Start)
|
||||
.lineHeight(22)
|
||||
Text(this.phoneNumber1)
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.align(Alignment.Start)
|
||||
.lineHeight(19)
|
||||
.fontColor('#555')
|
||||
}.alignItems(HorizontalAlign.Start)
|
||||
|
||||
Column() {
|
||||
Image(this.changeCard1 ? $r('app.media.ic_Radiobtn_on') : $r('app.media.ic_Radiobtn_off')).height(24).width(24)
|
||||
}
|
||||
}.height(64)
|
||||
.onClick(() => {
|
||||
this.action($r('app.string.sim_card_one_no_space'));
|
||||
this.changeCard1 = true;
|
||||
this.setDefaultVoiceSlotId(0)
|
||||
this.changeCard2 = false;
|
||||
this.changeDefault = false;
|
||||
this.controller.close();
|
||||
})
|
||||
|
||||
Divider().vertical(false).strokeWidth(0.5).color('#ccc')
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text($r('app.string.card_2'))
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.align(Alignment.Start)
|
||||
.lineHeight(22)
|
||||
Text(this.phoneNumber2)
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.align(Alignment.Start)
|
||||
.lineHeight(19)
|
||||
.fontColor('#555')
|
||||
}.alignItems(HorizontalAlign.Start)
|
||||
|
||||
Column() {
|
||||
Image(this.changeCard2 ? $r('app.media.ic_Radiobtn_on') : $r('app.media.ic_Radiobtn_off')).height(24).width(24)
|
||||
}
|
||||
}.height(64)
|
||||
.onClick(() => {
|
||||
setCache(this.SIM_CARD_DEFAULT, '+8618851354122');
|
||||
this.action($r('app.string.sim_card_two_no_space'));
|
||||
this.changeCard1 = false;
|
||||
setCache(this.SIM_CARD_KEYWORD, 2)
|
||||
this.setDefaultVoiceSlotId(1)
|
||||
this.changeCard2 = true;
|
||||
this.changeDefault = false;
|
||||
this.controller.close();
|
||||
})
|
||||
|
||||
Divider().vertical(false).strokeWidth(0.5).color('#ccc')
|
||||
Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) {
|
||||
Text($r('app.string.cancel'))
|
||||
.fontSize('16vp')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontColor('#2871d4')
|
||||
}
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
})
|
||||
.height(56)
|
||||
}
|
||||
}
|
||||
.height(297)
|
||||
.padding({ left: 24, right: 24 })
|
||||
}
|
||||
}
|
@ -0,0 +1,225 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
import { REGULAR } from '../../../common/utils/constant'
|
||||
import simServiceProxy from '../../../model/simServiceProxy'
|
||||
import radioServiceProxy from '../../../model/radioServiceProxy'
|
||||
import LogUtils from '../../utils/LogUtils'
|
||||
import { getString } from '../../utils/Utils'
|
||||
|
||||
const TAG = "EditSimInfo"
|
||||
|
||||
@CustomDialog
|
||||
export default struct EditSimInfo {
|
||||
controller: CustomDialogController;
|
||||
action: (simName, curEditList, phoneNumber) => void;
|
||||
disabledState: true;
|
||||
inputVal: '';
|
||||
isShow: true;
|
||||
curEditList: any = [];
|
||||
MinLength: number = 0;
|
||||
MaxLength: number = 17;
|
||||
@State simName: string = '';
|
||||
@State isChange: boolean = true;
|
||||
@State phoneNumber: string = '';
|
||||
SIM_NAME1 = 'sim_card_name1';
|
||||
SIM_NAME2 = 'sim_card_name2';
|
||||
SIM_phoneNumber1 = 'sim_card_phoneNumber1';
|
||||
SIM_phoneNumber2 = 'sim_card_phoneNumber2';
|
||||
|
||||
/**
|
||||
* Set user's custom operator name
|
||||
*/
|
||||
setShowName(slotId, name) {
|
||||
simServiceProxy.setShowName(slotId, name).then((res) => {
|
||||
if (res) {
|
||||
this.getShowName(slotId);
|
||||
}
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom operator name set by the user -- success
|
||||
*/
|
||||
getShowName(slotId) {
|
||||
simServiceProxy.getShowName(slotId).then((res: string) => {
|
||||
if (res !== 'null') {
|
||||
this.simName = res;
|
||||
}
|
||||
;
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the customized mobile phone number set by the user
|
||||
*/
|
||||
getShowNumber(slotId) {
|
||||
simServiceProxy.getShowNumber(slotId).then((res: string) => {
|
||||
if (res !== 'null') {
|
||||
this.phoneNumber = res;
|
||||
} else {
|
||||
this.getPhoneNumber(slotId);
|
||||
}
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user's customized mobile phone number
|
||||
*/
|
||||
setShowNumber(slotId, phoneNumber) {
|
||||
simServiceProxy.setShowNumber(slotId, phoneNumber).then(() => {
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get card slot operator name
|
||||
*/
|
||||
getNetName(slotId) {
|
||||
radioServiceProxy.getOperatorName(slotId).then((res: string) => {
|
||||
if (!slotId) {
|
||||
this.simName = res;
|
||||
} else {
|
||||
this.simName = res;
|
||||
}
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
getPhoneNumber(slotId) {
|
||||
simServiceProxy.getSimTelephoneNumber(slotId).then((res: string) => {
|
||||
this.phoneNumber = res;
|
||||
}).catch((err) => {
|
||||
})
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
LogUtils.i(TAG, "this.curentList:" + JSON.stringify(this.curEditList));
|
||||
if (this.curEditList.id === 0) {
|
||||
LogUtils.i(TAG, "this.curentList id:" + JSON.stringify(this.curEditList.id));
|
||||
this.getShowName(0);
|
||||
this.getShowNumber(0);
|
||||
} else {
|
||||
this.getShowName(1);
|
||||
this.getShowNumber(1);
|
||||
}
|
||||
this.isChange = !this.isChange;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) {
|
||||
Text($r('app.string.sim_edit', `${getString(this.curEditList.title)}`))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.fontSize('20vp')
|
||||
.fontColor('rgba(0, 0, 0, 0.9)')
|
||||
.lineHeight(56)
|
||||
.margin({ left: 12, right: 12 })
|
||||
|
||||
TextInput({ text: this.simName, placeholder: $r('app.string.sim_card_name') })
|
||||
.maxLength(20)
|
||||
.height(48)
|
||||
.placeholderFont({ size: 16, family: 'HarmonyHeiTi' })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_list_card_bg"))
|
||||
.onChange((value: string) => {
|
||||
this.simName = value;
|
||||
LogUtils.i(TAG, "simName: " + JSON.stringify(this.simName))
|
||||
})
|
||||
TextInput({ text: this.phoneNumber, placeholder: $r('app.string.sim_phone_number') })
|
||||
.maxLength(15)
|
||||
.height(48)
|
||||
.placeholderFont({ size: 16, family: 'HarmonyHeiTi' })
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_list_card_bg"))
|
||||
.onChange((v: string) => {
|
||||
let inputString = v.match(REGULAR.regular);
|
||||
this.phoneNumber = '';
|
||||
if (inputString != null) {
|
||||
this.phoneNumber = inputString.join('');
|
||||
}
|
||||
;
|
||||
this.isChange = !this.isChange;
|
||||
})
|
||||
Flex({ justifyContent: FlexAlign.SpaceAround }) {
|
||||
Text($r('app.string.cancel'))
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.lineHeight(21)
|
||||
.fontColor('#2871d4')
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
this.phoneNumber = '';
|
||||
this.simName = '';
|
||||
})
|
||||
Divider().vertical(true).height(0.5).strokeWidth(1).opacity(0.5)
|
||||
Text($r('app.string.confirm'))
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.lineHeight(21)
|
||||
.onClick(() => {
|
||||
if (this.phoneNumber == '+') {
|
||||
this.controller.close();
|
||||
return;
|
||||
}
|
||||
if (this.curEditList.id === 0) {
|
||||
if (!this.phoneNumber) {
|
||||
LogUtils.i(TAG, "onclick edit confim : ")
|
||||
this.phoneNumber = 'null';
|
||||
this.setShowNumber(0, 'null');
|
||||
} else {
|
||||
LogUtils.i(TAG, "onclick edit cancel : ")
|
||||
this.setShowNumber(0, this.phoneNumber);
|
||||
}
|
||||
if (!this.simName) {
|
||||
this.simName = 'null';
|
||||
this.setShowName(0, 'null');
|
||||
} else {
|
||||
this.setShowName(0, this.simName);
|
||||
}
|
||||
this.action(this.simName, this.curEditList, this.phoneNumber);
|
||||
} else {
|
||||
if (!this.phoneNumber) {
|
||||
this.phoneNumber = 'null'
|
||||
this.setShowNumber(1, 'null');
|
||||
} else {
|
||||
this.setShowNumber(1, this.phoneNumber);
|
||||
}
|
||||
if (!this.simName) {
|
||||
this.simName = 'null';
|
||||
this.setShowName(1, 'null');
|
||||
} else {
|
||||
this.setShowName(1, this.simName);
|
||||
}
|
||||
this.action(this.simName, this.curEditList, this.phoneNumber);
|
||||
}
|
||||
this.isChange = !this.isChange;
|
||||
this.controller.close()
|
||||
}).fontColor(this.isChange ? '#2871d4' : '#2871d4')
|
||||
}
|
||||
.margin({ left: 12, right: 12, top: 18 })
|
||||
.height(56)
|
||||
}
|
||||
}
|
||||
.height(216)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_list_card_bg"))
|
||||
.padding({ left: 12, right: 12 })
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
import { getString } from '../../utils/Utils'
|
||||
|
||||
@CustomDialog
|
||||
export default struct SetFlowLimit {
|
||||
controller: CustomDialogController;
|
||||
action: () => void;
|
||||
change: boolean = null;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({ direction: FlexDirection.Column }) {
|
||||
Text($r('app.string.sim_package_limit', `${this.change ? getString($r('app.string.sim_card_one_no_space')) : getString($r('app.string.sim_card_two_no_space')) }`))
|
||||
.fontWeight(600)
|
||||
.fontSize('28vp')
|
||||
.fontColor('rgba(0, 0, 0, 0.9)')
|
||||
.height('50vp')
|
||||
.textAlign(TextAlign.Start)
|
||||
Text($r('app.string.sim_additional_costs', `${this.change ? getString($r('app.string.sim_card_two_no_space')) : getString($r('app.string.sim_card_one_no_space')) }`))
|
||||
.fontSize('24vp')
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({ bottom: 20 })
|
||||
Flex({ justifyContent: FlexAlign.SpaceAround }) {
|
||||
Button($r('app.string.cancel'))
|
||||
.fontSize('24vp')
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
this.action();
|
||||
}).backgroundColor(0xffffff).fontColor('#2871d4')
|
||||
Divider().vertical(true).height(1).strokeWidth(1).lineCap(LineCapStyle.Round).opacity(0.5)
|
||||
Button($r('app.string.go_to_set'))
|
||||
.fontSize('24vp')
|
||||
.onClick(() => {
|
||||
this.controller.close();
|
||||
this.action();
|
||||
}).backgroundColor(0xffffff).fontColor('#2871d4')
|
||||
}
|
||||
}
|
||||
.height(200)
|
||||
}
|
||||
.padding(24)
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
import { setCache } from '../../utils/KvManager'
|
||||
import { getString } from '../../utils/Utils'
|
||||
|
||||
@CustomDialog
|
||||
export default struct StopSim {
|
||||
controller: CustomDialogController;
|
||||
action: (stop) => void;
|
||||
curEditList: any = [];
|
||||
title: any = '';
|
||||
cancel: (boolean) => void;
|
||||
@State isChange: boolean = false;
|
||||
SIM_CARD_Change = 'sim_card_management_card_change_boolean';
|
||||
SIM_CARD_DEFAULT = 'sim_card_management_card_default_call';
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start }) {
|
||||
Text(`${getString($r('app.string.stop_use'))}${getString(this.curEditList.title)}`)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonyHeiTi")
|
||||
.fontSize('20vp')
|
||||
.fontColor('rgba(0, 0, 0, 0.9)')
|
||||
.height(56)
|
||||
.textAlign(TextAlign.Start)
|
||||
Text($r('app.string.sim_mobile_data_change', `${this.curEditList.id === 0 ? getString($r('app.string.sim_card_two_no_space')) : getString($r('app.string.sim_card_one_no_space'))}`, `${getString(this.curEditList.title)}`))
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.textAlign(TextAlign.Start)
|
||||
.height(56)
|
||||
Flex({ justifyContent: FlexAlign.SpaceAround }) {
|
||||
Text($r('app.string.cancel'))
|
||||
.fontSize('16vp')
|
||||
.onClick(() => {
|
||||
this.isChange = true;
|
||||
this.controller.close();
|
||||
this.cancel(true);
|
||||
})
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonnyHeiTi")
|
||||
.lineHeight(21)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
Divider().vertical(true).height(1).strokeWidth(1).lineCap(LineCapStyle.Round).opacity(0.5)
|
||||
Text($r('app.string.stop_use'))
|
||||
.fontSize('16vp')
|
||||
.onClick(() => {
|
||||
setCache(this.SIM_CARD_DEFAULT, '不设置');
|
||||
this.isChange = false;
|
||||
this.controller.close();
|
||||
this.action(false);
|
||||
})
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily("HarmonnyHeiTi")
|
||||
.lineHeight(21)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
}
|
||||
.height(56)
|
||||
.margin({ top: 18 })
|
||||
}
|
||||
}
|
||||
.height(183)
|
||||
.padding({ left: 24, right: 24 })
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
import { getString } from '../../utils/Utils'
|
||||
|
||||
@CustomDialog
|
||||
export default struct UpdataInfo {
|
||||
controller: CustomDialogController;
|
||||
action: () => void;
|
||||
title: any = '';
|
||||
cancel: () => void;
|
||||
isChange: boolean;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r('app.string.sim_stop_information', `${!this.isChange ? getString($r('app.string.stop_use')) : getString($r('app.string.sim_enabled'))}`, `${getString(this.title)}`))
|
||||
.height('98vp')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontFamily('HarmonyHeiTi')
|
||||
.fontSize('20vp')
|
||||
.fontColor('rgba(0, 0, 0, 0.9)')
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.padding({ left: '24pv' })
|
||||
.width('100%')
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* head custom component
|
||||
*/
|
||||
@Component
|
||||
export default struct HeadComponent {
|
||||
@State isTouch: boolean = false;
|
||||
@State headName: any = '';
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Stack({ alignContent: Alignment.Center }) {
|
||||
Image($r('app.media.back'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.fillColor($r("sys.color.ohos_id_color_primary"))
|
||||
}
|
||||
.margin({ right: 16 })
|
||||
.backgroundColor(this.isTouch ? $r('app.color.color_E3E3E3_grey') : $r('app.color.color_00000000_transparent'))
|
||||
.onClick(() => {
|
||||
globalThis.simCardAbilityContext?.terminateSelf().then((data) => {
|
||||
});
|
||||
})
|
||||
.onTouch((event: TouchEvent) => {
|
||||
if (event.type === TouchType.Down) {
|
||||
this.isTouch = true;
|
||||
}
|
||||
if (event.type === TouchType.Up) {
|
||||
this.isTouch = false;
|
||||
}
|
||||
});
|
||||
|
||||
Text(this.headName)
|
||||
.fontSize(20)
|
||||
.lineHeight(33)
|
||||
.fontFamily('HarmonyHeiTi-Bold')
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor($r('app.color.font_color_182431'))
|
||||
.maxLines(1)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
.textAlign(TextAlign.Start)
|
||||
.margin({ top: 13, bottom: 15 });
|
||||
}
|
||||
.width("100%")
|
||||
.padding({ left: 12 })
|
||||
.height(56)
|
||||
.alignItems(VerticalAlign.Center)
|
||||
.align(Alignment.Start)
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: Card information init
|
||||
*/
|
||||
|
||||
import { CARD_NET_SUPPORT } from '../utils/constant';
|
||||
|
||||
export default {
|
||||
// card title
|
||||
title: '',
|
||||
// card name
|
||||
name: 'strings.noCardInserted',
|
||||
updateName: '',
|
||||
// card number
|
||||
number: '',
|
||||
updateNumber: '',
|
||||
// is contain this card
|
||||
isOpened: false,
|
||||
// is or isn't opened
|
||||
disabled: true,
|
||||
id: 0,
|
||||
netSupport: CARD_NET_SUPPORT.NO_SUPPORT_5G
|
||||
};
|
26
simcardmanagement/src/main/ets/common/config/cardSetData.ets
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: Card set data init
|
||||
*/
|
||||
|
||||
export default {
|
||||
dataBy: 0,
|
||||
isChangeDataCard: false,
|
||||
callBy: 0,
|
||||
card1Forward: false,
|
||||
card2Forward: false
|
||||
};
|
137
simcardmanagement/src/main/ets/common/utils/KvManager.ets
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
import distributedKVStore from '@ohos.data.distributedKVStore'
|
||||
import LogUtils from '../utils/LogUtils'
|
||||
|
||||
const TAG = "KVManager"
|
||||
let kvManager: any = AppStorage.Get("kvManager");
|
||||
|
||||
/**
|
||||
* Distributed database Basic configuration
|
||||
*/
|
||||
const options = {
|
||||
createIfMissing: true,
|
||||
encrypt: false,
|
||||
backup: false,
|
||||
autoSync: true,
|
||||
kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION,
|
||||
securityLevel: distributedKVStore.SecurityLevel.S2,
|
||||
};
|
||||
|
||||
/**
|
||||
* Distributed database Basic configuration
|
||||
*/
|
||||
const kvManagerConfig = {
|
||||
context: globalThis.simCardAbilityContext,
|
||||
bundleName: 'com.example.callui',
|
||||
userInfo: {
|
||||
userId: '0',
|
||||
userType: 0
|
||||
}
|
||||
};
|
||||
|
||||
function createKVManager() {
|
||||
try {
|
||||
LogUtils.i(TAG, "succeeded in creating KVManager")
|
||||
kvManager = distributedKVStore.createKVManager(kvManagerConfig);
|
||||
AppStorage.SetOrCreate("kvManager", kvManager)
|
||||
} catch(e) {
|
||||
LogUtils.i(TAG, "Failed to create KVManager.code is " + JSON.stringify(e.code) + " message is : " + JSON.stringify(e.message))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a database instance
|
||||
*
|
||||
* @param {Function} callback - Callback
|
||||
*/
|
||||
function getKVStore(callback) {
|
||||
if (kvManager == undefined) {
|
||||
createKVManager();
|
||||
}
|
||||
kvManager.getKVStore('storeId', options).then((store) => {
|
||||
callback(store);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Distributed database Set up storage
|
||||
*
|
||||
* @param {string} key - storage key
|
||||
* @param {string} value - storage value
|
||||
*/
|
||||
export function setCache(key, value) {
|
||||
getKVStore(
|
||||
(store) => {
|
||||
store.put(key, value).then((data) => {
|
||||
LogUtils.i(TAG, `put success key ${key}, value: ${value}:` + JSON.stringify(data))
|
||||
if (key === 'pinRemainingTime') {
|
||||
getCache(key, (data) => {
|
||||
LogUtils.i(TAG, `getCache success key ${key}: ` + JSON.stringify(data))
|
||||
});
|
||||
}
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, 'put err: ' + JSON.stringify(err));
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Distributed database Get up storage
|
||||
*
|
||||
* @param {string} key - storage key
|
||||
* @param {Function} callback - Callback
|
||||
*/
|
||||
export function getCache(key, callback) {
|
||||
getKVStore((store) => {
|
||||
store.get(key).then((data) => {
|
||||
callback(data);
|
||||
}).catch((err) => {
|
||||
LogUtils.i(TAG, 'getCache err: ' + JSON.stringify(err));
|
||||
callback(null, err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Distributed database Get up storage
|
||||
*
|
||||
* @param {string} key - storage key
|
||||
* @param {Function} callback - Callback
|
||||
*/
|
||||
export function deleteCache(key, callback) {
|
||||
getKVStore((store) => {
|
||||
store.delete(key).then((data) => {
|
||||
callback(data);
|
||||
}).catch((err) => {
|
||||
callback(null, err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Distributed database close storage
|
||||
*/
|
||||
export function closeKVStore() {
|
||||
getKVStore((store) => {
|
||||
kvManager.closeKVStore("appId", "storeId", function (err, data) {
|
||||
if (err != undefined) {
|
||||
LogUtils.e(TAG, `Fail to close KVStore code is ${err.code}, message is ${err.message} `)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
52
simcardmanagement/src/main/ets/common/utils/LogUtils.ts
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Log Util
|
||||
*
|
||||
* standard:
|
||||
* 1. define TAG, recommend class name.
|
||||
* 2. switch IS_DEBUG_ON as true, when debugging.
|
||||
* 3. msg should be short and valuable.
|
||||
* 4. choose appropriate function.
|
||||
* 5. the function execute many times can not print.
|
||||
* 6. uniqueness.
|
||||
*/
|
||||
|
||||
/**
|
||||
* log package tool class
|
||||
*/
|
||||
export class LogUtils {
|
||||
d(TAG, msg): void {
|
||||
console.debug("[simcardmanagement:]" + TAG + ":" + msg);
|
||||
}
|
||||
|
||||
i(TAG, msg): void {
|
||||
console.info("[simcardmanagement:]" + TAG + ":" + msg);
|
||||
}
|
||||
|
||||
w(TAG, msg): void {
|
||||
console.warn("[simcardmanagement:]" + TAG + ":" + msg);
|
||||
}
|
||||
|
||||
e(TAG, msg): void {
|
||||
console.error("[simcardmanagement:]" + TAG + ":" + msg);
|
||||
}
|
||||
}
|
||||
|
||||
let mLogUtil = new LogUtils();
|
||||
|
||||
export default mLogUtil as LogUtils;
|
||||
|
23
simcardmanagement/src/main/ets/common/utils/Utils.ets
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: Utils
|
||||
*/
|
||||
export function getString(value: Resource) {
|
||||
return globalThis.simCardAbilityContext.resourceManager.getStringSync(value);
|
||||
}
|
||||
|
||||
|
44
simcardmanagement/src/main/ets/common/utils/constant.ets
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: Constant selection data
|
||||
*/
|
||||
|
||||
export const DIALOG_TYPE = {
|
||||
TWO_BUTTON_DIALOG: 'twoButton',
|
||||
TOAST_DIALOG: 'toast'
|
||||
};
|
||||
|
||||
export const UPDATE_DIALOG_TYPE = {
|
||||
ADD_ESIM: 'addESim'
|
||||
};
|
||||
|
||||
export const CARD_CALLING_SET = {
|
||||
NO_SETTING: -1,
|
||||
CARD1: 0,
|
||||
CARD2: 1
|
||||
};
|
||||
|
||||
export const CARD_NET_SUPPORT = {
|
||||
NO_SUPPORT_5G: '4G/3G/2G',
|
||||
SUPPORT_5G: '5G/4G/3G/2G'
|
||||
};
|
||||
|
||||
export const REGULAR = {
|
||||
regular: /^[+]|[0-9]+/g,
|
||||
regular2: /[^~!@$%^&()#+*_\-=<>?:"{}|,.\/;₠₵¢¢Πη℅©¶¢€∣∅√÷×≈™′℗®'´''ˊ¢`•▪.·°∉¢φ£△∆·£¥£฿€$¥′″∏~~﹏﹋≈'\\[\]·~!@¥%……&()——\-={}|《》?:“”【】、;‘',。、A-Za-z\x22]/g
|
||||
};
|
||||
|
38
simcardmanagement/src/main/ets/model/api.ets
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: SIM open interface call
|
||||
*/
|
||||
|
||||
import observer from '@ohos.telephony.observer';
|
||||
import sim from '@ohos.telephony.sim';
|
||||
|
||||
export { sim, observer };
|
||||
|
||||
function getSimState(slotId=0) {
|
||||
return sim.getSimState(slotId);
|
||||
}
|
||||
|
||||
function getDefaultVoiceSlotId(slotId) {
|
||||
return sim.getDefaultVoiceSlotId(slotId);
|
||||
}
|
||||
|
||||
function getSimTelephoneNumber(slotId=0) {
|
||||
return sim.getSimTelephoneNumber(slotId);
|
||||
}
|
||||
|
||||
|
||||
export { getSimState, getDefaultVoiceSlotId, getSimTelephoneNumber, };
|
91
simcardmanagement/src/main/ets/model/dataServiceProxy.ets
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: data service interface
|
||||
*/
|
||||
|
||||
import data from '@ohos.telephony.data';
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
|
||||
const TAG = "dataServiceProxy"
|
||||
|
||||
/**
|
||||
* Get default dataSlotId
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function getDefaultDataSlotId() {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
data.getDefaultCellularDataSlotId((error, data) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "getDefaultCellularDataSlotId error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "getDefaultCellularDataSlotId data:" + JSON.stringify(data));
|
||||
resolve(data);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getDefaultCellularDataSlotId catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default dataSlotId
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function setDefaultDataSlotId(slotId = 0) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
data.setDefaultCellularDataSlotId(slotId, (error, data) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "setDefaultCellularDataSlotId error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "setDefaultCellularDataSlotId data:" + JSON.stringify(data));
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "setDefaultCellularDataSlotId catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Is change net
|
||||
*
|
||||
* @param {boolean} bool
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function isChangeNet(bool = true) {
|
||||
return new Promise((resolve) => {
|
||||
resolve(true);
|
||||
LogUtils.i(TAG, "isChangeNet resolve:" + bool);
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
getDefaultDataSlotId,
|
||||
setDefaultDataSlotId,
|
||||
isChangeNet
|
||||
};
|
78
simcardmanagement/src/main/ets/model/radioServiceProxy.ets
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: radio service interface
|
||||
*/
|
||||
|
||||
import radio from '@ohos.telephony.radio';
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
import { getString } from '../common/utils/Utils'
|
||||
|
||||
const TAG = "radioserviceProxy"
|
||||
|
||||
/**
|
||||
* Get support network
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
let getSupportNetwork = function (slotId = 0) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
let isSupported = radio.isNrSupported();
|
||||
LogUtils.i(TAG, "getSupportNetwork isNrSupported:" + isSupported);
|
||||
resolve(isSupported);
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getSupportNetwork isNrSupported:catch" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get operation name
|
||||
*
|
||||
* @param {number} slotId - slot id
|
||||
* @return {Promise}
|
||||
*/
|
||||
let getOperatorName = function (slotId = 0) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
radio.getOperatorName(slotId, (error, value) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "getOperatorName error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "getOperatorName value:" + JSON.stringify(value));
|
||||
if (value == 'CHINA MOBILE') {
|
||||
LogUtils.i(TAG, "getOperatorName value-CHINA MOBILE:" + JSON.stringify(value));
|
||||
resolve(getString($r('app.string.china_mobile')));
|
||||
} else {
|
||||
resolve(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getOperatorName catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export default {
|
||||
getSupportNetwork,
|
||||
getOperatorName
|
||||
};
|
44
simcardmanagement/src/main/ets/model/registerSimStateApi.ets
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: registerSimStateApi
|
||||
*/
|
||||
|
||||
import { observer } from './api';
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
import sim from '@ohos.telephony.sim';
|
||||
|
||||
const TAG = "registerSimStateApi"
|
||||
|
||||
/**
|
||||
* Monitor the SIM card status
|
||||
*
|
||||
* @param {function} callBack - call-back
|
||||
* @param {string} slotId - card The slot id
|
||||
*/
|
||||
export function registerSimStateChange(slotId, callBack) {
|
||||
return observer.on('simStateChange', {
|
||||
slotId: slotId
|
||||
}, (callStateInfo) => {
|
||||
LogUtils.i(TAG, "registerSimStateChange: then" + JSON.stringify(callStateInfo));
|
||||
callBack(callStateInfo);
|
||||
return callStateInfo
|
||||
});
|
||||
}
|
||||
|
||||
export function getMaxSimCount() {
|
||||
return sim.getMaxSimCount();
|
||||
}
|
395
simcardmanagement/src/main/ets/model/simServiceProxy.ets
Normal file
@ -0,0 +1,395 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: SIM card service interface
|
||||
*/
|
||||
|
||||
import sim from '@ohos.telephony.sim';
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
import { getString } from '../common/utils/Utils'
|
||||
|
||||
const TAG = "simServiceProxy"
|
||||
|
||||
/**
|
||||
* Get simAccount number
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function getSimAccountNumber(slotId = 0) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
sim.getSimAccountInfo(slotId, (error, info) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "getSimAccountNumber getSimAccountInfo error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "getSimAccountNumber getSimAccountInfo data:" + JSON.stringify(info.showNumber));
|
||||
resolve(info.showNumber);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getSimAccountNumber getSimAccountInfo catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* is has simcard
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function hasSimCard(slotId = 0) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
sim.hasSimCard(slotId, (error, data) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "hasSimCard error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "hasSimCard data:" + JSON.stringify(data));
|
||||
resolve(data);
|
||||
}
|
||||
;
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "hasSimCard catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get simSpn
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function getSimSpn(slotId = 0) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
sim.getSimSpn(slotId, (error, value) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "getSimSpn error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "getSimSpn data:" + JSON.stringify(value));
|
||||
resolve(value);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "hasSimCard catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sim telephone number
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function getSimTelephoneNumber(slotId = 0) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
sim.getSimTelephoneNumber(slotId, (error, value) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "getSimTelephoneNumber error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "getSimTelephoneNumber data:" + JSON.stringify(value));
|
||||
resolve(value);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getSimTelephoneNumber catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Is sim active
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function isSimActive(slotId = 0) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
sim.isSimActive(slotId, (error, value) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "isSimActive error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "isSimActive data:" + JSON.stringify(value));
|
||||
resolve(value);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "isSimActive catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sim state
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function getSimState(slotId = 0) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
sim.getSimState(slotId, (error, value) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "getSimState error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "getSimState data:" + JSON.stringify(value));
|
||||
resolve(value);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getSimState catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default voiceSlotId
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function getDefaultVoiceSlotId() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
sim.getDefaultVoiceSlotId((error, value) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "getDefaultVoiceSlotId error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "getDefaultVoiceSlotId data:" + JSON.stringify(value));
|
||||
resolve(value);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getDefaultVoiceSlotId catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default voiceSlotId
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function setDefaultVoiceSlotId(slotId = 0) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
sim.setDefaultVoiceSlotId(slotId, (error, data) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "setDefaultVoiceSlotId error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "setDefaultVoiceSlotId data:" + JSON.stringify(data));
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "setDefaultVoiceSlotId catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sim active
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @param {boolean} bool - Is SIM card activated
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function setSimActive(slotId = 0, bool) {
|
||||
if (bool) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
sim.activateSim(slotId, (error) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "activateSim error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "activateSim data:" + JSON.stringify(bool));
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "activateSim catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
sim.deactivateSim(slotId, (error) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "deactivateSim error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "deactivateSim data:" + JSON.stringify(bool));
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "deactivateSim catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set show name
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @param {string} name - name Value
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function setShowName(slotId = 0, name = '') {
|
||||
LogUtils.i(TAG, "setShowName data:" + JSON.stringify(name));
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
sim.setShowName(slotId, name, (error) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "setShowName error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "setShowName success:");
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "setShowName catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get show name
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function getShowName(slotId = 0) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
sim.getShowName(slotId, (error, value) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "getShowName error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "getShowName data:" + JSON.stringify(value));
|
||||
if (value == 'CHINA MOBILE') {
|
||||
resolve(getString($r('app.string.china_mobile')));
|
||||
} else {
|
||||
resolve(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getShowName catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set show number
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @param {string} number - phone number
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function setShowNumber(slotId = 0, number = '') {
|
||||
LogUtils.i(TAG, "setShowNumber number:" + JSON.stringify(number));
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
sim.setShowNumber(slotId, number, (error) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "setShowNumber error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "setShowNumber success:");
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "setShowNumber catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get show number
|
||||
*
|
||||
* @param {number} slotId - slot ID
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function getShowNumber(slotId = 0) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
sim.getShowNumber(slotId, (error, value) => {
|
||||
if (error) {
|
||||
LogUtils.i(TAG, "getShowNumber error:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
} else {
|
||||
LogUtils.i(TAG, "getShowNumber data:" + JSON.stringify(value));
|
||||
resolve(value);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
LogUtils.i(TAG, "getShowNumber catch:" + JSON.stringify(error));
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const simAdapter = {
|
||||
getSimAccountNumber,
|
||||
getSimSpn,
|
||||
getSimTelephoneNumber,
|
||||
setDefaultVoiceSlotId,
|
||||
getDefaultVoiceSlotId,
|
||||
isSimActive,
|
||||
hasSimCard,
|
||||
getSimState,
|
||||
setSimActive,
|
||||
setShowName,
|
||||
getShowName,
|
||||
setShowNumber,
|
||||
getShowNumber
|
||||
};
|
||||
|
||||
export default simAdapter;
|
314
simcardmanagement/src/main/ets/pages/index.ets
Normal file
@ -0,0 +1,314 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
/**
|
||||
SIM_CARD_INFO */
|
||||
import HeadComponent from '../common/components/headComponent'
|
||||
import CardInfomation from '../common/components/cardInfomation'
|
||||
import CardSetData from '../common/config/cardSetData';
|
||||
import SetFlowLimit from '../common/components/dialog/setFlowLimit'
|
||||
import DefaultDialCard from '../common/components/dialog/defalutDialing'
|
||||
import cardInfoData from '../common/config/cardInfoData';
|
||||
import { setCache, getCache } from '../common/utils/KvManager'
|
||||
import dataServiceProxy from '../model/dataServiceProxy';
|
||||
import simServiceProxy from '../model/simServiceProxy'
|
||||
import DefaultCard from '../common/components/defaultCard'
|
||||
import LogUtils from '../common/utils/LogUtils'
|
||||
|
||||
export const CARD_HOT_PULL_PLUG = {
|
||||
HOT_PULL: 1,
|
||||
HOT_PLUG: 4
|
||||
};
|
||||
|
||||
const TAG = "Index"
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
scroller: Scroller = new Scroller();
|
||||
@State simId: string = '';
|
||||
@State isShow: boolean = false;
|
||||
@State isShow2: boolean = false;
|
||||
private number1: string = '';
|
||||
private number2: string = '';
|
||||
@State phoneNumber: boolean = false;
|
||||
@State cardData: any = JSON.parse(JSON.stringify(CardSetData));
|
||||
@State isRegisterObserver: boolean = false;
|
||||
@State defaultDataChange: boolean = true;
|
||||
@State isStop: boolean = true;
|
||||
@State defaultset: any = '';
|
||||
@State closeTransfer: boolean = false;
|
||||
@State list: any = [
|
||||
JSON.parse(JSON.stringify(cardInfoData)),
|
||||
JSON.parse(JSON.stringify(cardInfoData))
|
||||
];
|
||||
SIM_CARD_STOP = 'sim_card_management_card_stop_boolean';
|
||||
SIM_CARD_Change = 'sim_card_management_card_change_boolean';
|
||||
SIM_CARD_DEFAULT = 'sim_card_management_card_default_call';
|
||||
SIM_CARD_TRANSFER = 'sim_card_management_transfer';
|
||||
SIM_CARD_TRANSFER2 = 'sim_card_management_transfer2';
|
||||
SHOW_CHANGE = 'sim_change_data'
|
||||
setFlowLimit: CustomDialogController = new CustomDialogController({
|
||||
builder: SetFlowLimit({ change: this.defaultDataChange }),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: false,
|
||||
offset: { dx: 0, dy: -30 }
|
||||
})
|
||||
defaultDialCard: CustomDialogController = new CustomDialogController({
|
||||
builder: DefaultDialCard({ action: (v) => {
|
||||
this.defaultset = v;
|
||||
}}),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: false,
|
||||
offset: { dx: 0, dy: -30 }
|
||||
})
|
||||
|
||||
/* set(item) {
|
||||
this.setFlowLimit.open();
|
||||
};*/
|
||||
|
||||
defaultCard() {
|
||||
LogUtils.i(TAG, "onclick defaultDialCard open")
|
||||
this.defaultDialCard.open();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the customized mobile phone number set by the user
|
||||
*/
|
||||
getShowNumber(slotId) {
|
||||
simServiceProxy.getShowNumber(slotId).then((res: string) => {
|
||||
if (res !== 'null') {
|
||||
if (!slotId) {
|
||||
this.number1 = res;
|
||||
} else {
|
||||
this.number2 = res;
|
||||
}
|
||||
} else {
|
||||
this.getPhoneNumber(slotId);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the phone number of sim card
|
||||
*/
|
||||
getPhoneNumber(slotId) {
|
||||
simServiceProxy.getSimTelephoneNumber(slotId).then((res: string) => {
|
||||
if (!slotId) {
|
||||
this.number1 = res;
|
||||
} else {
|
||||
this.number2 = res;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default voice sim card
|
||||
*/
|
||||
getDefaultVoiceSlotld() {
|
||||
simServiceProxy.getDefaultVoiceSlotId().then((res: string) => {
|
||||
if (res == '0') {
|
||||
this.defaultset = $r('app.string.sim_card_one_no_space');
|
||||
} else if (res == '1') {
|
||||
this.defaultset = $r('app.string.sim_card_two_no_space');
|
||||
} else {
|
||||
this.defaultset = $r('app.string.not_set');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
setDefaultDataSlotId(slotId) {
|
||||
dataServiceProxy.setDefaultDataSlotId(slotId)
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
LogUtils.i(TAG, "aboutToAppear")
|
||||
getCache(this.SHOW_CHANGE, (data) => {
|
||||
if (data == 0) {
|
||||
this.isShow = false;
|
||||
} else {
|
||||
this.isShow = true;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
getDefaultDataSlotId() {
|
||||
dataServiceProxy.getDefaultDataSlotId().then((res) => {
|
||||
if (res === 1) {
|
||||
this.defaultDataChange = false;
|
||||
} else {
|
||||
this.defaultDataChange = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
LogUtils.i(TAG, "onPageShow start ")
|
||||
this.getShowNumber(0);
|
||||
this.getShowNumber(1);
|
||||
this.getDefaultVoiceSlotld();
|
||||
this.getDefaultDataSlotId();
|
||||
getCache(this.SIM_CARD_Change, (data) => {
|
||||
if (data == null) {
|
||||
setCache(this.SIM_CARD_Change, 0);
|
||||
} else {
|
||||
if (data == 0) {
|
||||
this.defaultDataChange = true;
|
||||
} else {
|
||||
this.defaultDataChange = false;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
getCache(this.SIM_CARD_STOP, (data) => {
|
||||
if (data != null) {
|
||||
this.isStop = data;
|
||||
}
|
||||
;
|
||||
});
|
||||
|
||||
getCache(this.SIM_CARD_DEFAULT, (data) => {
|
||||
this.defaultset = data.replace('\'', '').replace('\'', '');
|
||||
});
|
||||
|
||||
LogUtils.i(TAG, "onPageShow end ")
|
||||
}
|
||||
|
||||
build() {
|
||||
GridRow({ columns: { sm: 4, md: 8, lg: 12 }, gutter: { x: 12 } }) {
|
||||
GridCol({ span: { sm: 4, md: 8, lg: 8 }, offset: { sm: 0, md: 1, lg: 2 } }) {
|
||||
Column() {
|
||||
Column() {
|
||||
HeadComponent({ headName: $r('app.string.sim_headName') })
|
||||
|
||||
Column() {
|
||||
}
|
||||
.height(12)
|
||||
.width("100%")
|
||||
|
||||
CardInfomation({
|
||||
simCardStop: $isStop,
|
||||
changeCard: $defaultDataChange,
|
||||
phone1Number: this.number1,
|
||||
phone2Number: this.number2,
|
||||
isCardChange: $defaultDataChange,
|
||||
isCardChange2: $isShow,
|
||||
defaultSetString: $defaultset,
|
||||
})
|
||||
|
||||
Column() {
|
||||
}
|
||||
.height(16)
|
||||
.width("100%")
|
||||
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Column() {
|
||||
Text($r('app.string.default_mobile_data')).fontSize('16vp').fontFamily("HarmonyHeiTi").fontWeight(FontWeight.Medium).maxLines(1)
|
||||
}
|
||||
.opacity(this.isStop ? 1 : 0.4)
|
||||
.align(Alignment.Center)
|
||||
|
||||
Row() {
|
||||
DefaultCard({ cardName: $r('app.string.card_1'),
|
||||
cardTextBackgrounColor: this.defaultDataChange ? "#0A59F7" : "#FFFFFF",
|
||||
cardTextColor: this.defaultDataChange ? "#FFFFFF" : "#0A59F7" })
|
||||
.opacity(this.isStop ? 1 : 0.4)
|
||||
.onClick(() => {
|
||||
LogUtils.i(TAG, "onclick defaultcard card one")
|
||||
setCache(this.SIM_CARD_Change, 0);
|
||||
this.setDefaultDataSlotId(0)
|
||||
this.defaultDataChange = !this.defaultDataChange;
|
||||
})
|
||||
.margin({ right: 6 })
|
||||
|
||||
DefaultCard({ cardName: $r('app.string.card_2'),
|
||||
cardTextBackgrounColor: this.defaultDataChange ? "#FFFFFF" : "#0A59F7",
|
||||
cardTextColor: this.defaultDataChange ? "#0A59F7" : "#FFFFFF" })
|
||||
.opacity(this.isStop ? 1 : 0.4)
|
||||
.onClick(() => {
|
||||
LogUtils.i(TAG, "onclick defaultcard card two")
|
||||
this.setDefaultDataSlotId(1)
|
||||
this.defaultDataChange = !this.defaultDataChange;
|
||||
})
|
||||
}
|
||||
.enabled(this.isStop)
|
||||
.margin({ right: 1 })
|
||||
.width(148)
|
||||
.height(40)
|
||||
.borderRadius(50)
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
.padding({
|
||||
top: 6,
|
||||
bottom: 6,
|
||||
right: 6,
|
||||
left: 6
|
||||
})
|
||||
}
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 12,
|
||||
bottom: 12
|
||||
})
|
||||
.width("100%")
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"))
|
||||
.borderRadius($r('app.float.radius_24'))
|
||||
|
||||
Column() {
|
||||
}
|
||||
.height(16)
|
||||
.width("100%")
|
||||
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Text($r('app.string.default_dial_card')).fontSize('16vp').fontFamily("HarmonyHeiTi").fontWeight(FontWeight.Medium).maxLines(1)
|
||||
.lineHeight(21)
|
||||
Row() {
|
||||
Text(this.defaultset ? this.defaultset : $r('app.string.not_set')).fontSize(14).fontColor('#555').margin({
|
||||
right: 5
|
||||
}).lineHeight(19)
|
||||
.fontFamily("HarmonyHeiTi").fontWeight(FontWeight.Regular)
|
||||
Image($r('app.media.next_icon')).height(20).width(12)
|
||||
}
|
||||
}
|
||||
.opacity(this.isStop ? 1 : 0.4)
|
||||
.enabled(this.isStop)
|
||||
.onClick(() => {
|
||||
this.defaultCard();
|
||||
})
|
||||
.height(60)
|
||||
.backgroundColor('rgba(255, 255, 255, 1)')
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 2,
|
||||
bottom: 2
|
||||
})
|
||||
.width("100%")
|
||||
.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary"))
|
||||
.borderRadius($r('app.float.radius_24'))
|
||||
}
|
||||
.useSizeType({
|
||||
sm: { span: 4, offset: 0 },
|
||||
md: { span: 6, offset: 1 },
|
||||
lg: { span: 8, offset: 2 }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding({ left: 12, right: 12 })
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor($r("sys.color.ohos_id_color_sub_background"))
|
||||
}
|
||||
}
|
45
simcardmanagement/src/main/module.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "simcardmanagement",
|
||||
"type": "feature",
|
||||
"srcEntrance": "./ets/Application/MyAbilityStage.ts",
|
||||
"description": "$string:simcardmanagement_desc",
|
||||
"mainElement": "com.ohos.simcardmanagement.MainAbility",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"metadata": [
|
||||
{
|
||||
"name": "ArkTSPartialUpdate",
|
||||
"value": "false"
|
||||
}
|
||||
],
|
||||
"abilities": [
|
||||
{
|
||||
"name": "com.ohos.simcardmanagement.MainAbility",
|
||||
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:MainAbility_label",
|
||||
"startWindowIcon": "$media:icon",
|
||||
"startWindowBackground": "$color:white",
|
||||
"visible": true
|
||||
}
|
||||
],
|
||||
"requestPermissions" : [
|
||||
{
|
||||
"name": "ohos.permission.GET_NETWORK_INFO"
|
||||
},
|
||||
{
|
||||
"name" : "ohos.permission.SET_TELEPHONY_STATE"
|
||||
},
|
||||
{
|
||||
"name" : "ohos.permission.GET_TELEPHONY_STATE"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
60
simcardmanagement/src/main/module.json5
Normal file
@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
{
|
||||
"module": {
|
||||
"name": "simcardmanagement",
|
||||
"type": "feature",
|
||||
"srcEntrance": "./ets/Application/MyAbilityStage.ts",
|
||||
"description": "$string:simcardmanagement_desc",
|
||||
"mainElement": "com.ohos.simcardmanagement.MainAbility",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"metadata": [
|
||||
{
|
||||
"name": "ArkTSPartialUpdate",
|
||||
"value": "false"
|
||||
}
|
||||
],
|
||||
"abilities": [
|
||||
{
|
||||
"name": "com.ohos.simcardmanagement.MainAbility",
|
||||
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:icon",
|
||||
"label": "$string:MainAbility_label",
|
||||
"startWindowIcon": "$media:icon",
|
||||
"startWindowBackground": "$color:white",
|
||||
"visible": true
|
||||
}
|
||||
],
|
||||
"requestPermissions" : [
|
||||
{
|
||||
"name": "ohos.permission.GET_NETWORK_INFO"
|
||||
},
|
||||
{
|
||||
"name" : "ohos.permission.SET_TELEPHONY_STATE"
|
||||
},
|
||||
{
|
||||
"name" : "ohos.permission.GET_TELEPHONY_STATE"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
36
simcardmanagement/src/main/resources/base/element/color.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"color": [
|
||||
{
|
||||
"name": "white",
|
||||
"value": "#FFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "color_333333_grey",
|
||||
"value": "#333333"
|
||||
},
|
||||
{
|
||||
"name": "color_666666_grey",
|
||||
"value": "#666666"
|
||||
},
|
||||
{
|
||||
"name": "color_999999_grey",
|
||||
"value": "#999999"
|
||||
},
|
||||
{
|
||||
"name": "color_E3E3E3_grey",
|
||||
"value": "#E3E3E3"
|
||||
},
|
||||
{
|
||||
"name": "color_00000000_transparent",
|
||||
"value": "#00000000"
|
||||
},
|
||||
{
|
||||
"name": "volume_bg_color",
|
||||
"value": "#CCFFFFFF"
|
||||
},
|
||||
{
|
||||
"name": "font_color_182431",
|
||||
"value": "#182431"
|
||||
}
|
||||
]
|
||||
}
|
128
simcardmanagement/src/main/resources/base/element/float.json
Normal file
@ -0,0 +1,128 @@
|
||||
{
|
||||
"float": [
|
||||
{
|
||||
"name": "wh_value_1",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_5",
|
||||
"value": "5"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_10",
|
||||
"value": "10"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_15",
|
||||
"value": "15"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_20",
|
||||
"value": "20"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_30",
|
||||
"value": "30"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_40",
|
||||
"value": "40"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_50",
|
||||
"value": "50"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_60",
|
||||
"value": "60"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_65",
|
||||
"value": "65"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_70",
|
||||
"value": "70"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_80",
|
||||
"value": "80"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_100",
|
||||
"value": "100"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_130",
|
||||
"value": "1300"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_160",
|
||||
"value": "160"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_230",
|
||||
"value": "230"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_280",
|
||||
"value": "280"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_390",
|
||||
"value": "390"
|
||||
},
|
||||
{
|
||||
"name": "wh_value_400",
|
||||
"value": "400"
|
||||
},
|
||||
{
|
||||
"name": "font_35",
|
||||
"value": "35"
|
||||
},
|
||||
{
|
||||
"name": "font_18",
|
||||
"value": "18"
|
||||
},
|
||||
{
|
||||
"name": "font_20",
|
||||
"value": "20"
|
||||
},
|
||||
{
|
||||
"name": "font_21",
|
||||
"value": "21"
|
||||
},
|
||||
{
|
||||
"name": "font_22",
|
||||
"value": "22"
|
||||
},
|
||||
{
|
||||
"name": "font_24",
|
||||
"value": "24"
|
||||
},
|
||||
{
|
||||
"name": "font_28",
|
||||
"value": "28"
|
||||
},
|
||||
{
|
||||
"name": "font_50",
|
||||
"value": "50"
|
||||
},
|
||||
{
|
||||
"name": "control_common_font_size",
|
||||
"value": "20"
|
||||
},
|
||||
{
|
||||
"name": "slider_text_padding_left",
|
||||
"value": "5"
|
||||
},
|
||||
{
|
||||
"name": "volume_border_radius",
|
||||
"value": "15"
|
||||
},
|
||||
{
|
||||
"name": "radius_24",
|
||||
"value": "24vp"
|
||||
}
|
||||
]
|
||||
}
|
232
simcardmanagement/src/main/resources/base/element/string.json
Normal file
@ -0,0 +1,232 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "simcardmanagement_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "card_1",
|
||||
"value": "卡 1"
|
||||
},
|
||||
{
|
||||
"name": "card_2",
|
||||
"value": "卡 2"
|
||||
},
|
||||
{
|
||||
"name": "card_1_set",
|
||||
"value": "卡 1 设置"
|
||||
},
|
||||
{
|
||||
"name": "card_2_set",
|
||||
"value": "卡 2 设置"
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"value": "类型"
|
||||
},
|
||||
{
|
||||
"name": "entity_card",
|
||||
"value": "实体卡"
|
||||
},
|
||||
{
|
||||
"name": "eSim_card",
|
||||
"value": "eSIM卡"
|
||||
},
|
||||
{
|
||||
"name": "eSim_card_set",
|
||||
"value": "eSIM卡设置"
|
||||
},
|
||||
{
|
||||
"name": "add_esim_communication",
|
||||
"value": "添加 eSIM 卡来使用通信相关服务"
|
||||
},
|
||||
{
|
||||
"name": "add_esim_card",
|
||||
"value": "添加 eSIM 卡"
|
||||
},
|
||||
{
|
||||
"name": "sim_card_manage",
|
||||
"value": "SIM 卡管理"
|
||||
},
|
||||
{
|
||||
"name": "default_mobile_data",
|
||||
"value": "默认移动数据"
|
||||
},
|
||||
{
|
||||
"name": "intellect_change_inter_card",
|
||||
"value": "智能切换上网卡"
|
||||
},
|
||||
{
|
||||
"name": "intellect_change_inter_card_bottom",
|
||||
"value": "根据网络质量状况和通话状态,暂时切换至"
|
||||
},
|
||||
{
|
||||
"name": "intellect_change_inter_card_bottom_2",
|
||||
"value": "上网,需消耗"
|
||||
},
|
||||
{
|
||||
"name": "intellect_change_inter_card_bottom_3",
|
||||
"value": "流量"
|
||||
},
|
||||
{
|
||||
"name": "go_to_set",
|
||||
"value": "前往设置"
|
||||
},
|
||||
{
|
||||
"name": "package_limit",
|
||||
"value": "套餐限额"
|
||||
},
|
||||
{
|
||||
"name": "default_dial_card",
|
||||
"value": "默认拨号卡"
|
||||
},
|
||||
{
|
||||
"name": "not_set",
|
||||
"value": "不设置"
|
||||
},
|
||||
{
|
||||
"name": "call_transfer_between_two_cards",
|
||||
"value": "双卡间呼叫转移"
|
||||
},
|
||||
{
|
||||
"name": "call_forwarding",
|
||||
"value": "一卡来电无法呼入时,呼转至另一张卡"
|
||||
},
|
||||
{
|
||||
"name": "closed",
|
||||
"value": "已关闭"
|
||||
},
|
||||
{
|
||||
"name": "long_sentence",
|
||||
"value": "为保证此功能正常开启,请确保 SIM 卡对应手机号准确无误且已开通呼叫等待服务。资费详情,请咨询当地运营商。"
|
||||
},
|
||||
{
|
||||
"name": "check_phone_number",
|
||||
"value": "检查手机号"
|
||||
},
|
||||
{
|
||||
"name": "select_call_forwarding_method",
|
||||
"value": "选择呼叫转移方式"
|
||||
},
|
||||
{
|
||||
"name": "Card_1_call_forwarding_to_card_2",
|
||||
"value": "卡 1 呼叫转移至卡 2"
|
||||
},
|
||||
{
|
||||
"name": "Card_2_call_forwarding_to_card_1",
|
||||
"value": "卡 2 呼叫转移至卡 1"
|
||||
},
|
||||
{
|
||||
"name": "switch_on_at_the_same_time",
|
||||
"value": "开关同时打开,表明已启用“卡 1 和卡 2 互相呼叫转移”"
|
||||
},
|
||||
{
|
||||
"name": "confirm",
|
||||
"value": "确认"
|
||||
},
|
||||
{
|
||||
"name": "stop_use",
|
||||
"value": "停用"
|
||||
},
|
||||
{
|
||||
"name": "stop_use_card",
|
||||
"value": "停用%s"
|
||||
},
|
||||
{
|
||||
"name": "cancel",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "set",
|
||||
"value": "设置"
|
||||
},
|
||||
{
|
||||
"name": "opening_on_this_function",
|
||||
"value": "开启该功能会消耗"
|
||||
},
|
||||
{
|
||||
"name": "card_1_phone",
|
||||
"value": "卡 1 手机号"
|
||||
},
|
||||
{
|
||||
"name": "sim_headName",
|
||||
"value": "SIM 卡管理"
|
||||
},
|
||||
{
|
||||
"name": "sim_not_enabled",
|
||||
"value": "未启用"
|
||||
},
|
||||
{
|
||||
"name": "sim_enabled",
|
||||
"value": "启用"
|
||||
},
|
||||
{
|
||||
"name": "sim_no_service",
|
||||
"value": "无服务"
|
||||
},
|
||||
{
|
||||
"name": "sim_no_card_inserted",
|
||||
"value": "未插卡"
|
||||
},
|
||||
{
|
||||
"name": "sim_card_one_no_space",
|
||||
"value": "卡1"
|
||||
},
|
||||
{
|
||||
"name": "sim_card_two_no_space",
|
||||
"value": "卡2"
|
||||
},
|
||||
{
|
||||
"name": "sim_add_esim",
|
||||
"value": "添加eSIM"
|
||||
},
|
||||
{
|
||||
"name": "sim_card_name",
|
||||
"value": "卡名称"
|
||||
},
|
||||
{
|
||||
"name": "sim_phone_number",
|
||||
"value": "手机号"
|
||||
},
|
||||
{
|
||||
"name": "sim_edit",
|
||||
"value": "编辑%s信息"
|
||||
},
|
||||
{
|
||||
"name": "sim_information",
|
||||
"value": "信息"
|
||||
},
|
||||
{
|
||||
"name": "sim_stop_information",
|
||||
"value": "正在%s%s。请稍后···"
|
||||
},
|
||||
{
|
||||
"name": "sim_mobile_data_change",
|
||||
"value": "默认移动数据将切换至%s。切换过程中,数据业务、打电话等功能将不可用。是否停用%s?"
|
||||
},
|
||||
{
|
||||
"name": "sim_package_limit",
|
||||
"value": "设置%s套餐限额"
|
||||
},
|
||||
{
|
||||
"name": "sim_additional_costs",
|
||||
"value": "开启该功能会消耗%s流量,设置套餐限额后可智能提醒,避免产生额外费用。"
|
||||
},
|
||||
{
|
||||
"name": "sim_null_character",
|
||||
"value": " "
|
||||
},
|
||||
{
|
||||
"name": "china_mobile",
|
||||
"value": "中国移动"
|
||||
}
|
||||
]
|
||||
}
|
BIN
simcardmanagement/src/main/resources/base/media/back.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
BIN
simcardmanagement/src/main/resources/base/media/eSIM.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 225 B |
BIN
simcardmanagement/src/main/resources/base/media/icon.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
simcardmanagement/src/main/resources/base/media/loading.gif
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
simcardmanagement/src/main/resources/base/media/nav_check.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
simcardmanagement/src/main/resources/base/media/next_icon.png
Normal file
After Width: | Height: | Size: 656 B |
BIN
simcardmanagement/src/main/resources/base/media/phone.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
simcardmanagement/src/main/resources/base/media/phoneOff.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
simcardmanagement/src/main/resources/base/media/redact.png
Normal file
After Width: | Height: | Size: 636 B |
BIN
simcardmanagement/src/main/resources/base/media/redactOff.png
Normal file
After Width: | Height: | Size: 751 B |
BIN
simcardmanagement/src/main/resources/base/media/right.png
Normal file
After Width: | Height: | Size: 656 B |
BIN
simcardmanagement/src/main/resources/base/media/user_icon.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,5 @@
|
||||
{
|
||||
"src": [
|
||||
"pages/index"
|
||||
]
|
||||
}
|
232
simcardmanagement/src/main/resources/en_US/element/string.json
Normal file
@ -0,0 +1,232 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "simcardmanagement_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "card_1",
|
||||
"value": "card 1"
|
||||
},
|
||||
{
|
||||
"name": "card_2",
|
||||
"value": "card 2"
|
||||
},
|
||||
{
|
||||
"name": "card_1_set",
|
||||
"value": "card 1 set"
|
||||
},
|
||||
{
|
||||
"name": "card_2_set",
|
||||
"value": "caard 2 set"
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"value": "type"
|
||||
},
|
||||
{
|
||||
"name": "entity_card",
|
||||
"value": "entity card"
|
||||
},
|
||||
{
|
||||
"name": "eSim_card",
|
||||
"value": "eSIM card"
|
||||
},
|
||||
{
|
||||
"name": "eSim_card_set",
|
||||
"value": "eSIM card set"
|
||||
},
|
||||
{
|
||||
"name": "add_esim_communication",
|
||||
"value": "Add ESIM card to adapt to communication related services"
|
||||
},
|
||||
{
|
||||
"name": "add_esim_card",
|
||||
"value": "Add eSIM card"
|
||||
},
|
||||
{
|
||||
"name": "sim_card_manage",
|
||||
"value": "SIM card management"
|
||||
},
|
||||
{
|
||||
"name": "default_mobile_data",
|
||||
"value": "defalut mobile data"
|
||||
},
|
||||
{
|
||||
"name": "intellect_change_inter_card",
|
||||
"value": "intellect change internet card"
|
||||
},
|
||||
{
|
||||
"name": "intellect_change_inter_card_bottom",
|
||||
"value": "According to the network quality status and call status, temporarily switch to"
|
||||
},
|
||||
{
|
||||
"name": "intellect_change_inter_card_bottom_2",
|
||||
"value": "surfing the internet,consumption required"
|
||||
},
|
||||
{
|
||||
"name": "intellect_change_inter_card_bottom_3",
|
||||
"value": "flow"
|
||||
},
|
||||
{
|
||||
"name": "go_to_set",
|
||||
"value": "go to set"
|
||||
},
|
||||
{
|
||||
"name": "package_limit",
|
||||
"value": "package limit"
|
||||
},
|
||||
{
|
||||
"name": "default_dial_card",
|
||||
"value": "default dial card"
|
||||
},
|
||||
{
|
||||
"name": "not_set",
|
||||
"value": "not set"
|
||||
},
|
||||
{
|
||||
"name": "call_transfer_between_two_cards",
|
||||
"value": "call transfer between two cards"
|
||||
},
|
||||
{
|
||||
"name": "call_forwarding",
|
||||
"value": "When an incoming call cannot be received from one card, the call will be transferred to another card"
|
||||
},
|
||||
{
|
||||
"name": "closed",
|
||||
"value": "closed"
|
||||
},
|
||||
{
|
||||
"name": "long_sentence",
|
||||
"value": "In order to ensure the normal opening of this function, please ensure that the mobile phone number corresponding to the SIM card is accurate and has opened the call waiting service. For tariff details, please consult the local operator."
|
||||
},
|
||||
{
|
||||
"name": "check_phone_number",
|
||||
"value": "check phone number"
|
||||
},
|
||||
{
|
||||
"name": "select_call_forwarding_method",
|
||||
"value": "select call forwarding method"
|
||||
},
|
||||
{
|
||||
"name": "Card_1_call_forwarding_to_card_2",
|
||||
"value": "card 1 call forwarding to card 2"
|
||||
},
|
||||
{
|
||||
"name": "Card_2_call_forwarding_to_card_1",
|
||||
"value": "card 2 call forwarding to card 1"
|
||||
},
|
||||
{
|
||||
"name": "switch_on_at_the_same_time",
|
||||
"value": "When the switch is turned on at the same time, it indicates that 'call forwarding between card 1 and card 2' is enabled"
|
||||
},
|
||||
{
|
||||
"name": "confirm",
|
||||
"value": "confirm"
|
||||
},
|
||||
{
|
||||
"name": "cancel",
|
||||
"value": "cancel"
|
||||
},
|
||||
{
|
||||
"name": "set",
|
||||
"value": "set"
|
||||
},
|
||||
{
|
||||
"name": "stop_use",
|
||||
"value": "stop"
|
||||
},
|
||||
{
|
||||
"name": "stop_use_card",
|
||||
"value": "stop%s"
|
||||
},
|
||||
{
|
||||
"name": "opening_on_this_function",
|
||||
"value": "Opening this function will consume"
|
||||
},
|
||||
{
|
||||
"name": "card_1_phone",
|
||||
"value": "Card 1 mobile number"
|
||||
},
|
||||
{
|
||||
"name": "sim_headName",
|
||||
"value": "SIM card management"
|
||||
},
|
||||
{
|
||||
"name": "sim_not_enabled",
|
||||
"value": "not enabled"
|
||||
},
|
||||
{
|
||||
"name": "sim_enabled",
|
||||
"value": "enabled"
|
||||
},
|
||||
{
|
||||
"name": "sim_no_service",
|
||||
"value": "no service"
|
||||
},
|
||||
{
|
||||
"name": "sim_no_card_inserted",
|
||||
"value": "No card inserted"
|
||||
},
|
||||
{
|
||||
"name": "sim_card_one_no_space",
|
||||
"value": "Card1"
|
||||
},
|
||||
{
|
||||
"name": "sim_card_two_no_space",
|
||||
"value": "Card2"
|
||||
},
|
||||
{
|
||||
"name": "sim_add_esim",
|
||||
"value": "Add eSIM"
|
||||
},
|
||||
{
|
||||
"name": "sim_card_name",
|
||||
"value": "Card name"
|
||||
},
|
||||
{
|
||||
"name": "sim_phone_number",
|
||||
"value": "Phone number"
|
||||
},
|
||||
{
|
||||
"name": "sim_edit",
|
||||
"value": "Edit %s"
|
||||
},
|
||||
{
|
||||
"name": "sim_information",
|
||||
"value": "Information"
|
||||
},
|
||||
{
|
||||
"name": "sim_stop_information",
|
||||
"value": "Is%s%s。Please wait···"
|
||||
},
|
||||
{
|
||||
"name": "sim_mobile_data_change",
|
||||
"value": "Default mobile data will be switched to%s。During the switching process, data services, phone calls and other functions will not be available. Deactivate or not%s?"
|
||||
},
|
||||
{
|
||||
"name": "sim_package_limit",
|
||||
"value": "Set%spackage limit"
|
||||
},
|
||||
{
|
||||
"name": "sim_additional_costs",
|
||||
"value": "Enabling this function will consume%s traffic. After setting the package limit, you can be reminded intelligently to avoid additional costs."
|
||||
},
|
||||
{
|
||||
"name": "sim_null_character",
|
||||
"value": " "
|
||||
},
|
||||
{
|
||||
"name": "china_mobile",
|
||||
"value": "China Mobile"
|
||||
}
|
||||
]
|
||||
}
|