Skip to content

Commit

Permalink
enabling/disabling primary carrier
Browse files Browse the repository at this point in the history
  • Loading branch information
leminlimez committed Jun 1, 2023
1 parent 4a2f6c6 commit aee8690
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cowabunga.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 10.3.2;
MARKETING_VERSION = 10.3.3;
OTHER_SWIFT_FLAGS = "-Xfrontend -debug-time-function-bodies";
PRODUCT_BUNDLE_IDENTIFIER = com.leemin.Cowabunga;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1577,7 +1577,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 10.3.2;
MARKETING_VERSION = 10.3.3;
OTHER_SWIFT_FLAGS = "-Xfrontend -debug-time-function-bodies";
PRODUCT_BUNDLE_IDENTIFIER = com.leemin.Cowabunga;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Binary file not shown.
4 changes: 4 additions & 0 deletions Cowabunga/Controllers/StatusManager/StatusManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
- (NSString*) getCrumbOverride;
- (void) setCrumb:(NSString*)text;
- (void) unsetCrumb;
- (bool) isCellularServiceOverridden;
- (bool) getCellularServiceOverride;
- (void) setCellularService:(bool)val;
- (void) unsetCellularService;
- (bool) isSecondaryCellularServiceOverridden;
- (bool) getSecondaryCellularServiceOverride;
- (void) setSecondaryCellularService:(bool)val;
Expand Down
16 changes: 16 additions & 0 deletions Cowabunga/Controllers/StatusManager/StatusManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ + (StatusManager *)sharedInstance {
return sharedObject;
}

- (bool) isCellularServiceOverridden {
return [self.setter isCellularServiceOverridden];
}

- (bool) getCellularServiceOverride {
return [self.setter getCellularServiceOverride];
}

- (void) setCellularService:(bool)val {
[self.setter setCellularService:val];
}

- (void) unsetCellularService {
[self.setter unsetCellularService];
}

- (bool) isCarrierOverridden {
return [self.setter isCarrierOverridden];
}
Expand Down
4 changes: 4 additions & 0 deletions Cowabunga/Controllers/StatusManager/StatusSetter.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
- (NSString*) getCrumbOverride;
- (void) setCrumb:(NSString*)text;
- (void) unsetCrumb;
- (bool) isCellularServiceOverridden;
- (bool) getCellularServiceOverride;
- (void) setCellularService:(bool)val;
- (void) unsetCellularService;
- (bool) isSecondaryCellularServiceOverridden;
- (bool) getSecondaryCellularServiceOverride;
- (void) setSecondaryCellularService:(bool)val;
Expand Down
27 changes: 27 additions & 0 deletions Cowabunga/Controllers/StatusManager/StatusSetter14.m
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,33 @@ - (void) unsetCrumb {
[self applyChanges:overrides];
}

- (bool) isCellularServiceOverridden {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] == 1;
}

- (bool) getCellularServiceOverride {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->values.itemIsEnabled[CellularServiceStatusBarItem] == 1;
}

- (void) setCellularService:(bool)val {
StatusBarOverrideData *overrides = [self getOverrides];
overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] = 1;
if (val) {
overrides->values.itemIsEnabled[CellularServiceStatusBarItem] = 1;
} else {
overrides->values.itemIsEnabled[CellularServiceStatusBarItem] = 0;
}
[self applyChanges:overrides];
}

- (void) unsetCellularService {
StatusBarOverrideData *overrides = [self getOverrides];
overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] = 0;
[self applyChanges:overrides];
}

- (bool) isSecondaryCellularServiceOverridden {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->overrideItemIsEnabled[SecondaryCellularServiceStatusBarItem] == 1;
Expand Down
27 changes: 27 additions & 0 deletions Cowabunga/Controllers/StatusManager/StatusSetter15.m
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,33 @@ - (void) unsetCrumb {
[self applyChanges:overrides];
}

- (bool) isCellularServiceOverridden {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] == 1;
}

- (bool) getCellularServiceOverride {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->values.itemIsEnabled[CellularServiceStatusBarItem] == 1;
}

- (void) setCellularService:(bool)val {
StatusBarOverrideData *overrides = [self getOverrides];
overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] = 1;
if (val) {
overrides->values.itemIsEnabled[CellularServiceStatusBarItem] = 1;
} else {
overrides->values.itemIsEnabled[CellularServiceStatusBarItem] = 0;
}
[self applyChanges:overrides];
}

- (void) unsetCellularService {
StatusBarOverrideData *overrides = [self getOverrides];
overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] = 0;
[self applyChanges:overrides];
}

- (bool) isSecondaryCellularServiceOverridden {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->overrideItemIsEnabled[SecondaryCellularServiceStatusBarItem] == 1;
Expand Down
27 changes: 27 additions & 0 deletions Cowabunga/Controllers/StatusManager/StatusSetter16.m
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,33 @@ - (void) unsetCrumb {
[self applyChanges:overrides];
}

- (bool) isCellularServiceOverridden {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] == 1;
}

- (bool) getCellularServiceOverride {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->values.itemIsEnabled[CellularServiceStatusBarItem] == 1;
}

- (void) setCellularService:(bool)val {
StatusBarOverrideData *overrides = [self getOverrides];
overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] = 1;
if (val) {
overrides->values.itemIsEnabled[CellularServiceStatusBarItem] = 1;
} else {
overrides->values.itemIsEnabled[CellularServiceStatusBarItem] = 0;
}
[self applyChanges:overrides];
}

- (void) unsetCellularService {
StatusBarOverrideData *overrides = [self getOverrides];
overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] = 0;
[self applyChanges:overrides];
}

- (bool) isSecondaryCellularServiceOverridden {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->overrideItemIsEnabled[SecondaryCellularServiceStatusBarItem] == 1;
Expand Down
27 changes: 27 additions & 0 deletions Cowabunga/Controllers/StatusManager/StatusSetter16_1.m
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,33 @@ - (void) unsetCrumb {
[self applyChanges:overrides];
}

- (bool) isCellularServiceOverridden {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] == 1;
}

- (bool) getCellularServiceOverride {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->values.itemIsEnabled[CellularServiceStatusBarItem] == 1;
}

- (void) setCellularService:(bool)val {
StatusBarOverrideData *overrides = [self getOverrides];
overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] = 1;
if (val) {
overrides->values.itemIsEnabled[CellularServiceStatusBarItem] = 1;
} else {
overrides->values.itemIsEnabled[CellularServiceStatusBarItem] = 0;
}
[self applyChanges:overrides];
}

- (void) unsetCellularService {
StatusBarOverrideData *overrides = [self getOverrides];
overrides->overrideItemIsEnabled[CellularServiceStatusBarItem] = 0;
[self applyChanges:overrides];
}

- (bool) isSecondaryCellularServiceOverridden {
StatusBarOverrideData *overrides = [self getOverrides];
return overrides->overrideItemIsEnabled[SecondaryCellularServiceStatusBarItem] == 1;
Expand Down
18 changes: 18 additions & 0 deletions Cowabunga/Views/UniqueToolsViews/StatusBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import SwiftUI
struct StatusBarView: View {
@Environment(\.openURL) var openURL

@State private var cellularServiceEnabled: Bool = StatusManager.sharedInstance().isCellularServiceOverridden()
@State private var cellularServiceValue: Bool = StatusManager.sharedInstance().getCellularServiceOverride()

@State private var carrierText: String = StatusManager.sharedInstance().getCarrierOverride()
@State private var carrierTextEnabled: Bool = StatusManager.sharedInstance().isCarrierOverridden()

Expand Down Expand Up @@ -200,6 +203,21 @@ struct StatusBarView: View {
}

Section {
Toggle("Change Service Status", isOn: $cellularServiceEnabled).onChange(of: cellularServiceEnabled, perform: { nv in
if nv {
StatusManager.sharedInstance().setCellularService(cellularServiceValue)
} else {
StatusManager.sharedInstance().unsetCellularService()
}
})
if cellularServiceEnabled {
Toggle("Cellular Service Enabled", isOn: $cellularServiceValue).onChange(of: cellularServiceValue, perform: { nv in
if cellularServiceEnabled {
StatusManager.sharedInstance().setCellularService(nv)
}
})
}

Toggle("Change Primary Carrier Text", isOn: $carrierTextEnabled).onChange(of: carrierTextEnabled, perform: { nv in
if nv {
StatusManager.sharedInstance().setCarrier(carrierText)
Expand Down

0 comments on commit aee8690

Please sign in to comment.