From 362a8e81780999382fae64f2c4f2f371515b0119 Mon Sep 17 00:00:00 2001 From: Bhaskar Sarma <61213083+bhaskar-apple@users.noreply.github.com> Date: Tue, 2 Jun 2020 07:03:42 -0700 Subject: [PATCH] Use navbar instead of tab bar controller. (#941) * Use navbar * Restyled by clang-format * Restyled by shellharden * Restyled by shfmt. Co-authored-by: Bhaskar Sarma Co-authored-by: Restyled.io --- .../CHIPTool.xcodeproj/project.pbxproj | 60 +++- .../{UI => Echo client}/EchoViewController.h | 0 .../{UI => Echo client}/EchoViewController.m | 0 .../OnOffCluster/OnOffViewController.h | 17 ++ .../OnOffCluster/OnOffViewController.m | 47 +++ .../{UI => QRCode}/QRCodeViewController.h | 0 .../{UI => QRCode}/QRCodeViewController.m | 0 .../CHIPTool/UI/Base.lproj/Main.storyboard | 268 +++++++++++++++--- .../Framework/CHIP.xcodeproj/project.pbxproj | 8 + .../Framework/chip_xcode_build_connector.sh | 2 +- 10 files changed, 351 insertions(+), 51 deletions(-) rename src/darwin/CHIPTool/CHIPTool/{UI => Echo client}/EchoViewController.h (100%) rename src/darwin/CHIPTool/CHIPTool/{UI => Echo client}/EchoViewController.m (100%) create mode 100644 src/darwin/CHIPTool/CHIPTool/OnOffCluster/OnOffViewController.h create mode 100644 src/darwin/CHIPTool/CHIPTool/OnOffCluster/OnOffViewController.m rename src/darwin/CHIPTool/CHIPTool/{UI => QRCode}/QRCodeViewController.h (100%) rename src/darwin/CHIPTool/CHIPTool/{UI => QRCode}/QRCodeViewController.m (100%) diff --git a/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj b/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj index f5d3f20ea47baa..9e2f0bc0603bae 100644 --- a/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj +++ b/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0CA0E0CF248599BB009087B9 /* OnOffViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CA0E0CE248599BB009087B9 /* OnOffViewController.m */; }; 991DC091247747F500C13860 /* EchoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 991DC090247747F500C13860 /* EchoViewController.m */; }; B204A621244E1D0600C7C0E1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B204A620244E1D0600C7C0E1 /* AppDelegate.m */; }; B204A624244E1D0600C7C0E1 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B204A623244E1D0600C7C0E1 /* SceneDelegate.m */; }; @@ -44,15 +45,17 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 991DC08F247747F500C13860 /* EchoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = EchoViewController.h; path = UI/EchoViewController.h; sourceTree = ""; }; - 991DC090247747F500C13860 /* EchoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = EchoViewController.m; path = UI/EchoViewController.m; sourceTree = ""; }; + 0CA0E0CD248599BB009087B9 /* OnOffViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OnOffViewController.h; sourceTree = ""; }; + 0CA0E0CE248599BB009087B9 /* OnOffViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OnOffViewController.m; sourceTree = ""; }; + 991DC08F247747F500C13860 /* EchoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EchoViewController.h; sourceTree = ""; }; + 991DC090247747F500C13860 /* EchoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EchoViewController.m; sourceTree = ""; }; B204A61C244E1D0600C7C0E1 /* CHIPTool.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CHIPTool.app; sourceTree = BUILT_PRODUCTS_DIR; }; B204A61F244E1D0600C7C0E1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = UI/AppDelegate.h; sourceTree = ""; }; B204A620244E1D0600C7C0E1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = UI/AppDelegate.m; sourceTree = ""; }; B204A622244E1D0600C7C0E1 /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SceneDelegate.h; path = UI/SceneDelegate.h; sourceTree = ""; }; B204A623244E1D0600C7C0E1 /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SceneDelegate.m; path = UI/SceneDelegate.m; sourceTree = ""; }; - B204A625244E1D0600C7C0E1 /* QRCodeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = QRCodeViewController.h; path = UI/QRCodeViewController.h; sourceTree = ""; }; - B204A626244E1D0600C7C0E1 /* QRCodeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = QRCodeViewController.m; path = UI/QRCodeViewController.m; sourceTree = ""; }; + B204A625244E1D0600C7C0E1 /* QRCodeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QRCodeViewController.h; sourceTree = ""; }; + B204A626244E1D0600C7C0E1 /* QRCodeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QRCodeViewController.m; sourceTree = ""; }; B204A62B244E1D0700C7C0E1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; B204A630244E1D0700C7C0E1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; B204A631244E1D0700C7C0E1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -82,6 +85,33 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 0C79937824858B3B0047A373 /* QRCode */ = { + isa = PBXGroup; + children = ( + B204A625244E1D0600C7C0E1 /* QRCodeViewController.h */, + B204A626244E1D0600C7C0E1 /* QRCodeViewController.m */, + ); + path = QRCode; + sourceTree = ""; + }; + 0C79937924858B4F0047A373 /* Echo client */ = { + isa = PBXGroup; + children = ( + 991DC08F247747F500C13860 /* EchoViewController.h */, + 991DC090247747F500C13860 /* EchoViewController.m */, + ); + path = "Echo client"; + sourceTree = ""; + }; + 0CA0E0D0248599C4009087B9 /* OnOffCluster */ = { + isa = PBXGroup; + children = ( + 0CA0E0CD248599BB009087B9 /* OnOffViewController.h */, + 0CA0E0CE248599BB009087B9 /* OnOffViewController.m */, + ); + path = OnOffCluster; + sourceTree = ""; + }; B20252DE2459EC7600F97062 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -112,6 +142,7 @@ B204A61E244E1D0600C7C0E1 /* CHIPTool */ = { isa = PBXGroup; children = ( + B204A62B244E1D0700C7C0E1 /* Assets.xcassets */, B2F53AEC245B0D190010745E /* Main.storyboard */, B2F53AE9245B0D140010745E /* LaunchScreen.storyboard */, B204A630244E1D0700C7C0E1 /* Info.plist */, @@ -120,11 +151,9 @@ B204A620244E1D0600C7C0E1 /* AppDelegate.m */, B204A622244E1D0600C7C0E1 /* SceneDelegate.h */, B204A623244E1D0600C7C0E1 /* SceneDelegate.m */, - B204A625244E1D0600C7C0E1 /* QRCodeViewController.h */, - B204A626244E1D0600C7C0E1 /* QRCodeViewController.m */, - B204A62B244E1D0700C7C0E1 /* Assets.xcassets */, - 991DC08F247747F500C13860 /* EchoViewController.h */, - 991DC090247747F500C13860 /* EchoViewController.m */, + 0C79937824858B3B0047A373 /* QRCode */, + 0C79937924858B4F0047A373 /* Echo client */, + 0CA0E0D0248599C4009087B9 /* OnOffCluster */, ); path = CHIPTool; sourceTree = ""; @@ -243,6 +272,7 @@ B204A621244E1D0600C7C0E1 /* AppDelegate.m in Sources */, B204A632244E1D0700C7C0E1 /* main.m in Sources */, B204A624244E1D0600C7C0E1 /* SceneDelegate.m in Sources */, + 0CA0E0CF248599BB009087B9 /* OnOffViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -398,8 +428,9 @@ B204A64C244E1D0700C7C0E1 /* Debug iOS */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = arm64; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; @@ -408,18 +439,22 @@ "$(inherited)", "@executable_path/Frameworks", ); + ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.chip.CHIPTool; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = iphoneos.internal; TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "arm64 armv4t armv5 armv6 armv6m armv7 armv7em armv7f armv7k armv7m armv7s xscale"; }; name = "Debug iOS"; }; B204A64D244E1D0700C7C0E1 /* Release iOS */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = arm64; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; @@ -428,10 +463,13 @@ "$(inherited)", "@executable_path/Frameworks", ); + ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.chip.CHIPTool; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; + SDKROOT = iphoneos.internal; TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "arm64 armv4t armv5 armv6 armv6m armv7 armv7em armv7f armv7k armv7m armv7s xscale"; }; name = "Release iOS"; }; diff --git a/src/darwin/CHIPTool/CHIPTool/UI/EchoViewController.h b/src/darwin/CHIPTool/CHIPTool/Echo client/EchoViewController.h similarity index 100% rename from src/darwin/CHIPTool/CHIPTool/UI/EchoViewController.h rename to src/darwin/CHIPTool/CHIPTool/Echo client/EchoViewController.h diff --git a/src/darwin/CHIPTool/CHIPTool/UI/EchoViewController.m b/src/darwin/CHIPTool/CHIPTool/Echo client/EchoViewController.m similarity index 100% rename from src/darwin/CHIPTool/CHIPTool/UI/EchoViewController.m rename to src/darwin/CHIPTool/CHIPTool/Echo client/EchoViewController.m diff --git a/src/darwin/CHIPTool/CHIPTool/OnOffCluster/OnOffViewController.h b/src/darwin/CHIPTool/CHIPTool/OnOffCluster/OnOffViewController.h new file mode 100644 index 00000000000000..fca4104633b6e5 --- /dev/null +++ b/src/darwin/CHIPTool/CHIPTool/OnOffCluster/OnOffViewController.h @@ -0,0 +1,17 @@ +// +// OnOffViewController.h +// CHIPTool +// +// Created by Bhaskar on 6/1/20. +// Copyright © 2020 CHIP. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface OnOffViewController : UIViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/CHIPTool/CHIPTool/OnOffCluster/OnOffViewController.m b/src/darwin/CHIPTool/CHIPTool/OnOffCluster/OnOffViewController.m new file mode 100644 index 00000000000000..d131250612be40 --- /dev/null +++ b/src/darwin/CHIPTool/CHIPTool/OnOffCluster/OnOffViewController.m @@ -0,0 +1,47 @@ +// +// OnOffViewController.m +// CHIPTool +// +// Created by Bhaskar on 6/1/20. +// Copyright © 2020 CHIP. All rights reserved. +// + +#import "OnOffViewController.h" + +@interface OnOffViewController () + +@end + +@implementation OnOffViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ +- (IBAction)onButtonTapped:(id)sender +{ + NSLog(@"On tapped"); +} + +- (IBAction)offButtonTapped:(id)sender +{ + NSLog(@"Off tapped"); +} + +- (IBAction)toggleButtonTapped:(id)sender +{ + NSLog(@"Toggle tapped"); +} + +@end diff --git a/src/darwin/CHIPTool/CHIPTool/UI/QRCodeViewController.h b/src/darwin/CHIPTool/CHIPTool/QRCode/QRCodeViewController.h similarity index 100% rename from src/darwin/CHIPTool/CHIPTool/UI/QRCodeViewController.h rename to src/darwin/CHIPTool/CHIPTool/QRCode/QRCodeViewController.h diff --git a/src/darwin/CHIPTool/CHIPTool/UI/QRCodeViewController.m b/src/darwin/CHIPTool/CHIPTool/QRCode/QRCodeViewController.m similarity index 100% rename from src/darwin/CHIPTool/CHIPTool/UI/QRCodeViewController.m rename to src/darwin/CHIPTool/CHIPTool/QRCode/QRCodeViewController.m diff --git a/src/darwin/CHIPTool/CHIPTool/UI/Base.lproj/Main.storyboard b/src/darwin/CHIPTool/CHIPTool/UI/Base.lproj/Main.storyboard index 302525ce01aa6f..9043bebf06f90e 100644 --- a/src/darwin/CHIPTool/CHIPTool/UI/Base.lproj/Main.storyboard +++ b/src/darwin/CHIPTool/CHIPTool/UI/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -16,10 +16,10 @@ - + - + @@ -51,7 +51,7 @@ - + - + - + @@ -283,6 +283,7 @@ + @@ -304,7 +305,7 @@ - + @@ -315,7 +316,7 @@ - + - + - + - - + @@ -401,6 +402,7 @@ + @@ -411,25 +413,213 @@ - + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj index fd5e72933e37eb..53e1df70d7882d 100644 --- a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj @@ -452,6 +452,7 @@ "@loader_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(CHIP_PREFIX)/lib"; + ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.chip.CHIP; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -481,6 +482,7 @@ "@loader_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(CHIP_PREFIX)/lib"; + ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.chip.CHIP; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -588,6 +590,7 @@ BA09EB742474881D00605257 /* Debug iOS */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = arm64; CHIP_PREFIX = "$(BUILT_PRODUCTS_DIR)"; CHIP_ROOT = "$(SRCROOT)/../../.."; CODE_SIGN_STYLE = Automatic; @@ -607,11 +610,13 @@ "@loader_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(CHIP_PREFIX)/lib"; + ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.chip.CHIP; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "arm64 armv4t armv5 armv6 armv6m armv7 armv7em armv7f armv7k armv7m armv7s xscale"; }; name = "Debug iOS"; }; @@ -692,6 +697,7 @@ BA09EB782474882200605257 /* Release iOS */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = arm64; CHIP_PREFIX = "$(BUILT_PRODUCTS_DIR)"; CHIP_ROOT = "$(SRCROOT)/../../.."; CODE_SIGN_STYLE = Automatic; @@ -711,11 +717,13 @@ "@loader_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(CHIP_PREFIX)/lib"; + ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.chip.CHIP; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "arm64 armv4t armv5 armv6 armv6m armv7 armv7em armv7f armv7k armv7m armv7s xscale"; }; name = "Release iOS"; }; diff --git a/src/darwin/Framework/chip_xcode_build_connector.sh b/src/darwin/Framework/chip_xcode_build_connector.sh index ac95c435828979..9ca09d2c2ee563 100755 --- a/src/darwin/Framework/chip_xcode_build_connector.sh +++ b/src/darwin/Framework/chip_xcode_build_connector.sh @@ -14,7 +14,7 @@ export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig" set -ex -if [[ ${ARCHS} = arm64 ]]; then +if [ "$ARCHS" = arm64 ]; then target=aarch64-apple-darwin else target=$ARCHS-apple-darwin