Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to support Xcode 14.0 #7062

Merged
merged 16 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ common_params:
repo: "woocommerce/woocommerce-ios/"
# Common environment values to use with the `env` key.
- &common_env
IMAGE_ID: xcode-13.4.1
IMAGE_ID: xcode-14

# This is the default pipeline – it will build and test the app
steps:
Expand Down Expand Up @@ -68,7 +68,7 @@ steps:
# UI Tests
#################
- label: "🔬 UI Tests (iPhone)"
command: .buildkite/commands/run-ui-tests.sh UITests 'iPhone 11'
command: .buildkite/commands/run-ui-tests.sh UITests 'iPhone 14'
depends_on: "build"
env: *common_env
plugins: *common_plugins
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1210"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
9 changes: 9 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -360,5 +360,14 @@ post_install do |installer|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'ALPHA=1']
end
end

# Fix a code signing issue in Xcode 14 beta.
# This solution is suggested here: https://github.com/CocoaPods/CocoaPods/issues/11402#issuecomment-1189861270
# ====================================
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['CODE_SIGN_IDENTITY'] = ''
end
end
# rubocop:enable Style/CombinableLoops
end
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,6 @@ SPEC CHECKSUMS:
ZendeskSupportProvidersSDK: 2bdf8544f7cd0fd4c002546f5704b813845beb2a
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba

PODFILE CHECKSUM: 0b413ca49ed0793630b6cffce7d1dabbaf0d2886
PODFILE CHECKSUM: 3e746ecbe69d5cf22e0377beba8d803003558dd6

COCOAPODS: 1.11.2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1210"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ final class HubMenuViewController: UIHostingController<HubMenu> {
func showPaymentsMenu() {
show(InPersonPaymentsMenuViewController(), sender: self)
}

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

// We want to hide navigation bar *only* on HubMenu screen. But on iOS 16, the `navigationBarHidden(true)`
// modifier on `HubMenu` view hides the navigation bar for the whole navigation stack.
// Here we manually hide or show navigation bar when entering or leaving the HubMenu screen.
if #available(iOS 16.0, *) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you still see the navigation bar issue #7091 with the latest Xcode 14? somehow I don't see this issue anymore on trunk using Xcode 14 in an iOS 16.0 simulator. I don't have an iOS 16 device though, might be worth testing on one to confirm if this workaround is still needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried to comment out viewWillAppear and viewWillDisappear - reproduced the issue on the device:

Payments Reviews
IMG_2289 IMG_2290

Copy link
Contributor

@crazytonyli crazytonyli Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaclync Hmm, that's strange. I just run the trunk branch on an iPhone 14 simulator using Xcode 14, and verified this is still an issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like something odd on my end then, thanks for checking both!

self.navigationController?.setNavigationBarHidden(true, animated: animated)
}
}

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

if #available(iOS 16.0, *) {
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}
Comment on lines +47 to +51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: does it make sense to reverse the order of the super call since this is a "disappear" event?

Suggested change
super.viewWillDisappear(animated)
if #available(iOS 16.0, *) {
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}
if #available(iOS 16.0, *) {
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}
super.viewWillDisappear(animated)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API doc says

If you override this method, you must call super at some point in your implementation.

I don't think the order of these two statements would make any difference, the pop animation should begin and end at the same time.

}
}

private extension HubMenuViewController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ struct ShippingLineDetails: View {
symbol: nil,
keyboardType: .default)
.accessibilityIdentifier("add-shipping-name-field")
.onTapGesture {
focusAmountInput = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have the testing steps for this change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was added so that the test_creat_new_order UI test can pass on CI. It's a strange issue though, since the test failure only occurs on CI, not on my mac.

BTW, the issue was mentioned in my original PR.

Here is a very strange issue only happens in UI test on CI. I had to explicitly make a text field loose keyboard focus by changing the binding variable, for the other "add-shipping-name-field" text field to gain keyboard focus.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, you can find my many attempts of fixing this issue in this buildkite branch builds.

From the test result bundle (you can download one from the artifacts of this step), it appears even thought "add-shipping-name-field" is tapped, it's still "add-shipping-amount-field" that has the keyboard focus, which caused the test to fail.
Screen Shot 2022-09-16 at 9 17 57 AM

}
}
.padding(.horizontal, insets: safeAreaInsets)
.addingTopAndBottomDividers()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1210"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1210"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1210"
LastUpgradeVersion = "1400"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1210"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1210"
LastUpgradeVersion = "1400"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,11 @@ final class StoreStatsPeriodViewModelTests: XCTestCase {
viewModel.selectedIntervalIndex = 0

// Then
XCTAssertEqual(timeRangeBarViewModels.map { $0.timeRangeText }, ["Monday, Jan 3", "Monday, Jan 3, 1:00 AM"])
if #available(iOS 16.0, *) {
XCTAssertEqual(timeRangeBarViewModels.map { $0.timeRangeText }, ["Monday, Jan 3", "Monday, Jan 3 at 1:00 AM"])
} else {
XCTAssertEqual(timeRangeBarViewModels.map { $0.timeRangeText }, ["Monday, Jan 3", "Monday, Jan 3, 1:00 AM"])
}
Comment on lines +344 to +348
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

}

func test_timeRangeBarViewModel_for_thisWeek_is_emitted_twice_after_order_and_visitor_stats_updated_and_selecting_interval() {
Expand Down
5 changes: 4 additions & 1 deletion WooFoundation/WooFoundation.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1330;
LastUpgradeCheck = 1330;
LastUpgradeCheck = 1400;
TargetAttributes = {
B9C9C634283E703C001B879F = {
CreatedOnToolsVersion = 13.3;
Expand Down Expand Up @@ -526,6 +526,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -629,6 +630,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -687,6 +689,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1210"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down