Skip to content

Commit 0114876

Browse files
authored
Merge pull request #1221 from kiwix/1205-phets-content-app-start-fix-iphones
Fix Phets initial webView sizing
2 parents ba5b0e2 + b561aee commit 0114876

File tree

3 files changed

+37
-19
lines changed

3 files changed

+37
-19
lines changed

App/CompactViewController.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,16 +299,19 @@ private struct Content<LaunchModel>: View where LaunchModel: LaunchProtocol {
299299
let _ = model.updateWith(hasZimFiles: !zimFiles.isEmpty,
300300
hasSeenCategories: hasSeenCategories)
301301
switch model.state {
302-
case .loadingData:
303-
LoadingDataView()
304-
case .webPage(let isLoading):
305-
WebView(browser: browser)
306-
.ignoresSafeArea()
307-
.overlay {
308-
if isLoading {
309-
LoadingProgressView()
302+
case .loadingData, .webPage:
303+
ZStack {
304+
LoadingDataView()
305+
.opacity(model.state == .loadingData ? 1.0 : 0.0)
306+
WebView(browser: browser)
307+
.opacity(model.state == .loadingData ? 0.0 : 1.0)
308+
.ignoresSafeArea()
309+
.overlay {
310+
if case .webPage(let isLoading) = model.state, isLoading {
311+
LoadingProgressView()
312+
}
310313
}
311-
}
314+
}
312315
case .catalog(let catalogSequence):
313316
switch catalogSequence {
314317
case .fetching:

UITests_iPhone/LoadingUI_iPhone_Test.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ final class LoadingUI_iPhone_Test: XCTestCase {
2525

2626
let app = XCUIApplication()
2727
app.activate()
28-
Wait.inApp(app, forElement: app.buttons["Categories"])
29-
30-
XCTAssertTrue(app.buttons["Categories"].isSelected)
28+
let categoriesButton = app.buttons["Categories"]
29+
Wait.inApp(app, forElement: categoriesButton)
30+
XCTAssertTrue(categoriesButton.isSelected)
3131

3232
app.buttons["New"].tap()
3333
app.buttons["Downloads"].tap()
3434
app.buttons["Opened"].tap()
35-
app.buttons["Categories"].tap()
35+
categoriesButton.tap()
3636
app.buttons["Done"].tap()
3737

3838
XCTAssertFalse(app.buttons["Go Back"].isEnabled)

project.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ targets:
119119
type: bundle.unit-test
120120
supportedDestinations: [iOS, macOS]
121121
settings:
122-
PRODUCT_BUNDLE_IDENTIFIER: org.kiwix.Tests
122+
PRODUCT_BUNDLE_IDENTIFIER: self.kiwix.Tests
123123
TEST_HOST: $(BUILT_PRODUCTS_DIR)/Kiwix.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Kiwix
124124
BUNDLE_LOADER: $(TEST_HOST)
125125
entitlements:
@@ -138,7 +138,7 @@ targets:
138138
type: bundle.ui-testing
139139
supportedDestinations: [macOS]
140140
settings:
141-
PRODUCT_BUNDLE_IDENTIFIER: org.kiwix.UITests
141+
PRODUCT_BUNDLE_IDENTIFIER: self.Kiwix.UITests.macOS
142142
# TEST_HOST: $(BUILT_PRODUCTS_DIR)/Kiwix.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Kiwix
143143
BUNDLE_LOADER: $(TEST_HOST)
144144
entitlements:
@@ -157,8 +157,11 @@ targets:
157157
type: bundle.ui-testing
158158
supportedDestinations: [iOS]
159159
settings:
160-
PRODUCT_BUNDLE_IDENTIFIER: org.kiwix.UITests
161-
# TEST_HOST: $(BUILT_PRODUCTS_DIR)/Kiwix.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Kiwix
160+
# https://developer.apple.com/documentation/xcode/build-settings-reference#Targeted-Device-Families
161+
TARGETED_DEVICE_FAMILY: 1
162+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: NO
163+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD: NO
164+
PRODUCT_BUNDLE_IDENTIFIER: self.Kiwix.UITests.iPhone
162165
BUNDLE_LOADER: $(TEST_HOST)
163166
entitlements:
164167
path: Support/Kiwix-unitTest.entitlements
@@ -172,8 +175,11 @@ targets:
172175
type: bundle.ui-testing
173176
supportedDestinations: [iOS]
174177
settings:
175-
PRODUCT_BUNDLE_IDENTIFIER: org.kiwix.UITests
176-
# TEST_HOST: $(BUILT_PRODUCTS_DIR)/Kiwix.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Kiwix
178+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: NO
179+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD: NO
180+
# https://developer.apple.com/documentation/xcode/build-settings-reference#Targeted-Device-Families
181+
TARGETED_DEVICE_FAMILY: 2
182+
PRODUCT_BUNDLE_IDENTIFIER: self.Kiwix.UITests.iPad
177183
BUNDLE_LOADER: $(TEST_HOST)
178184
entitlements:
179185
path: Support/Kiwix-unitTest.entitlements
@@ -196,6 +202,9 @@ schemes:
196202
gatherCoverageData: true
197203
coverageTargets:
198204
- Kiwix
205+
preActions:
206+
- script: xcrun simctl uninstall booted self.Kiwix
207+
settingsTarget: Kiwix
199208
UITests_macOS:
200209
build:
201210
targets:
@@ -214,6 +223,9 @@ schemes:
214223
- UITests_iPhone
215224
commandLineArguments:
216225
testing: true
226+
preActions:
227+
- script: xcrun simctl uninstall booted self.Kiwix
228+
settingsTarget: Kiwix
217229
UITests_iPad:
218230
build:
219231
targets:
@@ -223,3 +235,6 @@ schemes:
223235
- UITests_iPad
224236
commandLineArguments:
225237
testing: true
238+
preActions:
239+
- script: xcrun simctl uninstall booted self.Kiwix
240+
settingsTarget: Kiwix

0 commit comments

Comments
 (0)