From d00bbd3b823973f1cb992306ca4b49bd8852aa54 Mon Sep 17 00:00:00 2001 From: khetiSubrat Date: Fri, 6 Nov 2026 23:15:10 +0530 Subject: [PATCH] feat: add carrier selection - Add predefined mobile carrier options - Support operators across multiple countries --- .../Controllers/SimCtl+SubCommands.swift | 28 +++++++++++++++++++ ControlRoom/Controllers/SimCtl.swift | 4 +-- ControlRoom/Localizable.xcstrings | 7 ++++- .../ControlScreens/StatusBarView.swift | 13 +++++++-- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/ControlRoom/Controllers/SimCtl+SubCommands.swift b/ControlRoom/Controllers/SimCtl+SubCommands.swift index fa98229..546d70f 100644 --- a/ControlRoom/Controllers/SimCtl+SubCommands.swift +++ b/ControlRoom/Controllers/SimCtl+SubCommands.swift @@ -730,6 +730,34 @@ extension SimCtl { case ltePlus = "lte+" } + enum Carrier: String, CaseIterable { + case airtel = "Airtel" + case att = "AT&T" + case au = "au" + case bell = "Bell" + case bsnl = "BSNL" + case bouygues = "Bouygues" + case ee = "EE" + case free = "Free" + case jio = "Jio" + case ntt = "NTT Docomo" + case o2 = "O2" + case optus = "Optus" + case orange = "Orange" + case rakuten = "Rakuten" + case rogers = "Rogers" + case sfr = "SFR" + case softbank = "SoftBank" + case telstra = "Telstra" + case telus = "Telus" + case telekom = "Telekom" + case three = "Three" + case tmobile = "T-Mobile" + case verizon = "Verizon" + case vodafone = "Vodafone" + case vodafoneIdea = "Vodafone Idea" + } + enum WifiMode: String, CaseIterable { case searching case failed diff --git a/ControlRoom/Controllers/SimCtl.swift b/ControlRoom/Controllers/SimCtl.swift index 767e73c..139011b 100644 --- a/ControlRoom/Controllers/SimCtl.swift +++ b/ControlRoom/Controllers/SimCtl.swift @@ -104,12 +104,12 @@ enum SimCtl: CommandLineCommandExecuter { _ simulator: String, cellMode: StatusBar.CellularMode, cellBars: StatusBar.CellularBars, - carrier: String + carrier: StatusBar.Carrier ) { execute(.statusBar(deviceId: simulator, operation: .override([ .cellularMode(cellMode), .cellularBars(cellBars), - .operatorName(carrier) + .operatorName(carrier.rawValue) ]))) } diff --git a/ControlRoom/Localizable.xcstrings b/ControlRoom/Localizable.xcstrings index ba30c9c..d64e77f 100644 --- a/ControlRoom/Localizable.xcstrings +++ b/ControlRoom/Localizable.xcstrings @@ -357,6 +357,10 @@ } } }, + "Carrier" : { + "comment" : "A drop-down menu that lets you select a carrier.", + "isCommentAutoGenerated" : true + }, "Cellular bars:" : { "localizations" : { "ar" : { @@ -1277,6 +1281,7 @@ } }, "Operator" : { + "extractionState" : "stale", "localizations" : { "ar" : { "stringUnit" : { @@ -2143,5 +2148,5 @@ } } }, - "version" : "1.0" + "version" : "1.1" } \ No newline at end of file diff --git a/ControlRoom/Simulator UI/ControlScreens/StatusBarView.swift b/ControlRoom/Simulator UI/ControlScreens/StatusBarView.swift index 29ece9e..e0a77a9 100644 --- a/ControlRoom/Simulator UI/ControlScreens/StatusBarView.swift +++ b/ControlRoom/Simulator UI/ControlScreens/StatusBarView.swift @@ -38,6 +38,8 @@ struct StatusBarView: View { /// The current battery state of the device; must be "Charging", "Charged", or "Discharging" /// Note: "Charged" looks the same as "Discharging", so it's not included in this screen. @State private var batteryState: SimCtl.StatusBar.BatteryState = .charged + + @State private var carrierSelection: SimCtl.StatusBar.Carrier = .jio var body: some View { ScrollView { @@ -56,7 +58,14 @@ struct StatusBarView: View { .frame(height: 40) Section { - TextField("Operator", text: $carrierName, onCommit: updateCellularData) + + Picker("Carrier", selection: $carrierSelection.onChange(updateCellularData)) { + ForEach(SimCtl.StatusBar.Carrier.allCases, id:\.self) { carreir in + Text(carreir.rawValue) + .tag(carreir) + } + } + .pickerStyle(.menu) Picker("Network type:", selection: $dataNetwork.onChange(updateWiFiData)) { ForEach(SimCtl.StatusBar.DataNetwork.allCases, id: \.self) { network in @@ -182,7 +191,7 @@ struct StatusBarView: View { simulator.udid, cellMode: cellularMode, cellBars: cellularBar, - carrier: carrierName + carrier: carrierSelection ) }