Skip to content

Commit

Permalink
Updated iOS CHIP tool README and qr scanner to indicate requirement >… (
Browse files Browse the repository at this point in the history
#15715)

* Updated iOS CHIP tool README and qr scanner to indicate requirement >= iOS 15.4 (#15640)

* Restyled by clang-format

* Restyled by prettier-markdown

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jun 27, 2023
1 parent f6793a6 commit 1612716
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
32 changes: 28 additions & 4 deletions src/darwin/CHIPTool/CHIPTool/View Controllers/RootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
[tableView deselectRowAtIndexPath:indexPath animated:YES];
switch (indexPath.row) {
case 0:
[self pushQRCodeScanner];
[self pushQRCodeScannerWithSkipCheck:NO];
break;
case 1:
[self pushEnumeration];
Expand Down Expand Up @@ -125,10 +125,34 @@ - (void)pushNetworkConfiguration
[self.navigationController pushViewController:controller animated:YES];
}

- (void)pushQRCodeScanner
- (void)pushQRCodeScannerWithSkipCheck:(BOOL)skipIosCheck
{
QRCodeViewController * controller = [QRCodeViewController new];
[self.navigationController pushViewController:controller animated:YES];
if (skipIosCheck) {
QRCodeViewController * controller = [QRCodeViewController new];
[self.navigationController pushViewController:controller animated:YES];
} else {
if (@available(iOS 15.4, *)) {
// Device using the required iOS version (>= 15.4)
[self pushQRCodeScannerWithSkipCheck:YES];
} else {
// Device NOT using the required iOS version (< 15.4)
// Show a warning, but let the user continue
UIAlertController * alertController =
[UIAlertController alertControllerWithTitle:@"Warning"
message:@"QRCode scanner to pair a matter device requires iOS >= 15.4"
preferredStyle:UIAlertControllerStyleAlert];
__weak typeof(self) weakSelf = self;
[alertController addAction:[UIAlertAction actionWithTitle:@"I understand"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
typeof(self) strongSelf = weakSelf;
if (strongSelf) {
[strongSelf pushQRCodeScannerWithSkipCheck:YES];
}
}]];
[self presentViewController:alertController animated:YES completion:nil];
}
}
}

- (void)pushEnumeration
Expand Down
8 changes: 8 additions & 0 deletions src/darwin/CHIPTool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ control.

---

## Prerequisites

- Requires building and running the app to a physical device on iOS >= 15.4.
- At time of writing 15.4 is in beta and the current active iOS version is
15.3.1. For detailed instructions on how to install the iOS 15.4 beta
onto your device visit
[beta.apple.com](https://beta.apple.com/sp/betaprogram/enroll#ios)

## Building the Application

CHIPTool iOS can be built with the latest Xcode releases.
Expand Down

0 comments on commit 1612716

Please sign in to comment.