[iOS] rename MWMLocationManager to LocationManager in swift

This commit is contained in:
Aleksey Belousov 2020-09-02 07:24:17 +03:00 committed by Maksim Andrianov
parent 5ecb9bb357
commit 1dab9556f4
9 changed files with 20 additions and 15 deletions

View file

@ -152,9 +152,9 @@ final class MopubBanner: NSObject, Banner {
let fbConfig = FacebookNativeAdRenderer.rendererConfiguration(with: settings)
request = MPNativeAdRequest(adUnitIdentifier: placementID, rendererConfigurations: [config, fbConfig])
let targeting = MPNativeAdRequestTargeting()
targeting?.keywords = "user_lang:\(AppInfo.shared().twoLetterLanguageId ?? "")"
targeting?.keywords = "user_lang:\(AppInfo.shared().twoLetterLanguageId)"
targeting?.desiredAssets = [kAdTitleKey, kAdTextKey, kAdIconImageKey, kAdCTATextKey]
if let location = MWMLocationManager.lastLocation() {
if let location = LocationManager.lastLocation() {
targeting?.location = location
}
request.targeting = targeting

View file

@ -1,4 +1,4 @@
extension MWMLocationManager {
extension LocationManager {
@objc static func speedSymbolFor(_ speed: Double) -> String {
switch max(speed, 0) {
case 0 ..< 1: return "🐢"

View file

@ -1,6 +1,9 @@
#import "MWMMyPositionMode.h"
#import "MWMLocationObserver.h"
NS_ASSUME_NONNULL_BEGIN
NS_SWIFT_NAME(LocationManager)
@interface MWMLocationManager : NSObject
+ (void)start;
@ -12,9 +15,9 @@
+ (void)setMyPositionMode:(MWMMyPositionMode)mode;
+ (CLLocation *)lastLocation;
+ (nullable CLLocation *)lastLocation;
+ (BOOL)isLocationProhibited;
+ (CLHeading *)lastHeading;
+ (nullable CLHeading *)lastHeading;
+ (void)applicationDidBecomeActive;
+ (void)applicationWillResignActive;
@ -29,3 +32,5 @@
+ (instancetype) new __attribute__((unavailable("call +manager instead")));
@end
NS_ASSUME_NONNULL_END

View file

@ -30,7 +30,7 @@ final class ThemeManager: NSObject {
return isDarkModeEnabled ? .vehicleNight : .vehicleDay
} else {
guard isVehicleRouting else { return .day }
switch FrameworkHelper.daytime(at: MWMLocationManager.lastLocation()) {
switch FrameworkHelper.daytime(at: LocationManager.lastLocation()) {
case .day: return .vehicleDay
case .night: return .vehicleNight
@unknown default:

View file

@ -61,7 +61,7 @@ extension BottomMenuInteractor: BottomMenuInteractorProtocol {
func shareLocation(cell: BottomMenuItemCell) {
Statistics.logEvent(kStatToolbarClick, withParameters: [kStatItem : kStatShareMyLocation])
let lastLocation = MWMLocationManager.lastLocation()
let lastLocation = LocationManager.lastLocation()
guard let coordinates = lastLocation?.coordinate else {
UIAlertView(title: L("unknown_current_position"),
message: nil,

View file

@ -61,7 +61,7 @@ class DownloadMapsViewController: MWMViewController {
case .downloaded:
dataSource = DownloadedMapsDataSource()
case .available:
dataSource = AvailableMapsDataSource(location: MWMLocationManager.lastLocation()?.coordinate)
dataSource = AvailableMapsDataSource(location: LocationManager.lastLocation()?.coordinate)
@unknown default:
fatalError()
}

View file

@ -231,16 +231,16 @@ class PlacePageCommonLayout: NSObject, IPlacePageLayout {
self?.onLoadUgc()
}
MWMLocationManager.add(observer: self)
if let lastLocation = MWMLocationManager.lastLocation() {
LocationManager.add(observer: self)
if let lastLocation = LocationManager.lastLocation() {
onLocationUpdate(lastLocation)
self.lastLocation = lastLocation
}
if let lastHeading = MWMLocationManager.lastHeading() {
if let lastHeading = LocationManager.lastHeading() {
onHeadingUpdate(lastHeading)
}
if !MWMLocationManager.isLocationProhibited() && FrameworkHelper.isNetworkConnected() {
if !LocationManager.isLocationProhibited() && FrameworkHelper.isNetworkConnected() {
taxiViewController.view.isHidden = false
}
@ -429,7 +429,7 @@ extension PlacePageCommonLayout: MWMLocationObserver {
if location.speed > 0 && location.timestamp.timeIntervalSinceNow >= -2 {
let speed = imperial ? location.speed * 2.237 : location.speed * 3.6
let speedMeasurement = Measurement(value: speed.rounded(), unit: imperial ? UnitSpeed.milesPerHour: UnitSpeed.kilometersPerHour)
let speedString = "\(MWMLocationManager.speedSymbolFor(location.speed))\(unitsFormatter.string(from: speedMeasurement))"
let speedString = "\(LocationManager.speedSymbolFor(location.speed))\(unitsFormatter.string(from: speedMeasurement))"
previewViewController.updateSpeedAndAltitude("\(altString) \(speedString)")
} else {
previewViewController.updateSpeedAndAltitude(altString)

View file

@ -39,7 +39,7 @@ extension FirstLaunchPresenter: IFirstLaunchPresenter {
func onAppear() {
switch config.requestPermission {
case .location:
MWMLocationManager.start()
LocationManager.start()
case .notifications:
MWMPushNotifications.setup()
case .nothing:

View file

@ -93,7 +93,7 @@ final class WelcomePageController: UIPageViewController {
view.removeFromSuperview()
removeFromParent()
parentController.closePageController(self)
FrameworkHelper.processFirstLaunch(MWMLocationManager.lastLocation() != nil)
FrameworkHelper.processFirstLaunch(LocationManager.lastLocation() != nil)
}
@objc func show() {