Skip to content

Commit 5809c7c

Browse files
committed
Merge branch 'make-it-look-like-an-iphone-ios-719'
2 parents d304842 + 3d35779 commit 5809c7c

13 files changed

+60
-650
lines changed

ios/MullvadVPN.xcodeproj/project.pbxproj

+12-20
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
5838322B2AC3EF9600EA2071 /* EventChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5838322A2AC3EF9600EA2071 /* EventChannel.swift */; };
116116
583D86482A2678DC0060D63B /* DeviceStateAccessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 583D86472A2678DC0060D63B /* DeviceStateAccessor.swift */; };
117117
583DA21425FA4B5C00318683 /* LocationDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 583DA21325FA4B5C00318683 /* LocationDataSource.swift */; };
118-
583FE01029C0F532006E85F9 /* CustomSplitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 583FE00F29C0F532006E85F9 /* CustomSplitViewController.swift */; };
119118
583FE02429C1ACB3006E85F9 /* RESTCreateApplePaymentResponse+Localization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06FAE67828F83CA50033DD93 /* RESTCreateApplePaymentResponse+Localization.swift */; };
120119
584023222A406BF5007B27AC /* UDPOverTCPObfuscator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 584023212A406BF5007B27AC /* UDPOverTCPObfuscator.swift */; };
121120
584023292A407F5F007B27AC /* libtunnel_obfuscator_proxy.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 584023282A407F5F007B27AC /* libtunnel_obfuscator_proxy.a */; };
@@ -138,8 +137,6 @@
138137
58607A4D2947287800BC467D /* AccountExpiryInAppNotificationProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58607A4C2947287800BC467D /* AccountExpiryInAppNotificationProvider.swift */; };
139138
586168692976F6BD00EF8598 /* DisplayError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 586168682976F6BD00EF8598 /* DisplayError.swift */; };
140139
5862805422428EF100F5A6E1 /* TranslucentButtonBlurView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5862805322428EF100F5A6E1 /* TranslucentButtonBlurView.swift */; };
141-
5864859929A0D028006C5743 /* FormsheetPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5864859829A0D028006C5743 /* FormsheetPresentationController.swift */; };
142-
5864859B29A0EAF2006C5743 /* SecondaryContextPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5864859A29A0EAF2006C5743 /* SecondaryContextPresentationController.swift */; };
143140
5864AF0729C78843005B0CD9 /* SettingsCellFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5864AF0029C7879B005B0CD9 /* SettingsCellFactory.swift */; };
144141
5864AF0829C78849005B0CD9 /* CellFactoryProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5864AF0129C7879B005B0CD9 /* CellFactoryProtocol.swift */; };
145142
5864AF0929C78850005B0CD9 /* VPNSettingsCellFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5864AF0229C7879B005B0CD9 /* VPNSettingsCellFactory.swift */; };
@@ -605,6 +602,7 @@
605602
7ADCB2D82B6A6EB300C88F89 /* AnyRelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ADCB2D72B6A6EB300C88F89 /* AnyRelay.swift */; };
606603
7ADCB2DA2B6A730400C88F89 /* IPOverrideRepositoryStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ADCB2D92B6A730400C88F89 /* IPOverrideRepositoryStub.swift */; };
607604
7AE044BB2A935726003915D8 /* Routing.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A88DCD02A8FABBE00D2FF0E /* Routing.h */; settings = {ATTRIBUTES = (Public, ); }; };
605+
7AE2414A2C20682B0076CE33 /* FormsheetPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE241482C20682B0076CE33 /* FormsheetPresentationController.swift */; };
608606
7AED35CC2BD13F60002A67D1 /* ApplicationConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58BFA5CB22A7CE1F00A6173D /* ApplicationConfiguration.swift */; };
609607
7AED35CD2BD13FC4002A67D1 /* ApplicationTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58C76A072A33850E00100D75 /* ApplicationTarget.swift */; };
610608
7AEF7F1A2AD00F52006FE45D /* AppMessageHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AEF7F192AD00F52006FE45D /* AppMessageHandler.swift */; };
@@ -1552,7 +1550,6 @@
15521550
583E1E292848DF67004838B3 /* OperationObserverTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationObserverTests.swift; sourceTree = "<group>"; };
15531551
583E60952A9F6D0800DC61EF /* ConfigurationBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationBuilder.swift; sourceTree = "<group>"; };
15541552
583FE00B29C0C7FD006E85F9 /* ModalPresentationConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalPresentationConfiguration.swift; sourceTree = "<group>"; };
1555-
583FE00F29C0F532006E85F9 /* CustomSplitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSplitViewController.swift; sourceTree = "<group>"; };
15561553
583FE01129C0F99A006E85F9 /* PresentationControllerDismissalInterceptor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationControllerDismissalInterceptor.swift; sourceTree = "<group>"; };
15571554
5840231F2A406BF5007B27AC /* TunnelObfuscation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TunnelObfuscation.framework; sourceTree = BUILT_PRODUCTS_DIR; };
15581555
584023212A406BF5007B27AC /* UDPOverTCPObfuscator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UDPOverTCPObfuscator.swift; sourceTree = "<group>"; };
@@ -1585,8 +1582,6 @@
15851582
58607A4C2947287800BC467D /* AccountExpiryInAppNotificationProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountExpiryInAppNotificationProvider.swift; sourceTree = "<group>"; };
15861583
586168682976F6BD00EF8598 /* DisplayError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayError.swift; sourceTree = "<group>"; };
15871584
5862805322428EF100F5A6E1 /* TranslucentButtonBlurView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TranslucentButtonBlurView.swift; sourceTree = "<group>"; };
1588-
5864859829A0D028006C5743 /* FormsheetPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormsheetPresentationController.swift; sourceTree = "<group>"; };
1589-
5864859A29A0EAF2006C5743 /* SecondaryContextPresentationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondaryContextPresentationController.swift; sourceTree = "<group>"; };
15901585
5864AF0029C7879B005B0CD9 /* SettingsCellFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsCellFactory.swift; sourceTree = "<group>"; };
15911586
5864AF0129C7879B005B0CD9 /* CellFactoryProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellFactoryProtocol.swift; sourceTree = "<group>"; };
15921587
5864AF0229C7879B005B0CD9 /* VPNSettingsCellFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VPNSettingsCellFactory.swift; sourceTree = "<group>"; };
@@ -1976,6 +1971,7 @@
19761971
7AD0AA202AD6CB0000119E10 /* URLRequestProxyStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLRequestProxyStub.swift; sourceTree = "<group>"; };
19771972
7ADCB2D72B6A6EB300C88F89 /* AnyRelay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyRelay.swift; sourceTree = "<group>"; };
19781973
7ADCB2D92B6A730400C88F89 /* IPOverrideRepositoryStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPOverrideRepositoryStub.swift; sourceTree = "<group>"; };
1974+
7AE241482C20682B0076CE33 /* FormsheetPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormsheetPresentationController.swift; sourceTree = "<group>"; };
19791975
7AEF7F192AD00F52006FE45D /* AppMessageHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppMessageHandler.swift; sourceTree = "<group>"; };
19801976
7AF10EB12ADE859200C090B9 /* AlertViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertViewController.swift; sourceTree = "<group>"; };
19811977
7AF10EB32ADE85BC00C090B9 /* RelayFilterCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RelayFilterCoordinator.swift; sourceTree = "<group>"; };
@@ -3131,15 +3127,6 @@
31313127
path = RelayCacheTracker;
31323128
sourceTree = "<group>";
31333129
};
3134-
5864859729A0D012006C5743 /* Presentation controllers */ = {
3135-
isa = PBXGroup;
3136-
children = (
3137-
5864859829A0D028006C5743 /* FormsheetPresentationController.swift */,
3138-
5864859A29A0EAF2006C5743 /* SecondaryContextPresentationController.swift */,
3139-
);
3140-
path = "Presentation controllers";
3141-
sourceTree = "<group>";
3142-
};
31433130
5864AF0629C78816005B0CD9 /* Protocols */ = {
31443131
isa = PBXGroup;
31453132
children = (
@@ -3402,7 +3389,6 @@
34023389
children = (
34033390
58D1560C29C0B27600749324 /* Root */,
34043391
583FE01329C102EB006E85F9 /* Navigation */,
3405-
583FE00F29C0F532006E85F9 /* CustomSplitViewController.swift */,
34063392
);
34073393
path = Containers;
34083394
sourceTree = "<group>";
@@ -3574,7 +3560,7 @@
35743560
F09D04B82AE94F27003D4F89 /* GeneralAPIs */,
35753561
58B26E1F2943516500D5980C /* Notifications */,
35763562
586A950B2901250A007BAF2B /* Operations */,
3577-
5864859729A0D012006C5743 /* Presentation controllers */,
3563+
7AE241492C20682B0076CE33 /* Presentation controllers */,
35783564
5864AF0629C78816005B0CD9 /* Protocols */,
35793565
585DA87526B0249A00B8C587 /* RelayCacheTracker */,
35803566
58E25F802837BBBB002CFB2C /* SceneDelegate.swift */,
@@ -3934,6 +3920,14 @@
39343920
path = SelectLocation;
39353921
sourceTree = "<group>";
39363922
};
3923+
7AE241492C20682B0076CE33 /* Presentation controllers */ = {
3924+
isa = PBXGroup;
3925+
children = (
3926+
7AE241482C20682B0076CE33 /* FormsheetPresentationController.swift */,
3927+
);
3928+
path = "Presentation controllers";
3929+
sourceTree = "<group>";
3930+
};
39373931
7AF9BE912A39F47D00DBFEDB /* RelayFilter */ = {
39383932
isa = PBXGroup;
39393933
children = (
@@ -5667,7 +5661,6 @@
56675661
5891BF5125E66B1E006D6FB0 /* UIBarButtonItem+KeyboardNavigation.swift in Sources */,
56685662
58E511E628DDDEAC00B0BCDE /* CodingErrors+CustomErrorDescription.swift in Sources */,
56695663
58C76A0B2A338E4300100D75 /* BackgroundTask.swift in Sources */,
5670-
5864859B29A0EAF2006C5743 /* SecondaryContextPresentationController.swift in Sources */,
56715664
7A9CCCC32A96302800DD6A34 /* ApplicationCoordinator.swift in Sources */,
56725665
5864AF0729C78843005B0CD9 /* SettingsCellFactory.swift in Sources */,
56735666
587B75412668FD7800DEF7E9 /* AccountExpirySystemNotificationProvider.swift in Sources */,
@@ -5796,7 +5789,6 @@
57965789
586A950E290125F3007BAF2B /* ProductsRequestOperation.swift in Sources */,
57975790
7AF9BE902A39F26000DBFEDB /* Collection+Sorting.swift in Sources */,
57985791
58F19E35228C15BA00C7710B /* SpinnerActivityIndicatorView.swift in Sources */,
5799-
5864859929A0D028006C5743 /* FormsheetPresentationController.swift in Sources */,
58005792
58CEB3022AFD365600E6E088 /* SwitchCellContentConfiguration.swift in Sources */,
58015793
7A9CCCB52A96302800DD6A34 /* AddCreditSucceededCoordinator.swift in Sources */,
58025794
7A0C0F632A979C4A0058EFCE /* Coordinator+Router.swift in Sources */,
@@ -5876,6 +5868,7 @@
58765868
5807E2C02432038B00F5FF30 /* String+Split.swift in Sources */,
58775869
58B26E242943520C00D5980C /* NotificationProviderProtocol.swift in Sources */,
58785870
5877F94E2A0A59AA0052D9E9 /* NotificationResponse.swift in Sources */,
5871+
7AE2414A2C20682B0076CE33 /* FormsheetPresentationController.swift in Sources */,
58795872
7A6389E52B7E4247008E77E1 /* EditCustomListCoordinator.swift in Sources */,
58805873
58677712290976FB006F721F /* SettingsInteractor.swift in Sources */,
58815874
58EF875D2B1638BF00C098B2 /* ProxyConfigurationTesterProtocol.swift in Sources */,
@@ -5885,7 +5878,6 @@
58855878
5878F50029CDA742003D4BE2 /* UIView+AutoLayoutBuilder.swift in Sources */,
58865879
7A28826D2BAAC9DE00FD9F20 /* IPOverrideHeaderView.swift in Sources */,
58875880
A98502032B627B120061901E /* LocalNetworkProbe.swift in Sources */,
5888-
583FE01029C0F532006E85F9 /* CustomSplitViewController.swift in Sources */,
58895881
7A6F2FA92AFD0842006D0856 /* CustomDNSDataSource.swift in Sources */,
58905882
58EF580B25D69D7A00AEBA94 /* ProblemReportSubmissionOverlayView.swift in Sources */,
58915883
5892A45E265FABFF00890742 /* EmptyTableViewHeaderFooterView.swift in Sources */,

ios/MullvadVPN/Classes/AppRoutes.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import Routing
1010
import UIKit
1111

1212
/**
13-
Enum type describing groups of routes. Each group is a modal layer with horizontal navigation
14-
inside with exception where primary navigation is a part of root controller on iPhone.
13+
Enum type describing groups of routes.
1514
*/
1615
enum AppRouteGroup: AppRouteGroupProtocol {
1716
/**
@@ -47,7 +46,7 @@ enum AppRouteGroup: AppRouteGroupProtocol {
4746
var isModal: Bool {
4847
switch self {
4948
case .primary:
50-
return UIDevice.current.userInterfaceIdiom == .pad
49+
return false
5150

5251
case .selectLocation, .account, .settings, .changelog, .alert:
5352
return true

ios/MullvadVPN/Classes/AutomaticKeyboardResponder.swift

-92
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ class AutomaticKeyboardResponder {
1515

1616
private var lastKeyboardRect: CGRect?
1717

18-
private let logger = Logger(label: "AutomaticKeyboardResponder")
19-
private var presentationFrameObserver: NSKeyValueObservation?
20-
2118
init<T: UIView>(targetView: T, handler: @escaping (T, CGFloat) -> Void) {
2219
self.targetView = targetView
2320
self.handler = { view, adjustment in
@@ -32,18 +29,6 @@ class AutomaticKeyboardResponder {
3229
name: UIResponder.keyboardWillChangeFrameNotification,
3330
object: nil
3431
)
35-
NotificationCenter.default.addObserver(
36-
self,
37-
selector: #selector(keyboardWillShow(_:)),
38-
name: UIResponder.keyboardWillShowNotification,
39-
object: nil
40-
)
41-
NotificationCenter.default.addObserver(
42-
self,
43-
selector: #selector(keyboardWillHide(_:)),
44-
name: UIResponder.keyboardWillHideNotification,
45-
object: nil
46-
)
4732
}
4833

4934
func updateContentInsets() {
@@ -53,14 +38,6 @@ class AutomaticKeyboardResponder {
5338

5439
// MARK: - Keyboard notifications
5540

56-
@objc private func keyboardWillShow(_ notification: Notification) {
57-
addPresentationControllerObserver()
58-
}
59-
60-
@objc private func keyboardWillHide(_ notification: Notification) {
61-
presentationFrameObserver = nil
62-
}
63-
6441
@objc private func keyboardWillChangeFrame(_ notification: Notification) {
6542
handleKeyboardNotification(notification)
6643
}
@@ -99,75 +76,6 @@ class AutomaticKeyboardResponder {
9976
}
10077
}
10178

102-
private func addPresentationControllerObserver() {
103-
guard isFormSheetPresentation else { return }
104-
105-
// Presentation controller follows the keyboard on iPad.
106-
// Install the observer to listen for the container view frame and adjust the target view
107-
// accordingly.
108-
guard let containerView = presentationContainerView else {
109-
logger.warning("Cannot determine the container view in form sheet presentation.")
110-
return
111-
}
112-
113-
presentationFrameObserver = containerView.observe(
114-
\.frame,
115-
options: [.new],
116-
changeHandler: { [weak self] _, _ in
117-
guard let self,
118-
let keyboardFrameValue = lastKeyboardRect else { return }
119-
120-
adjustContentInsets(convertedKeyboardFrameEnd: keyboardFrameValue)
121-
}
122-
)
123-
}
124-
125-
/// Returns the first parent controller in the responder chain
126-
private var parentViewController: UIViewController? {
127-
var responder: UIResponder? = targetView
128-
let iterator = AnyIterator { () -> UIResponder? in
129-
responder = responder?.next
130-
return responder
131-
}
132-
return iterator.first { $0 is UIViewController } as? UIViewController
133-
}
134-
135-
/// Returns the presentation container view that's moved along with the keyboard on iPad
136-
private var presentationContainerView: UIView? {
137-
var currentView = parentViewController?.view
138-
let iterator = AnyIterator { () -> UIView? in
139-
currentView = currentView?.superview
140-
return currentView
141-
}
142-
143-
// Find the container view that private `_UIFormSheetPresentationController` moves
144-
// along with the keyboard.
145-
return iterator.first { view -> Bool in
146-
view.description.starts(with: "<UIDropShadowView")
147-
}
148-
}
149-
150-
private var isFormSheetPresentation: Bool {
151-
// Form sheet is only supported on iPad
152-
guard UIDevice.current.userInterfaceIdiom == .pad else { return false }
153-
154-
// Find the parent controller holding the view
155-
guard let parent = parentViewController else { return false }
156-
157-
// Determine presentation style within the context
158-
let presentationStyle: UIModalPresentationStyle
159-
160-
// Use the presentation style of a presented controller,
161-
// when parent controller is being presented as a child of other modal controller.
162-
if let presented = parent.presentingViewController?.presentedViewController {
163-
presentationStyle = presented.modalPresentationStyle
164-
} else {
165-
presentationStyle = parent.modalPresentationStyle
166-
}
167-
168-
return presentationStyle == .formSheet
169-
}
170-
17179
private func adjustContentInsets(convertedKeyboardFrameEnd: CGRect) {
17280
guard let targetView else { return }
17381

ios/MullvadVPN/Containers/CustomSplitViewController.swift

-81
This file was deleted.

0 commit comments

Comments
 (0)