Skip to content

Commit

Permalink
Merge pull request #18 from SiliconLabs/release-2.8.2
Browse files Browse the repository at this point in the history
BTAPP-1442, BTAPP-1693 | Fix issues and update apple policy.
  • Loading branch information
mantosh83 committed May 3, 2024
2 parents 0d6b210 + aa36bfa commit ed9b230
Show file tree
Hide file tree
Showing 11 changed files with 191 additions and 15 deletions.
12 changes: 8 additions & 4 deletions SiliconLabsApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@
4D9E26262212CA7000617DBA /* SILRangeTestBoardInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D9E26242212CA7000617DBA /* SILRangeTestBoardInfo.swift */; };
4D9E26272212CA7000617DBA /* SILRangeTestBoardInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D9E26242212CA7000617DBA /* SILRangeTestBoardInfo.swift */; };
721423922AD69E8B00DC3FA2 /* PlugViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 721423912AD69E8B00DC3FA2 /* PlugViewController.m */; };
724CB4D42BD7DEBE003E9A99 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 724CB4D32BD7DEBE003E9A99 /* PrivacyInfo.xcprivacy */; };
7254545F2ACC1710003967CA /* Cluster.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7254545E2ACC1710003967CA /* Cluster.storyboard */; };
725454622ACC82B9003967CA /* WindowOpenCloseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 725454612ACC82B9003967CA /* WindowOpenCloseViewController.m */; };
725454652ACC8486003967CA /* DoorLockViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 725454642ACC8486003967CA /* DoorLockViewController.m */; };
Expand Down Expand Up @@ -1947,6 +1948,7 @@
721423902AD69E8B00DC3FA2 /* PlugViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlugViewController.h; sourceTree = "<group>"; };
721423912AD69E8B00DC3FA2 /* PlugViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PlugViewController.m; sourceTree = "<group>"; };
722F5EF560719504746B876B /* Pods-BlueGecko.release-wireless-gecko.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BlueGecko.release-wireless-gecko.xcconfig"; path = "Pods/Target Support Files/Pods-BlueGecko/Pods-BlueGecko.release-wireless-gecko.xcconfig"; sourceTree = "<group>"; };
724CB4D32BD7DEBE003E9A99 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
7254545E2ACC1710003967CA /* Cluster.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Cluster.storyboard; sourceTree = "<group>"; };
725454602ACC82B9003967CA /* WindowOpenCloseViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WindowOpenCloseViewController.h; sourceTree = "<group>"; };
725454612ACC82B9003967CA /* WindowOpenCloseViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WindowOpenCloseViewController.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5104,6 +5106,7 @@
E6CAA2231A64011900A49DAF /* Supporting Files */,
FE36FC6B2864783B00A9CB41 /* SILAppDelegate.swift */,
498311D31BF29A5400D49FF2 /* SILCharacteristicEditEnabler.h */,
724CB4D32BD7DEBE003E9A99 /* PrivacyInfo.xcprivacy */,
);
path = SiliconLabsApp;
sourceTree = "<group>";
Expand Down Expand Up @@ -5389,6 +5392,7 @@
4C9EAB5F24042FB00023FFB1 /* Roboto-LightItalic.ttf in Resources */,
1E1457FF266E0579009792C2 /* SILAppTypeThroughput.storyboard in Resources */,
2051321A270365A800C27B92 /* Assets.xcassets in Resources */,
724CB4D42BD7DEBE003E9A99 /* PrivacyInfo.xcprivacy in Resources */,
0C2FCBB81F9A542300F4F259 /* SILDebugAdvDetailsViewController.xib in Resources */,
4C95EB7723FEC8600091FB5A /* SILAppBluetoothBrowserDetails.storyboard in Resources */,
0C2FCBB91F9A542300F4F259 /* SILRetailBeaconDetailsViewController.xib in Resources */,
Expand Down Expand Up @@ -6910,7 +6914,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_RESOURCE_RULES_PATH = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 52444FG85C;
DISPLAY_NAME = "EFR Connect";
Expand All @@ -6928,7 +6932,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.8.1;
MARKETING_VERSION = 2.8.2;
PRODUCT_BUNDLE_IDENTIFIER = com.silabs.BlueGeckoDemoApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -6952,7 +6956,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_RESOURCE_RULES_PATH = "";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 52444FG85C;
Expand All @@ -6970,7 +6974,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.8.1;
MARKETING_VERSION = 2.8.2;
PRODUCT_BUNDLE_IDENTIFIER = com.silabs.BlueGeckoDemoApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "BlueGeckoDemoApp Distribution";
Expand Down
2 changes: 2 additions & 0 deletions SiliconLabsApp/Models/SILBlinkyPeripheralDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ class SILBlinkyPeripheralDelegate: NSObject, CBPeripheralDelegate {
return
}

// battery level
UserDefaults.standard.set(Int(value), forKey: "initialBatteryLevel")
self.updatePower(batteryLevel: Int(value))
updateStateIfIsInitiated()
}
Expand Down
20 changes: 20 additions & 0 deletions SiliconLabsApp/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>85F4.1</string>
<string>3B52.1</string>
<string>35F9.1</string>
<string>1C8F.1</string>
</array>
</dict>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ConnectedDeviceBarView: UIView {
@IBOutlet weak var batteryStatusLabel: UILabel!
@IBOutlet weak var batteryStatusImageView: BatteryIcon!
@IBOutlet weak var firmwareVersionLabel: UILabel!
var defaultValue = 0

var level: Int = 0 {
didSet {
Expand Down Expand Up @@ -49,7 +50,12 @@ class ConnectedDeviceBarView: UIView {
case .aa(let level):
self.level = level
case .coinCell(let level):
self.level = level
if level == defaultValue {
let initialBatteryLevel: Int = UserDefaults.standard.integer(forKey: "initialBatteryLevel")
self.level = initialBatteryLevel
} else {
self.level = level
}
case .genericBattery(let level):
self.level = level
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ class SILAppSelectionViewController : UIViewController, UICollectionViewDataSour
if let viewController = storyboard.instantiateInitialViewController() {
self.navigationController?.pushViewController(viewController, animated: animated)
}

}

private func showRSSIGraph(app: SILApp!, animated: Bool) {
Expand Down Expand Up @@ -406,4 +405,13 @@ class SILAppSelectionViewController : UIViewController, UICollectionViewDataSour
self.navigationController?.pushViewController(demoViewController, animated: true)
}
}

// func dismissView(devicePopover: WYPopoverController) {
// print("dismiss popup mantosh ")
// DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
// self.didDismissSILWifiOTAConfigViewController()
// self.didDismissDeviceSelectionViewController()
// print("deleted popup mantosh ")
// }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class SILAppTypeBlinkyViewController: UIViewController, ConnectedDeviceDelegate,
super.viewDidDisappear(animated)
viewModel?.removeObserverAndDisconnect()
self.disposeBag.invalidateTokens()
UserDefaults.standard.removeObject(forKey: "initialBatteryLevel")
}

override func viewWillAppear(_ animated: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ @interface SILConnectedLightingViewController () <CBPeripheralDelegate, UIGestur
@property (weak, nonatomic) IBOutlet UILabel *lastEventSourceLabel;
@property (weak, nonatomic) IBOutlet UIView *lastEventImageContentView;
@property (strong, nonatomic) UISelectionFeedbackGenerator *feedbackGenerator;
@property (nonatomic, strong) CBCentralManager *bluetoothManager;

@end

Expand Down Expand Up @@ -231,6 +232,11 @@ - (void)viewDidLoad {
[self setLeftAlignedTitle:@"Connected Lighting"];

[self.lastEventImageContentView setHidden:YES];

if(!self.bluetoothManager) {
NSDictionary *options = @{CBCentralManagerOptionShowPowerAlertKey: @NO};
self.bluetoothManager = [[CBCentralManager alloc] initWithDelegate: self queue:nil options:options];
}
}

- (void)viewDidLayoutSubviews {
Expand Down Expand Up @@ -330,6 +336,25 @@ - (void)discoverPeripheralCharacteristicsForServices {
}
}

#pragma mark - Central Manager status

- (void) showAlert: (NSString *) stateString {
UIAlertAction* okButton = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self.navigationController popViewControllerAnimated:YES];
}];

UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Bluetooth Disabled" message:stateString preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:okButton];
[self presentViewController:alert animated:YES completion:nil];
}

- (void)centralManagerDidUpdateState:(CBCentralManager *)central {
if (central.state == CBManagerStatePoweredOff) {
[self showAlert:@"You will be redirected to the home screen. Turn on Bluetoooth to use Connected Lighting"];
}
}

#pragma mark - CBPeripheralDelegate

- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ @interface SILHealthThermometerAppViewController () <CBPeripheralDelegate, UICol
@property (weak, nonatomic) IBOutlet SILThermometerSegmentedControl *typeControl;
@property (assign, nonatomic) BOOL isConnected;
@property (weak, nonatomic) IBOutlet UIStackView *presentationSpace;
@property (nonatomic, strong) CBCentralManager *bluetoothManager;

@end

Expand Down Expand Up @@ -226,6 +227,11 @@ - (void)viewDidLoad {
[self setup];
self.temperatureMeasurements = [NSMutableArray array];
[self setLeftAlignedTitle:@"Health Thermometer"];

if(!self.bluetoothManager) {
NSDictionary *options = @{CBCentralManagerOptionShowPowerAlertKey: @NO};
self.bluetoothManager = [[CBCentralManager alloc] initWithDelegate: self queue:nil options:options];
}
}

- (void)viewDidAppear:(BOOL)animated {
Expand Down Expand Up @@ -313,6 +319,25 @@ - (void)discoverPeripheralCharacteristicsForServices {
}
}

#pragma mark - Central Manager status

- (void) showAlert: (NSString *) stateString {
UIAlertAction* okButton = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self.navigationController popViewControllerAnimated:YES];
}];

UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Bluetooth Disabled" message:stateString preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:okButton];
[self presentViewController:alert animated:YES completion:nil];
}

- (void)centralManagerDidUpdateState:(CBCentralManager *)central {
if (central.state == CBManagerStatePoweredOff) {
[self showAlert:@"You will be redirected to the home screen. Turn on Bluetoooth to use Health Thermometer"];
}
}

#pragma mark - Central Manager Notifications

- (void)registerForBluetoothControllerNotifications {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@ protocol SILRangeTestBluetoothConnectionsHandler: class {
var filter: DiscoveredPeripheralFilter { get }
}

class SILRangeTestAppContainerViewController: UIViewController, UITabBarControllerDelegate {
class SILRangeTestAppContainerViewController: UIViewController, UITabBarControllerDelegate, CBCentralManagerDelegate {

@IBOutlet weak var tabSelection: UISegmentedControl!

var tabController: UITabBarController!
var connectedPeripherals: [CBPeripheral] = []

var manager: CBCentralManager!

override func viewDidLoad() {
super.viewDidLoad()
setLeftAlignedTitle("Range Test")
manager = CBCentralManager()
manager.delegate = self
}

override func viewWillAppear(_ animated: Bool) {
Expand Down Expand Up @@ -103,4 +106,27 @@ extension SILRangeTestAppContainerViewController: SILRangeTestBluetoothConnectio
connectedPeripherals.append(peripheral)
}
}

// MARK: - centralManagerDidUpdateState delegate
@objc func centralManagerDidUpdateState(_ central: CBCentralManager) {
switch central.state {
case .poweredOn:
break
case .poweredOff:
self.bluetoothIsDisabled()
print(" main VC ")
break
case .resetting:
break
case .unauthorized:
break
case .unsupported:
break
case .unknown:
break
default:
break
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

class SILRangeTestSelectDeviceViewController: UIViewController, SILDeviceSelectionViewControllerDelegate, WYPopoverControllerDelegate, SILRangeTestModeSelectionViewControllerDelegate {
class SILRangeTestSelectDeviceViewController: UIViewController, SILDeviceSelectionViewControllerDelegate, WYPopoverControllerDelegate, SILRangeTestModeSelectionViewControllerDelegate, CBCentralManagerDelegate {

@IBOutlet weak var connectButton: SILPrimaryButton!

Expand All @@ -17,16 +17,22 @@ class SILRangeTestSelectDeviceViewController: UIViewController, SILDeviceSelecti

private var popoverController: WYPopoverController?
weak var bluetoothConnectionsHandler: SILRangeTestBluetoothConnectionsHandler?

var manager: CBCentralManager!
var bleStatus: Bool = true

override func viewDidLoad() {
super.viewDidLoad()
connectButton.isEnabled = false
manager = CBCentralManager()
manager.delegate = self
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

connect()
// show popup and connect if bluetooth is available
if bleStatus {
connect()
}
}

@IBAction func didTapConnect(_ sender: Any) {
Expand Down Expand Up @@ -102,4 +108,31 @@ class SILRangeTestSelectDeviceViewController: UIViewController, SILDeviceSelecti
func popoverControllerDidDismissPopover(_ popoverController: WYPopoverController!) {
self.popoverController = nil
}

// MARK: - centralManagerDidUpdateState delegate
@objc func centralManagerDidUpdateState(_ central: CBCentralManager) {
switch central.state {
case .poweredOn:
bleStatus = true
break
case .poweredOff:
self.popoverController?.dismissPopover(animated: true)
bleStatus = false
break
case .resetting:
bleStatus = false
break
case .unauthorized:
bleStatus = false
break
case .unsupported:
bleStatus = false
break
case .unknown:
bleStatus = false
break
default:
break
}
}
}

0 comments on commit ed9b230

Please sign in to comment.