1/** 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file: Mobile Network Home page 18 */ 19import { addAirPlaneModeListener, removeAirPlaneModeListener, queryAirPlaneMode } from '../common/utils/AirplaneMode'; 20import publiccontent from '../common/components/publiccontent'; 21import item from '../common/components/listItem/listItem'; 22import call from '@ohos.telephony.call'; 23import CommonEvent from '@ohos.commonEvent'; 24import settings from '@ohos.settings'; 25import { CommonEventSubscriber } from './commonEvent/commonEventSubscriber'; 26import { CommonEventSubscribeInfo } from './commonEvent/commonEventSubscribeInfo'; 27import Base from '@ohos.base'; 28import { registerSimStateChange, getMaxSimCount } from '../model/registerSimStateApi'; 29import { getSimStateCardOne, getSimStateCardTwo } from '../common/model/getSimStateApi'; 30import { getSimCardOnePhoneNumber, getSimCardTwoPhoneNumber } from '../common/model/getSimTelephoneNumberApi'; 31import { 32 isCellularDataRoamingEnabledCardOne, 33 isCellularDataRoamingEnabledCardTwo, 34 getSupportNetwork 35} from '../common/model/getCellularDataRoamingEnabledApi'; 36import { setPreferredNetwork } from '../common/model/setPreferredNetworkApi'; 37import { getPreferredNetwork } from '../common/model/getPreferredNetworkModeApi'; 38import { 39 isCellularDataEnabled, 40 enableCellularData, 41 disableCellularData, 42 getOperatorName 43} from '../model/mobileDataStatus'; 44import HeadComponent from '../common/components/headComponent'; 45import { SubHeader } from '../common/components/subHeader'; 46import LogUtils from '../common/utils/LogUtils'; 47import router from '@ohos.router'; 48 49const TAG = "Index"; 50 51@Entry 52@Component 53struct Index { 54 scroller: Scroller = new Scroller(); 55 @State byValueWLMS: Resource = publiccontent.strings.fourAuto; 56 @State publicheader: Resource = publiccontent.strings.mobileData; 57 @State isLoading: boolean = true; 58 @State moisBtn: boolean = true; 59 @State isBtn: boolean = true; 60 @State gqBtn: boolean = true; 61 @State moislastone: boolean = true; 62 @State isSupport: boolean = true; 63 @State mobileDataDisabled: boolean = false; 64 @State mobileDataDisabled2: boolean = false; 65 // Mobile data switch 66 @State isDataEnable: boolean = true; 67 // Mobile AirPlane Mode 68 @State isAirPlaneMode: boolean = false; 69 // Data roaming switch 70 @State dataRoamSwitchCardOne: boolean = false; 71 @State dataRoamSwitchCardTwo: boolean = false; 72 // HD call switch 73 @State volteSwitch: boolean = false; 74 // Card I status 75 @State simStateStatusCardOne: boolean = true; 76 // Card 2 status 77 @State simStateStatusCardTwo: boolean = false; 78 @State ControlswitchWLMS: boolean = false; 79 @State slotId: number = 0; 80 @State dialogTitle: Resource = publiccontent.strings.preferredNetworkMode; 81 setCache_cun_name = 'DISTRIBUTEDDATA_CUN_NAME'; 82 setCache_wl_name = 'SETCACHE_WL_NAME'; 83 @State enable5g: boolean = false; 84 @StorageLink("imsOne") enableISM: boolean = false; 85 @State enableISM2: boolean = false; 86 @State TelephoneNumber: string = ''; 87 @State TelephoneNumber2?: string = ''; 88 @State ceshi: boolean = false; 89 @State cardOne: number = 0; 90 @State cardTwo: number = 1; 91 @State controllerMobileNetworkIsOn: boolean = false; 92 private subscriber: CommonEventSubscriber = undefined; 93 private subscribeInfo: CommonEventSubscribeInfo = { 94 events: [CommonEvent.Support.COMMON_EVENT_AIRPLANE_MODE_CHANGED] 95 }; 96 childComponentTitle: Resource = $r('app.string.mobile_data') 97 98 /** 99 * Get network mode 100 * 101 * @param {Object} slotId - call slotId 102 */ 103 async getPreferredNetwork(slotId) { 104 const res = await getPreferredNetwork(this.slotId); 105 if (res == 0) { 106 this.byValueWLMS = $r('app.string.mobile_data_5g'); 107 } else if (res == 5) { 108 this.byValueWLMS = $r('app.string.mobile_data_4g'); 109 } else if (res == 6) { 110 this.byValueWLMS = $r('app.string.mobile_data_3g'); 111 } else if (res == 1) { 112 this.byValueWLMS = $r('app.string.mobile_data_2g'); 113 } 114 } 115 116 /** 117 * This interface is used to obtain sim cardOne status 118 */ 119 getSimStateDataCardOne() { 120 getSimStateCardOne().then((res: number) => { 121 LogUtils.i(TAG, "getSimStateData Card1 :success " + JSON.stringify(res)) 122 const simState = { 123 SIM_STATE_UNKNOWN: 0, 124 SIM_STATE_NOT_PRESENT: 1, 125 SIM_STATE_LOCKED: 2, 126 SIM_STATE_NOT_READY: 3, 127 SIM_STATE_READY: 4, 128 SIM_STATE_LOADED: 5 129 }; 130 if (res == simState.SIM_STATE_LOADED || res == simState.SIM_STATE_READY) { 131 this.simStateStatusCardOne = true; 132 } else { 133 this.simStateStatusCardOne = false; 134 } 135 }).catch((err) => { 136 this.simStateStatusCardOne = false; 137 LogUtils.i(TAG, 'getSimStateData Card1 :console.error() ' + JSON.stringify(err.message)); 138 }); 139 } 140 141 /** 142 * This interface is used to obtain sim cardTwo status 143 */ 144 getSimStateDataCardTwo() { 145 getSimStateCardTwo().then((res: number) => { 146 LogUtils.i(TAG, "getSimState Card2 :success then" + JSON.stringify(res)); 147 const simState = { 148 SIM_STATE_UNKNOWN: 0, 149 SIM_STATE_NOT_PRESENT: 1, 150 SIM_STATE_LOCKED: 2, 151 SIM_STATE_NOT_READY: 3, 152 SIM_STATE_READY: 4, 153 SIM_STATE_LOADED: 5 154 }; 155 if (res == simState.SIM_STATE_LOADED || res == simState.SIM_STATE_READY) { 156 this.simStateStatusCardTwo = true; 157 } else { 158 this.simStateStatusCardTwo = false; 159 } 160 }).catch((err) => { 161 this.simStateStatusCardTwo = false; 162 LogUtils.i(TAG, 'getSimState Card2 :console.error() ' + JSON.stringify(err.message)); 163 }); 164 } 165 166 getSupportNetwork(slotId) { 167 getSupportNetwork(slotId).then((res) => { 168 if (res) { 169 this.isSupport = true; 170 } else { 171 this.isSupport = false; 172 } 173 }).catch((err) => { 174 }); 175 } 176 177 /** 178 * Get mobile phone number 179 */ 180 getSimCardOnePhoneNumber() { 181 getSimCardOnePhoneNumber().then((res) => { 182 LogUtils.i(TAG, "getSimTelephoneNumber card1 other success" + JSON.stringify(res)); 183 this.TelephoneNumber = res; 184 }).catch((err) => { 185 LogUtils.i(TAG, "getSimTelephoneNumber card1 other catch" + JSON.stringify(err)); 186 }); 187 } 188 189 /** 190 * Get mobile phone number 191 */ 192 getSimCardTwoPhoneNumber() { 193 getSimCardTwoPhoneNumber().then((res) => { 194 LogUtils.i(TAG, "getSimTelephoneNumber card2 other success" + JSON.stringify(res)); 195 this.TelephoneNumber2 = res; 196 }).catch((err) => { 197 LogUtils.i(TAG, "getSimTelephoneNumber card2 other catch" + JSON.stringify(err)); 198 }); 199 } 200 201 /** 202 * Get mobile data on or off 203 */ 204 getCellularDataState() { 205 isCellularDataEnabled().then((data) => { 206 LogUtils.i(TAG, "isCellularDataEnabled success: isON:" + JSON.stringify(data)); 207 this.isDataEnable = data; 208 }).catch((error) => { 209 LogUtils.i(TAG, "isCellularDataEnabled error catch" + JSON.stringify(error)); 210 }); 211 } 212 213 // init AirPlane Mode 214 initAirPlaneMode() { 215 LogUtils.i(TAG, 'initAirPlaneMode'); 216 try { 217 addAirPlaneModeListener((data) => { 218 LogUtils.i(TAG, 'initAirPlaneMode callback'); 219 this.isAirPlaneMode = data == 1 ? true : false; 220 }); 221 let context = globalThis.settingsAbilityContext as Context; 222 LogUtils.i('CommonEvent', `globalThis.settingsAbilityContext:${context}`); 223 if (!context) { 224 return; 225 } 226 LogUtils.i('CommonEvent', 'settings.getValueSync ' + settings.getValueSync(context, 'settings.telephony.airplanemode', '0')); 227 if (settings.getValueSync(context, 'settings.telephony.airplanemode', '0') === '1') { 228 this.controllerMobileNetworkIsOn = true; 229 } else { 230 this.controllerMobileNetworkIsOn = false; 231 } 232 CommonEvent.createSubscriber(this.subscribeInfo).then((commonEventSubscriber) => { 233 this.subscriber = commonEventSubscriber; 234 //订阅公共事件 235 CommonEvent.subscribe(this.subscriber, (err, data) => { 236 LogUtils.i('CommonEvent', `subscribe data is ` + JSON.stringify(data)); 237 if (err && err.code !== 0) { 238 LogUtils.i('CommonEvent', `subscribe failed, code is ${err.code}, message is ${err.message}`); 239 } else { 240 if (data.code === 1) { 241 this.controllerMobileNetworkIsOn = true; 242 } else { 243 this.controllerMobileNetworkIsOn = false; 244 } 245 } 246 }); 247 }).catch((err: Base.BusinessError) => { 248 console.error(`createSubscriber failed, code is ${err?.code}, message is ${err.message}`); 249 }); 250 } catch (err) { 251 LogUtils.e(TAG, `initAirPlaneMode err = ${JSON.stringify(err)}`); 252 } 253 } 254 255 // query AirPlane Mode 256 getAirPlaneMode() { 257 LogUtils.i(TAG, 'getAirPlaneMode'); 258 try { 259 queryAirPlaneMode((data) => { 260 LogUtils.i(TAG, 'getAirPlaneMode callback'); 261 this.isAirPlaneMode = data == 1 ? true : false; 262 LogUtils.i(TAG, `getAirPlaneMode callback:${data}`); 263 }); 264 } catch (err) { 265 LogUtils.e(TAG, `getAirPlaneMode err = ${JSON.stringify(err)}`); 266 } 267 } 268 269 addRegisterSimStateChange(slotId) { 270 registerSimStateChange(slotId, async () => { 271 this.getCellularDataRoamingEnabled(); 272 this.getSimStateDataCardOne(); 273 this.getSimStateDataCardTwo(); 274 this.getPreferredNetwork(slotId); 275 this.getSupportNetwork(slotId); 276 this.getSimCardOnePhoneNumber(); 277 this.getSimCardTwoPhoneNumber(); 278 this.getCellularDataState(); 279 this.isImsSwitchEnabled(0); 280 if (getMaxSimCount() === 2) { 281 this.isImsSwitchEnabled(1); 282 } 283 }) 284 } 285 286 isImsSwitchEnabled(slotId) { 287 call.isImsSwitchEnabled(slotId).then((res: boolean) => { 288 if (slotId) { 289 this.enableISM2 = res; 290 LogUtils.i(TAG, "isImsSwitchEnable enable 1:" + JSON.stringify(this.enableISM2)); 291 } else { 292 this.enableISM = res; 293 LogUtils.i(TAG, "isImsSwitchEnable enable 0:" + JSON.stringify(this.enableISM)); 294 } 295 }).catch((err) => { 296 if (slotId) { 297 this.enableISM2 = true; 298 LogUtils.i(TAG, "isImsSwitchEnable err 1:" + JSON.stringify(this.enableISM2)); 299 } else { 300 this.enableISM = true; 301 LogUtils.i(TAG, "isImsSwitchEnable err 0:" + JSON.stringify(this.enableISM)); 302 } 303 LogUtils.i(TAG, "isImsSwitchEnabled card catch:" + JSON.stringify(err)); 304 }); 305 } 306 307 aboutToAppear() { 308 LogUtils.i(TAG, "aboutToAppear") 309 this.initAirPlaneMode(); 310 if (getMaxSimCount() === 2) { 311 this.addRegisterSimStateChange(1); 312 this.isImsSwitchEnabled(1); 313 this.getSimStateDataCardTwo(); 314 } 315 this.addRegisterSimStateChange(0); 316 //Get data roaming status 317 this.getCellularDataRoamingEnabled(); 318 //Get HD call status 319 this.isImsSwitchEnabled(0); 320 this.getSimStateDataCardOne(); 321 //Get network mode 322 this.getPreferredNetwork(this.slotId); 323 getOperatorName().then((res) => { 324 }) 325 this.getSupportNetwork(this.slotId); 326 //card number acquire 327 this.getSimCardOnePhoneNumber(); 328 this.getSimCardTwoPhoneNumber(); 329 this.getCellularDataState(); 330 } 331 332 onPageShow() { 333 this.isImsSwitchEnabled(0); 334 this.getAirPlaneMode(); 335 } 336 337 onPageHide() { 338 removeAirPlaneModeListener(); 339 } 340 341 /** 342 * Set network mode 343 */ 344 radioChange(slotId, v) { 345 const res = setPreferredNetwork(slotId, v); 346 LogUtils.i(TAG, "radioChange res:" + JSON.stringify(res)); 347 } 348 349 getCellularDataRoamingEnabled() { 350 isCellularDataRoamingEnabledCardOne().then((res) => { 351 LogUtils.i(TAG, "getCellularDataRoamingEnabled card one success then:" + JSON.stringify(res)); 352 this.dataRoamSwitchCardOne = res; 353 }).catch((err) => { 354 this.dataRoamSwitchCardOne = false; 355 LogUtils.i(TAG, "enableCellularDataRoaming card one catch:" + JSON.stringify(err)); 356 }); 357 if (getMaxSimCount() === 2) { 358 isCellularDataRoamingEnabledCardTwo().then((res) => { 359 LogUtils.i(TAG, "getCellularDataRoamingEnabled card two success then:" + JSON.stringify(res)); 360 this.dataRoamSwitchCardTwo = res; 361 }).catch((err) => { 362 this.dataRoamSwitchCardTwo = false; 363 LogUtils.i(TAG, "enableCellularDataRoaming card two catch:" + JSON.stringify(err)); 364 }); 365 } 366 } 367 368 clickHandle(click: number) { 369 switch (click) { 370 case 0: 371 router.pushUrl({ 372 url: 'pages/networkStand' 373 }) 374 break 375 case 1: 376 router.pushUrl({ 377 url: 'pages/apnList' 378 }) 379 break 380 } 381 } 382 383 build() { 384 GridRow({ columns: { sm: 4, md: 8, lg: 12 }, gutter: { x: 12 } }) { 385 GridCol({ span: { sm: 4, md: 8, lg: 8 }, offset: { sm: 0, md: 1, lg: 2 } }) { 386 Column() { 387 Column() { 388 389 HeadComponent({ isTouch: true, title: this.childComponentTitle }); 390 391 Stack({ alignContent: Alignment.TopStart }) { 392 Scroll(this.scroller) { 393 Column() { 394 SubHeader({ titleContent: $r('app.string.mobile_data_general'), subTitleContent: '' }); 395 396 Flex({ 397 direction: FlexDirection.Row, 398 justifyContent: FlexAlign.SpaceBetween, 399 alignItems: ItemAlign.Center 400 }) { 401 Column() { 402 Row() { 403 Text($r('app.string.mobile_data')) 404 .fontSize(16) 405 .fontWeight(FontWeight.Medium) 406 .fontFamily('HarmonyHeiTi') 407 .lineHeight(22) 408 .fontColor($r('app.color.font_color_182431')) 409 } 410 411 Row() { 412 Text($r('app.string.mobile_data_charges')) 413 .fontSize(14) 414 .fontWeight(FontWeight.Regular) 415 .fontFamily('HarmonyHeiTi') 416 .fontColor('#555') 417 .opacity(0.6) 418 .lineHeight(19) 419 .maxLines(2) 420 } 421 .margin({ top: 2, right: 26 }) 422 } 423 .alignItems(HorizontalAlign.Start) 424 425 Toggle({ type: ToggleType.Switch, isOn: this.isDataEnable }) 426 .width(36) 427 .height(20) 428 .enabled((this.simStateStatusCardOne || this.simStateStatusCardTwo) && 429 !this.controllerMobileNetworkIsOn) 430 .onChange((isOn: boolean) => { 431 this.isDataEnable = !this.isDataEnable; 432 LogUtils.i(TAG, "mobile data switch changes enable:" + JSON.stringify(this.isDataEnable)); 433 if (this.isDataEnable == false) { 434 disableCellularData().then((data) => { 435 LogUtils.i(TAG, "disableCellularData: success then" + JSON.stringify(data)); 436 }).catch((error) => { 437 LogUtils.i(TAG, "disableCellularData: error catch" + JSON.stringify(error)); 438 }); 439 } else { 440 enableCellularData().then((data) => { 441 LogUtils.i(TAG, "enableCellularData: success then" + JSON.stringify(data)); 442 }).catch((error) => { 443 LogUtils.i(TAG, "enableCellularData: error catch" + JSON.stringify(error)); 444 }); 445 } 446 }) 447 } 448 .padding({ 449 left: 12, 450 right: 12, 451 top: 4, 452 bottom: 4 453 }) 454 .height(90) 455 .width("100%") 456 .borderRadius(16) 457 .backgroundColor($r("sys.color.ohos_id_color_foreground_contrary")) 458 .opacity((this.simStateStatusCardOne || this.simStateStatusCardTwo) && 459 !this.controllerMobileNetworkIsOn ? 1 : 0.4) 460 461 SubHeader({ 462 titleContent: $r('app.string.mobile_data_card1'), 463 subTitleContent: this.TelephoneNumber 464 }); 465 466 Column() { 467 item({ 468 isBtn: this.moisBtn, 469 cardType: this.cardOne, 470 controlSwitch: $dataRoamSwitchCardOne, 471 title: $r('app.string.mobile_data_dataRoaming'), 472 describe: $r('app.string.mobile_data_enableDataWhileRoaming'), 473 isDisabled: this.simStateStatusCardOne && !this.controllerMobileNetworkIsOn, 474 isCard: true, 475 isSupport: false, 476 isCon: 0, 477 }) 478 479 Divider() 480 .strokeWidth(0.5) 481 .color("#E3E3E3") 482 .lineCap(LineCapStyle.Round) 483 .margin({ right: '2%' }) 484 485 item({ 486 isBtn: this.gqBtn, 487 cardType: this.cardOne, 488 controlSwitch: $enableISM, 489 title: $r('app.string.mobile_data_volte'), 490 describe: $r('app.string.mobile_data_confirmation_function'), 491 isDisabled: this.simStateStatusCardOne && !this.controllerMobileNetworkIsOn, 492 isSupport: false, 493 isCard: true, 494 isCon: 22, 495 }) 496 Divider() 497 .strokeWidth(0.5) 498 .color("#E3E3E3") 499 .lineCap(LineCapStyle.Round) 500 .margin({ right: '2%' }) 501 502 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { 503 Column() { 504 Text($r('app.string.network_standard')) 505 .fontFamily('HarmonyHeiTi') 506 .fontSize($r('sys.float.ohos_id_text_size_body1')) 507 .fontWeight(FontWeight.Medium) 508 .fontColor($r('sys.color.ohos_id_color_text_primary')) 509 .opacity((this.simStateStatusCardOne && !this.controllerMobileNetworkIsOn) ? 0.9 : 0.6) 510 .letterSpacing(1) 511 .lineHeight(22) 512 .textAlign(TextAlign.Start) 513 Text($r('app.string.network_standard_select')) 514 .margin({ top: 2 }) 515 .fontFamily('HarmonyHeiTi') 516 .fontWeight(FontWeight.Regular) 517 .fontSize($r('sys.float.ohos_id_text_size_body2')) 518 .fontColor($r('sys.color.ohos_id_color_text_secondary')) 519 .opacity(0.6) 520 .lineHeight(19) 521 .letterSpacing(1) 522 } 523 .width('100%') 524 .alignItems(HorizontalAlign.Start) 525 .margin({ right: 26 }) 526 527 Image($r('app.media.next_icon')) 528 .width(10) 529 .height(15) 530 .margin({ right: 10 }) 531 .enabled(this.simStateStatusCardOne && !this.controllerMobileNetworkIsOn) 532 533 }.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary")) 534 .opacity((this.simStateStatusCardOne && !this.controllerMobileNetworkIsOn) ? 1 : 0.4) 535 .margin({ top: 8, bottom: this.isSupport ? 5 : 11 }) 536 .onClick(() => { 537 if ((this.simStateStatusCardOne && !this.controllerMobileNetworkIsOn)) { 538 this.clickHandle(0) 539 } 540 }) 541 542 Divider() 543 .strokeWidth(0.5) 544 .color("#E3E3E3") 545 .lineCap(LineCapStyle.Round) 546 .margin({ right: '2%' }) 547 548 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { 549 Column() { 550 Text($r('app.string.access_point_name')) 551 .fontFamily('HarmonyHeiTi') 552 .fontSize($r('sys.float.ohos_id_text_size_body1')) 553 .fontWeight(FontWeight.Medium) 554 .fontColor($r('sys.color.ohos_id_color_text_primary')) 555 .opacity((this.simStateStatusCardOne && !this.controllerMobileNetworkIsOn) ? 0.9 : 0.6) 556 .letterSpacing(1) 557 .lineHeight(22) 558 .textAlign(TextAlign.Start) 559 Text($r('app.string.apn_stttings')) 560 .margin({ top: 2 }) 561 .fontFamily('HarmonyHeiTi') 562 .fontWeight(FontWeight.Regular) 563 .fontSize($r('sys.float.ohos_id_text_size_body2')) 564 .fontColor($r('sys.color.ohos_id_color_text_secondary')) 565 .opacity(0.6) 566 .lineHeight(19) 567 .letterSpacing(1) 568 }.justifyContent(FlexAlign.Center) 569 .width('100%') 570 .alignItems(HorizontalAlign.Start) 571 .margin({ right: 26 }) 572 573 Image($r('app.media.next_icon')) 574 .width(10) 575 .height(15) 576 .margin({ right: 10 }) 577 .enabled(this.simStateStatusCardOne && !this.controllerMobileNetworkIsOn) 578 579 }.backgroundColor($r("sys.color.ohos_id_color_foreground_contrary")) 580 .opacity((this.simStateStatusCardOne && !this.controllerMobileNetworkIsOn) ? 1 : 0.4) 581 .margin({ top: 8, bottom: this.isSupport ? 5 : 11 }) 582 .onClick(() => { 583 if ((this.simStateStatusCardOne && !this.controllerMobileNetworkIsOn)) { 584 this.clickHandle(1) 585 } 586 }) 587 } 588 .padding({ 589 left: 12, 590 right: 12, 591 top: 4, 592 bottom: 4 593 }) 594 .width("100%") 595 .borderRadius(16) 596 .backgroundColor($r("sys.color.ohos_id_color_foreground_contrary")) 597 .opacity(this.simStateStatusCardOne && !this.isAirPlaneMode ? 1 : 0.4) 598 599 SubHeader({ 600 titleContent: $r('app.string.mobile_data_card2'), 601 subTitleContent: this.TelephoneNumber2 602 }) 603 .visibility(getMaxSimCount() === 2 ? Visibility.Visible : Visibility.Hidden) 604 605 Column() { 606 item({ 607 isBtn: this.moisBtn, 608 cardType: this.cardTwo, 609 controlSwitch: $mobileDataDisabled2, 610 title: $r('app.string.mobile_data_dataRoaming'), 611 describe: $r('app.string.mobile_data_enableDataWhileRoaming'), 612 isDisabled: this.simStateStatusCardTwo && !this.isAirPlaneMode, 613 isSupport: false, 614 isCard: true, 615 isCon: 0, 616 }) 617 Divider() 618 .strokeWidth(0.5) 619 .color("#E3E3E3") 620 .lineCap(LineCapStyle.Round) 621 .margin({ right: '2%' }) 622 item({ 623 isBtn: this.gqBtn, 624 cardType: this.cardTwo, 625 controlSwitch: $enableISM2, 626 title: $r('app.string.mobile_data_volte'), 627 describe: $r('app.string.mobile_data_confirmation_function'), 628 isDisabled: this.simStateStatusCardTwo && !this.isAirPlaneMode, 629 isSupport: false, 630 isCard: true, 631 isCon: 22, 632 }) 633 } 634 .padding({ 635 left: 12, 636 right: 12, 637 top: 4, 638 bottom: 4 639 }) 640 .padding({ 641 left: 12, 642 right: 12, 643 top: 4, 644 bottom: 4 645 }) 646 .width("100%") 647 .borderRadius(16) 648 .backgroundColor($r("sys.color.ohos_id_color_foreground_contrary")) 649 .opacity(this.simStateStatusCardTwo && !this.isAirPlaneMode ? 1 : 0.4) 650 .visibility(getMaxSimCount() === 2 ? Visibility.Visible : Visibility.Hidden) 651 } 652 .alignItems(HorizontalAlign.Start) 653 } 654 } 655 } 656 .useSizeType({ 657 sm: { span: 4, offset: 0 }, 658 md: { span: 6, offset: 1 }, 659 lg: { span: 8, offset: 2 } 660 }) 661 } 662 .visibility(this.isLoading ? Visibility.Visible : Visibility.Hidden) 663 } 664 } 665 .padding({ left: 12, right: 12 }) 666 .width('100%') 667 .height('100%') 668 .backgroundColor($r("sys.color.ohos_id_color_sub_background")) 669 } 670}