[ios] Switched OSM profile to SwiftUI and redesigned it

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2025-07-04 21:20:43 +02:00
committed by Yannik Bloscheck
parent db1ef9b148
commit 15c7e71866
127 changed files with 1753 additions and 2503 deletions

View File

@@ -34,10 +34,11 @@
[navigationController setNavigationBarHidden:YES animated:animated];
return;
}
NSAssert([viewController conformsToProtocol:@protocol(MWMController)], @"Controller must inherit ViewController or TableViewController class");
id<MWMController> vc = (id<MWMController>)viewController;
[navigationController setNavigationBarHidden:!vc.hasNavigationBar animated:animated];
if ([viewController conformsToProtocol:@protocol(MWMController)]) {
id<MWMController> vc = (id<MWMController>)viewController;
[navigationController setNavigationBarHidden:!vc.hasNavigationBar animated:animated];
}
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated

View File

@@ -31,8 +31,6 @@
- (void)presentResetChangesAlertWithBlock:(nonnull MWMVoidBlock)block;
- (void)presentDeleteFeatureAlertWithBlock:(nonnull MWMVoidBlock)block;
- (void)presentEditorViralAlert;
- (void)presentOsmAuthAlert;
- (void)presentOsmReauthAlert;
- (void)presentPersonalInfoWarningAlertWithBlock:(nonnull MWMVoidBlock)block;
- (void)presentTrackWarningAlertWithCancelBlock:(nonnull MWMVoidBlock)block;
- (void)presentMobileInternetAlertWithBlock:(nonnull MWMMobileInternetAlertCompletionBlock)block;

View File

@@ -158,13 +158,6 @@ static NSString *const kAlertControllerNibIdentifier = @"MWMAlertViewController"
- (void)presentEditorViralAlert {
[self displayAlert:[MWMAlert editorViralAlert]];
}
- (void)presentOsmAuthAlert {
[self displayAlert:[MWMAlert osmAuthAlert]];
}
- (void)presentOsmReauthAlert {
[self displayAlert:[MWMAlert osmReauthAlert]];
}
- (void)presentCreateBookmarkCategoryAlertWithMaxCharacterNum:(NSUInteger)max
minCharacterNum:(NSUInteger)min
@@ -211,7 +204,7 @@ static NSString *const kAlertControllerNibIdentifier = @"MWMAlertViewController"
- (void)displayAlert:(MWMAlert *)alert {
UIViewController *ownerVC = self.ownerViewController;
if (ownerVC.navigationController != nil) {
ownerVC = self.ownerViewController.navigationController;
ownerVC = ownerVC.navigationController;
}
BOOL isOwnerLoaded = ownerVC.isViewLoaded;
if (!isOwnerLoaded) {

View File

@@ -23,8 +23,6 @@
+ (MWMAlert *)resetChangesAlertWithBlock:(MWMVoidBlock)block;
+ (MWMAlert *)deleteFeatureAlertWithBlock:(MWMVoidBlock)block;
+ (MWMAlert *)editorViralAlert;
+ (MWMAlert *)osmAuthAlert;
+ (MWMAlert *)osmReauthAlert;
+ (MWMAlert *)personalInfoWarningAlertWithBlock:(MWMVoidBlock)block;
+ (MWMAlert *)trackWarningAlertWithCancelBlock:(MWMVoidBlock)block;
+ (MWMAlert *)infoAlert:(NSString *)title text:(NSString *)text;

View File

@@ -4,8 +4,6 @@
#import "MWMDownloadTransitMapAlert.h"
#import "MWMEditorViralAlert.h"
#import "MWMLocationAlert.h"
#import "MWMOsmAuthAlert.h"
#import "MWMOsmReauthAlert.h"
#import "MWMPlaceDoesntExistAlert.h"
#import "MWMRoutingDisclaimerAlert.h"
@@ -135,12 +133,6 @@
+ (MWMAlert *)editorViralAlert {
return [MWMEditorViralAlert alert];
}
+ (MWMAlert *)osmAuthAlert {
return [MWMOsmAuthAlert alert];
}
+ (MWMAlert *)osmReauthAlert {
return [MWMOsmReauthAlert alert];
}
+ (MWMAlert *)personalInfoWarningAlertWithBlock:(MWMVoidBlock)block {
return [MWMDefaultAlert personalInfoWarningAlertWithBlock:block];
}

View File

@@ -1,7 +1,6 @@
#import "MWMEditorViralAlert.h"
#import "MWMActivityViewController.h"
#import "MWMAlertViewController.h"
#import "MWMAuthorizationCommon.h"
#import "SwiftBridge.h"
@interface MWMEditorViralAlert ()

View File

@@ -1,7 +0,0 @@
#import "MWMAlert.h"
@interface MWMOsmAuthAlert : MWMAlert
+ (instancetype)alert;
@end

View File

@@ -1,56 +0,0 @@
#import "MWMAlertViewController.h"
#import "MWMOsmAuthAlert.h"
#include <string>
#include "editor/osm_auth.hpp"
static NSString * const kMap2OsmLoginSegue = @"Map2OsmLogin";
extern NSString * const kMap2FBLoginSegue;
extern NSString * const kMap2GoogleLoginSegue;
@implementation MWMOsmAuthAlert
+ (instancetype)alert
{
MWMOsmAuthAlert * alert =
[NSBundle.mainBundle loadNibNamed:[self className] owner:nil options:nil].firstObject;
return alert;
}
- (IBAction)facebookTap
{
[self close:^{
[self.alertController.ownerViewController performSegueWithIdentifier:kMap2FBLoginSegue
sender:nil];
}];
}
- (IBAction)googleTap
{
[self close:^{
[self.alertController.ownerViewController performSegueWithIdentifier:kMap2GoogleLoginSegue
sender:nil];
}];
}
- (IBAction)osmTap
{
[self close:^{
[self.alertController.ownerViewController openUrl:@(osm::OsmOAuth::ServerAuth().BuildOAuth2Url().c_str()) externally:NO skipEncoding:YES];
}];
}
- (IBAction)signUpTap
{
[self close:^{
[self.alertController.ownerViewController openUrl:@(osm::OsmOAuth::ServerAuth().GetRegistrationURL().c_str()) externally:YES];
}];
}
- (IBAction)closeTap
{
[self close:nil];
}
@end

View File

@@ -1,172 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="J1a-qv-gDF" customClass="MWMOsmAuthAlert" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TM8-yS-nAN" userLabel="ContainerView">
<rect key="frame" x="56.666666666666657" y="229.66666666666663" width="280" height="393"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zn5-ic-jDO" userLabel="Done" customClass="MWMButton">
<rect key="frame" x="240" y="0.0" width="40" height="40"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="G1f-X1-bIC"/>
<constraint firstAttribute="width" constant="40" id="H82-kb-Oje"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" image="ic_cancel">
<color key="titleColor" red="0.01176470588" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlack"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="closeTap" destination="J1a-qv-gDF" eventType="touchUpInside" id="vUi-Os-Czy"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iX9-ov-Ks7" userLabel="Title">
<rect key="frame" x="20" y="140.00000000000003" width="240" height="61"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="6y2-gu-OZJ"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="30" id="uAq-DT-bJU"/>
</constraints>
<string key="text">Войдите, чтобы ваши изменения увидели
другие пользователи</string>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium17:blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="login_to_make_edits_visible"/>
</userDefinedRuntimeAttributes>
</label>
<button hidden="YES" opaque="NO" userInteractionEnabled="NO" alpha="0.0" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1Oa-Ks-27P" userLabel="Google">
<rect key="frame" x="20" y="221.00000000000003" width="115" height="43.999999999999972"/>
<constraints>
<constraint firstAttribute="width" constant="115" id="Wxi-Ef-iFz"/>
<constraint firstAttribute="height" constant="44" id="jZt-Vg-20q"/>
</constraints>
<state key="normal" image="google_btn"/>
<state key="highlighted" image="google_btn_highlighted"/>
<connections>
<action selector="googleTap" destination="J1a-qv-gDF" eventType="touchUpInside" id="W4r-Gx-ylI"/>
</connections>
</button>
<button hidden="YES" opaque="NO" userInteractionEnabled="NO" alpha="0.0" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="o9z-GX-feY" userLabel="Facebook">
<rect key="frame" x="145" y="221.00000000000003" width="115" height="43.999999999999972"/>
<constraints>
<constraint firstAttribute="width" constant="115" id="OxE-Ml-Dmd"/>
<constraint firstAttribute="height" constant="44" id="fmf-GO-Qsi"/>
</constraints>
<state key="normal" image="facebook_btn"/>
<state key="highlighted" image="facebook_btn_highlighted"/>
<connections>
<action selector="facebookTap" destination="J1a-qv-gDF" eventType="touchUpInside" id="l5P-Sg-dHo"/>
</connections>
</button>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Gt7-p9-qTx" userLabel="OSM" customClass="MWMButton">
<rect key="frame" x="20" y="275" width="240" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="FrF-vf-pus"/>
<constraint firstAttribute="height" constant="44" id="U6r-o8-OzE"/>
</constraints>
<state key="normal" title="OpenStreetMap"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="FlatNormalButtonBig"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="osmTap" destination="J1a-qv-gDF" eventType="touchUpInside" id="6yw-kg-9NC"/>
</connections>
</button>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="y0p-Db-vW6" userLabel="Я">
<rect key="frame" x="20" y="329" width="240" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="I2g-A3-lui"/>
<constraint firstAttribute="width" constant="240" id="UMB-F0-ZFe"/>
</constraints>
<state key="normal" title="Sign Up Now"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="FlatNormalTransButtonBig"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="register_at_openstreetmap"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="signUpTap" destination="J1a-qv-gDF" eventType="touchUpInside" id="hOM-N1-C34"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="img_login" translatesAutoresizingMaskIntoConstraints="NO" id="RxI-RO-UVT">
<rect key="frame" x="80" y="20" width="120" height="120"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="2hS-zF-nc0"/>
<constraint firstAttribute="width" secondItem="RxI-RO-UVT" secondAttribute="height" multiplier="1:1" id="FhS-SS-k9B"/>
</constraints>
</imageView>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="o9z-GX-feY" secondAttribute="trailing" constant="20" id="1gG-1g-DTw"/>
<constraint firstItem="RxI-RO-UVT" firstAttribute="centerX" secondItem="TM8-yS-nAN" secondAttribute="centerX" id="60Z-9U-HTk"/>
<constraint firstItem="Gt7-p9-qTx" firstAttribute="top" secondItem="1Oa-Ks-27P" secondAttribute="bottom" constant="10" id="7Q2-cf-yXi"/>
<constraint firstItem="Gt7-p9-qTx" firstAttribute="centerX" secondItem="TM8-yS-nAN" secondAttribute="centerX" id="80J-3h-oMs"/>
<constraint firstItem="y0p-Db-vW6" firstAttribute="centerX" secondItem="TM8-yS-nAN" secondAttribute="centerX" id="8nN-We-KX6"/>
<constraint firstItem="RxI-RO-UVT" firstAttribute="top" secondItem="TM8-yS-nAN" secondAttribute="top" constant="20" id="9pC-3a-sLm"/>
<constraint firstItem="iX9-ov-Ks7" firstAttribute="top" secondItem="RxI-RO-UVT" secondAttribute="bottom" id="DqY-Hq-3rT"/>
<constraint firstItem="y0p-Db-vW6" firstAttribute="top" secondItem="Gt7-p9-qTx" secondAttribute="bottom" constant="10" id="FXY-gL-ECF"/>
<constraint firstItem="1Oa-Ks-27P" firstAttribute="leading" secondItem="TM8-yS-nAN" secondAttribute="leading" constant="20" id="GWt-23-wjh"/>
<constraint firstItem="zn5-ic-jDO" firstAttribute="top" secondItem="TM8-yS-nAN" secondAttribute="top" id="QZf-zp-tkp"/>
<constraint firstItem="iX9-ov-Ks7" firstAttribute="top" secondItem="TM8-yS-nAN" secondAttribute="top" constant="20" id="VUe-EZ-7u0">
<variation key="heightClass=compact" constant="32"/>
</constraint>
<constraint firstAttribute="trailing" secondItem="zn5-ic-jDO" secondAttribute="trailing" id="aRL-nT-g07"/>
<constraint firstAttribute="width" constant="280" id="b3y-ro-3LQ"/>
<constraint firstItem="iX9-ov-Ks7" firstAttribute="centerX" secondItem="TM8-yS-nAN" secondAttribute="centerX" id="fJQ-Dc-Lx5"/>
<constraint firstItem="o9z-GX-feY" firstAttribute="top" secondItem="iX9-ov-Ks7" secondAttribute="bottom" constant="20" id="qRG-5y-Aup"/>
<constraint firstAttribute="bottom" secondItem="y0p-Db-vW6" secondAttribute="bottom" constant="20" id="rjz-5m-l3e"/>
<constraint firstItem="1Oa-Ks-27P" firstAttribute="top" secondItem="iX9-ov-Ks7" secondAttribute="bottom" constant="20" id="ucL-aV-J1p"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
<variation key="default">
<mask key="constraints">
<exclude reference="VUe-EZ-7u0"/>
</mask>
</variation>
<variation key="heightClass=compact">
<mask key="subviews">
<exclude reference="RxI-RO-UVT"/>
</mask>
<mask key="constraints">
<include reference="VUe-EZ-7u0"/>
</mask>
</variation>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="Z2W-ia-IOB"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="TM8-yS-nAN" firstAttribute="centerX" secondItem="J1a-qv-gDF" secondAttribute="centerX" id="rY8-Ie-aSn"/>
<constraint firstItem="TM8-yS-nAN" firstAttribute="centerY" secondItem="J1a-qv-gDF" secondAttribute="centerY" id="t5z-q7-9wM"/>
</constraints>
<point key="canvasLocation" x="305" y="172"/>
</view>
</objects>
<resources>
<image name="facebook_btn" width="115" height="44"/>
<image name="facebook_btn_highlighted" width="115" height="44"/>
<image name="google_btn" width="115" height="44"/>
<image name="google_btn_highlighted" width="115" height="44"/>
<image name="ic_cancel" width="40" height="40"/>
<image name="img_login" width="120" height="120"/>
</resources>
</document>

View File

@@ -1,9 +0,0 @@
#import "MWMAlert.h"
@interface MWMOsmReauthAlert : MWMAlert <UITextViewDelegate>
+ (instancetype)alert;
@property (nonatomic) IBOutlet UITextView *messageLabel;
@end

View File

@@ -1,63 +0,0 @@
#import "MWMAlertViewController.h"
#import "MWMOsmReauthAlert.h"
#import "MWMAuthorizationCommon.h"
#include "editor/osm_auth.hpp"
static NSString * const kMap2OsmLoginSegue = @"Map2OsmLogin";
@implementation MWMOsmReauthAlert
+ (instancetype)alert
{
MWMOsmReauthAlert * alert = [NSBundle.mainBundle loadNibNamed:[self className] owner:nil options:nil].firstObject;
alert.messageLabel.attributedText = [self buildAlertMessage];
alert.messageLabel.textAlignment = NSTextAlignmentCenter;
alert.messageLabel.delegate = alert;
return alert;
}
// Build attributed string in format "{alert_reauth_message_ios} {alert_reauth_link_text_ios}"
// where {alert_reauth_link_text_ios} has blue color as a link
+ (NSMutableAttributedString*)buildAlertMessage
{
auto textAttrs = @{NSFontAttributeName : UIFont.regular17};
auto linkAttrs = @{NSForegroundColorAttributeName : UIColor.linkBlue,
NSFontAttributeName : UIFont.regular17,
NSLinkAttributeName : @"https://github.com/organicmaps/organicmaps/issues/6144"};
NSMutableAttributedString *alertMessage =
[[NSMutableAttributedString alloc] initWithString: L(@"alert_reauth_message_ios")
attributes: textAttrs];
// Add space char
[alertMessage appendAttributedString:([[NSMutableAttributedString alloc] initWithString: @" "
attributes: textAttrs])];
NSAttributedString *alertLinkText =
[[NSAttributedString alloc] initWithString: L(@"alert_reauth_link_text_ios")
attributes: linkAttrs];
[alertMessage appendAttributedString:alertLinkText];
return alertMessage;
}
- (IBAction)closeTap
{
[self close:nil];
}
- (IBAction)osmTap
{
[self close:^{
[self.alertController.ownerViewController openUrl:@(osm::OsmOAuth::ServerAuth().BuildOAuth2Url().c_str()) externally:NO skipEncoding:YES];
}];
}
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange interaction:(UITextItemInteraction)interaction
{
[[UIApplication sharedApplication] openURL:URL options:@{} completionHandler:nil];
return NO;
}
@end

View File

@@ -1,132 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="OOr-tJ-QfW" customClass="MWMOsmReauthAlert" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pGb-Pj-lsX" userLabel="ContainerView">
<rect key="frame" x="56.666666666666657" y="238.33333333333334" width="280" height="375.33333333333326"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bKJ-wq-v28" userLabel="Done" customClass="MWMButton">
<rect key="frame" x="240" y="0.0" width="40" height="40"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="W81-6E-cNz"/>
<constraint firstAttribute="height" constant="40" id="yqF-ZS-dOn"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" image="ic_cancel">
<color key="titleColor" red="0.01176470588" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlack"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="closeTap" destination="OOr-tJ-QfW" eventType="touchUpInside" id="vUN-3c-vWF"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="img_login" translatesAutoresizingMaskIntoConstraints="NO" id="BXR-WK-BfJ">
<rect key="frame" x="80" y="19.999999999999972" width="120" height="120"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="n5Z-5L-UPW"/>
<constraint firstAttribute="width" secondItem="BXR-WK-BfJ" secondAttribute="height" multiplier="1:1" id="oyf-fo-zbh"/>
</constraints>
</imageView>
<textView clipsSubviews="YES" contentMode="center" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" text="Please login to OpenStreetMap to automatically upload all your map edits. Learn more here" textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="shy-1g-PJO" userLabel="message">
<rect key="frame" x="20" y="149.99999999999997" width="240" height="97.333333333333343"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="30" id="3EU-DW-uAs"/>
<constraint firstAttribute="width" constant="240" id="gUg-UX-yGB"/>
</constraints>
<color key="textColor" systemColor="labelColor"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<dataDetectorType key="dataDetectorTypes" link="YES"/>
</textView>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="33p-SN-9fc" userLabel="login_osm" customClass="MWMButton" customModule="CoMaps" customModuleProvider="target">
<rect key="frame" x="20" y="257.33333333333337" width="240" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="6Mj-n7-paj"/>
<constraint firstAttribute="height" constant="44" id="vzZ-AA-l0W"/>
</constraints>
<state key="normal" title="Login OpenStreetMap"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="FlatNormalButtonBig"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="login_osm"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="osmTap" destination="OOr-tJ-QfW" eventType="touchUpInside" id="eEw-ZQ-bth"/>
</connections>
</button>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OS7-Xd-HGC" userLabel="cancel" customClass="MWMButton" customModule="CoMaps" customModuleProvider="target">
<rect key="frame" x="20" y="311.33333333333326" width="240" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="240" id="Bzd-Uh-BSU"/>
<constraint firstAttribute="height" constant="44" id="uTD-56-ZBz"/>
</constraints>
<state key="normal" title="Cancel"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="FlatNormalTransButtonBig"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="cancel"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="closeTap" destination="OOr-tJ-QfW" eventType="touchUpInside" id="Jmk-bD-kAS"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="OS7-Xd-HGC" firstAttribute="centerX" secondItem="pGb-Pj-lsX" secondAttribute="centerX" id="6ms-nM-I0P"/>
<constraint firstItem="33p-SN-9fc" firstAttribute="top" secondItem="shy-1g-PJO" secondAttribute="bottom" constant="10" id="936-U9-5lw"/>
<constraint firstItem="OS7-Xd-HGC" firstAttribute="top" secondItem="33p-SN-9fc" secondAttribute="bottom" constant="10" id="Bui-bG-czy"/>
<constraint firstItem="BXR-WK-BfJ" firstAttribute="centerX" secondItem="pGb-Pj-lsX" secondAttribute="centerX" id="NV9-Kj-IPD"/>
<constraint firstAttribute="bottom" secondItem="OS7-Xd-HGC" secondAttribute="bottom" constant="20" id="Oum-gS-fQc"/>
<constraint firstItem="bKJ-wq-v28" firstAttribute="top" secondItem="pGb-Pj-lsX" secondAttribute="top" id="Rjm-H1-YUW"/>
<constraint firstItem="BXR-WK-BfJ" firstAttribute="top" secondItem="pGb-Pj-lsX" secondAttribute="top" constant="20" id="SMy-Y2-C3I"/>
<constraint firstItem="shy-1g-PJO" firstAttribute="centerX" secondItem="pGb-Pj-lsX" secondAttribute="centerX" id="bs3-xk-8fF"/>
<constraint firstAttribute="width" constant="280" id="coi-hW-q18"/>
<constraint firstItem="shy-1g-PJO" firstAttribute="top" secondItem="BXR-WK-BfJ" secondAttribute="bottom" constant="10" id="f0G-uE-wLN"/>
<constraint firstAttribute="trailing" secondItem="bKJ-wq-v28" secondAttribute="trailing" id="gTa-Ov-TWc"/>
<constraint firstItem="33p-SN-9fc" firstAttribute="centerX" secondItem="pGb-Pj-lsX" secondAttribute="centerX" id="khE-QQ-4bJ"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="AlertView"/>
</userDefinedRuntimeAttributes>
<variation key="heightClass=compact">
<mask key="subviews">
<exclude reference="BXR-WK-BfJ"/>
</mask>
</variation>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="Wzy-Dc-f4s"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="pGb-Pj-lsX" firstAttribute="centerX" secondItem="OOr-tJ-QfW" secondAttribute="centerX" id="NJE-Ru-ipu"/>
<constraint firstItem="pGb-Pj-lsX" firstAttribute="centerY" secondItem="OOr-tJ-QfW" secondAttribute="centerY" id="pMZ-fj-kFC"/>
</constraints>
<connections>
<outlet property="messageLabel" destination="shy-1g-PJO" id="A3b-gL-OVy"/>
</connections>
<point key="canvasLocation" x="305" y="172"/>
</view>
</objects>
<resources>
<image name="ic_cancel" width="40" height="40"/>
<image name="img_login" width="120" height="120"/>
<systemColor name="labelColor">
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -1,30 +0,0 @@
#include <string>
#include "editor/osm_auth.hpp"
namespace osm_auth_ios
{
enum class AuthorizationButtonType
{
AuthorizationButtonTypeGoogle,
AuthorizationButtonTypeFacebook,
AuthorizationButtonTypeOSM
};
// Deletes any stored credentials if called with empty key or secret.
void AuthorizationStoreCredentials(std::string const & oauthToken);
BOOL AuthorizationHaveOAuth1Credentials();
void AuthorizationClearOAuth1Credentials();
BOOL AuthorizationHaveCredentials();
void AuthorizationClearCredentials();
// Returns empty key and secret if user has not beed authorized.
std::string const AuthorizationGetCredentials();
void AuthorizationSetNeedCheck(BOOL needCheck);
BOOL AuthorizationIsNeedCheck();
/// Returns nil if not logged in.
NSString * OSMUserName();
/// Returns 0 if not logged in.
NSInteger OSMUserChangesetsCount();
} // namespace osm_auth_ios

View File

@@ -1,124 +0,0 @@
#import "MWMAuthorizationCommon.h"
#import "MWMNetworkPolicy+UI.h"
#import "UIButton+RuntimeAttributes.h"
#include "base/logging.hpp"
#include "editor/server_api.hpp"
namespace osm_auth_ios
{
NSString * const kOSMRequestToken = @"OSMRequestToken"; // Unused after migration from OAuth1 to OAuth2
NSString * const kOSMRequestSecret = @"OSMRequestSecret"; // Unused after migration from OAuth1 to OAuth2
NSString * const kAuthNeedCheck = @"AuthNeedCheck";
NSString * const kOSMAuthToken = @"OSMAuthToken";
NSString * const kOSMUserName = @"UDOsmUserName";
NSString * const kOSMChangesetsCount = @"OSMUserChangesetsCount";
BOOL LoadOsmUserPreferences(osm::UserPreferences & prefs)
{
__block BOOL success = false;
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^
{
try
{
osm::ServerApi06 const api {osm::OsmOAuth::ServerAuth(AuthorizationGetCredentials())};
prefs = api.GetUserPreferences();
success = true;
}
catch (std::exception const & ex)
{
LOG(LWARNING, ("Can't load user preferences from OSM server:", ex.what()));
}
});
return success;
}
void AuthorizationStoreCredentials(std::string const & oauthToken)
{
NSUserDefaults * ud = NSUserDefaults.standardUserDefaults;
[ud setObject:@(oauthToken.c_str()) forKey:kOSMAuthToken];
osm::UserPreferences prefs;
if (LoadOsmUserPreferences(prefs)) {
[ud setObject:@(prefs.m_displayName.c_str()) forKey:kOSMUserName];
// To also see # of edits when offline.
[ud setInteger:prefs.m_changesets forKey:kOSMChangesetsCount];
}
}
BOOL AuthorizationHaveOAuth1Credentials()
{
NSUserDefaults * ud = NSUserDefaults.standardUserDefaults;
NSString * requestToken = [ud stringForKey:kOSMRequestToken];
NSString * requestSecret = [ud stringForKey:kOSMRequestSecret];
return requestToken.length && requestSecret.length;
}
void AuthorizationClearOAuth1Credentials()
{
NSUserDefaults * ud = NSUserDefaults.standardUserDefaults;
[ud removeObjectForKey:kOSMRequestToken];
[ud removeObjectForKey:kOSMRequestSecret];
}
BOOL AuthorizationHaveCredentials()
{
NSUserDefaults * ud = NSUserDefaults.standardUserDefaults;
NSString * oauthToken = [ud stringForKey:kOSMAuthToken];
return oauthToken.length;
}
void AuthorizationClearCredentials()
{
NSUserDefaults * ud = NSUserDefaults.standardUserDefaults;
[ud removeObjectForKey:kOSMAuthToken];
[ud removeObjectForKey:kOSMRequestToken];
[ud removeObjectForKey:kOSMRequestSecret];
[ud removeObjectForKey:kOSMUserName];
[ud removeObjectForKey:kOSMChangesetsCount];
}
std::string const AuthorizationGetCredentials()
{
NSUserDefaults * ud = NSUserDefaults.standardUserDefaults;
NSString * oauthToken = [ud stringForKey:kOSMAuthToken];
if (oauthToken)
return std::string(oauthToken.UTF8String);
return {};
}
void AuthorizationSetNeedCheck(BOOL needCheck)
{
NSUserDefaults * ud = NSUserDefaults.standardUserDefaults;
[ud setBool:needCheck forKey:kAuthNeedCheck];
}
BOOL AuthorizationIsNeedCheck()
{
return [NSUserDefaults.standardUserDefaults boolForKey:kAuthNeedCheck];
}
NSString * OSMUserName()
{
return [NSUserDefaults.standardUserDefaults stringForKey:kOSMUserName];
}
NSInteger OSMUserChangesetsCount()
{
__block NSInteger count = -1;
[[MWMNetworkPolicy sharedPolicy] callOnlineApi:^(BOOL permitted) {
if (permitted)
if (osm::UserPreferences prefs; YES == LoadOsmUserPreferences(prefs))
count = prefs.m_changesets;
}];
NSUserDefaults * ud = NSUserDefaults.standardUserDefaults;
if (count >= 0)
{
[ud setInteger:count forKey:kOSMChangesetsCount];
return count;
}
return [ud integerForKey:kOSMChangesetsCount];
}
} // namespace osm_auth_ios

View File

@@ -1,5 +0,0 @@
#import "MWMViewController.h"
@interface MWMAuthorizationLoginViewController : MWMViewController
@end

View File

@@ -1,149 +0,0 @@
#import "MWMAlertViewController.h"
#import "MWMAuthorizationCommon.h"
#import "MWMAuthorizationLoginViewController.h"
#include <CoreApi/Framework.h>
namespace
{
NSString * const kWebViewAuthSegue = @"Authorization2WebViewAuthorizationSegue";
NSString * const kOSMAuthSegue = @"Authorization2OSMAuthorizationSegue";
NSString * const kCancel = L(@"cancel");
NSString * const kLogout = L(@"logout");
NSString * const kRefresh = L(@"refresh");
} // namespace
using namespace osm;
using namespace osm_auth_ios;
@interface MWMAuthorizationLoginViewController ()
@property (weak, nonatomic) IBOutlet UIView * authView;
@property (weak, nonatomic) IBOutlet UIView * accountView;
@property (weak, nonatomic) IBOutlet UIButton * loginOSMButton;
@property (weak, nonatomic) IBOutlet UIButton * signupButton;
@property (weak, nonatomic) IBOutlet UILabel * changesCountLabel;
@property (weak, nonatomic) IBOutlet UILabel * lastUpdateLabel;
@end
@implementation MWMAuthorizationLoginViewController
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self checkConnection];
if (AuthorizationHaveCredentials())
[self configHaveAuth];
else
[self configNoAuth];
AuthorizationSetNeedCheck(NO);
}
- (void)checkConnection
{
self.signupButton.enabled = Platform::IsConnected();
}
- (void)configHaveAuth
{
NSString * osmUserName = OSMUserName();
self.title = osmUserName.length > 0 ? osmUserName : L(@"osm_account");
self.authView.hidden = YES;
self.accountView.hidden = NO;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"•••" style:UIBarButtonItemStylePlain target:self action:@selector(showActionSheet)];
[self refresh:NO];
}
- (void)configNoAuth
{
self.title = L(@"profile");
self.authView.hidden = NO;
self.accountView.hidden = YES;
}
#pragma mark - Actions
- (void)performOnlineAction:(MWMVoidBlock)block
{
if (Platform::IsConnected())
block();
else
[self.alertController presentNoConnectionAlert];
}
- (IBAction)loginOSM
{
[self performOnlineAction:^
{
[self openUrl:@(OsmOAuth::ServerAuth().BuildOAuth2Url().c_str()) externally:NO skipEncoding:YES];
}];
}
- (IBAction)signup
{
[self performOnlineAction:^
{
[self openUrl:@(OsmOAuth::ServerAuth().GetRegistrationURL().c_str()) externally:YES];
}];
}
- (IBAction)osmTap
{
[self openUrl:L(@"osm_wiki_about_url")];
}
- (IBAction)historyTap
{
[self openUrl:@(OsmOAuth::ServerAuth().GetHistoryURL([OSMUserName() UTF8String]).c_str())];
}
- (void)logout
{
AuthorizationClearCredentials();
[self.navigationController popViewControllerAnimated:YES];
}
- (void)refresh:(BOOL)force
{
self.changesCountLabel.text = @(OSMUserChangesetsCount()).stringValue;
}
#pragma mark - ActionSheet
- (void)showActionSheet
{
UIAlertController * alertController =
[UIAlertController alertControllerWithTitle:nil
message:nil
preferredStyle:UIAlertControllerStyleActionSheet];
alertController.popoverPresentationController.barButtonItem =
self.navigationItem.rightBarButtonItem;
[alertController addAction:[UIAlertAction actionWithTitle:kRefresh
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self refresh:YES];
}]];
[alertController addAction:[UIAlertAction actionWithTitle:kLogout
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction * action) {
[self logout];
}]];
[alertController
addAction:[UIAlertAction actionWithTitle:kCancel style:UIAlertActionStyleCancel handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
}
@end

View File

@@ -1,5 +0,0 @@
#import "MWMViewController.h"
@interface MWMAuthorizationOSMLoginViewController : MWMViewController
@end

View File

@@ -1,147 +0,0 @@
#import "MWMAuthorizationOSMLoginViewController.h"
#import "MWMAlertViewController.h"
#import "MWMAuthorizationCommon.h"
#import "MWMCircularProgress.h"
#import "MWMSettingsViewController.h"
#import "UITextField+RuntimeAttributes.h"
#include "base/logging.hpp"
#include "editor/server_api.hpp"
#include "platform/platform.hpp"
#include "private.h"
using namespace osm;
@interface MWMAuthorizationOSMLoginViewController ()<UITextFieldDelegate>
@property(weak, nonatomic) IBOutlet UITextField * loginTextField;
@property(weak, nonatomic) IBOutlet UITextField * passwordTextField;
@property(weak, nonatomic) IBOutlet UIButton * loginButton;
@property(weak, nonatomic) IBOutlet UIButton * forgotButton;
@property(weak, nonatomic) IBOutlet UIView * spinnerView;
@property(nonatomic) MWMCircularProgress * spinner;
@end
@implementation MWMAuthorizationOSMLoginViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = L(@"osm_account");
[self checkConnection];
[self stopSpinner];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if (!self.loginTextField.text.length && !self.passwordTextField.text.length)
[self.loginTextField becomeFirstResponder];
}
- (BOOL)shouldAutorotate { return NO; }
- (void)checkConnection { self.forgotButton.enabled = Platform::IsConnected(); }
#pragma mark - UITextFieldDelegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if ([textField isEqual:self.loginTextField])
{
[self.passwordTextField becomeFirstResponder];
}
else if ([textField isEqual:self.passwordTextField])
{
[textField resignFirstResponder];
[self login];
}
return YES;
}
- (void)startSpinner
{
self.spinnerView.hidden = NO;
self.spinner = [[MWMCircularProgress alloc] initWithParentView:self.spinnerView];
[self.spinner setInvertColor:YES];
self.spinner.state = MWMCircularProgressStateSpinner;
self.loginTextField.enabled = NO;
self.passwordTextField.enabled = NO;
self.forgotButton.enabled = NO;
[self.loginButton setTitle:@"" forState:UIControlStateNormal];
}
- (void)stopSpinner
{
self.spinnerView.hidden = YES;
self.spinner = nil;
self.loginTextField.enabled = YES;
self.passwordTextField.enabled = YES;
self.forgotButton.enabled = YES;
[self.loginButton setTitle:L(@"login") forState:UIControlStateNormal];
}
#pragma mark - Actions
- (IBAction)login
{
if (!self.loginButton.enabled || self.spinner)
return;
if (Platform::IsConnected())
{
NSString * username = self.loginTextField.text;
NSString * password = self.passwordTextField.text;
[self startSpinner];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
OsmOAuth auth = OsmOAuth::ServerAuth();
try
{
auth.AuthorizePassword(username.UTF8String, password.UTF8String);
}
catch (std::exception const & ex)
{
LOG(LWARNING, ("Error login", ex.what()));
}
dispatch_async(dispatch_get_main_queue(), ^{
[self stopSpinner];
if (auth.IsAuthorized())
{
osm_auth_ios::AuthorizationStoreCredentials(auth.GetAuthToken());
UIViewController * svc = nil;
for (UIViewController * vc in self.navigationController.viewControllers)
{
if ([vc isKindOfClass:[MWMSettingsViewController class]])
{
svc = vc;
break;
}
}
if (svc)
[self.navigationController popToViewController:svc animated:YES];
else
[self.navigationController popToRootViewControllerAnimated:YES];
}
else
{
[self.alertController presentInvalidUserNameOrPasswordAlert];
}
});
});
}
else
{
[self.alertController presentNoConnectionAlert];
}
}
- (IBAction)cancel { [self.navigationController popViewControllerAnimated:YES]; }
- (IBAction)forgotPassword
{
[self openUrl:@(OsmOAuth::ServerAuth().GetResetPasswordURL().c_str())];
}
@end

View File

@@ -26,8 +26,6 @@
- (void)updateStatusBarStyle;
- (void)migrateOAuthCredentials;
- (void)performAction:(NSString *_Nonnull)action;
- (void)openMenu;

View File

@@ -1,7 +1,6 @@
#import "MapViewController.h"
#import <CoreApi/MWMBookmarksManager.h>
#import "EAGLView.h"
#import "MWMAuthorizationCommon.h"
#import "MWMAutoupdateController.h"
#import "MWMEditorViewController.h"
#import "MWMFrameworkListener.h"
@@ -425,10 +424,6 @@ NSString *const kSettingsSegue = @"Map2Settings";
if ([MWMNavigationDashboardManager sharedManager].state == MWMNavigationDashboardStateHidden)
self.controlsManager.menuState = self.controlsManager.menuRestoreState;
// Added in https://github.com/organicmaps/organicmaps/pull/7333
// After all users migrate to OAuth2 we can remove next code
[self migrateOAuthCredentials];
if (self.trackRecordingManager.isActive)
[self showTrackRecordingPlacePage];
@@ -499,8 +494,7 @@ NSString *const kSettingsSegue = @"Map2Settings";
- (void)showViralAlertIfNeeded {
NSUserDefaults *ud = NSUserDefaults.standardUserDefaults;
using namespace osm_auth_ios;
if (!AuthorizationIsNeedCheck() || [ud objectForKey:kUDViralAlertWasShown] || !AuthorizationHaveCredentials())
if (!Profile.needsReauthorization || [ud objectForKey:kUDViralAlertWasShown] || Profile.isExisting)
return;
if (osm::Editor::Instance().GetStats().m_edits.size() < 2)
@@ -536,14 +530,6 @@ NSString *const kSettingsSegue = @"Map2Settings";
[self setNeedsStatusBarAppearanceUpdate];
}
- (void)migrateOAuthCredentials {
if (osm_auth_ios::AuthorizationHaveOAuth1Credentials())
{
osm_auth_ios::AuthorizationClearOAuth1Credentials();
[self.alertController presentOsmReauthAlert];
}
}
- (id)initWithCoder:(NSCoder *)coder {
NSLog(@"MapViewController initWithCoder Started");
self = [super initWithCoder:coder];
@@ -661,13 +647,12 @@ NSString *const kSettingsSegue = @"Map2Settings";
#pragma mark - Authorization
- (void)checkAuthorization {
using namespace osm_auth_ios;
BOOL const isAfterEditing = AuthorizationIsNeedCheck() && !AuthorizationHaveCredentials();
BOOL const isAfterEditing = Profile.needsReauthorization && !Profile.isExisting;
if (isAfterEditing) {
AuthorizationSetNeedCheck(NO);
[Profile requestReauthorizationWithShouldReauthorize:NO];
if (!Platform::IsConnected())
return;
[self.alertController presentOsmAuthAlert];
[self presentViewController:BridgeControllers.profileAsAlert animated:YES completion:nil];
}
}

View File

@@ -1,7 +1,6 @@
#import "MapsAppDelegate.h"
#import "EAGLView.h"
#import "MWMAuthorizationCommon.h"
#import "MWMCoreRouterType.h"
#import "MWMFrameworkListener.h"
#import "MWMFrameworkObservers.h"
@@ -58,7 +57,6 @@ void InitLocalizedStrings() {
}
} // namespace
using namespace osm_auth_ios;
@interface MapsAppDelegate () <MWMStorageObserver,
CPApplicationDelegate>