mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[ios] Switching to iOS 15 as the minimum
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
35cda6d342
commit
78b54acad4
@@ -89,7 +89,7 @@
|
||||
|
||||
- (BOOL)canMakeCalls
|
||||
{
|
||||
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone)
|
||||
if (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPhone)
|
||||
return NO;
|
||||
NSURL * telURL = [NSURL URLWithString:@"tel://"];
|
||||
if (![UIApplication.sharedApplication canOpenURL:telURL])
|
||||
|
||||
@@ -50,12 +50,6 @@ static inline BOOL equalScreenDimensions(CGFloat left, CGFloat right)
|
||||
return fabs(left - right) < 0.5;
|
||||
}
|
||||
|
||||
static inline CGFloat statusBarHeight(void) NS_EXTENSION_UNAVAILABLE_IOS("Not available in extensions")
|
||||
{
|
||||
CGSize const statusBarSize = UIApplication.sharedApplication.statusBarFrame.size;
|
||||
return MIN(statusBarSize.height, statusBarSize.width);
|
||||
}
|
||||
|
||||
static inline void performOnce(MWMVoidBlock block, NSString *key) {
|
||||
BOOL performed = [[NSUserDefaults standardUserDefaults] boolForKey:key];
|
||||
if (!performed) {
|
||||
|
||||
@@ -3,7 +3,7 @@ extension UIApplication {
|
||||
|
||||
@objc
|
||||
func showLoadingOverlay(completion: (() -> Void)? = nil) {
|
||||
guard let window = self.windows.first(where: { $0.isKeyWindow }) else {
|
||||
guard let window = (self.connectedScenes.filter { $0.activationState == .foregroundActive }.first(where: { $0 is UIWindowScene }) as? UIWindowScene)?.windows.first(where: { $0.isKeyWindow }) else {
|
||||
completion?()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ final class CarPlayService: NSObject {
|
||||
|
||||
let alert = CPNavigationAlert(titleVariants: [L("trip_finished")],
|
||||
subtitleVariants: [subtitle],
|
||||
imageSet: nil,
|
||||
image: nil,
|
||||
primaryAction: doneAction,
|
||||
secondaryAction: nil,
|
||||
duration: 0)
|
||||
|
||||
@@ -125,13 +125,9 @@ final class ListTemplateBuilder {
|
||||
private class func buildBarButton(type: BarButtonType, action: ((CPBarButton) -> Void)?) -> CPBarButton {
|
||||
switch type {
|
||||
case .bookmarks:
|
||||
let button = CPBarButton(type: .image, handler: action)
|
||||
button.image = UIImage(named: "ic_carplay_bookmark")
|
||||
return button
|
||||
return CPBarButton(image: UIImage(named: "ic_carplay_bookmark")!, handler: action)
|
||||
case .search:
|
||||
let button = CPBarButton(type: .image, handler: action)
|
||||
button.image = UIImage(named: "ic_carplay_keyboard")
|
||||
return button
|
||||
return CPBarButton(image: UIImage(named: "ic_carplay_keyboard")!, handler: action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,37 +166,21 @@ final class MapTemplateBuilder {
|
||||
private class func buildBarButton(type: BarButtonType, action: ((CPBarButton) -> Void)?) -> CPBarButton {
|
||||
switch type {
|
||||
case .dismissPaning:
|
||||
let button = CPBarButton(type: .text, handler: action)
|
||||
button.title = L("done")
|
||||
return button
|
||||
return CPBarButton(title: L("done"), handler: action)
|
||||
case .destination:
|
||||
let button = CPBarButton(type: .text, handler: action)
|
||||
button.title = L("pick_destination")
|
||||
return button
|
||||
return CPBarButton(title: L("pick_destination"), handler: action)
|
||||
case .recenter:
|
||||
let button = CPBarButton(type: .text, handler: action)
|
||||
button.title = L("follow_my_position")
|
||||
return button
|
||||
return CPBarButton(title: L("follow_my_position"), handler: action)
|
||||
case .settings:
|
||||
let button = CPBarButton(type: .image, handler: action)
|
||||
button.image = UIImage(named: "ic_carplay_settings")
|
||||
return button
|
||||
return CPBarButton(image: UIImage(named: "ic_carplay_settings")!, handler: action)
|
||||
case .mute:
|
||||
let button = CPBarButton(type: .image, handler: action)
|
||||
button.image = UIImage(named: "ic_carplay_unmuted")
|
||||
return button
|
||||
return CPBarButton(image: UIImage(named: "ic_carplay_unmuted")!, handler: action)
|
||||
case .unmute:
|
||||
let button = CPBarButton(type: .image, handler: action)
|
||||
button.image = UIImage(named: "ic_carplay_muted")
|
||||
return button
|
||||
return CPBarButton(image: UIImage(named: "ic_carplay_muted")!, handler: action)
|
||||
case .redirectRoute:
|
||||
let button = CPBarButton(type: .image, handler: action)
|
||||
button.image = UIImage(named: "ic_carplay_redirect_route")
|
||||
return button
|
||||
return CPBarButton(image: UIImage(named: "ic_carplay_redirect_route")!, handler: action)
|
||||
case .endRoute:
|
||||
let button = CPBarButton(type: .text, handler: action)
|
||||
button.title = L("navigation_stop_button").capitalized
|
||||
return button
|
||||
return CPBarButton(title: L("navigation_stop_button").capitalized, handler: action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class CopyableLabel: UILabel {
|
||||
|
||||
override func copy(_ sender: Any?) {
|
||||
UIPasteboard.general.string = text
|
||||
UIMenuController.shared.setMenuVisible(false, animated: true)
|
||||
UIMenuController.shared.hideMenu()
|
||||
}
|
||||
|
||||
override var canBecomeFirstResponder: Bool {
|
||||
|
||||
@@ -210,6 +210,9 @@ static NSString *const kAlertControllerNibIdentifier = @"MWMAlertViewController"
|
||||
|
||||
- (void)displayAlert:(MWMAlert *)alert {
|
||||
UIViewController *ownerVC = self.ownerViewController;
|
||||
if (ownerVC.navigationController != nil) {
|
||||
ownerVC = self.ownerViewController.navigationController;
|
||||
}
|
||||
BOOL isOwnerLoaded = ownerVC.isViewLoaded;
|
||||
if (!isOwnerLoaded) {
|
||||
return;
|
||||
@@ -234,10 +237,19 @@ static NSString *const kAlertControllerNibIdentifier = @"MWMAlertViewController"
|
||||
}
|
||||
completion:nil];
|
||||
|
||||
[self willMoveToParentViewController:NULL];
|
||||
[self.view removeFromSuperview];
|
||||
[self removeFromParentViewController];
|
||||
|
||||
alert.alertController = self;
|
||||
|
||||
[ownerVC addChildViewController:self];
|
||||
self.view.frame = CGRectMake(0, 0, ownerVC.view.frame.size.width, ownerVC.view.frame.size.height);
|
||||
[ownerVC.view addSubview:self.view];
|
||||
[self didMoveToParentViewController:ownerVC];
|
||||
|
||||
alert.alpha = 0.;
|
||||
[self.view addSubview:alert];
|
||||
CGFloat const scale = 1.1;
|
||||
alert.transform = CGAffineTransformMakeScale(scale, scale);
|
||||
[UIView animateWithDuration:kDefaultAnimationDuration
|
||||
|
||||
@@ -222,19 +222,6 @@
|
||||
view.frame = window.bounds;
|
||||
}
|
||||
|
||||
- (void)setAlertController:(MWMAlertViewController *)alertController {
|
||||
_alertController = alertController;
|
||||
UIView *view = alertController.view;
|
||||
UIViewController *ownerViewController = alertController.ownerViewController;
|
||||
view.frame = ownerViewController.view.bounds;
|
||||
[ownerViewController.view addSubview:view];
|
||||
[self addControllerViewToWindow];
|
||||
auto const orientation = UIApplication.sharedApplication.statusBarOrientation;
|
||||
[self rotate:orientation duration:0.0];
|
||||
[view addSubview:self];
|
||||
self.frame = view.bounds;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
self.frame = self.superview.bounds;
|
||||
|
||||
@@ -70,7 +70,7 @@ final class Toast: NSObject {
|
||||
|
||||
private func show(withAlignment alignment: Alignment, pinToSafeArea: Bool) {
|
||||
Self.hideAll()
|
||||
guard let view = UIApplication.shared.keyWindow else { return }
|
||||
guard let view = (UIApplication.shared.connectedScenes.filter { $0.activationState == .foregroundActive }.first(where: { $0 is UIWindowScene }) as? UIWindowScene)?.keyWindow else { return }
|
||||
view.addSubview(blurView)
|
||||
|
||||
let leadingConstraint = blurView.leadingAnchor.constraint(greaterThanOrEqualTo: view.leadingAnchor, constant: Constants.horizontalOffset)
|
||||
|
||||
@@ -48,7 +48,7 @@ double getExactDPI(double contentScaleFactor)
|
||||
float const iPhoneDPI = 163.f;
|
||||
float const mDPI = 160.f;
|
||||
|
||||
switch (UI_USER_INTERFACE_IDIOM())
|
||||
switch (UIDevice.currentDevice.userInterfaceIdiom)
|
||||
{
|
||||
case UIUserInterfaceIdiomPhone:
|
||||
return iPhoneDPI * contentScaleFactor;
|
||||
|
||||
@@ -834,19 +834,14 @@ NSString *const kSettingsSegue = @"Map2Settings";
|
||||
|
||||
- (NSArray *)keyCommands {
|
||||
NSArray *commands = @[
|
||||
[UIKeyCommand keyCommandWithInput:UIKeyInputDownArrow modifierFlags:0 action:@selector(zoomOut)], // Alternative, not shown when holding CMD
|
||||
[UIKeyCommand keyCommandWithInput:@"-" modifierFlags:UIKeyModifierCommand action:@selector(zoomOut) discoverabilityTitle:@"Zoom Out"],
|
||||
[UIKeyCommand keyCommandWithInput:UIKeyInputUpArrow modifierFlags:0 action:@selector(zoomIn)], // Alternative, not shown when holding CMD
|
||||
[UIKeyCommand keyCommandWithInput:@"=" modifierFlags:UIKeyModifierCommand action:@selector(zoomIn)], // Alternative, not shown when holding CMD
|
||||
[UIKeyCommand keyCommandWithInput:@"+" modifierFlags:UIKeyModifierCommand action:@selector(zoomIn) discoverabilityTitle:@"Zoom In"],
|
||||
[UIKeyCommand keyCommandWithInput:UIKeyInputEscape modifierFlags:0 action:@selector(goBack) discoverabilityTitle:@"Go Back"],
|
||||
[UIKeyCommand keyCommandWithInput:@"0" modifierFlags:UIKeyModifierCommand action:@selector(switchPositionMode) discoverabilityTitle:@"Switch position mode"]
|
||||
[UIKeyCommand commandWithTitle:@"Zoom Out" image:[UIImage systemImageNamed: @"minus.magnifyingglass"] action:@selector(zoomIn) input:@"-" modifierFlags:UIKeyModifierCommand propertyList:nil],
|
||||
[UIKeyCommand commandWithTitle:@"Zoom In" image:[UIImage systemImageNamed: @"plus.magnifyingglass"] action:@selector(zoomIn) input:@"+" modifierFlags:UIKeyModifierCommand propertyList:nil],
|
||||
[UIKeyCommand commandWithTitle:@"Go Back" image:nil action:@selector(goBack) input:UIKeyInputEscape modifierFlags:0 propertyList:nil],
|
||||
[UIKeyCommand commandWithTitle:@"Switch position mode" image:nil action:@selector(switchPositionMode) input:@"0" modifierFlags:UIKeyModifierCommand propertyList:nil]
|
||||
];
|
||||
|
||||
if (@available(iOS 15, *)) {
|
||||
for (UIKeyCommand *command in commands) {
|
||||
command.wantsPriorityOverSystemBehavior = YES;
|
||||
}
|
||||
for (UIKeyCommand *command in commands) {
|
||||
command.wantsPriorityOverSystemBehavior = YES;
|
||||
}
|
||||
|
||||
return commands;
|
||||
|
||||
@@ -259,9 +259,6 @@ using namespace osm_auth_ios;
|
||||
- (void)disableDownloadIndicator {
|
||||
--m_activeDownloadsCounter;
|
||||
if (m_activeDownloadsCounter <= 0) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
UIApplication.sharedApplication.networkActivityIndicatorVisible = NO;
|
||||
});
|
||||
m_activeDownloadsCounter = 0;
|
||||
if (UIApplication.sharedApplication.applicationState == UIApplicationStateBackground) {
|
||||
[UIApplication.sharedApplication endBackgroundTask:m_backgroundTask];
|
||||
@@ -272,9 +269,6 @@ using namespace osm_auth_ios;
|
||||
|
||||
- (void)enableDownloadIndicator {
|
||||
++m_activeDownloadsCounter;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
UIApplication.sharedApplication.networkActivityIndicatorVisible = YES;
|
||||
});
|
||||
}
|
||||
|
||||
+ (void)customizeAppearanceForNavigationBar:(UINavigationBar *)navigationBar {
|
||||
|
||||
@@ -161,6 +161,8 @@
|
||||
<string>app.comaps.3daction.route</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
<false/>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>audio</string>
|
||||
|
||||
@@ -27,11 +27,6 @@ func toString(_ cls: AnyClass) -> String {
|
||||
return String(describing: cls)
|
||||
}
|
||||
|
||||
func statusBarHeight() -> CGFloat {
|
||||
let statusBarSize = UIApplication.shared.statusBarFrame.size
|
||||
return min(statusBarSize.height, statusBarSize.width)
|
||||
}
|
||||
|
||||
func LOG(_ level: LogLevel,
|
||||
_ message: @autoclosure () -> Any,
|
||||
functionName: StaticString = #function,
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#define IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
|
||||
#define IPAD (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad)
|
||||
|
||||
#define L(str) NSLocalizedString(str, nil)
|
||||
|
||||
@@ -509,10 +509,10 @@ void setShowLocationAlert(BOOL needShow) {
|
||||
|
||||
// Delegate's method didChangeAuthorizationStatus is used to handle the authorization status when the application finishes launching
|
||||
// or user changes location access in the application settings.
|
||||
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
|
||||
- (void)locationManagerDidChangeAuthorization:(CLLocationManager *)manager
|
||||
{
|
||||
LOG(LWARNING, ("CLLocationManagerDelegate: Authorization status has changed to", DebugPrint(status)));
|
||||
switch (status) {
|
||||
LOG(LWARNING, ("CLLocationManagerDelegate: Authorization status has changed to", DebugPrint(manager.authorizationStatus)));
|
||||
switch (manager.authorizationStatus) {
|
||||
case kCLAuthorizationStatusAuthorizedWhenInUse:
|
||||
case kCLAuthorizationStatusAuthorizedAlways:
|
||||
[self startUpdatingLocationFor:manager];
|
||||
@@ -579,7 +579,7 @@ void setShowLocationAlert(BOOL needShow) {
|
||||
if ([CLLocationManager locationServicesEnabled])
|
||||
{
|
||||
CLLocationManager * locationManager = self.locationManager;
|
||||
switch (CLLocationManager.authorizationStatus)
|
||||
switch (locationManager.authorizationStatus)
|
||||
{
|
||||
case kCLAuthorizationStatusAuthorizedWhenInUse:
|
||||
case kCLAuthorizationStatusAuthorizedAlways:
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
for (auto const & categoryKey : categoriesKeys)
|
||||
{
|
||||
CSSearchableItemAttributeSet * attrSet = [[CSSearchableItemAttributeSet alloc]
|
||||
initWithItemContentType:static_cast<NSString *>(kUTTypeItem)];
|
||||
initWithItemContentType: UTTypeItem.identifier];
|
||||
|
||||
NSString * categoryName = nil;
|
||||
NSMutableDictionary<NSString *, NSString *> * localizedStrings = [@{} mutableCopy];
|
||||
|
||||
@@ -22,8 +22,12 @@
|
||||
}
|
||||
|
||||
func update () {
|
||||
for window in UIApplication.shared.windows {
|
||||
updateView(window.rootViewController?.view)
|
||||
for scene in UIApplication.shared.connectedScenes {
|
||||
if let windowsScene = scene as? UIWindowScene {
|
||||
for window in windowsScene.windows {
|
||||
updateView(window.rootViewController?.view)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let appDelegate = UIApplication.shared.delegate as! MapsAppDelegate
|
||||
|
||||
@@ -7,8 +7,8 @@ extension UIFont {
|
||||
let attributes: [UIFontDescriptor.AttributeName: Any] = [
|
||||
.featureSettings: [
|
||||
[
|
||||
UIFontDescriptor.FeatureKey.featureIdentifier: kNumberSpacingType,
|
||||
UIFontDescriptor.FeatureKey.typeIdentifier: kMonospacedNumbersSelector
|
||||
UIFontDescriptor.FeatureKey.type: kNumberSpacingType,
|
||||
UIFontDescriptor.FeatureKey.selector: kMonospacedNumbersSelector
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
Platform::Platform()
|
||||
{
|
||||
m_isTablet = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
|
||||
m_isTablet = (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad);
|
||||
|
||||
NSBundle * bundle = NSBundle.mainBundle;
|
||||
NSString * path = [bundle resourcePath];
|
||||
|
||||
@@ -9,7 +9,7 @@ HEADER_SEARCH_PATHS = $(inherited) $(OMIM_ROOT) $(BOOST_ROOT) $(OMIM_ROOT)/3part
|
||||
FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(QT_PATH)/lib
|
||||
|
||||
// Deployment target
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.6
|
||||
// The minimum version that properly supports Qt6's std::filesystem for C++17
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15
|
||||
|
||||
|
||||
Reference in New Issue
Block a user