├── CHANGELOG.md ├── docs ├── app-example.png └── login-button.png ├── sample ├── Podfile ├── MRAuthorizationSample.xcworkspace │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── contents.xcworkspacedata ├── MRAuthorizationSample │ ├── ViewController.h │ ├── AppDelegate.h │ ├── main.m │ ├── MRAuthorizationSample.entitlements │ ├── en.lproj │ │ └── Main.strings │ ├── ru.lproj │ │ └── Main.strings │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── ViewController.m ├── Podfile.lock └── MRAuthorizationSample.xcodeproj │ └── project.pbxproj ├── mr-mail-sdk ├── sources │ ├── ui │ │ ├── MRMailSDKUI.xcassets │ │ │ ├── Contents.json │ │ │ ├── SignInButtonBackground.imageset │ │ │ │ ├── btn_bg.png │ │ │ │ ├── btn_bg@2x.png │ │ │ │ ├── btn_bg@3x.png │ │ │ │ └── Contents.json │ │ │ ├── SignInButtonLogo.imageset │ │ │ │ ├── ic_logo_mail.png │ │ │ │ ├── ic_logo_mail@2x.png │ │ │ │ ├── ic_logo_mail@3x.png │ │ │ │ └── Contents.json │ │ │ └── SignInButtonSelectedBackground.imageset │ │ │ │ ├── btn_bg_1.png │ │ │ │ ├── btn_bg_1@2x.png │ │ │ │ ├── btn_bg_1@3x.png │ │ │ │ └── Contents.json │ │ ├── en.lproj │ │ │ └── MRMailSDKUI.strings │ │ ├── ru.lproj │ │ │ └── MRMailSDKUI.strings │ │ ├── MRMailSignInButton.h │ │ ├── MRSafariAuthHandler.h │ │ ├── MRWebViewAuthHandler.h │ │ ├── MRSafariSessionAuthHandler.h │ │ ├── MRInternalAuthHandler.h │ │ ├── MRMailWebViewController.h │ │ ├── MRSafariSessionAuthHandler.m │ │ ├── MRSafariAuthHandler.m │ │ ├── MRMailWebViewController.m │ │ ├── MRWebViewAuthHandler.m │ │ └── MRMailSignInButton.m │ ├── mail-sign-in │ │ └── MRMailSDK+MailSignIn.h │ ├── utils │ │ ├── UIApplication+MRSDK.h │ │ ├── NSURL+MRSDK.h │ │ ├── NSBundle+MRSDK.h │ │ ├── NSData+MRSDK.h │ │ ├── NSMutableURLRequest+MRSDK.h │ │ ├── NSBundle+MRSDK.m │ │ ├── UIApplication+MRSDK.m │ │ ├── NSError+MRSDK.h │ │ ├── NSURL+MRSDK.m │ │ ├── NSData+MRSDK.m │ │ ├── NSError+MRSDK.m │ │ └── NSMutableURLRequest+MRSDK.m │ ├── core │ │ ├── MRMailAuthParameters.m │ │ ├── MRMailAuthParameters+QueryItems.h │ │ ├── MRSDKOAuthTokenResponseParser.h │ │ ├── MRMailAuthParameters.h │ │ ├── MRMailAuthRedirectURLParser.h │ │ ├── MRMailAuthParameters+Protected.h │ │ ├── MRMailAuthParameters+QueryItems.m │ │ ├── MRMailAuthRedirectURLParser.m │ │ └── MRSDKOAuthTokenResponseParser.m │ ├── MRMailSDK+Private.h │ ├── MRMailSDKConstants.m │ ├── MRMailSDKConstants.h │ ├── MRSDKAuthorizationResult.m │ ├── MRSDKAuthorizationResult.h │ ├── MRMailSDK.h │ └── MRMailSDK.m ├── module.map └── Info.plist ├── .gitignore ├── LICENSE ├── MRMailSDK.podspec ├── mr-mail-sdk.xcodeproj ├── xcshareddata │ └── xcschemes │ │ └── mr-mail-sdk.xcscheme └── project.pbxproj └── README.md /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0 - 23.05.2017 2 | Initial version, base functionality 3 | -------------------------------------------------------------------------------- /docs/app-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/docs/app-example.png -------------------------------------------------------------------------------- /docs/login-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/docs/login-button.png -------------------------------------------------------------------------------- /sample/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | 3 | target 'MRAuthorizationSample' do 4 | pod 'MRMailSDK', :path => '../' 5 | end 6 | 7 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/en.lproj/MRMailSDKUI.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/en.lproj/MRMailSDKUI.strings -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/ru.lproj/MRMailSDKUI.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/ru.lproj/MRMailSDKUI.strings -------------------------------------------------------------------------------- /mr-mail-sdk/sources/mail-sign-in/MRMailSDK+MailSignIn.h: -------------------------------------------------------------------------------- 1 | // 2 | // MRMailSDK+MailSignIn.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 19/06/2019. 6 | // Copyright © 2019 Mail.Ru. All rights reserved. 7 | // 8 | 9 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonBackground.imageset/btn_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonBackground.imageset/btn_bg.png -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonLogo.imageset/ic_logo_mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonLogo.imageset/ic_logo_mail.png -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonBackground.imageset/btn_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonBackground.imageset/btn_bg@2x.png -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonBackground.imageset/btn_bg@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonBackground.imageset/btn_bg@3x.png -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonLogo.imageset/ic_logo_mail@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonLogo.imageset/ic_logo_mail@2x.png -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonLogo.imageset/ic_logo_mail@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonLogo.imageset/ic_logo_mail@3x.png -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonSelectedBackground.imageset/btn_bg_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonSelectedBackground.imageset/btn_bg_1.png -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonSelectedBackground.imageset/btn_bg_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonSelectedBackground.imageset/btn_bg_1@2x.png -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonSelectedBackground.imageset/btn_bg_1@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailru/mail-auth-sdk-ios/master/mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonSelectedBackground.imageset/btn_bg_1@3x.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | *.swp 3 | *~.nib 4 | 5 | #Xcode 6 | project.xcworkspace 7 | *.xcuserstate 8 | build/* 9 | *.mode1 10 | *.mode1v3 11 | *.mode2v3 12 | *.perspective 13 | *.perspectivev3 14 | *.pbxuser 15 | xcuserdata 16 | *.o 17 | *.pyc 18 | #Idea 19 | .idea 20 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/UIApplication+MRSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 16/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @interface UIApplication (MRSDK) 9 | 10 | + (UIApplication *)mrsdk_sharedApplication; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /mr-mail-sdk/module.map: -------------------------------------------------------------------------------- 1 | framework module MRMailSDK 2 | { 3 | header "MRMailSDK.h" 4 | header "MRMailSDKConstants.h" 5 | header "MRMailSDK+MailSignIn.h" 6 | export * 7 | 8 | explicit module MRMailSDK_Private 9 | { 10 | header "MRMailSDK+Private.h" 11 | export * 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/core/MRMailAuthParameters.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 16/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import "MRMailAuthParameters.h" 7 | #import "MRMailAuthParameters+Protected.h" 8 | 9 | @implementation MRMailAuthParameters { 10 | 11 | } 12 | @end 13 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSignInButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // MRMailSignInButton.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Nikolay Morev on 22/03/2018. 6 | // Copyright © 2018 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | IB_DESIGNABLE 12 | @interface MRMailSignInButton : UIControl 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // MRAuthorizationSample 4 | // 5 | // Created by Aleksandr Karimov on 16/05/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/NSURL+MRSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 18/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @interface NSURL (MRSDK) 9 | 10 | - (NSString *)mrsdk_urlWithoutQuery; 11 | - (NSDictionary *)mrsdk_GETParameters; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/core/MRMailAuthParameters+QueryItems.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 16/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "MRMailAuthParameters.h" 8 | 9 | @interface MRMailAuthParameters (QueryItems) 10 | 11 | - (NSArray *)mrsdk_queryItems; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/MRMailSDK+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 30/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "MRMailSDK.h" 8 | 9 | @interface MRMailSDK () 10 | 11 | /** 12 | * Use test hosts for authorization 13 | */ 14 | @property (nonatomic, assign) BOOL useTestHosts; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // MRAuthorizationSample 4 | // 5 | // Created by Aleksandr Karimov on 16/05/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /sample/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MRMailSDK (1.3): 3 | - MRMailSDK/Core (= 1.3) 4 | - MRMailSDK/Core (1.3) 5 | 6 | DEPENDENCIES: 7 | - MRMailSDK (from `../`) 8 | 9 | EXTERNAL SOURCES: 10 | MRMailSDK: 11 | :path: "../" 12 | 13 | SPEC CHECKSUMS: 14 | MRMailSDK: fcd55ad1e9b6693ea412db0e890e5c1d786cfa96 15 | 16 | PODFILE CHECKSUM: 7106376652ae18bede9f0b64f4ed53d59d1754e0 17 | 18 | COCOAPODS: 1.7.2 19 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MRAuthorizationSample 4 | // 5 | // Created by Aleksandr Karimov on 16/05/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/NSBundle+MRSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+MRSDK.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Nikolay Morev on 22/03/2018. 6 | // Copyright © 2018 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSBundle (MRSDK) 14 | 15 | @property (nonatomic, readonly, class) NSBundle *mrsdk_UIResourcesBundle; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonLogo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ic_logo_mail.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "ic_logo_mail@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "ic_logo_mail@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/NSData+MRSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+MRSDK.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 06/08/2019. 6 | // Copyright © 2019 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSData (MRSDK) 14 | 15 | @property (nonatomic, readonly, copy) NSData *mrsdk_SHA256Hash; 16 | 17 | @property (nonatomic, readonly, copy) NSData *mrsdk_base64URLNoPaddingEncoded; 18 | 19 | + (nullable NSData *)mrsdk_randomlyFilledDataWithLength:(NSUInteger)length; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/NSMutableURLRequest+MRSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableURLRequest+MRSDK.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 17/06/2019. 6 | // Copyright © 2019 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSMutableURLRequest (MRSDK) 14 | 15 | - (void)mrsdk_setHTTPBodyQueryItems:(NSArray *)queryItems; 16 | 17 | - (BOOL)mrsdk_addBasicAccessAuthenticationHeaderFieldWithUsername:(NSString *)userName password:(NSString *)password; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRSafariAuthHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 19/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "MRInternalAuthHandler.h" 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | @class MRMailAuthRedirectURLParser; 12 | 13 | @interface MRSafariAuthHandler : NSObject 14 | 15 | - (instancetype)initWithRedirectURLParser:(MRMailAuthRedirectURLParser *)redirectURLParser NS_DESIGNATED_INITIALIZER; 16 | 17 | + (instancetype)new NS_UNAVAILABLE; 18 | - (instancetype)init NS_UNAVAILABLE; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRWebViewAuthHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 18/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "MRInternalAuthHandler.h" 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | @class MRMailAuthRedirectURLParser; 12 | 13 | @interface MRWebViewAuthHandler : NSObject 14 | 15 | - (instancetype)initWithRedirectURLParser:(MRMailAuthRedirectURLParser *)redirectURLParser NS_DESIGNATED_INITIALIZER; 16 | 17 | + (instancetype)new NS_UNAVAILABLE; 18 | - (instancetype)init NS_UNAVAILABLE; 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/NSBundle+MRSDK.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+MRSDK.m 3 | // mr-mail-sdk 4 | // 5 | // Created by Nikolay Morev on 22/03/2018. 6 | // Copyright © 2018 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import "NSBundle+MRSDK.h" 10 | #import "MRMailSDK.h" 11 | 12 | @implementation NSBundle (MRSDK) 13 | 14 | + (instancetype)mrsdk_UIResourcesBundle { 15 | NSBundle *classBundle = [NSBundle bundleForClass:[MRMailSDK class]]; 16 | NSURL *bundleURL = [classBundle URLForResource:@"MRMailSDKUI" withExtension:@"bundle"]; 17 | if (!bundleURL) { 18 | return classBundle; 19 | } 20 | return [NSBundle bundleWithURL:bundleURL]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/MRAuthorizationSample.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.icloud-container-identifiers 6 | 7 | com.apple.developer.ubiquity-kvstore-identifier 8 | $(TeamIdentifierPrefix)$(CFBundleIdentifier) 9 | com.apple.security.application-groups 10 | 11 | keychain-access-groups 12 | 13 | $(AppIdentifierPrefix)ru.mail.sharedKeychain 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/core/MRSDKOAuthTokenResponseParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MRSDKOAuthTokenResponseParser.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 07/08/2019. 6 | // Copyright © 2019 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @class MRSDKAuthorizationResult; 14 | 15 | @interface MRSDKOAuthTokenResponseParser : NSObject 16 | 17 | - (BOOL)getAuthorizationResult:(out MRSDKAuthorizationResult *_Nullable *_Nullable)authorizationResult 18 | apiError:(out NSError **)error 19 | fromTokenResponseData:(NSData *)responseData; 20 | 21 | @end 22 | 23 | NS_ASSUME_NONNULL_END 24 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/core/MRMailAuthParameters.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 16/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @interface MRMailAuthParameters : NSObject 9 | 10 | @property (nonatomic, copy, readonly) NSString *clientId; 11 | @property (nonatomic, copy, readonly) NSString *state; 12 | @property (nonatomic, copy, readonly) NSString *scopes; 13 | @property (nonatomic, copy, readonly) NSString *redirectUri; 14 | @property (nonatomic, copy, readonly) NSString *loginHint; 15 | @property (nonatomic, copy, readonly) NSString *codeChallenge; 16 | @property (nonatomic, copy, readonly) NSString *challengeMethod; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/en.lproj/Main.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "UILabel"; text = "Use test hosts for internal authorization"; ObjectID = "8qs-a4-KDo"; */ 3 | "8qs-a4-KDo.text" = "Use test hosts for internal authorization"; 4 | 5 | /* Class = "UIButton"; normalTitle = "PRESS FOR INTERNAL AUTHORIZATION"; ObjectID = "GZC-RY-Wjy"; */ 6 | "GZC-RY-Wjy.normalTitle" = "PRESS FOR INTERNAL AUTHORIZATION"; 7 | 8 | /* Class = "UILabel"; text = "Use Safari for internal authorization"; ObjectID = "RfY-dH-sHa"; */ 9 | "RfY-dH-sHa.text" = "Use Safari for internal authorization"; 10 | 11 | /* Class = "UIButton"; normalTitle = "PRESS FOR AUTHORIZATION"; ObjectID = "dYi-ae-NWa"; */ 12 | "dYi-ae-NWa.normalTitle" = "PRESS FOR AUTHORIZATION"; 13 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/ru.lproj/Main.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "UILabel"; text = "Use test hosts for internal authorization"; ObjectID = "8qs-a4-KDo"; */ 3 | "8qs-a4-KDo.text" = "Use test hosts for internal authorization"; 4 | 5 | /* Class = "UIButton"; normalTitle = "PRESS FOR INTERNAL AUTHORIZATION"; ObjectID = "GZC-RY-Wjy"; */ 6 | "GZC-RY-Wjy.normalTitle" = "PRESS FOR INTERNAL AUTHORIZATION"; 7 | 8 | /* Class = "UILabel"; text = "Use Safari for internal authorization"; ObjectID = "RfY-dH-sHa"; */ 9 | "RfY-dH-sHa.text" = "Use Safari for internal authorization"; 10 | 11 | /* Class = "UIButton"; normalTitle = "PRESS FOR AUTHORIZATION"; ObjectID = "dYi-ae-NWa"; */ 12 | "dYi-ae-NWa.normalTitle" = "PRESS FOR AUTHORIZATION"; 13 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/core/MRMailAuthRedirectURLParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MRMailAuthRedirectURLParser.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 24/07/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface MRMailAuthRedirectURLParser : NSObject 14 | 15 | - (instancetype)initWithRedirectURI:(NSString *)redirectURI NS_DESIGNATED_INITIALIZER; 16 | 17 | - (BOOL)parseURL:(NSURL *)url code:(out NSString *_Nullable *_Nullable)code error:(out NSError *_Nullable *_Nullable)error; 18 | 19 | + (instancetype)new NS_UNAVAILABLE; 20 | - (instancetype)init NS_UNAVAILABLE; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/UIApplication+MRSDK.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 16/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import "UIApplication+MRSDK.h" 7 | 8 | @implementation UIApplication (MRSDK) 9 | 10 | #pragma mark - public 11 | 12 | + (UIApplication *)mrsdk_sharedApplication { 13 | if (!self.mrsdk_isAppExtension && [UIApplication respondsToSelector:@selector(sharedApplication)]) { 14 | return [UIApplication performSelector:@selector(sharedApplication)]; 15 | } 16 | return nil; 17 | } 18 | 19 | #pragma mark - private 20 | 21 | + (BOOL)mrsdk_isAppExtension { 22 | return [[[NSBundle mainBundle] bundlePath] hasSuffix:@".appex"]; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/core/MRMailAuthParameters+Protected.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 16/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "MRMailAuthParameters.h" 8 | 9 | @interface MRMailAuthParameters () 10 | 11 | @property (nonatomic, copy, readwrite) NSString *clientId; 12 | @property (nonatomic, copy, readwrite) NSString *state; 13 | @property (nonatomic, copy, readwrite) NSString *scopes; 14 | @property (nonatomic, copy, readwrite) NSString *redirectUri; 15 | @property (nonatomic, copy) NSString *loginHint; 16 | @property (nonatomic, copy) NSString *codeChallenge; 17 | @property (nonatomic, copy) NSString *challengeMethod; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/MRMailSDKConstants.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 17/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import "MRMailSDKConstants.h" 7 | 8 | NSString *const kMRMailSDKErrorDomain = @"mr-mail-sdk-domain"; 9 | 10 | const NSInteger kMRSDKUninitializedErrorCode = 0; 11 | const NSInteger kMRSDKIncorrectClientIdErrorCode = 1; 12 | const NSInteger kMRSDKAuthorizationAlreadyInProgressErrorCode = 2; 13 | const NSInteger kMRSDKOAuthErrorCode = 3; 14 | const NSInteger kMRSDKNetworkErrorCode = 4; 15 | const NSInteger kMRSDKCanceledByUserErrorCode = 5; 16 | const NSInteger kMRSDKUnauthorizedApplicationErrorCode = 6; 17 | const NSInteger kMRSDKExternalOAuthDisabledErrorCode = 7; 18 | const NSInteger kMRSDKExternalOAuthRefuseErrorCode = 8; 19 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/MRMailSDKConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 17/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | extern NSString *const kMRMailSDKErrorDomain; 9 | 10 | extern const NSInteger kMRSDKUninitializedErrorCode; 11 | extern const NSInteger kMRSDKIncorrectClientIdErrorCode; 12 | extern const NSInteger kMRSDKAuthorizationAlreadyInProgressErrorCode; 13 | extern const NSInteger kMRSDKOAuthErrorCode; 14 | extern const NSInteger kMRSDKNetworkErrorCode; 15 | extern const NSInteger kMRSDKCanceledByUserErrorCode; 16 | extern const NSInteger kMRSDKUnauthorizedApplicationErrorCode; 17 | extern const NSInteger kMRSDKExternalOAuthDisabledErrorCode; 18 | extern const NSInteger kMRSDKExternalOAuthRefuseErrorCode; 19 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/NSError+MRSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 17/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | NS_ASSUME_NONNULL_BEGIN 9 | 10 | @interface NSError (MRSDK) 11 | 12 | + (NSError *)mrsdk_uninitializedError; 13 | + (NSError *)mrsdk_incorrectClientIdError; 14 | + (NSError *)mrsdk_authorizationAlreadyInProgressError; 15 | + (NSError *)mrsdk_OAuthError; 16 | + (NSError *)mrsdk_networkError; 17 | + (NSError *)mrsdk_canceledByUserError; 18 | + (NSError *)mrsdk_unauthorizedApplicationError; 19 | + (NSError *)mrsdk_externalOAuthDisabledError; 20 | 21 | + (nullable NSError *)mrsdk_errorFromCode:(NSString *)code 22 | withDescription:(NSString *)description; 23 | 24 | @end 25 | 26 | NS_ASSUME_NONNULL_END 27 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRSafariSessionAuthHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // MRSafariSessionAuthHandler.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 24/07/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 11 | #import "MRInternalAuthHandler.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @class MRMailAuthRedirectURLParser; 16 | 17 | API_AVAILABLE(ios(11.0)) 18 | @interface MRSafariSessionAuthHandler : NSObject 19 | 20 | - (instancetype)initWithRedirectURI:(NSString *)redirectURI redirectURLParser:(MRMailAuthRedirectURLParser *)redirectURLParser NS_DESIGNATED_INITIALIZER; 21 | 22 | + (instancetype)new NS_UNAVAILABLE; 23 | - (instancetype)init NS_UNAVAILABLE; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /mr-mail-sdk/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | ru.mail.mail-sdk 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/core/MRMailAuthParameters+QueryItems.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 16/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import "MRMailAuthParameters+QueryItems.h" 7 | 8 | @implementation MRMailAuthParameters (QueryItems) 9 | 10 | - (NSArray *)mrsdk_queryItems { 11 | NSMutableArray *items = @[].mutableCopy; 12 | void(^addItem)(NSString *, NSString *) = ^(NSString *value, NSString *name) { 13 | if (value) { 14 | [items addObject:[NSURLQueryItem queryItemWithName:name value:value]]; 15 | } 16 | }; 17 | addItem(self.clientId, @"client_id"); 18 | addItem(self.scopes, @"scope"); 19 | addItem(self.redirectUri, @"redirect_uri"); 20 | addItem(self.state, @"state"); 21 | addItem(self.loginHint, @"login"); 22 | addItem(self.codeChallenge, @"code_challenge"); 23 | addItem(self.challengeMethod, @"code_challenge_method"); 24 | 25 | return items; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRInternalAuthHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 17/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @class MRMailAuthParameters; 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @protocol MRInternalAuthHandlerDelegate 13 | - (void)authHandlerShouldPresentViewController:(UIViewController *)controller; 14 | - (void)authHandlerWillDismissViewController:(UIViewController *)controller; 15 | - (void)authHandlerDidDismissViewController:(UIViewController *)controller; 16 | - (void)authHandlerDidFinishWithCode:(NSString *)code; 17 | - (void)authHandlerDidFailWithError:(NSError *)error; 18 | @end 19 | 20 | @protocol MRInternalAuthHandler 21 | 22 | @property (nonatomic, weak, nullable) id delegate; 23 | 24 | - (void)performAuthorizationWithURL:(NSURL *)url; 25 | - (void)cancel; 26 | 27 | - (BOOL)handleURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication; 28 | 29 | @end 30 | 31 | NS_ASSUME_NONNULL_END 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Mail.Ru 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /MRMailSDK.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "MRMailSDK" 3 | s.version = "1.4.3" 4 | s.summary = "Library for Mail.Ru OAuth2 authorization" 5 | s.platform = :ios 6 | s.ios.deployment_target = '9.0' 7 | s.source = { :git => "https://github.com/mailru/mail-auth-sdk-ios.git", :tag => s.version.to_s } 8 | s.resource_bundles = { 9 | 'MRMailSDKUI' => [ 'mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets', 10 | 'mr-mail-sdk/sources/ui/ru.lproj/*.strings', 11 | 'mr-mail-sdk/sources/ui/en.lproj/*.strings' ] 12 | } 13 | s.frameworks = 'Foundation','UIKit','SafariServices','WebKit' 14 | s.requires_arc = true 15 | s.license = "None" 16 | s.homepage = "https://github.com/mailru/mail-auth-sdk-ios" 17 | s.authors = { 'Aleksandr Karimov' => 'a.karimov@corp.mail.ru' } 18 | s.default_subspecs = 'Core' 19 | 20 | s.subspec 'Core' do |cs| 21 | cs.source_files = 'mr-mail-sdk/sources/*.{h,m}', 'mr-mail-sdk/sources/core/**/*.{h,m}', 'mr-mail-sdk/sources/ui/**/*.{h,m}', 'mr-mail-sdk/sources/utils/**/*.{h,m}' 22 | cs.public_header_files = 'mr-mail-sdk/sources/*.h' 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/MRSDKAuthorizationResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // MRSDKAuthorizationResult.m 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 07/08/2019. 6 | // Copyright © 2019 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import "MRSDKAuthorizationResult.h" 10 | 11 | @implementation MRSDKAuthorizationResult 12 | 13 | - (instancetype)initWithAuthorizationCode:(NSString *)authorizationCode codeVerifier:(NSString *)codeVerifier { 14 | self = [super init]; 15 | if (self) { 16 | _type = MRSDKAuthorizationResultTypeCode; 17 | _authorizationCode = [authorizationCode copy]; 18 | _codeVerifier = [codeVerifier copy]; 19 | } 20 | return self; 21 | } 22 | 23 | - (instancetype)initWithRefreshToken:(NSString *)refreshToken accessToken:(NSString *)accessToken accessTokenExpirationDate:(NSDate *)accessTokenExpirationDate { 24 | self = [super init]; 25 | if (self) { 26 | _type = MRSDKAuthorizationResultTypeToken; 27 | _refreshToken = [refreshToken copy]; 28 | _accessToken = [accessToken copy]; 29 | _accessTokenExpirationDate = [accessTokenExpirationDate copy]; 30 | } 31 | return self; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailWebViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MRMailWebViewController.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Aleksandr Karimov on 18/05/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MRInternalAuthHandler.h" 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @protocol MRMailWebViewControllerDelegate 15 | - (BOOL)webViewControllerShouldStartLoadingRequest:(NSURLRequest *)request; 16 | - (void)webViewControllerDidFailLoadingWithError:(nullable NSError *)error; 17 | - (void)webViewControllerDidPressCancelButton; 18 | @end 19 | 20 | @interface MRMailWebViewController : UIViewController 21 | 22 | @property (nonatomic, weak, nullable) id delegate; 23 | @property (nonatomic, readonly, strong) NSURL *url; 24 | 25 | - (instancetype)initWithURL:(NSURL *)url NS_DESIGNATED_INITIALIZER; 26 | 27 | - (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_UNAVAILABLE; 28 | - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE; 29 | + (instancetype)new NS_UNAVAILABLE; 30 | - (instancetype)init NS_UNAVAILABLE; 31 | 32 | @end 33 | 34 | NS_ASSUME_NONNULL_END 35 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/NSURL+MRSDK.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 18/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import "NSURL+MRSDK.h" 7 | 8 | @implementation NSURL (MRSDK) 9 | 10 | - (NSDictionary *)mrsdk_GETParameters { 11 | NSMutableDictionary *parameters = @{}.mutableCopy; 12 | NSURLComponents *components = [NSURLComponents componentsWithURL:self 13 | resolvingAgainstBaseURL:NO]; 14 | [components.queryItems enumerateObjectsUsingBlock:^(NSURLQueryItem *item, NSUInteger idx, BOOL *stop) { 15 | parameters[item.name] = item.value; 16 | }]; 17 | return parameters.count ? parameters.copy : nil; 18 | } 19 | 20 | - (NSString *)mrsdk_urlWithoutQuery { 21 | NSString *urlString = @""; 22 | NSString *scheme = [self scheme]; 23 | if (scheme) { 24 | urlString = [scheme stringByAppendingString:@"://"]; 25 | } 26 | NSString *host = [self host]; 27 | if (host) { 28 | urlString = [urlString stringByAppendingString:host]; 29 | } 30 | NSString *path = [self path]; 31 | if (path) { 32 | urlString = [urlString stringByAppendingString:path]; 33 | } 34 | return urlString; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/NSData+MRSDK.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+MRSDK.m 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 06/08/2019. 6 | // Copyright © 2019 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "NSData+MRSDK.h" 12 | 13 | @implementation NSData (MRSDK) 14 | 15 | + (NSData *)mrsdk_randomlyFilledDataWithLength:(NSUInteger)length { 16 | NSMutableData *data = [[NSMutableData alloc] initWithLength:length]; 17 | int result = SecRandomCopyBytes(kSecRandomDefault, data.length, data.mutableBytes); 18 | if (result != errSecSuccess) { 19 | return nil; 20 | } 21 | return data; 22 | } 23 | 24 | - (NSData *)mrsdk_SHA256Hash { 25 | NSMutableData *hash = [NSMutableData dataWithLength:CC_SHA256_DIGEST_LENGTH]; 26 | CC_SHA256(self.bytes, (CC_LONG)self.length, hash.mutableBytes); 27 | 28 | return hash; 29 | } 30 | 31 | - (NSData *)mrsdk_base64URLNoPaddingEncoded { 32 | NSString *base64String = [self base64EncodedStringWithOptions:kNilOptions]; 33 | base64String = [base64String stringByReplacingOccurrencesOfString:@"+" withString:@"-"]; 34 | base64String = [base64String stringByReplacingOccurrencesOfString:@"/" withString:@"_"]; 35 | base64String = [base64String stringByReplacingOccurrencesOfString:@"=" withString:@""]; 36 | 37 | return (NSData *_Nonnull)[base64String dataUsingEncoding:NSUTF8StringEncoding]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "resizing" : { 5 | "mode" : "9-part", 6 | "center" : { 7 | "mode" : "tile", 8 | "width" : 1, 9 | "height" : 1 10 | }, 11 | "cap-insets" : { 12 | "bottom" : 5, 13 | "top" : 5, 14 | "right" : 5, 15 | "left" : 4 16 | } 17 | }, 18 | "idiom" : "universal", 19 | "filename" : "btn_bg.png", 20 | "scale" : "1x" 21 | }, 22 | { 23 | "resizing" : { 24 | "mode" : "9-part", 25 | "center" : { 26 | "mode" : "tile", 27 | "width" : 1, 28 | "height" : 1 29 | }, 30 | "cap-insets" : { 31 | "bottom" : 10, 32 | "top" : 9, 33 | "right" : 10, 34 | "left" : 9 35 | } 36 | }, 37 | "idiom" : "universal", 38 | "filename" : "btn_bg@2x.png", 39 | "scale" : "2x" 40 | }, 41 | { 42 | "resizing" : { 43 | "mode" : "9-part", 44 | "center" : { 45 | "mode" : "tile", 46 | "width" : 1, 47 | "height" : 1 48 | }, 49 | "cap-insets" : { 50 | "bottom" : 14, 51 | "top" : 14, 52 | "right" : 15, 53 | "left" : 14 54 | } 55 | }, 56 | "idiom" : "universal", 57 | "filename" : "btn_bg@3x.png", 58 | "scale" : "3x" 59 | } 60 | ], 61 | "info" : { 62 | "version" : 1, 63 | "author" : "xcode" 64 | } 65 | } -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSDKUI.xcassets/SignInButtonSelectedBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "resizing" : { 5 | "mode" : "9-part", 6 | "center" : { 7 | "mode" : "tile", 8 | "width" : 1, 9 | "height" : 1 10 | }, 11 | "cap-insets" : { 12 | "bottom" : 5, 13 | "top" : 5, 14 | "right" : 5, 15 | "left" : 4 16 | } 17 | }, 18 | "idiom" : "universal", 19 | "filename" : "btn_bg_1.png", 20 | "scale" : "1x" 21 | }, 22 | { 23 | "resizing" : { 24 | "mode" : "9-part", 25 | "center" : { 26 | "mode" : "tile", 27 | "width" : 1, 28 | "height" : 1 29 | }, 30 | "cap-insets" : { 31 | "bottom" : 9, 32 | "top" : 9, 33 | "right" : 10, 34 | "left" : 9 35 | } 36 | }, 37 | "idiom" : "universal", 38 | "filename" : "btn_bg_1@2x.png", 39 | "scale" : "2x" 40 | }, 41 | { 42 | "resizing" : { 43 | "mode" : "9-part", 44 | "center" : { 45 | "mode" : "tile", 46 | "width" : 1, 47 | "height" : 1 48 | }, 49 | "cap-insets" : { 50 | "bottom" : 14, 51 | "top" : 14, 52 | "right" : 15, 53 | "left" : 14 54 | } 55 | }, 56 | "idiom" : "universal", 57 | "filename" : "btn_bg_1@3x.png", 58 | "scale" : "3x" 59 | } 60 | ], 61 | "info" : { 62 | "version" : 1, 63 | "author" : "xcode" 64 | } 65 | } -------------------------------------------------------------------------------- /mr-mail-sdk/sources/core/MRMailAuthRedirectURLParser.m: -------------------------------------------------------------------------------- 1 | // 2 | // MRMailAuthRedirectURLParser.m 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 24/07/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import "MRMailAuthRedirectURLParser.h" 10 | 11 | #import "NSURL+MRSDK.h" 12 | #import "NSError+MRSDK.h" 13 | 14 | @interface MRMailAuthRedirectURLParser () 15 | @property (copy, nonatomic, readonly) NSString *redirectURI; 16 | @end 17 | 18 | @implementation MRMailAuthRedirectURLParser 19 | 20 | - (instancetype)initWithRedirectURI:(NSString *)redirectURI { 21 | NSParameterAssert(redirectURI); 22 | self = [super init]; 23 | if (self) { 24 | _redirectURI = [redirectURI copy]; 25 | } 26 | return self; 27 | } 28 | 29 | - (BOOL)parseURL:(NSURL *)url code:(NSString **)code error:(NSError **)error { 30 | NSParameterAssert(url); 31 | NSString *hostName = url.mrsdk_urlWithoutQuery; 32 | if (![self.redirectURI isEqual:hostName]) { 33 | return NO; 34 | } 35 | NSDictionary *queryParameters = url.mrsdk_GETParameters; 36 | NSString *internalCode = queryParameters[@"code"]; 37 | if (internalCode.length > 0) { 38 | if (code) { 39 | *code = internalCode; 40 | } 41 | } else { 42 | NSString *errorCode = queryParameters[@"error"]; 43 | NSError *internalError; 44 | if ([errorCode isEqualToString:@"access_denied"]) { 45 | internalError = NSError.mrsdk_canceledByUserError; 46 | } else { 47 | internalError = NSError.mrsdk_OAuthError; 48 | } 49 | if (error) { 50 | *error = internalError; 51 | } 52 | } 53 | return YES; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // MRAuthorizationSample 4 | // 5 | // Created by Aleksandr Karimov on 16/05/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import 11 | 12 | static NSString *const kClientId = @"bddc421472584782aacd6d7549cbc31b"; 13 | static NSString *const kRedirectURI = @"sample-auth-callback://"; 14 | static NSString *const kReturnScheme = @"sample-auth-callback"; 15 | 16 | @interface AppDelegate () 17 | 18 | @end 19 | 20 | @implementation AppDelegate 21 | 22 | #pragma mark - AppDelegate 23 | 24 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 25 | // Override point for customization after application launch. 26 | [self initializeMailSdk]; 27 | return YES; 28 | } 29 | 30 | - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { 31 | NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey]; 32 | id annotation = options[UIApplicationOpenURLOptionsAnnotationKey]; 33 | return [[MRMailSDK sharedInstance] handleURL:url 34 | sourceApplication:sourceApplication 35 | annotation:annotation]; 36 | } 37 | 38 | #pragma mark - private 39 | 40 | - (void)initializeMailSdk { 41 | MRMailSDK *mailSDK = [MRMailSDK sharedInstance]; 42 | [mailSDK initializeWithClientID:kClientId 43 | redirectURI:kRedirectURI]; 44 | mailSDK.returnScheme = kReturnScheme; 45 | mailSDK.internalAuthMode = kMRMailSDKInternalAuthMode_WebKit; 46 | mailSDK.proofKeyForCodeExchangeEnabled = YES; 47 | [mailSDK forceLogout]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /mr-mail-sdk/sources/MRSDKAuthorizationResult.h: -------------------------------------------------------------------------------- 1 | // 2 | // MRAuthorizationResult.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 07/08/2019. 6 | // Copyright © 2019 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | typedef NS_ENUM(NSInteger, MRSDKAuthorizationResultType) { 14 | MRSDKAuthorizationResultTypeCode, 15 | MRSDKAuthorizationResultTypeToken, 16 | }; 17 | 18 | @interface MRSDKAuthorizationResult : NSObject 19 | 20 | @property (nonatomic, readonly, assign) MRSDKAuthorizationResultType type; 21 | /// The authorization code generated by the authorization server 22 | /// Set when the ResultType is Code 23 | @property (nonatomic, nullable, readonly, copy) NSString *authorizationCode; 24 | /// The PKCE code verifier 25 | /// May be set when the ResultType is Code and PKCE is enabled 26 | @property (nonatomic, nullable, readonly, copy) NSString *codeVerifier; 27 | /// The refresh token generated by the authorization server 28 | /// Set when the ResultType is Token 29 | @property (nonatomic, nullable, readonly, copy) NSString *refreshToken; 30 | /// The access token generated by the authorization server 31 | /// Set when the ResultType is Token 32 | @property (nonatomic, nullable, readonly, copy) NSString *accessToken; 33 | /// The approximate expiration date & time of the access token 34 | @property (nonatomic, nullable, readonly, strong) NSDate *accessTokenExpirationDate; 35 | 36 | - (instancetype)initWithAuthorizationCode:(NSString *)authorizationCode 37 | codeVerifier:(nullable NSString *)codeVerifier NS_DESIGNATED_INITIALIZER; 38 | 39 | - (instancetype)initWithRefreshToken:(NSString *)refreshToken 40 | accessToken:(NSString *)accessToken 41 | accessTokenExpirationDate:(nullable NSDate *)accessTokenExpirationDate NS_DESIGNATED_INITIALIZER; 42 | 43 | + (instancetype)new NS_UNAVAILABLE; 44 | - (instancetype)init NS_UNAVAILABLE; 45 | 46 | @end 47 | 48 | NS_ASSUME_NONNULL_END 49 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSpokenName 20 | 21 | CFBundleURLTypes 22 | 23 | 24 | CFBundleURLSchemes 25 | 26 | sample-auth-callback 27 | 28 | 29 | 30 | CFBundleVersion 31 | 1 32 | LSApplicationCategoryType 33 | 34 | LSApplicationQueriesSchemes 35 | 36 | mr-mail-oauth2 37 | 38 | LSRequiresIPhoneOS 39 | 40 | NSAppTransportSecurity 41 | 42 | NSAllowsArbitraryLoads 43 | 44 | 45 | UILaunchStoryboardName 46 | LaunchScreen 47 | UIMainStoryboardFile 48 | Main 49 | UIRequiredDeviceCapabilities 50 | 51 | armv7 52 | 53 | UISupportedInterfaceOrientations 54 | 55 | UIInterfaceOrientationPortrait 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | UISupportedInterfaceOrientations~ipad 60 | 61 | UIInterfaceOrientationPortrait 62 | UIInterfaceOrientationPortraitUpsideDown 63 | UIInterfaceOrientationLandscapeLeft 64 | UIInterfaceOrientationLandscapeRight 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRSafariSessionAuthHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // MRSafariSessionAuthHandler.m 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 24/07/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 11 | #import 12 | 13 | #import "MRSafariSessionAuthHandler.h" 14 | #import "MRMailAuthRedirectURLParser.h" 15 | 16 | #import "NSError+MRSDK.h" 17 | 18 | @interface MRSafariSessionAuthHandler () 19 | @property (copy, nonatomic, readonly) NSString *redirectURI; 20 | @property (strong, nonatomic, readonly) MRMailAuthRedirectURLParser *redirectURLParser; 21 | @property (strong, nonatomic) SFAuthenticationSession *authenticationSession; 22 | @end 23 | 24 | @implementation MRSafariSessionAuthHandler 25 | 26 | @synthesize delegate = _delegate; 27 | 28 | - (instancetype)initWithRedirectURI:(NSString *)redirectURI redirectURLParser:(MRMailAuthRedirectURLParser *)redirectURLParser { 29 | NSParameterAssert(redirectURI); 30 | NSParameterAssert(redirectURLParser); 31 | self = [super init]; 32 | if (self) { 33 | _redirectURI = [redirectURI copy]; 34 | _redirectURLParser = redirectURLParser; 35 | } 36 | return self; 37 | } 38 | 39 | #pragma mark - MRInternalAuthHandler 40 | 41 | - (void)performAuthorizationWithURL:(NSURL *)url { 42 | NSParameterAssert(url); 43 | NSAssert(!self.authenticationSession, @"Class not supports multiple simultaneously authorizations"); 44 | 45 | NSString *scheme = [NSURL URLWithString:self.redirectURI].scheme; 46 | self.authenticationSession = [[SFAuthenticationSession alloc] initWithURL:url callbackURLScheme:scheme completionHandler:^(NSURL *callbackURL, NSError *error) { 47 | [self handleCallbackURL:callbackURL error:error]; 48 | }]; 49 | [self.authenticationSession start]; 50 | } 51 | 52 | - (void)cancel { 53 | [self.authenticationSession cancel]; 54 | self.authenticationSession = nil; 55 | } 56 | 57 | - (BOOL)handleURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication { 58 | return NO; 59 | } 60 | 61 | #pragma mark - Private 62 | 63 | - (void)handleCallbackURL:(NSURL *)url error:(NSError *)error { 64 | self.authenticationSession = nil; 65 | 66 | id delegate = self.delegate; 67 | if ([error.domain isEqualToString:SFAuthenticationErrorDomain] && error.code == SFAuthenticationErrorCanceledLogin) { 68 | [delegate authHandlerDidFailWithError:NSError.mrsdk_canceledByUserError]; 69 | return; 70 | } 71 | 72 | NSString *code; 73 | NSError *parsedError; 74 | [self.redirectURLParser parseURL:url code:&code error:&parsedError]; 75 | if (code) { 76 | [delegate authHandlerDidFinishWithCode:code]; 77 | } else { 78 | [delegate authHandlerDidFailWithError:parsedError]; 79 | } 80 | } 81 | 82 | @end 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // MRAuthorizationSample 4 | // 5 | // Created by Aleksandr Karimov on 16/05/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #import "ViewController.h" 13 | 14 | @interface ViewController () 15 | 16 | @property (nonatomic, weak) IBOutlet UILabel *resultLabel; 17 | @property (nonatomic, weak) IBOutlet UISwitch *switchHostsControl; 18 | @property (nonatomic, weak) IBOutlet UISwitch *switchSafariControl; 19 | 20 | @end 21 | 22 | @implementation ViewController 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | 27 | MRMailSDK.sharedInstance.delegate = self; 28 | MRMailSDK.sharedInstance.uiDelegate = self; 29 | } 30 | 31 | - (IBAction)didPressAuthorizeButton:(id)sender { 32 | MRMailSDK.sharedInstance.usesMailApplication = YES; 33 | MRMailSDK.sharedInstance.loginHint = nil; 34 | 35 | [MRMailSDK.sharedInstance forceLogout]; 36 | [MRMailSDK.sharedInstance authorize]; 37 | } 38 | 39 | - (IBAction)didPressInternalAuthorizeButton:(id)sender { 40 | MRMailSDK.sharedInstance.usesMailApplication = NO; 41 | MRMailSDK.sharedInstance.loginHint = nil; 42 | 43 | [MRMailSDK.sharedInstance forceLogout]; 44 | [MRMailSDK.sharedInstance authorize]; 45 | } 46 | 47 | - (IBAction)didChangeValueInTestHostsSwitchControl:(id)sender { 48 | MRMailSDK.sharedInstance.useTestHosts = self.switchHostsControl.on; 49 | } 50 | 51 | - (IBAction)didChangeValueInSafariSwitchControl:(id)sender { 52 | MRMailSDK.sharedInstance.internalAuthMode = self.switchSafariControl.on ? 53 | kMRMailSDKInternalAuthMode_Safari : kMRMailSDKInternalAuthMode_WebKit; 54 | } 55 | 56 | #pragma mark - MRMailSDKDelegate 57 | 58 | - (void)mrMailSDK:(MRMailSDK *)sdk authorizationDidFinishWithResult:(MRSDKAuthorizationResult *)result { 59 | [self processSuccessWithCode:result.authorizationCode]; 60 | } 61 | 62 | - (void)mrMailSDK:(MRMailSDK *)sdk authorizationDidFailWithError:(NSError *)error { 63 | [self processFailWithError:error]; 64 | } 65 | 66 | #pragma mark - MRMailSDKUIDelegate 67 | 68 | - (void)mrMailSDK:(MRMailSDK *)sdk shouldPresentViewController:(UIViewController *)controller { 69 | [self presentViewController:controller 70 | animated:YES 71 | completion:nil]; 72 | } 73 | 74 | - (void)mrMailSDK:(MRMailSDK *)sdk willDismissViewController:(UIViewController *)controller { 75 | 76 | } 77 | 78 | - (void)mrMailSDK:(MRMailSDK *)sdk didDismissViewController:(UIViewController *)controller { 79 | 80 | } 81 | 82 | #pragma mark - private 83 | 84 | - (void)processFailWithError:(NSError *)error { 85 | self.resultLabel.text = [NSString stringWithFormat:@"ошибка - %ld (%@)", (long)error.code, error.userInfo[NSHelpAnchorErrorKey]]; 86 | } 87 | 88 | - (void)processSuccessWithCode:(NSString *)code { 89 | self.resultLabel.text = @"успех - код получен"; 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/NSError+MRSDK.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 17/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import "NSError+MRSDK.h" 7 | #import "MRMailSDKConstants.h" 8 | 9 | @implementation NSError (MRSDK) 10 | 11 | #pragma mark - public 12 | 13 | 14 | + (NSError *)mrsdk_uninitializedError { 15 | return [self mrsdk_errorWithCode:kMRSDKUninitializedErrorCode 16 | userInfo:nil]; 17 | } 18 | 19 | + (NSError *)mrsdk_incorrectClientIdError { 20 | return [self mrsdk_errorWithCode:kMRSDKIncorrectClientIdErrorCode 21 | userInfo:nil]; 22 | } 23 | 24 | + (NSError *)mrsdk_authorizationAlreadyInProgressError { 25 | return [self mrsdk_errorWithCode:kMRSDKAuthorizationAlreadyInProgressErrorCode 26 | userInfo:nil]; 27 | } 28 | 29 | + (NSError *)mrsdk_OAuthError { 30 | return [self mrsdk_errorWithCode:kMRSDKOAuthErrorCode 31 | userInfo:nil]; 32 | } 33 | 34 | + (NSError *)mrsdk_networkError { 35 | return [self mrsdk_errorWithCode:kMRSDKNetworkErrorCode 36 | userInfo:nil]; 37 | } 38 | 39 | + (NSError *)mrsdk_canceledByUserError { 40 | return [self mrsdk_errorWithCode:kMRSDKCanceledByUserErrorCode 41 | userInfo:nil]; 42 | } 43 | 44 | + (NSError *)mrsdk_unauthorizedApplicationError { 45 | return [self mrsdk_errorWithCode:kMRSDKUnauthorizedApplicationErrorCode 46 | userInfo:nil]; 47 | } 48 | 49 | + (NSError *)mrsdk_externalOAuthDisabledError { 50 | return [self mrsdk_errorWithCode:kMRSDKExternalOAuthDisabledErrorCode 51 | userInfo:nil]; 52 | } 53 | 54 | + (instancetype)mrsdk_errorFromCode:(NSString *)code 55 | withDescription:(NSString *)description { 56 | __auto_type codesMap = @{ @"network-error" : @(kMRSDKNetworkErrorCode), 57 | @"oauth-error" : @(kMRSDKOAuthErrorCode), 58 | @"already-in-progress" : @(kMRSDKAuthorizationAlreadyInProgressErrorCode), 59 | @"canceled-by-user" : @(kMRSDKCanceledByUserErrorCode), 60 | @"unauthorized-application" : @(kMRSDKUnauthorizedApplicationErrorCode), 61 | @"oauth-disabled" : @(kMRSDKExternalOAuthDisabledErrorCode), 62 | @"incorrect-client-id" : @(kMRSDKIncorrectClientIdErrorCode), 63 | @"refuse-oauth" : @(kMRSDKExternalOAuthRefuseErrorCode)}; 64 | if (!codesMap[code]) { 65 | return nil; 66 | } 67 | return [self mrsdk_errorWithCode:[codesMap[code] integerValue] 68 | userInfo:@{ NSHelpAnchorErrorKey : description ?: code }]; 69 | } 70 | 71 | #pragma mark - private 72 | 73 | + (NSError *)mrsdk_errorWithCode:(NSInteger)code 74 | userInfo:(NSDictionary *)userInfo { 75 | return [NSError errorWithDomain:kMRMailSDKErrorDomain 76 | code:code 77 | userInfo:userInfo]; 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /mr-mail-sdk.xcodeproj/xcshareddata/xcschemes/mr-mail-sdk.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/utils/NSMutableURLRequest+MRSDK.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableURLRequest+MRSDK.m 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 17/06/2019. 6 | // Copyright © 2019 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import "NSMutableURLRequest+MRSDK.h" 10 | 11 | // https://github.com/AFNetworking/AFNetworking/blob/685e31a31bb1ebce3fdb5a752e392dfd8263e169/AFNetworking/AFURLRequestSerialization.m#L47 12 | static NSString *MRSDKAFPercentEscapedStringFromString(NSString *string) { 13 | static NSString * const kAFCharactersGeneralDelimitersToEncode = @":#[]@"; // does not include "?" or "/" due to RFC 3986 - Section 3.4 14 | static NSString * const kAFCharactersSubDelimitersToEncode = @"!$&'()*+,;="; 15 | 16 | NSMutableCharacterSet * allowedCharacterSet = [[NSCharacterSet URLQueryAllowedCharacterSet] mutableCopy]; 17 | [allowedCharacterSet removeCharactersInString:[kAFCharactersGeneralDelimitersToEncode stringByAppendingString:kAFCharactersSubDelimitersToEncode]]; 18 | 19 | static NSUInteger const batchSize = 50; 20 | 21 | NSUInteger index = 0; 22 | NSMutableString *escaped = @"".mutableCopy; 23 | 24 | while (index < string.length) { 25 | NSUInteger length = MIN(string.length - index, batchSize); 26 | NSRange range = NSMakeRange(index, length); 27 | 28 | // To avoid breaking up character sequences such as 👴🏻👮🏽 29 | range = [string rangeOfComposedCharacterSequencesForRange:range]; 30 | 31 | NSString *substring = [string substringWithRange:range]; 32 | NSString *encoded = [substring stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet]; 33 | [escaped appendString:encoded]; 34 | 35 | index += range.length; 36 | } 37 | 38 | return escaped; 39 | } 40 | 41 | 42 | @implementation NSMutableURLRequest (MRSDK) 43 | 44 | - (void)mrsdk_setHTTPBodyQueryItems:(NSArray *)queryItems { 45 | NSMutableArray *components = [[NSMutableArray alloc] initWithCapacity:queryItems.count]; 46 | 47 | for (NSURLQueryItem *item in queryItems) { 48 | if (item.value) { 49 | [components addObject:[NSString stringWithFormat:@"%@=%@", 50 | MRSDKAFPercentEscapedStringFromString(item.name), 51 | MRSDKAFPercentEscapedStringFromString(item.value)]]; 52 | } else { 53 | [components addObject:MRSDKAFPercentEscapedStringFromString(item.name)]; 54 | } 55 | } 56 | NSString *bodyString = [components componentsJoinedByString:@"&"]; 57 | self.HTTPBody = [bodyString dataUsingEncoding:NSUTF8StringEncoding]; 58 | } 59 | 60 | - (BOOL)mrsdk_addBasicAccessAuthenticationHeaderFieldWithUsername:(NSString *)userName password:(NSString *)password { 61 | NSParameterAssert(userName); 62 | NSParameterAssert(password); 63 | 64 | NSString *credentialString = [NSString stringWithFormat:@"%@:%@", userName, password]; 65 | NSString *encodedCredential = [[credentialString dataUsingEncoding:NSUTF8StringEncoding] base64EncodedStringWithOptions:kNilOptions]; 66 | if (!encodedCredential) { 67 | return NO; 68 | } 69 | NSString *value = [NSString stringWithFormat:@"Basic %@", encodedCredential]; 70 | [self addValue:value forHTTPHeaderField:@"Authorization"]; 71 | 72 | return YES; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/core/MRSDKOAuthTokenResponseParser.m: -------------------------------------------------------------------------------- 1 | // 2 | // MRSDKOAuthTokenResponseParser.m 3 | // mr-mail-sdk 4 | // 5 | // Created by Evgeniy Yurtaev on 07/08/2019. 6 | // Copyright © 2019 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import "MRSDKOAuthTokenResponseParser.h" 10 | #import "MRSDKAuthorizationResult.h" 11 | #import "MRMailSDKConstants.h" 12 | 13 | #import "NSError+MRSDK.h" 14 | 15 | @implementation MRSDKOAuthTokenResponseParser 16 | 17 | - (BOOL)getAuthorizationResult:(out MRSDKAuthorizationResult **)authorizationResult apiError:(out NSError **)apiError fromTokenResponseData:(NSData *)responseData { 18 | NSParameterAssert(responseData); 19 | 20 | NSDictionary *responseJSON = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:NULL]; 21 | if (![responseJSON isKindOfClass:NSDictionary.class]) { 22 | return NO; 23 | } 24 | 25 | MRSDKAuthorizationResult *parsedAuthorizationResult = [self authorizationResultFromResponse:responseJSON]; 26 | if (parsedAuthorizationResult) { 27 | if (authorizationResult) { 28 | *authorizationResult = parsedAuthorizationResult; 29 | } 30 | return YES; 31 | } 32 | 33 | NSError *parsedApiError = [self errorFromResponse:responseJSON]; 34 | if (parsedApiError) { 35 | if (apiError) { 36 | *apiError = parsedApiError; 37 | } 38 | return YES; 39 | } 40 | 41 | return NO; 42 | } 43 | 44 | #pragma mark - Private 45 | 46 | - (NSError *)errorFromResponse:(NSDictionary *)response { 47 | NSNumber *apiErrorCode = [self objectWithClass:NSNumber.class key:@"error_code" fromResponse:response]; 48 | if (apiErrorCode == nil) { 49 | return nil; 50 | } 51 | NSString *helpAnchor = [self objectWithClass:NSString.class key:@"error_description" fromResponse:response]; 52 | if (!helpAnchor) { 53 | helpAnchor = [self objectWithClass:NSString.class key:@"error" fromResponse:response] ?: apiErrorCode.stringValue; 54 | } 55 | NSInteger sdkErrorCode = 0; 56 | switch (apiErrorCode.integerValue) { 57 | case 1: 58 | sdkErrorCode = kMRSDKIncorrectClientIdErrorCode; 59 | break; 60 | default: 61 | sdkErrorCode = kMRSDKOAuthErrorCode; 62 | } 63 | return [NSError errorWithDomain:kMRMailSDKErrorDomain code:sdkErrorCode userInfo:@{ 64 | NSHelpAnchorErrorKey: helpAnchor, 65 | }]; 66 | } 67 | 68 | - (MRSDKAuthorizationResult *)authorizationResultFromResponse:(NSDictionary *)response { 69 | NSString *refreshToken = [self objectWithClass:NSString.class key:@"refresh_token" fromResponse:response]; 70 | if (!refreshToken) { 71 | return nil; 72 | } 73 | NSString *accessToken = [self objectWithClass:NSString.class key:@"access_token" fromResponse:response]; 74 | if (!accessToken) { 75 | return nil; 76 | } 77 | NSNumber *expiresIn = [self objectWithClass:NSNumber.class key:@"expires_in" fromResponse:response]; 78 | NSDate *expirationDate; 79 | if (expiresIn != nil) { 80 | expirationDate = [NSDate dateWithTimeIntervalSinceNow:expiresIn.doubleValue]; 81 | } 82 | 83 | return [[MRSDKAuthorizationResult alloc] initWithRefreshToken:refreshToken accessToken:accessToken accessTokenExpirationDate:expirationDate]; 84 | } 85 | 86 | - (id)objectWithClass:(Class)objectClass key:(NSString *)key fromResponse:(NSDictionary *)response { 87 | id object = response[key]; 88 | if (![object isKindOfClass:objectClass]) { 89 | return nil; 90 | } 91 | return object; 92 | } 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRSafariAuthHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 19/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import "MRSafariAuthHandler.h" 7 | #import "NSError+MRSDK.h" 8 | #import 9 | #import "MRMailAuthRedirectURLParser.h" 10 | 11 | @interface MRSafariAuthHandler () 12 | @property (nonatomic, strong, readonly) MRMailAuthRedirectURLParser *redirectURLParser; 13 | @property (nonatomic, strong) SFSafariViewController *safariViewController; 14 | @property (nonatomic, strong) NSURL *url; 15 | @end 16 | 17 | @implementation MRSafariAuthHandler 18 | #pragma mark - MRInternalAuthHandler 19 | 20 | @synthesize delegate = _delegate; 21 | 22 | - (instancetype)initWithRedirectURLParser:(MRMailAuthRedirectURLParser *)redirectURLParser { 23 | NSParameterAssert(redirectURLParser); 24 | self = [super init]; 25 | if (self) { 26 | _redirectURLParser = redirectURLParser; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)performAuthorizationWithURL:(NSURL *)url { 32 | self.url = url; 33 | SFSafariViewController *viewController = [[SFSafariViewController alloc] initWithURL:url]; 34 | viewController.delegate = self; 35 | self.safariViewController = viewController; 36 | [_delegate authHandlerShouldPresentViewController:viewController]; 37 | } 38 | 39 | - (void)cancel { 40 | self.safariViewController.delegate = nil; 41 | [self.safariViewController dismissViewControllerAnimated:YES 42 | completion:nil]; 43 | self.safariViewController = nil; 44 | self.url = nil; 45 | } 46 | 47 | - (BOOL)handleURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication { 48 | if (![sourceApplication isEqualToString:@"com.apple.SafariViewService"]) { 49 | return NO; 50 | } 51 | NSString *code; 52 | NSError *error; 53 | if ([self.redirectURLParser parseURL:url code:&code error:&error]) { 54 | [self dismissViewController]; 55 | id delegate = self.delegate; 56 | if (code) { 57 | [delegate authHandlerDidFinishWithCode:code]; 58 | } else { 59 | [delegate authHandlerDidFailWithError:error]; 60 | } 61 | return YES; 62 | } 63 | return NO; 64 | } 65 | 66 | #pragma mark - SFSafariViewControllerDelegate 67 | 68 | - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller { 69 | // пользователь нажал Done button 70 | [self dismissViewController]; 71 | [_delegate authHandlerDidFailWithError:[NSError mrsdk_canceledByUserError]]; 72 | 73 | } 74 | 75 | - (void)safariViewController:(SFSafariViewController *)controller didCompleteInitialLoad:(BOOL)didLoadSuccessfully { 76 | if (!didLoadSuccessfully) { 77 | [self dismissViewController]; 78 | [_delegate authHandlerDidFailWithError:[NSError mrsdk_networkError]]; 79 | } 80 | } 81 | 82 | #pragma mark - private 83 | 84 | - (void)dismissViewController { 85 | id delegate = self.delegate; 86 | UIViewController *viewController = self.safariViewController; 87 | [delegate authHandlerWillDismissViewController:viewController]; 88 | [self.safariViewController dismissViewControllerAnimated:YES 89 | completion:^{ 90 | [delegate authHandlerDidDismissViewController:viewController]; 91 | }]; 92 | self.safariViewController = nil; 93 | self.url = nil; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailWebViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MRMailWebViewController.m 3 | // mr-mail-sdk 4 | // 5 | // Created by Aleksandr Karimov on 18/05/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import "MRMailWebViewController.h" 10 | #import 11 | 12 | @interface MRMailWebViewController () 13 | @property (nonatomic, readwrite, strong) NSURL *url; 14 | @property (nonatomic, strong) WKWebView *webView; 15 | @end 16 | 17 | @implementation MRMailWebViewController 18 | 19 | @synthesize delegate = _delegate; 20 | 21 | #pragma mark - init 22 | 23 | - (instancetype)initWithURL:(NSURL *)url { 24 | self = [super initWithNibName:nil bundle:nil]; 25 | if (self) { 26 | self.url = url; 27 | } 28 | return self; 29 | } 30 | 31 | #pragma mark - UIViewController 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | [self configureWebView]; 36 | [self configureNavigationItems]; 37 | } 38 | 39 | - (void)viewWillAppear:(BOOL)animated { 40 | [super viewWillAppear:animated]; 41 | [self.webView loadRequest:[NSURLRequest requestWithURL:self.url]]; 42 | } 43 | 44 | #pragma mark - action 45 | 46 | - (void)didPressDismissButton:(id)sender { 47 | [self.delegate webViewControllerDidPressCancelButton]; 48 | } 49 | 50 | #pragma mark - WKNavigationDelegate 51 | 52 | - (void) webView:(WKWebView *)webView 53 | decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction 54 | decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { 55 | BOOL shouldStartLoading = !_delegate || [_delegate webViewControllerShouldStartLoadingRequest:navigationAction.request]; 56 | decisionHandler(shouldStartLoading ? WKNavigationActionPolicyAllow : WKNavigationActionPolicyCancel); 57 | } 58 | 59 | - (void) webView:(WKWebView *)webView 60 | didFailProvisionalNavigation:(WKNavigation *)navigation 61 | withError:(NSError *)error { 62 | [self webView:webView didFailNavigation:navigation withError:error]; 63 | } 64 | 65 | - (void) webView:(WKWebView *)webView 66 | didFailNavigation:(WKNavigation *)navigation 67 | withError:(NSError *)error { 68 | [self.delegate webViewControllerDidFailLoadingWithError:error]; 69 | } 70 | 71 | #pragma mark - private 72 | 73 | - (void)configureWebView { 74 | WKWebView *view = [[WKWebView alloc] init]; 75 | view.navigationDelegate = self; 76 | 77 | [self.view addSubview:view]; 78 | view.translatesAutoresizingMaskIntoConstraints = NO; 79 | NSMutableArray *constraints = [NSMutableArray array]; 80 | NSDictionary *bindings = NSDictionaryOfVariableBindings(view); 81 | [constraints addObjectsFromArray: 82 | [NSLayoutConstraint constraintsWithVisualFormat:@"|[view]|" 83 | options:0 84 | metrics:nil 85 | views:bindings]]; 86 | [constraints addObjectsFromArray: 87 | [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view]|" 88 | options:0 89 | metrics:nil 90 | views:bindings]]; 91 | [self.view addConstraints:constraints]; 92 | self.webView = view; 93 | } 94 | 95 | - (void)configureNavigationItems { 96 | UIBarButtonItem *dismissButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel 97 | target:self 98 | action:@selector(didPressDismissButton:)]; 99 | self.navigationItem.rightBarButtonItem = dismissButton; 100 | } 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRWebViewAuthHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Aleksandr Karimov on 18/05/2017. 3 | // Copyright (c) 2017 Mail.Ru. All rights reserved. 4 | // 5 | 6 | #import "MRWebViewAuthHandler.h" 7 | #import "NSError+MRSDK.h" 8 | #import "MRMailWebViewController.h" 9 | #import "MRMailAuthRedirectURLParser.h" 10 | 11 | @interface MRWebViewAuthHandler () 12 | @property (nonatomic, strong, readonly) MRMailAuthRedirectURLParser *redirectURLParser; 13 | @property (nonatomic, strong) MRMailWebViewController *webViewController; 14 | @end 15 | 16 | @implementation MRWebViewAuthHandler 17 | 18 | #pragma mark - MRInternalAuthHandler 19 | 20 | @synthesize delegate = _delegate; 21 | 22 | - (instancetype)initWithRedirectURLParser:(MRMailAuthRedirectURLParser *)redirectURLParser { 23 | NSParameterAssert(redirectURLParser); 24 | self = [super init]; 25 | if (self) { 26 | _redirectURLParser = redirectURLParser; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)performAuthorizationWithURL:(NSURL *)url { 32 | MRMailWebViewController *webViewController = [[MRMailWebViewController alloc] initWithURL:url]; 33 | webViewController.delegate = self; 34 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:webViewController]; 35 | self.webViewController = webViewController; 36 | [_delegate authHandlerShouldPresentViewController:navigationController]; 37 | } 38 | 39 | - (void)cancel { 40 | self.webViewController.delegate = nil; 41 | [self.webViewController.navigationController dismissViewControllerAnimated:YES 42 | completion:nil]; 43 | self.webViewController = nil; 44 | } 45 | 46 | - (BOOL)handleURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication { 47 | return NO; 48 | } 49 | 50 | #pragma mark - MRMailWebViewControllerDelegate 51 | 52 | - (BOOL)webViewControllerShouldStartLoadingRequest:(NSURLRequest *)request { 53 | NSString *code; 54 | NSError *error; 55 | if ([self.redirectURLParser parseURL:request.URL code:&code error:&error]) { 56 | [self dismissAuthController]; 57 | id delegate = self.delegate; 58 | if (code) { 59 | [delegate authHandlerDidFinishWithCode:code]; 60 | } else { 61 | [delegate authHandlerDidFailWithError:error]; 62 | } 63 | return NO; 64 | } 65 | return YES; 66 | } 67 | 68 | - (void)webViewControllerDidFailLoadingWithError:(NSError *)error { 69 | if (self.webViewController) { 70 | NSError *sdkError = [NSError mrsdk_OAuthError]; 71 | if ([error.domain isEqualToString:NSURLErrorDomain]) { 72 | if (error.code == NSURLErrorCancelled) { 73 | // не обрабатываем networking cancel, так как это может происходить перед новым запросом, 74 | // если предыдущий не был до конца завершен 75 | return; 76 | } 77 | sdkError = [NSError mrsdk_networkError]; 78 | } 79 | else if ([error.domain isEqualToString:@"WebKitErrorDomain"]) { 80 | sdkError = [NSError mrsdk_networkError]; 81 | } 82 | [self dismissAuthController]; 83 | [_delegate authHandlerDidFailWithError:sdkError]; 84 | } 85 | } 86 | 87 | - (void)webViewControllerDidPressCancelButton { 88 | [self dismissAuthController]; 89 | [_delegate authHandlerDidFailWithError:[NSError mrsdk_canceledByUserError]]; 90 | } 91 | 92 | #pragma mark - private 93 | 94 | - (void)dismissAuthController { 95 | id delegate = self.delegate; 96 | UIViewController *viewController = self.webViewController.navigationController; 97 | [delegate authHandlerWillDismissViewController:viewController]; 98 | [self.webViewController.navigationController dismissViewControllerAnimated:YES 99 | completion:^{ 100 | [delegate authHandlerDidDismissViewController:viewController]; 101 | }]; 102 | self.webViewController = nil; 103 | } 104 | 105 | @end 106 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/ui/MRMailSignInButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // MRMailSignInButton.m 3 | // mr-mail-sdk 4 | // 5 | // Created by Nikolay Morev on 22/03/2018. 6 | // Copyright © 2018 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import "MRMailSignInButton.h" 10 | #import "MRMailSDK.h" 11 | #import "NSBundle+MRSDK.h" 12 | 13 | @interface MRMailSignInButton () 14 | 15 | @property (nonatomic, weak) UIImageView *backgroundImageView; 16 | @property (nonatomic, weak) UIImageView *selectedBackgroundImageView; 17 | @property (nonatomic, weak) UIImageView *logoImageView; 18 | @property (nonatomic, weak) UILabel *actionLabel; 19 | 20 | @end 21 | 22 | @implementation MRMailSignInButton 23 | 24 | - (instancetype)initWithFrame:(CGRect)frame { 25 | if (self = [super initWithFrame:frame]) { 26 | [self commonInit]; 27 | } 28 | return self; 29 | } 30 | 31 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 32 | if (self = [super initWithCoder:aDecoder]) { 33 | [self commonInit]; 34 | } 35 | return self; 36 | } 37 | 38 | - (void)commonInit { 39 | UIImage *backgroundImage = [UIImage imageNamed:@"SignInButtonBackground" inBundle:NSBundle.mrsdk_UIResourcesBundle compatibleWithTraitCollection:nil]; 40 | UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:backgroundImage]; 41 | backgroundImageView.translatesAutoresizingMaskIntoConstraints = NO; 42 | [self addSubview:backgroundImageView]; 43 | _backgroundImageView = backgroundImageView; 44 | 45 | UIImage *selectedBackgroundImage = [UIImage imageNamed:@"SignInButtonSelectedBackground" inBundle:NSBundle.mrsdk_UIResourcesBundle compatibleWithTraitCollection:nil]; 46 | UIImageView *selectedBackgroundImageView = [[UIImageView alloc] initWithImage:selectedBackgroundImage]; 47 | selectedBackgroundImageView.translatesAutoresizingMaskIntoConstraints = NO; 48 | selectedBackgroundImageView.hidden = YES; 49 | [self addSubview:selectedBackgroundImageView]; 50 | _backgroundImageView = selectedBackgroundImageView; 51 | 52 | UIImage *logoImage = [UIImage imageNamed:@"SignInButtonLogo" inBundle:NSBundle.mrsdk_UIResourcesBundle compatibleWithTraitCollection:nil]; 53 | UIImageView *logoImageView = [[UIImageView alloc] initWithImage:logoImage]; 54 | logoImageView.translatesAutoresizingMaskIntoConstraints = NO; 55 | [self addSubview:logoImageView]; 56 | _logoImageView = logoImageView; 57 | 58 | UILabel *actionLabel = [[UILabel alloc] initWithFrame:CGRectZero]; 59 | actionLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; 60 | actionLabel.textColor = [UIColor whiteColor]; 61 | actionLabel.text = NSLocalizedStringFromTableInBundle(@"with Mail.Ru", @"MRMailSDKUI", NSBundle.mrsdk_UIResourcesBundle, @"Call to action text on Sign in Button"); 62 | actionLabel.translatesAutoresizingMaskIntoConstraints = NO; 63 | [self addSubview:actionLabel]; 64 | _actionLabel = actionLabel; 65 | 66 | [logoImageView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; 67 | [logoImageView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; 68 | [logoImageView setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; 69 | [logoImageView setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; 70 | 71 | [self setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; 72 | [self setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisVertical]; 73 | 74 | [NSLayoutConstraint activateConstraints: 75 | @[ [self.leadingAnchor constraintEqualToAnchor:backgroundImageView.leadingAnchor], 76 | [self.trailingAnchor constraintEqualToAnchor:backgroundImageView.trailingAnchor], 77 | [self.topAnchor constraintEqualToAnchor:backgroundImageView.topAnchor], 78 | [self.bottomAnchor constraintEqualToAnchor:backgroundImageView.bottomAnchor], 79 | 80 | [self.leadingAnchor constraintEqualToAnchor:selectedBackgroundImageView.leadingAnchor], 81 | [self.trailingAnchor constraintEqualToAnchor:selectedBackgroundImageView.trailingAnchor], 82 | [self.topAnchor constraintEqualToAnchor:selectedBackgroundImageView.topAnchor], 83 | [self.bottomAnchor constraintEqualToAnchor:selectedBackgroundImageView.bottomAnchor], 84 | 85 | [self.centerYAnchor constraintEqualToAnchor:logoImageView.centerYAnchor], 86 | [logoImageView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:10], 87 | 88 | [self.centerYAnchor constraintEqualToAnchor:actionLabel.centerYAnchor], 89 | [actionLabel.leadingAnchor constraintEqualToAnchor:logoImageView.trailingAnchor constant:10], 90 | [self.trailingAnchor constraintEqualToAnchor:actionLabel.trailingAnchor constant:22], 91 | [actionLabel.topAnchor constraintGreaterThanOrEqualToAnchor:self.topAnchor constant:10], 92 | [self.bottomAnchor constraintGreaterThanOrEqualToAnchor:actionLabel.bottomAnchor constant:10], 93 | 94 | [self.heightAnchor constraintGreaterThanOrEqualToConstant:44] ]]; 95 | 96 | [self addTarget:self action:@selector(signInAction) forControlEvents:UIControlEventTouchUpInside]; 97 | [self configureSelectedState]; 98 | } 99 | 100 | - (void)setSelected:(BOOL)selected { 101 | [super setSelected:selected]; 102 | [self configureSelectedState]; 103 | } 104 | 105 | - (void)setHighlighted:(BOOL)highlighted { 106 | [super setHighlighted:highlighted]; 107 | [self configureSelectedState]; 108 | } 109 | 110 | - (void)configureSelectedState { 111 | BOOL selected = self.selected || self.highlighted; 112 | self.backgroundImageView.hidden = !selected; 113 | self.selectedBackgroundImageView.hidden = selected; 114 | } 115 | 116 | - (void)signInAction { 117 | [[MRMailSDK sharedInstance] authorize]; 118 | } 119 | 120 | - (NSString *)accessibilityLabel { 121 | return NSLocalizedStringFromTableInBundle(@"Mail.Ru", @"MRMailSDKUI", [NSBundle bundleForClass:[self class]], @"Sign in button accessibility label"); 122 | } 123 | 124 | - (UIAccessibilityTraits)accessibilityTraits { 125 | return UIAccessibilityTraitButton; 126 | } 127 | 128 | - (NSString *)accessibilityHint { 129 | return NSLocalizedStringFromTableInBundle(@"Sign in with Mail.Ru", @"MRMailSDKUI", [NSBundle bundleForClass:[self class]], @"Sign in button accessibility hint"); 130 | } 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/MRMailSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // MRMailSDK.h 3 | // mr-mail-sdk 4 | // 5 | // Created by Aleksandr Karimov on 16/05/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #import "MRMailSDKConstants.h" 13 | #import "MRSDKAuthorizationResult.h" 14 | 15 | @class MRMailSDK; 16 | 17 | NS_ASSUME_NONNULL_BEGIN 18 | 19 | typedef NS_ENUM(NSInteger, MRMailSDKInternalAuthMode) { 20 | kMRMailSDKInternalAuthMode_Safari = 0, // use SKSafariViewController for internal authorization 21 | kMRMailSDKInternalAuthMode_WebKit // use WKWebView for internal authorization 22 | }; 23 | 24 | @protocol MRMailSDKDelegate 25 | 26 | @optional 27 | /** 28 | * Notifies about authorization was completed and returns authorization result 29 | */ 30 | - (void)mrMailSDK:(MRMailSDK *)sdk authorizationDidFinishWithResult:(MRSDKAuthorizationResult *)result; 31 | 32 | /** 33 | * Notifies about error occurred during authorization 34 | * @param sdk - reference to MRMailSDK instance 35 | * @param error - NSError 36 | */ 37 | - (void)mrMailSDK:(MRMailSDK *)sdk authorizationDidFailWithError:(NSError *)error; 38 | 39 | - (void)mrMailSDK:(MRMailSDK *)sdk authorizationDidFinishWithCode:(NSString *)code __attribute__((deprecated("Use `mrMailSDK:authorizationDidFinishWithResult:` instead"))); 40 | 41 | @end 42 | 43 | @protocol MRMailSDKUIDelegate 44 | 45 | /** 46 | Pass view controller that should be presented to user. Usually, it's an authorization window. 47 | @param controller view controller that must be shown to user 48 | */ 49 | - (void)mrMailSDK:(MRMailSDK *)sdk shouldPresentViewController:(UIViewController *)controller; 50 | 51 | @optional 52 | /** 53 | * Called when a controller presented by SDK will be dismissed. 54 | */ 55 | - (void)mrMailSDK:(MRMailSDK *)sdk willDismissViewController:(UIViewController *)controller; 56 | 57 | /** 58 | * Called when a controller presented by SDK did dismiss. 59 | */ 60 | - (void)mrMailSDK:(MRMailSDK *)sdk didDismissViewController:(UIViewController *)controller; 61 | 62 | /** 63 | * The SDK flow has finished selecting how to proceed, and the UI should no longer display 64 | * a spinner or other "please wait" element. 65 | */ 66 | - (void)mrMailSDKWillDispatch:(MRMailSDK *)sdk; 67 | 68 | @end 69 | 70 | @interface MRMailSDK : NSObject 71 | 72 | /** 73 | * Returns a shared MRMailSDK instance. 74 | */ 75 | + (instancetype)sharedInstance; 76 | 77 | /** 78 | * Configure required SDK parameters 79 | * @param clientID - Client ID of the application (https://o2.mail.ru/docs/) 80 | * @param redirectURI - Redirect url in case of success authorization (https://o2.mail.ru/docs/), SHOULDN'T CONTAIN UNDERSCORE SYMBOLS 81 | * @return YES in success case, otherwise NO 82 | */ 83 | - (BOOL)initializeWithClientID:(NSString *)clientID 84 | redirectURI:(NSString *)redirectURI; 85 | 86 | /** 87 | * Flag means that authorization process is in progress 88 | */ 89 | @property (nonatomic, readonly) BOOL authorizationIsInProgress; 90 | /** 91 | * The expected result type 92 | * default value – Code 93 | */ 94 | @property (nonatomic, assign) MRSDKAuthorizationResultType resultType; 95 | /** 96 | * Client ID of the application (https://o2.mail.ru/docs/). 97 | * This property is REQUIRED for authorization. 98 | */ 99 | @property (nonatomic, copy, readonly) NSString *clientID; 100 | /** 101 | * Client Secret of the application (https://o2.mail.ru/docs/) 102 | * This property is REQUIRED for authorization with Token result 103 | */ 104 | @property (nonatomic, nullable, copy) NSString *clientSecret; 105 | /** 106 | * Redirect url in case of success authorization (https://o2.mail.ru/docs/). 107 | * This property is REQUIRED for authorization. 108 | */ 109 | @property (nonatomic, copy, readonly) NSString *redirectURI; 110 | 111 | /** 112 | * returnScheme will be opened as result of MRMail (external) authorization 113 | * This property is OPTIONAL. If you set it, set it before calling authorize 114 | * If it is not set ONLY INTERNAL AUTHORIZATION IS AVAILABLE 115 | */ 116 | @property (nonatomic, copy) NSString *returnScheme; 117 | 118 | /** 119 | * Scope of the token (https://o2.mail.ru/docs/). 120 | * This property is OPTIONAL. If you set it, set it before calling authorize 121 | */ 122 | @property (nonatomic, copy, nullable) NSArray *scopes; 123 | /** 124 | * Flag enables PKCE (https://tools.ietf.org/html/rfc7636) 125 | * Default value - False for code authorization code result and True otherwize 126 | */ 127 | @property (nonatomic, getter=isProofKeyForCodeExchangeEnabled, assign) BOOL proofKeyForCodeExchangeEnabled; 128 | 129 | /** 130 | * Additional string for redirect_uri (https://o2.mail.ru/docs/). 131 | * This property is OPTIONAL. If you set it, set it before calling authorize 132 | */ 133 | @property (nonatomic, copy, nullable) NSString *state; 134 | 135 | /** 136 | * Flag enables authorization through mail application if it was installed 137 | * Default value - True 138 | */ 139 | @property (nonatomic, assign) BOOL usesMailApplication; 140 | 141 | /** 142 | * Setup mode for for internal authorization 143 | * Default value - kMRMailSDKInternalAuthMode_Safari 144 | * If you set it, set it before calling authorize 145 | */ 146 | @property (nonatomic, assign) MRMailSDKInternalAuthMode internalAuthMode; 147 | 148 | /** 149 | * The login hint that will be prefilled if possible 150 | */ 151 | @property (nonatomic, nullable, copy) NSString *loginHint; 152 | 153 | /** 154 | * The object to be notified with sdk events (authorization is finished or failed). 155 | */ 156 | @property (nonatomic, weak, nullable) id delegate; 157 | 158 | /** 159 | * The object to be notified with UI events related to presentation. 160 | */ 161 | @property (nonatomic, weak, nullable) id uiDelegate; 162 | 163 | /** 164 | * Start authorization process. 165 | */ 166 | - (void)authorize; 167 | 168 | /** 169 | * Cancel current authorization process 170 | */ 171 | - (void)cancelAuthorization; 172 | 173 | /** 174 | * Clear all stored cookies and values for authorized accounts. 175 | */ 176 | - (void)forceLogout; 177 | 178 | /** 179 | * This method should be called from your UIApplicationDelegate's application:openURL:options: 180 | * Returns YES if MRMailSDK handled this URL. 181 | */ 182 | - (BOOL)handleURL:(NSURL *)url 183 | sourceApplication:(nullable NSString *)sourceApplication 184 | annotation:(nullable id)annotation; 185 | 186 | /** 187 | * Start internal authorization (without MRMail application). 188 | */ 189 | - (void)authorizeInternally __attribute__((deprecated("use `usesMailApplicationUserAgent` flag instead"))); 190 | 191 | // Disable methods for instance creation, use sharedInstance instead 192 | + (instancetype)new NS_UNAVAILABLE; 193 | - (instancetype)init NS_UNAVAILABLE; 194 | 195 | @end 196 | 197 | NS_ASSUME_NONNULL_END 198 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mail.Ru iOS SDK 2 | 3 | SDK позволяет пользователям сторонних iOS приложений пройти авторизацию через учетную запись Mail.Ru. После этого можно использовать код авторизации для получения информации о пользователе, как описано в руководстве [OAuth 2.0 Авторизация](https://o2.mail.ru/docs/). 4 | 5 | Страница проекта и исходный код: https://github.com/mailru/mail-auth-sdk-ios. 6 | 7 | Поддерживаются версии iOS 9.0 и выше. 8 | 9 | # Подготовка к использованию 10 | 11 | Перед началом работы с Mail.Ru SDK необходимо [создать приложение](https://o2.mail.ru/app/). Сохраните ваш **ID приложения** и заполните обязательные поля. 12 | 13 | ![Пример настроек приложения](docs/app-example.png) 14 | 15 | ## Настройка URL-схемы в iOS приложении 16 | 17 | Для авторизации через Mail.Ru SDK необходимо настроить URL-схему вашего приложения. Для этого добавьте в раздел `URL Types → URL Schemes` файла `Info.plist` вашего проекта: 18 | 19 | - Схему для возврата из приложения Почта Mail.Ru результатов авторизации. Ее нужно будет указать при инициализации SDK в свойстве `returnScheme`. 20 | - Если вы выберете вариант авторизации через `SafariViewController`, необходимо так же добавить схему, указанную в настройках приложения в поле **redirect_uri**. 21 | 22 | Эти схемы могут совпадать, тогда достаточно добавить в `Info.plist` только один пункт. 23 | 24 | В раздел `LSApplicationQueriesSchemes` файла `Info.plist` добавьте схему `mr-mail-oauth2`. Благодаря этому, SDK сможет узнать, установлено ли приложение Почта Mail.Ru на устройстве и авторизоваться через него. 25 | 26 | Подробнее об этих настройках вы можете прочитать в руководстве Apple [App Programming Guide for iOS](https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html#//apple_ref/doc/uid/TP40007072-CH6-SW10) и [Information Property List Key Reference](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html). 27 | 28 | # Подключение SDK к приложению 29 | 30 | Интегрировать библиотеку можно при помощи Cocoapods, Carthage или без использования менеджеров зависимостей. Примеры интеграции и использования можно найти в папке `samples`. 31 | 32 | ## С помощью CocoaPods 33 | 34 | CocoaPods — это менеджер зависимостей в проектов на Objective-C и Swift, упрощающий процесс использования сторонних библиотек, таких как Mail.Ru SDK. Подробнее о нем вы можете прочитать в руководстве [Getting Started](https://guides.cocoapods.org/using/getting-started.html). 35 | 36 | Добавьте в ваш Podfile строку: 37 | 38 | ``` 39 | pod 'MRMailSDK' 40 | ``` 41 | 42 | И выполните команду: 43 | 44 | ``` 45 | pod install 46 | ``` 47 | 48 | ## С помощью Carthage 49 | 50 | Добавьте в ваш `Cartfile` строку: 51 | 52 | ``` 53 | github "mailru/mail-auth-sdk-ios" 54 | ``` 55 | 56 | Выполните команду: 57 | 58 | ``` 59 | carthage update 60 | ``` 61 | 62 | И подключите собранный фреймворк к проекту как описано в [инструкции](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos). 63 | 64 | ## Без использования менеджеров зависимостей 65 | 66 | Добавьте проект `mr-mail-sdk.xcodeproj` в ваш проект в качестве подпроекта. Затем в свойствах вашего проекта найдите настройку `General → Embedded Binaries` и добавьте `mr-mail-sdk.framework`. 67 | 68 | # Работа с SDK 69 | 70 | ## Инициализация 71 | 72 | Поместите этот код в класс Application Delegate, заменив строки на те, что указаны в настройках вашего приложения: 73 | 74 | ```objective-c 75 | #import 76 | 77 | @implementation AppDelegate 78 | 79 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 80 | MRMailSDK *mailSDK = [MRMailSDK sharedInstance]; 81 | [mailSDK initializeWithClientID:@"bddc421472584782aacd6d7549cbc31b" 82 | redirectURI:@"sample-auth-callback://"]; 83 | mailSDK.returnScheme = @"sample-auth-callback"; 84 | return YES; 85 | } 86 | 87 | - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { 88 | return [[MRMailSDK sharedInstance] handleURL:url 89 | sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey] 90 | annotation:options[UIApplicationOpenURLOptionsAnnotationKey]]; 91 | } 92 | 93 | @end 94 | ``` 95 | 96 | То же самое на Swift: 97 | 98 | ```swift 99 | import MRMailSDK 100 | 101 | @UIApplicationMain 102 | class AppDelegate: UIResponder, UIApplicationDelegate, MRMailSDKDelegate { 103 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 104 | let mailSDK = MRMailSDK.sharedInstance() 105 | mailSDK.initialize(withClientID: "bddc421472584782aacd6d7549cbc31b", redirectURI: "sample-auth-callback://") 106 | mailSDK.returnScheme = "sample-auth-callback" 107 | return true 108 | } 109 | 110 | func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { 111 | let sourceApplication = options[.sourceApplication] as? String 112 | let annotation = options[.annotation] as? String 113 | return MRMailSDK.sharedInstance().handle(url, sourceApplication: sourceApplication, annotation: annotation) 114 | } 115 | } 116 | ``` 117 | 118 | ## Авторизация через учетную запись Mail.Ru 119 | 120 | Задайте делегат, ему будут передаваться результаты авторизации. 121 | 122 | ```objective-c 123 | MRMailSDK.sharedInstance.delegate = self; 124 | ``` 125 | 126 | Вызовите метод `authorize`, чтобы авторизоваться: 127 | 128 | ``` 129 | [MRMailSDK.sharedInstance authorize]; 130 | ``` 131 | 132 | Или воспользуйтесь готовой кнопкой `MRMailSignInButton`. 133 | 134 | ![Кнопка авторизации](docs/login-button.png) 135 | 136 | Если у пользователя установлено приложение Почта Mail.Ru и при инициализации был задан параметр `returnScheme`, то авторизация пройдет через него без ввода логина и пароля. Иначе откроется веб-интерфейс. Через параметр `internalAuthMode` можно задать, чтобы веб-интерфейс открывался в `SFSafariViewController` или в Web View, встроенном в SDK. 137 | 138 | В результате авторизации вызовется один из методов делегата. В случае успешной авторизации SDK вызовет метод `-[MRMailSDKDelegate mrMailSDK:authorizationDidFinishWithCode:]`, передав в него код авторизации. Этот код затем можно обменять на токен, а токен можно использовать для получения информации о пользователе, как описано в руководстве [OAuth 2.0 Авторизация](https://o2.mail.ru/docs/). 139 | 140 | ## Ошибки авторизации 141 | 142 | В случае ошибки будет вызван метод `-[MRMailSDKDelegate mrMailSDK:authorizationDidFailWithError:]`. Возможны следующие коды ошибок: 143 | 144 | - `kMRSDKUninitializedErrorCode` (0) — SDK не был инициализирован. 145 | - `kMRSDKIncorrectClientIdErrorCode` (1) — неправильный id приложения. 146 | - `kMRSDKAuthorizationAlreadyInProgressErrorCode` (2) — процесс авторизации уже запущен и еще не завершился. 147 | - `kMRSDKOAuthErrorCode` (3) — ошибка OAuth API. 148 | - `kMRSDKNetworkErrorCode` (4) — сетевая ошибка. 149 | - `kMRSDKCanceledByUserErrorCode` (5) — процесс авторизации прерван пользователем. 150 | - `kMRSDKUnauthorizedApplicationErrorCode` (6) — ваше приложение не имеет разрешения на авторизацию. 151 | - `kMRSDKExternalOAuthDisabledErrorCode` (7) — OAuth авторизация отключена. 152 | - `kMRSDKExternalOAuthRefuseErrorCode` (8) — OAuth авторизация отклонена. 153 | 154 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 52 | 59 | 60 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /sample/MRAuthorizationSample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 835F2474678945415A301A83 /* libPods-MRAuthorizationSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B374FD8BD1D2178FF8D85129 /* libPods-MRAuthorizationSample.a */; }; 11 | AC2000311ECB44DC005064F4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AC2000301ECB44DC005064F4 /* main.m */; }; 12 | AC2000341ECB44DC005064F4 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AC2000331ECB44DC005064F4 /* AppDelegate.m */; }; 13 | AC2000371ECB44DC005064F4 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AC2000361ECB44DC005064F4 /* ViewController.m */; }; 14 | AC20003A1ECB44DC005064F4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AC2000381ECB44DC005064F4 /* Main.storyboard */; }; 15 | AC20003C1ECB44DC005064F4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AC20003B1ECB44DC005064F4 /* Assets.xcassets */; }; 16 | AC20003F1ECB44DC005064F4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AC20003D1ECB44DC005064F4 /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 6EA052C9FA242DEF7D3F8E5F /* Pods-MRAuthorizationSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MRAuthorizationSample.release.xcconfig"; path = "Target Support Files/Pods-MRAuthorizationSample/Pods-MRAuthorizationSample.release.xcconfig"; sourceTree = ""; }; 21 | 855236842063C2300072BFFC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 22 | 855236852063C2300072BFFC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 23 | 855236892063C2A70072BFFC /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Main.strings; sourceTree = ""; }; 24 | 8552368B2063C2D90072BFFC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = ""; }; 25 | 858E0F4D2063E88500286AFC /* MRMailSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MRMailSDK.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | 8FD6F17522BA58480078D40B /* MRAuthorizationSample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MRAuthorizationSample.entitlements; sourceTree = ""; }; 27 | AC20002C1ECB44DC005064F4 /* MRAuthorizationSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MRAuthorizationSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | AC2000301ECB44DC005064F4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | AC2000321ECB44DC005064F4 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 30 | AC2000331ECB44DC005064F4 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 31 | AC2000351ECB44DC005064F4 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 32 | AC2000361ECB44DC005064F4 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 33 | AC20003B1ECB44DC005064F4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 34 | AC2000401ECB44DC005064F4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | AC20004C1ECB519F005064F4 /* MRMailSdk.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MRMailSdk.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | B374FD8BD1D2178FF8D85129 /* libPods-MRAuthorizationSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MRAuthorizationSample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | ED896810B22D23D09B7BB305 /* Pods-MRAuthorizationSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MRAuthorizationSample.debug.xcconfig"; path = "Target Support Files/Pods-MRAuthorizationSample/Pods-MRAuthorizationSample.debug.xcconfig"; sourceTree = ""; }; 38 | /* End PBXFileReference section */ 39 | 40 | /* Begin PBXFrameworksBuildPhase section */ 41 | AC2000291ECB44DC005064F4 /* Frameworks */ = { 42 | isa = PBXFrameworksBuildPhase; 43 | buildActionMask = 2147483647; 44 | files = ( 45 | 835F2474678945415A301A83 /* libPods-MRAuthorizationSample.a in Frameworks */, 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | /* End PBXFrameworksBuildPhase section */ 50 | 51 | /* Begin PBXGroup section */ 52 | 00F1ABBCD523D7EFE32C7CCC /* Pods */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | ED896810B22D23D09B7BB305 /* Pods-MRAuthorizationSample.debug.xcconfig */, 56 | 6EA052C9FA242DEF7D3F8E5F /* Pods-MRAuthorizationSample.release.xcconfig */, 57 | ); 58 | path = Pods; 59 | sourceTree = ""; 60 | }; 61 | AC2000231ECB44DB005064F4 = { 62 | isa = PBXGroup; 63 | children = ( 64 | AC20002E1ECB44DC005064F4 /* MRAuthorizationSample */, 65 | AC20002D1ECB44DC005064F4 /* Products */, 66 | AC2000461ECB460B005064F4 /* Frameworks */, 67 | 00F1ABBCD523D7EFE32C7CCC /* Pods */, 68 | ); 69 | sourceTree = ""; 70 | }; 71 | AC20002D1ECB44DC005064F4 /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | AC20002C1ECB44DC005064F4 /* MRAuthorizationSample.app */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | AC20002E1ECB44DC005064F4 /* MRAuthorizationSample */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | AC2000321ECB44DC005064F4 /* AppDelegate.h */, 83 | AC2000331ECB44DC005064F4 /* AppDelegate.m */, 84 | AC2000351ECB44DC005064F4 /* ViewController.h */, 85 | AC2000361ECB44DC005064F4 /* ViewController.m */, 86 | 8FD6F17522BA58480078D40B /* MRAuthorizationSample.entitlements */, 87 | AC2000381ECB44DC005064F4 /* Main.storyboard */, 88 | AC20003B1ECB44DC005064F4 /* Assets.xcassets */, 89 | AC20003D1ECB44DC005064F4 /* LaunchScreen.storyboard */, 90 | AC2000401ECB44DC005064F4 /* Info.plist */, 91 | AC20002F1ECB44DC005064F4 /* Supporting Files */, 92 | ); 93 | path = MRAuthorizationSample; 94 | sourceTree = ""; 95 | }; 96 | AC20002F1ECB44DC005064F4 /* Supporting Files */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | AC2000301ECB44DC005064F4 /* main.m */, 100 | ); 101 | name = "Supporting Files"; 102 | sourceTree = ""; 103 | }; 104 | AC2000461ECB460B005064F4 /* Frameworks */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 858E0F4D2063E88500286AFC /* MRMailSDK.framework */, 108 | AC20004C1ECB519F005064F4 /* MRMailSdk.framework */, 109 | B374FD8BD1D2178FF8D85129 /* libPods-MRAuthorizationSample.a */, 110 | ); 111 | name = Frameworks; 112 | sourceTree = ""; 113 | }; 114 | /* End PBXGroup section */ 115 | 116 | /* Begin PBXNativeTarget section */ 117 | AC20002B1ECB44DC005064F4 /* MRAuthorizationSample */ = { 118 | isa = PBXNativeTarget; 119 | buildConfigurationList = AC2000431ECB44DC005064F4 /* Build configuration list for PBXNativeTarget "MRAuthorizationSample" */; 120 | buildPhases = ( 121 | 6B1A117538AE1E9AED062CAD /* [CP] Check Pods Manifest.lock */, 122 | AC2000281ECB44DC005064F4 /* Sources */, 123 | AC2000291ECB44DC005064F4 /* Frameworks */, 124 | AC20002A1ECB44DC005064F4 /* Resources */, 125 | 469F24EBBED1B57F3F0C01DD /* [CP] Copy Pods Resources */, 126 | ); 127 | buildRules = ( 128 | ); 129 | dependencies = ( 130 | ); 131 | name = MRAuthorizationSample; 132 | productName = MRAuthorizationSample; 133 | productReference = AC20002C1ECB44DC005064F4 /* MRAuthorizationSample.app */; 134 | productType = "com.apple.product-type.application"; 135 | }; 136 | /* End PBXNativeTarget section */ 137 | 138 | /* Begin PBXProject section */ 139 | AC2000241ECB44DB005064F4 /* Project object */ = { 140 | isa = PBXProject; 141 | attributes = { 142 | LastUpgradeCheck = 0920; 143 | ORGANIZATIONNAME = Mail.Ru; 144 | TargetAttributes = { 145 | AC20002B1ECB44DC005064F4 = { 146 | CreatedOnToolsVersion = 8.3.2; 147 | DevelopmentTeam = L2QFT5NA2Q; 148 | ProvisioningStyle = Manual; 149 | SystemCapabilities = { 150 | com.apple.ApplicationGroups.iOS = { 151 | enabled = 1; 152 | }; 153 | com.apple.Keychain = { 154 | enabled = 1; 155 | }; 156 | com.apple.iCloud = { 157 | enabled = 1; 158 | }; 159 | }; 160 | }; 161 | }; 162 | }; 163 | buildConfigurationList = AC2000271ECB44DB005064F4 /* Build configuration list for PBXProject "MRAuthorizationSample" */; 164 | compatibilityVersion = "Xcode 3.2"; 165 | developmentRegion = English; 166 | hasScannedForEncodings = 0; 167 | knownRegions = ( 168 | English, 169 | en, 170 | Base, 171 | ru, 172 | ); 173 | mainGroup = AC2000231ECB44DB005064F4; 174 | productRefGroup = AC20002D1ECB44DC005064F4 /* Products */; 175 | projectDirPath = ""; 176 | projectRoot = ""; 177 | targets = ( 178 | AC20002B1ECB44DC005064F4 /* MRAuthorizationSample */, 179 | ); 180 | }; 181 | /* End PBXProject section */ 182 | 183 | /* Begin PBXResourcesBuildPhase section */ 184 | AC20002A1ECB44DC005064F4 /* Resources */ = { 185 | isa = PBXResourcesBuildPhase; 186 | buildActionMask = 2147483647; 187 | files = ( 188 | AC20003F1ECB44DC005064F4 /* LaunchScreen.storyboard in Resources */, 189 | AC20003C1ECB44DC005064F4 /* Assets.xcassets in Resources */, 190 | AC20003A1ECB44DC005064F4 /* Main.storyboard in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXShellScriptBuildPhase section */ 197 | 469F24EBBED1B57F3F0C01DD /* [CP] Copy Pods Resources */ = { 198 | isa = PBXShellScriptBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | ); 202 | inputPaths = ( 203 | "${PODS_ROOT}/Target Support Files/Pods-MRAuthorizationSample/Pods-MRAuthorizationSample-resources.sh", 204 | "${PODS_CONFIGURATION_BUILD_DIR}/MRMailSDK/MRMailSDKUI.bundle", 205 | ); 206 | name = "[CP] Copy Pods Resources"; 207 | outputPaths = ( 208 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MRMailSDKUI.bundle", 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | shellPath = /bin/sh; 212 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MRAuthorizationSample/Pods-MRAuthorizationSample-resources.sh\"\n"; 213 | showEnvVarsInLog = 0; 214 | }; 215 | 6B1A117538AE1E9AED062CAD /* [CP] Check Pods Manifest.lock */ = { 216 | isa = PBXShellScriptBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | ); 220 | inputFileListPaths = ( 221 | ); 222 | inputPaths = ( 223 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 224 | "${PODS_ROOT}/Manifest.lock", 225 | ); 226 | name = "[CP] Check Pods Manifest.lock"; 227 | outputFileListPaths = ( 228 | ); 229 | outputPaths = ( 230 | "$(DERIVED_FILE_DIR)/Pods-MRAuthorizationSample-checkManifestLockResult.txt", 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | shellPath = /bin/sh; 234 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 235 | showEnvVarsInLog = 0; 236 | }; 237 | /* End PBXShellScriptBuildPhase section */ 238 | 239 | /* Begin PBXSourcesBuildPhase section */ 240 | AC2000281ECB44DC005064F4 /* Sources */ = { 241 | isa = PBXSourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | AC2000371ECB44DC005064F4 /* ViewController.m in Sources */, 245 | AC2000341ECB44DC005064F4 /* AppDelegate.m in Sources */, 246 | AC2000311ECB44DC005064F4 /* main.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | /* End PBXSourcesBuildPhase section */ 251 | 252 | /* Begin PBXVariantGroup section */ 253 | AC2000381ECB44DC005064F4 /* Main.storyboard */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | 855236842063C2300072BFFC /* Base */, 257 | 855236892063C2A70072BFFC /* ru */, 258 | 8552368B2063C2D90072BFFC /* en */, 259 | ); 260 | name = Main.storyboard; 261 | sourceTree = ""; 262 | }; 263 | AC20003D1ECB44DC005064F4 /* LaunchScreen.storyboard */ = { 264 | isa = PBXVariantGroup; 265 | children = ( 266 | 855236852063C2300072BFFC /* Base */, 267 | ); 268 | name = LaunchScreen.storyboard; 269 | sourceTree = ""; 270 | }; 271 | /* End PBXVariantGroup section */ 272 | 273 | /* Begin XCBuildConfiguration section */ 274 | AC2000411ECB44DC005064F4 /* Debug */ = { 275 | isa = XCBuildConfiguration; 276 | buildSettings = { 277 | ALWAYS_SEARCH_USER_PATHS = NO; 278 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 279 | CLANG_ANALYZER_NONNULL = YES; 280 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 281 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 282 | CLANG_CXX_LIBRARY = "libc++"; 283 | CLANG_ENABLE_MODULES = YES; 284 | CLANG_ENABLE_OBJC_ARC = YES; 285 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 286 | CLANG_WARN_BOOL_CONVERSION = YES; 287 | CLANG_WARN_COMMA = YES; 288 | CLANG_WARN_CONSTANT_CONVERSION = YES; 289 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 290 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INFINITE_RECURSION = YES; 294 | CLANG_WARN_INT_CONVERSION = YES; 295 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 296 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 297 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 298 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 299 | CLANG_WARN_STRICT_PROTOTYPES = YES; 300 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 301 | CLANG_WARN_UNREACHABLE_CODE = YES; 302 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 303 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 304 | COPY_PHASE_STRIP = NO; 305 | DEBUG_INFORMATION_FORMAT = dwarf; 306 | ENABLE_STRICT_OBJC_MSGSEND = YES; 307 | ENABLE_TESTABILITY = YES; 308 | GCC_C_LANGUAGE_STANDARD = gnu99; 309 | GCC_DYNAMIC_NO_PIC = NO; 310 | GCC_NO_COMMON_BLOCKS = YES; 311 | GCC_OPTIMIZATION_LEVEL = 0; 312 | GCC_PREPROCESSOR_DEFINITIONS = ( 313 | "DEBUG=1", 314 | "$(inherited)", 315 | ); 316 | GCC_TREAT_WARNINGS_AS_ERRORS = YES; 317 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 318 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 319 | GCC_WARN_UNDECLARED_SELECTOR = YES; 320 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 321 | GCC_WARN_UNUSED_FUNCTION = YES; 322 | GCC_WARN_UNUSED_VARIABLE = YES; 323 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 324 | MTL_ENABLE_DEBUG_INFO = YES; 325 | ONLY_ACTIVE_ARCH = YES; 326 | SDKROOT = iphoneos; 327 | TARGETED_DEVICE_FAMILY = "1,2"; 328 | }; 329 | name = Debug; 330 | }; 331 | AC2000421ECB44DC005064F4 /* Release */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | ALWAYS_SEARCH_USER_PATHS = NO; 335 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 336 | CLANG_ANALYZER_NONNULL = YES; 337 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 355 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 356 | CLANG_WARN_STRICT_PROTOTYPES = YES; 357 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = NO; 362 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 363 | ENABLE_NS_ASSERTIONS = NO; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_TREAT_WARNINGS_AS_ERRORS = YES; 368 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 369 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 370 | GCC_WARN_UNDECLARED_SELECTOR = YES; 371 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 372 | GCC_WARN_UNUSED_FUNCTION = YES; 373 | GCC_WARN_UNUSED_VARIABLE = YES; 374 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 375 | MTL_ENABLE_DEBUG_INFO = NO; 376 | SDKROOT = iphoneos; 377 | TARGETED_DEVICE_FAMILY = "1,2"; 378 | VALIDATE_PRODUCT = YES; 379 | }; 380 | name = Release; 381 | }; 382 | AC2000441ECB44DC005064F4 /* Debug */ = { 383 | isa = XCBuildConfiguration; 384 | baseConfigurationReference = ED896810B22D23D09B7BB305 /* Pods-MRAuthorizationSample.debug.xcconfig */; 385 | buildSettings = { 386 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 387 | CODE_SIGN_ENTITLEMENTS = MRAuthorizationSample/MRAuthorizationSample.entitlements; 388 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; 389 | DEVELOPMENT_TEAM = L2QFT5NA2Q; 390 | INFOPLIST_FILE = MRAuthorizationSample/Info.plist; 391 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 392 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 393 | PRODUCT_BUNDLE_IDENTIFIER = ru.mail.mail.sdk.MRAuthorizationSample; 394 | PRODUCT_NAME = "$(TARGET_NAME)"; 395 | PROVISIONING_PROFILE = "4d64de6d-1b14-4a13-8686-a5e0082997fa"; 396 | PROVISIONING_PROFILE_SPECIFIER = "XC: *"; 397 | }; 398 | name = Debug; 399 | }; 400 | AC2000451ECB44DC005064F4 /* Release */ = { 401 | isa = XCBuildConfiguration; 402 | baseConfigurationReference = 6EA052C9FA242DEF7D3F8E5F /* Pods-MRAuthorizationSample.release.xcconfig */; 403 | buildSettings = { 404 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 405 | CODE_SIGN_ENTITLEMENTS = MRAuthorizationSample/MRAuthorizationSample.entitlements; 406 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; 407 | DEVELOPMENT_TEAM = L2QFT5NA2Q; 408 | INFOPLIST_FILE = MRAuthorizationSample/Info.plist; 409 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 411 | PRODUCT_BUNDLE_IDENTIFIER = ru.mail.mail.sdk.MRAuthorizationSample; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | PROVISIONING_PROFILE = "4d64de6d-1b14-4a13-8686-a5e0082997fa"; 414 | PROVISIONING_PROFILE_SPECIFIER = "XC: *"; 415 | }; 416 | name = Release; 417 | }; 418 | /* End XCBuildConfiguration section */ 419 | 420 | /* Begin XCConfigurationList section */ 421 | AC2000271ECB44DB005064F4 /* Build configuration list for PBXProject "MRAuthorizationSample" */ = { 422 | isa = XCConfigurationList; 423 | buildConfigurations = ( 424 | AC2000411ECB44DC005064F4 /* Debug */, 425 | AC2000421ECB44DC005064F4 /* Release */, 426 | ); 427 | defaultConfigurationIsVisible = 0; 428 | defaultConfigurationName = Release; 429 | }; 430 | AC2000431ECB44DC005064F4 /* Build configuration list for PBXNativeTarget "MRAuthorizationSample" */ = { 431 | isa = XCConfigurationList; 432 | buildConfigurations = ( 433 | AC2000441ECB44DC005064F4 /* Debug */, 434 | AC2000451ECB44DC005064F4 /* Release */, 435 | ); 436 | defaultConfigurationIsVisible = 0; 437 | defaultConfigurationName = Release; 438 | }; 439 | /* End XCConfigurationList section */ 440 | }; 441 | rootObject = AC2000241ECB44DB005064F4 /* Project object */; 442 | } 443 | -------------------------------------------------------------------------------- /mr-mail-sdk/sources/MRMailSDK.m: -------------------------------------------------------------------------------- 1 | // 2 | // MRMailSDK.m 3 | // mr-mail-sdk 4 | // 5 | // Created by Aleksandr Karimov on 16/05/2017. 6 | // Copyright © 2017 Mail.Ru. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MRMailSDK.h" 11 | #import "UIApplication+MRSDK.h" 12 | #import "NSMutableURLRequest+MRSDK.h" 13 | #import "NSData+MRSDK.h" 14 | #import "MRMailAuthRedirectURLParser.h" 15 | #import "MRSDKOAuthTokenResponseParser.h" 16 | #import "MRMailAuthParameters.h" 17 | #import "MRMailAuthParameters+Protected.h" 18 | #import "MRMailAuthParameters+QueryItems.h" 19 | #import "NSError+MRSDK.h" 20 | #import "MRInternalAuthHandler.h" 21 | #import "MRWebViewAuthHandler.h" 22 | #import "MRSafariAuthHandler.h" 23 | #import "MRSafariSessionAuthHandler.h" 24 | #import "MRMailSDK+Private.h" 25 | 26 | 27 | static NSString *const MRMailScheme = @"mr-mail-oauth2"; 28 | static NSString *const MRMailClientID = @"mail-ios"; 29 | static NSString *const MRMailDomain = @"mail.ru"; 30 | static NSString *const MRMailHost = @"authorize"; 31 | static NSString *const MRDefaultScope = @"userinfo"; 32 | static NSString *const MRDefaultState = @"default-state"; 33 | 34 | static NSString *const MROAuth2BaseURL = @"https://o2.mail.ru/"; 35 | static NSString *const MROAuth2TestBaseURL = @"https://o2.test.mail.ru/"; 36 | static NSString *const MROAuth2AuthorizationURLPath = @"login"; 37 | static NSString *const MROAuth2TokenURLPath = @"token"; 38 | 39 | static NSString *const MRCodeChallengeMethod = @"S256"; 40 | static const NSUInteger MRCodeVerifierSizeInBytes = 32; 41 | 42 | @interface MRMailSDK () 43 | 44 | @property (nonatomic, strong) id authHandler; 45 | @property (nonatomic) BOOL authorizationIsInProgress; 46 | @property (nonatomic, copy) NSString *codeVerifier; 47 | @property (nonatomic, strong) NSURLSession *urlSession; 48 | 49 | @property (nonatomic, copy, readwrite) NSString *clientID; 50 | @property (nonatomic, copy, readwrite) NSString *redirectURI; 51 | @property (nonatomic, getter=isInternalProofKeyForCodeExchangeEnabled, assign) NSNumber *internalProofKeyForCodeExchangeEnabled; 52 | 53 | @end 54 | 55 | @implementation MRMailSDK 56 | 57 | #pragma mark - shared instance 58 | 59 | + (instancetype)sharedInstance { 60 | static MRMailSDK *sharedSdkInstance = nil; 61 | static dispatch_once_t once; 62 | dispatch_once(&once, ^{ 63 | sharedSdkInstance = [[self alloc] init_]; 64 | }); 65 | return sharedSdkInstance; 66 | } 67 | 68 | #pragma mark - private init 69 | 70 | - (instancetype)init_ { 71 | return [super init]; 72 | } 73 | 74 | #pragma mark - public 75 | 76 | - (BOOL)initializeWithClientID:(NSString *)clientID 77 | redirectURI:(NSString *)redirectURI { 78 | NSCParameterAssert(clientID != nil); 79 | NSCParameterAssert(redirectURI != nil && ![redirectURI containsString:@"_"]); 80 | if (!clientID || !redirectURI || [redirectURI containsString:@"_"]) { 81 | return NO; 82 | } 83 | self.clientID = clientID; 84 | self.redirectURI = redirectURI; 85 | return YES; 86 | } 87 | 88 | - (void)authorize { 89 | NSAssert(self.isInitialized, @"MRMailSDK should be initialized"); 90 | 91 | if ([self abortStartingAuthorizationIfNeeded]) { 92 | return; 93 | } 94 | 95 | self.authorizationIsInProgress = YES; 96 | 97 | [self authorizeNonInteractivelyWithCompletionHandler:^(NSString *authorizationCode) { 98 | id delegate = self.uiDelegate; 99 | if ([delegate respondsToSelector:@selector(mrMailSDKWillDispatch:)]) { 100 | [delegate mrMailSDKWillDispatch:self]; 101 | } 102 | 103 | if (authorizationCode) { 104 | [self handleAuthorizationCompletionWithCode:authorizationCode]; 105 | } else { 106 | [self authorizeInteractively]; 107 | } 108 | }]; 109 | } 110 | 111 | - (void)authorizeInternally { 112 | self.usesMailApplication = NO; 113 | [self authorize]; 114 | } 115 | 116 | - (void)cancelAuthorization { 117 | if (!self.authorizationIsInProgress) { 118 | return; 119 | } 120 | self.authorizationIsInProgress = NO; 121 | 122 | NSURLSession *urlSession = self.urlSession; 123 | self.urlSession = nil; 124 | [urlSession invalidateAndCancel]; 125 | 126 | [self.authHandler cancel]; 127 | [self completeWithError:NSError.mrsdk_canceledByUserError]; 128 | } 129 | 130 | - (void)forceLogout { 131 | [self cancelAuthorization]; 132 | // clear stored OAuth2 cookies 133 | NSHTTPCookieStorage *storage = NSHTTPCookieStorage.sharedHTTPCookieStorage; 134 | [storage.cookies enumerateObjectsUsingBlock:^(NSHTTPCookie *cookie, NSUInteger idx, BOOL *stop) { 135 | if ([cookie.domain containsString:MRMailDomain]) { 136 | [storage deleteCookie:cookie]; 137 | } 138 | }]; 139 | WKWebsiteDataStore *dataStore = WKWebsiteDataStore.defaultDataStore; 140 | [dataStore fetchDataRecordsOfTypes:WKWebsiteDataStore.allWebsiteDataTypes 141 | completionHandler:^(NSArray *dataRecords) { 142 | [dataRecords enumerateObjectsUsingBlock:^(WKWebsiteDataRecord *record, NSUInteger idx, BOOL *stop) { 143 | if ([record.displayName containsString:MRMailDomain]) { 144 | [dataStore removeDataOfTypes:record.dataTypes 145 | forDataRecords:@[record] 146 | completionHandler:^{}]; 147 | } 148 | }]; 149 | }]; 150 | } 151 | 152 | - (BOOL)handleURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(nullable id)annotation { 153 | NSCAssert(self.isInitialized, @"MRMailSDK should be initialized"); 154 | if (!self.isInitialized) { 155 | return NO; 156 | } 157 | if (!self.authorizationIsInProgress) { 158 | NSError *error = [NSError mrsdk_unauthorizedApplicationError]; 159 | [self.delegate mrMailSDK:self authorizationDidFailWithError:error]; 160 | return NO; 161 | } 162 | NSURLComponents *components = [NSURLComponents componentsWithURL:url 163 | resolvingAgainstBaseURL:NO]; 164 | if ([self.authHandler handleURL:url sourceApplication:sourceApplication]) { 165 | return YES; 166 | } 167 | if ([components.scheme isEqualToString:self.returnScheme]) { 168 | [self processReceivedMailAppResults:components.queryItems]; 169 | return YES; 170 | } 171 | return NO; 172 | } 173 | 174 | - (void)setInternalAuthMode:(MRMailSDKInternalAuthMode)internalAuthMode { 175 | if (_internalAuthMode == internalAuthMode) { 176 | return; 177 | } 178 | _internalAuthMode = internalAuthMode; 179 | _authHandler = nil; 180 | } 181 | 182 | - (BOOL)isProofKeyForCodeExchangeEnabled { 183 | BOOL isEnabled = NO; 184 | if (self.internalProofKeyForCodeExchangeEnabled != nil) { 185 | isEnabled = self.internalProofKeyForCodeExchangeEnabled.boolValue; 186 | } else { 187 | isEnabled = self.resultType != MRSDKAuthorizationResultTypeCode; 188 | } 189 | return isEnabled; 190 | } 191 | 192 | - (void)setProofKeyForCodeExchangeEnabled:(BOOL)proofKeyForCodeExchangeEnabled { 193 | self.internalProofKeyForCodeExchangeEnabled = @(proofKeyForCodeExchangeEnabled); 194 | } 195 | 196 | 197 | #pragma mark - MRInternalAuthHandlerDelegate 198 | 199 | - (void)authHandlerShouldPresentViewController:(UIViewController *)controller { 200 | [_uiDelegate mrMailSDK:self shouldPresentViewController:controller]; 201 | } 202 | 203 | - (void)authHandlerDidFinishWithCode:(NSString *)code { 204 | [self handleAuthorizationCompletionWithCode:code]; 205 | } 206 | 207 | - (void)authHandlerDidFailWithError:(NSError *)error { 208 | [self completeWithError:error]; 209 | } 210 | 211 | - (void)authHandlerWillDismissViewController:(UIViewController *)controller { 212 | id delegate = self.uiDelegate; 213 | if ([delegate respondsToSelector:@selector(mrMailSDK:willDismissViewController:)]) { 214 | [delegate mrMailSDK:self willDismissViewController:controller]; 215 | } 216 | } 217 | 218 | - (void)authHandlerDidDismissViewController:(UIViewController *)controller { 219 | id delegate = self.uiDelegate; 220 | if ([delegate respondsToSelector:@selector(mrMailSDK:willDismissViewController:)]) { 221 | [delegate mrMailSDK:self didDismissViewController:controller]; 222 | } 223 | } 224 | 225 | #pragma mark - private 226 | 227 | - (BOOL)isInitialized { 228 | NSCAssert(self.clientID && self.redirectURI, @"SDK is not initialized, call initialize before work with SDK"); 229 | return self.clientID && self.redirectURI; 230 | } 231 | 232 | - (void)authorizeInteractively { 233 | if (self.proofKeyForCodeExchangeEnabled) { 234 | self.codeVerifier = [self generateCodeVerifier]; 235 | } 236 | if (self.usesMailApplication && self.isExternalAuthAvailable) { 237 | [[UIApplication mrsdk_sharedApplication] openURL:self.openInMailURL]; 238 | } else { 239 | [self performInternalAuthorization]; 240 | } 241 | } 242 | 243 | - (BOOL)isExternalAuthAvailable { 244 | return self.returnScheme && [[UIApplication mrsdk_sharedApplication] canOpenURL:self.openInMailURL]; 245 | } 246 | 247 | - (BOOL)abortStartingAuthorizationIfNeeded { 248 | NSError *error = nil; 249 | if (!self.isInitialized) { 250 | error = [NSError mrsdk_uninitializedError]; 251 | } else if (self.authorizationIsInProgress) { 252 | error = [NSError mrsdk_authorizationAlreadyInProgressError]; 253 | } else if (self.resultType == MRSDKAuthorizationResultTypeToken && self.clientSecret == nil) { 254 | error = [NSError errorWithDomain:kMRMailSDKErrorDomain code:kMRSDKUninitializedErrorCode userInfo:@{ 255 | NSHelpAnchorErrorKey: @"Client secret is required for authorization with token result", 256 | }]; 257 | } 258 | if (error) { 259 | [self.delegate mrMailSDK:self authorizationDidFailWithError:error]; 260 | } 261 | return (error != nil); 262 | } 263 | 264 | - (MRMailAuthParameters *)authorizationParameters { 265 | MRMailAuthParameters *authParameters = [MRMailAuthParameters new]; 266 | authParameters.clientId = self.clientID; 267 | authParameters.redirectUri = self.redirectURI; 268 | authParameters.scopes = self.scopes.count > 0 ? [self.scopes componentsJoinedByString:@" "] : MRDefaultScope; 269 | authParameters.state = self.state ?: MRDefaultState; 270 | authParameters.loginHint = self.loginHint; 271 | 272 | if (self.codeVerifier) { 273 | authParameters.codeChallenge = [self codeChallengeWithCodeVerifier:self.codeVerifier]; 274 | authParameters.challengeMethod = MRCodeChallengeMethod; 275 | } 276 | 277 | return authParameters; 278 | } 279 | 280 | - (void)processReceivedMailAppResults:(NSArray *)items { 281 | __block NSString *code = nil; 282 | __block NSString *errorCode = nil; 283 | __block NSString *errorDescription = nil; 284 | [items enumerateObjectsUsingBlock:^(NSURLQueryItem *item, NSUInteger idx, BOOL *stop) { 285 | if ([item.name isEqualToString:@"code"]) { 286 | code = item.value; 287 | } 288 | else if ([item.name isEqualToString:@"error"]) { 289 | errorCode = item.value; 290 | } 291 | else if ([item.name isEqualToString:@"error-description"]) { 292 | errorDescription = item.value; 293 | } 294 | }]; 295 | if (code) { 296 | [self handleAuthorizationCompletionWithCode:code]; 297 | } 298 | else if (errorCode) { 299 | NSError *error = [NSError mrsdk_errorFromCode:errorCode withDescription:errorDescription]; 300 | if (error.code == kMRSDKUnauthorizedApplicationErrorCode || 301 | error.code == kMRSDKExternalOAuthDisabledErrorCode || 302 | error.code == kMRSDKExternalOAuthRefuseErrorCode) { 303 | // external авторизация в MRMail для данного приложения не разрешена либо приложение не может в данный момент авторизовать, 304 | // пробуем сделать internal авторизацию 305 | [self performInternalAuthorization]; 306 | } 307 | else { 308 | [self completeWithError:error]; 309 | } 310 | } 311 | } 312 | 313 | - (void)authorizeNonInteractivelyWithCompletionHandler:(void(^)(NSString *authorizationCode))comletionHandler { 314 | comletionHandler(nil); 315 | } 316 | 317 | - (void)performInternalAuthorization { 318 | NSURLComponents *components = [NSURLComponents componentsWithURL:self.OAuth2AuthorizationURL resolvingAgainstBaseURL:YES]; 319 | NSArray *queryItems = self.authorizationParameters.mrsdk_queryItems; 320 | components.queryItems = [queryItems arrayByAddingObject:[NSURLQueryItem queryItemWithName:@"response_type" value:@"code"]]; 321 | [self.authHandler performAuthorizationWithURL:components.URL]; 322 | } 323 | 324 | - (id)authHandler { 325 | if (!_authHandler) { 326 | id authHandler; 327 | MRMailAuthRedirectURLParser *redirectURLParser = [[MRMailAuthRedirectURLParser alloc] initWithRedirectURI:self.redirectURI]; 328 | 329 | if (self.internalAuthMode == kMRMailSDKInternalAuthMode_WebKit) { 330 | authHandler = [[MRWebViewAuthHandler alloc] initWithRedirectURLParser:redirectURLParser]; 331 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 332 | } else if (@available(iOS 11.0, *)) { 333 | authHandler = [[MRSafariSessionAuthHandler alloc] initWithRedirectURI:self.redirectURI redirectURLParser:redirectURLParser]; 334 | #endif 335 | } else { 336 | authHandler = [[MRSafariAuthHandler alloc] initWithRedirectURLParser:redirectURLParser]; 337 | } 338 | authHandler.delegate = self; 339 | _authHandler = authHandler; 340 | } 341 | return _authHandler; 342 | } 343 | 344 | - (void)handleAuthorizationCompletionWithCode:(NSString *)authorizationCode { 345 | if (self.resultType == MRSDKAuthorizationResultTypeCode) { 346 | MRSDKAuthorizationResult *result = [[MRSDKAuthorizationResult alloc] initWithAuthorizationCode:authorizationCode codeVerifier:self.codeVerifier]; 347 | [self completeWithAuthorizationResult:result]; 348 | } else { 349 | [self requestTokenWithAuthorizationCode:authorizationCode]; 350 | } 351 | } 352 | 353 | #pragma mark - Private: Token Request 354 | 355 | - (void)requestTokenWithAuthorizationCode:(NSString *)authorizationCode { 356 | NSURLRequest *request = [self tokenRequestWithAuthorizationCode:authorizationCode]; 357 | 358 | self.urlSession = [NSURLSession sessionWithConfiguration:NSURLSessionConfiguration.ephemeralSessionConfiguration delegate:nil delegateQueue:NSOperationQueue.mainQueue]; 359 | NSURLSessionTask *task = [self.urlSession dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { 360 | if (self.urlSession == nil) { 361 | return; 362 | } 363 | if (error) { 364 | [self completeWithError:NSError.mrsdk_networkError]; 365 | return; 366 | } 367 | if (!data) { 368 | [self completeWithError:NSError.mrsdk_OAuthError]; 369 | return; 370 | } 371 | [self handleTokenResponseData:data]; 372 | }]; 373 | [task resume]; 374 | } 375 | 376 | - (void)handleTokenResponseData:(NSData *)responseData { 377 | MRSDKAuthorizationResult *authorizationResult; 378 | NSError *apiError; 379 | 380 | MRSDKOAuthTokenResponseParser *parser = [[MRSDKOAuthTokenResponseParser alloc] init]; 381 | BOOL isParsed = [parser getAuthorizationResult:&authorizationResult apiError:&apiError fromTokenResponseData:responseData]; 382 | if (isParsed && authorizationResult) { 383 | [self completeWithAuthorizationResult:authorizationResult]; 384 | } else { 385 | [self completeWithError:(apiError ?: NSError.mrsdk_OAuthError)]; 386 | } 387 | } 388 | 389 | - (NSURLRequest *)tokenRequestWithAuthorizationCode:(NSString *)authorizationCode { 390 | NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:self.OAuth2TokenURL]; 391 | request.HTTPMethod = @"POST"; 392 | 393 | [request addValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; 394 | if (self.clientID && self.clientSecret) { 395 | [request mrsdk_addBasicAccessAuthenticationHeaderFieldWithUsername:self.clientID password:self.clientSecret]; 396 | } 397 | 398 | NSMutableArray *bodyParameters = [NSMutableArray arrayWithArray:@[ 399 | [NSURLQueryItem queryItemWithName:@"code" value:authorizationCode], 400 | [NSURLQueryItem queryItemWithName:@"grant_type" value:@"authorization_code"], 401 | [NSURLQueryItem queryItemWithName:@"redirect_uri" value:self.redirectURI], 402 | ]]; 403 | if (self.codeVerifier) { 404 | [bodyParameters addObject:[NSURLQueryItem queryItemWithName:@"code_verifier" value:self.codeVerifier]]; 405 | } 406 | [request mrsdk_setHTTPBodyQueryItems:bodyParameters]; 407 | 408 | return request; 409 | } 410 | 411 | #pragma mark - Private: Proof Key for Code Exchange 412 | 413 | - (NSString *)generateCodeVerifier { 414 | NSData *randomData = [NSData mrsdk_randomlyFilledDataWithLength:MRCodeVerifierSizeInBytes]; 415 | if (!randomData) { 416 | return nil; 417 | } 418 | return [[NSString alloc] initWithData:randomData.mrsdk_base64URLNoPaddingEncoded encoding:kNilOptions]; 419 | } 420 | 421 | - (NSString *)codeChallengeWithCodeVerifier:(NSString *)codeVerifier { 422 | NSData *verifierData = [codeVerifier dataUsingEncoding:NSUTF8StringEncoding]; 423 | if (!verifierData) { 424 | return nil; 425 | } 426 | NSData *hashedVerifierData = verifierData.mrsdk_SHA256Hash.mrsdk_base64URLNoPaddingEncoded; 427 | 428 | return [[NSString alloc] initWithData:hashedVerifierData encoding:NSUTF8StringEncoding]; 429 | } 430 | 431 | #pragma mark - Private: URLs 432 | 433 | - (NSURL *)OAuth2AuthorizationURL { 434 | return (NSURL *_Nonnull)[NSURL URLWithString:MROAuth2AuthorizationURLPath relativeToURL:self.OAuth2BaseURL]; 435 | } 436 | 437 | - (NSURL *)OAuth2TokenURL { 438 | return (NSURL *_Nonnull)[NSURL URLWithString:MROAuth2TokenURLPath relativeToURL:self.OAuth2BaseURL]; 439 | } 440 | 441 | - (NSURL *)OAuth2BaseURL { 442 | NSString *urlString = self.useTestHosts ? MROAuth2TestBaseURL : MROAuth2BaseURL; 443 | return (NSURL *_Nonnull)[NSURL URLWithString:urlString]; 444 | } 445 | 446 | - (NSURL *)openInMailURL { 447 | NSURLComponents *components = [NSURLComponents new]; 448 | components.scheme = MRMailScheme; 449 | components.host = MRMailHost; 450 | 451 | NSArray *queryItems = self.authorizationParameters.mrsdk_queryItems; 452 | if (self.returnScheme) { 453 | queryItems = [queryItems arrayByAddingObject:[NSURLQueryItem queryItemWithName:@"return_scheme" value:self.returnScheme]]; 454 | } 455 | components.queryItems = queryItems; 456 | 457 | return components.URL; 458 | } 459 | 460 | #pragma mark - Private: Completion Handlers 461 | 462 | - (void)completeWithAuthorizationResult:(MRSDKAuthorizationResult *)authorizationResult { 463 | [self cleanUp]; 464 | 465 | id delegate = self.delegate; 466 | if ([delegate respondsToSelector:@selector(mrMailSDK:authorizationDidFinishWithResult:)]) { 467 | [delegate mrMailSDK:self authorizationDidFinishWithResult:authorizationResult]; 468 | } else if ([delegate respondsToSelector:@selector(mrMailSDK:authorizationDidFinishWithCode:)]) { 469 | if (authorizationResult.type == MRSDKAuthorizationResultTypeCode && !authorizationResult.codeVerifier) { 470 | #pragma clang diagnostic push 471 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 472 | [delegate mrMailSDK:self authorizationDidFinishWithCode:authorizationResult.authorizationCode]; 473 | #pragma clang diagnostic pop 474 | } else { 475 | if (authorizationResult.type == MRSDKAuthorizationResultTypeCode) { 476 | NSLog(@"[MRMailSDK] Use `mrMailSDK:authorizationDidFinishWithResult:` to get the code verifier"); 477 | } else { 478 | NSLog(@"[MRMailSDK] Use `mrMailSDK:authorizationDidFinishWithResult:` to get the token result"); 479 | } 480 | [self completeWithError:NSError.mrsdk_uninitializedError]; 481 | } 482 | } 483 | } 484 | 485 | - (void)completeWithError:(NSError *)error { 486 | [self cleanUp]; 487 | [self.delegate mrMailSDK:self authorizationDidFailWithError:error]; 488 | } 489 | 490 | - (void)cleanUp { 491 | self.urlSession = nil; 492 | self.codeVerifier = nil; 493 | self.authorizationIsInProgress = NO; 494 | } 495 | 496 | @end 497 | -------------------------------------------------------------------------------- /mr-mail-sdk.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 82B6606E80161CAC496D27E3 /* UIApplication+MRSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = 82B6665130DA2C488D5A28D6 /* UIApplication+MRSDK.m */; }; 11 | 82B660FA56E4400954A92B6A /* NSURL+MRSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = 82B6616467A0F15C0632D82D /* NSURL+MRSDK.m */; }; 12 | 82B661CE2326C333FEF6D58E /* MRMailAuthParameters+QueryItems.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B6606ED58CFC8C86042972 /* MRMailAuthParameters+QueryItems.h */; }; 13 | 82B661D67BDFA6B3A84B70A6 /* MRMailAuthParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B666AAC9E92CB781AAC2F5 /* MRMailAuthParameters.h */; }; 14 | 82B662E62FF73E77D9E554B9 /* NSError+MRSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = 82B66C23B51518EBD3292DA0 /* NSError+MRSDK.m */; }; 15 | 82B663FCE82AF0111156A281 /* NSError+MRSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B661F5FB0AE87744780F05 /* NSError+MRSDK.h */; }; 16 | 82B6653120EE503D7EFD073E /* MRMailSDKConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 82B664E33F259CADD8564C0D /* MRMailSDKConstants.m */; }; 17 | 82B665A9657B42563FD6E8DC /* MRMailSDKConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B66FAB6995601B80F69382 /* MRMailSDKConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 18 | 82B6666286F582FE3B413A6F /* MRSafariAuthHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 82B662F53D6AE4E67ACAB6BD /* MRSafariAuthHandler.m */; }; 19 | 82B66913D7B040638A91E01E /* UIApplication+MRSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B66EA28A5BC39FF35993FA /* UIApplication+MRSDK.h */; }; 20 | 82B6695881C8CBA239F21167 /* MRSafariAuthHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B66431373E020E81F348CE /* MRSafariAuthHandler.h */; }; 21 | 82B669885D88BD29E04E28C8 /* MRWebViewAuthHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B664D620887EE994A51830 /* MRWebViewAuthHandler.h */; }; 22 | 82B669CB8EBD1C6E043F7098 /* MRInternalAuthHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B66AAE30DDA0E84ED875A4 /* MRInternalAuthHandler.h */; }; 23 | 82B66B32D87BEAF216CDD281 /* NSURL+MRSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B66A7994D5940842FC6499 /* NSURL+MRSDK.h */; }; 24 | 82B66CE63DE49EA273817E86 /* MRWebViewAuthHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 82B66C68AEDF4F16CB28442C /* MRWebViewAuthHandler.m */; }; 25 | 82B66CF9E4E32AC4FD42E5F2 /* MRMailSDK+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B66BA82B60C450E0983236 /* MRMailSDK+Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26 | 82B66E508277F1634F11CFD0 /* MRMailAuthParameters+Protected.h in Headers */ = {isa = PBXBuildFile; fileRef = 82B66D367795919A6D6086E7 /* MRMailAuthParameters+Protected.h */; }; 27 | 82B66E9BB01F7629D86EED96 /* MRMailAuthParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 82B661947CBF290DAA686618 /* MRMailAuthParameters.m */; }; 28 | 82B66FE702049C5DE0F66B14 /* MRMailAuthParameters+QueryItems.m in Sources */ = {isa = PBXBuildFile; fileRef = 82B66A9D6C72BB44A8B9216C /* MRMailAuthParameters+QueryItems.m */; }; 29 | 8552367C2063BF730072BFFC /* MRMailSDKUI.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8552367E2063BF730072BFFC /* MRMailSDKUI.strings */; }; 30 | 858E0F512063F7A000286AFC /* NSBundle+MRSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = 858E0F4F2063F7A000286AFC /* NSBundle+MRSDK.h */; }; 31 | 858E0F522063F7A000286AFC /* NSBundle+MRSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = 858E0F502063F7A000286AFC /* NSBundle+MRSDK.m */; }; 32 | 85CC3ECC2063A68C0012559E /* MRMailSignInButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 85CC3ECA2063A68C0012559E /* MRMailSignInButton.h */; }; 33 | 85CC3ECD2063A68C0012559E /* MRMailSignInButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 85CC3ECB2063A68C0012559E /* MRMailSignInButton.m */; }; 34 | 85CC3ECF2063B33E0012559E /* MRMailSDKUI.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 85CC3ECE2063B33E0012559E /* MRMailSDKUI.xcassets */; }; 35 | 8F2AFCCB22BA20FF0015AE50 /* MRMailSDK+MailSignIn.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F2AFCCA22BA20FF0015AE50 /* MRMailSDK+MailSignIn.h */; }; 36 | 8F2CA42B1F263C7800C1B94F /* MRSafariSessionAuthHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F2CA4291F263C7800C1B94F /* MRSafariSessionAuthHandler.h */; }; 37 | 8F2CA42C1F263C7800C1B94F /* MRSafariSessionAuthHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F2CA42A1F263C7800C1B94F /* MRSafariSessionAuthHandler.m */; }; 38 | 8F3EFB5722FACE4400136617 /* NSMutableURLRequest+MRSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F3EFB5522FACE4300136617 /* NSMutableURLRequest+MRSDK.h */; }; 39 | 8F3EFB5822FACE4400136617 /* NSMutableURLRequest+MRSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F3EFB5622FACE4400136617 /* NSMutableURLRequest+MRSDK.m */; }; 40 | 8F3EFB5B22FAD3DA00136617 /* MRSDKOAuthTokenResponseParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F3EFB5922FAD3DA00136617 /* MRSDKOAuthTokenResponseParser.h */; }; 41 | 8F3EFB5C22FAD3DA00136617 /* MRSDKOAuthTokenResponseParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F3EFB5A22FAD3DA00136617 /* MRSDKOAuthTokenResponseParser.m */; }; 42 | 8F44869B1F26310900E7D646 /* MRMailAuthRedirectURLParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F4486991F26310900E7D646 /* MRMailAuthRedirectURLParser.h */; }; 43 | 8F44869C1F26310900E7D646 /* MRMailAuthRedirectURLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F44869A1F26310900E7D646 /* MRMailAuthRedirectURLParser.m */; }; 44 | 8F6C3BA122FAB6E800B524B6 /* MRSDKAuthorizationResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F6C3B9F22FAB6E800B524B6 /* MRSDKAuthorizationResult.h */; settings = {ATTRIBUTES = (Public, ); }; }; 45 | 8F6C3BA622FABF6000B524B6 /* MRSDKAuthorizationResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F6C3BA522FABF6000B524B6 /* MRSDKAuthorizationResult.m */; }; 46 | 8F6C3B9D22F9DD8500B524B6 /* NSData+MRSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F6C3B9B22F9DD8500B524B6 /* NSData+MRSDK.h */; }; 47 | 8F6C3B9E22F9DD8500B524B6 /* NSData+MRSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F6C3B9C22F9DD8500B524B6 /* NSData+MRSDK.m */; }; 48 | AC20FFEC1ECAFC0B005064F4 /* MRMailSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = AC20FFEA1ECAFC0B005064F4 /* MRMailSDK.h */; settings = {ATTRIBUTES = (Public, ); }; }; 49 | AC20FFED1ECAFC0B005064F4 /* MRMailSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = AC20FFEB1ECAFC0B005064F4 /* MRMailSDK.m */; }; 50 | ACB655011ECEE9CF0049D6F0 /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AC2000511ECC9B69005064F4 /* SafariServices.framework */; }; 51 | ACC49BE11ECD8D870021C69C /* MRMailWebViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = ACC49BDE1ECD8D870021C69C /* MRMailWebViewController.h */; }; 52 | ACC49BE21ECD8D870021C69C /* MRMailWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ACC49BDF1ECD8D870021C69C /* MRMailWebViewController.m */; }; 53 | ACC49BE51ECD95520021C69C /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ACC49BE41ECD95520021C69C /* WebKit.framework */; }; 54 | /* End PBXBuildFile section */ 55 | 56 | /* Begin PBXFileReference section */ 57 | 82B6606ED58CFC8C86042972 /* MRMailAuthParameters+QueryItems.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MRMailAuthParameters+QueryItems.h"; sourceTree = ""; }; 58 | 82B6616467A0F15C0632D82D /* NSURL+MRSDK.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+MRSDK.m"; sourceTree = ""; }; 59 | 82B661947CBF290DAA686618 /* MRMailAuthParameters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MRMailAuthParameters.m; sourceTree = ""; }; 60 | 82B661F5FB0AE87744780F05 /* NSError+MRSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSError+MRSDK.h"; sourceTree = ""; }; 61 | 82B662F53D6AE4E67ACAB6BD /* MRSafariAuthHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MRSafariAuthHandler.m; sourceTree = ""; }; 62 | 82B66431373E020E81F348CE /* MRSafariAuthHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MRSafariAuthHandler.h; sourceTree = ""; }; 63 | 82B664D620887EE994A51830 /* MRWebViewAuthHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MRWebViewAuthHandler.h; sourceTree = ""; }; 64 | 82B664E33F259CADD8564C0D /* MRMailSDKConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MRMailSDKConstants.m; sourceTree = ""; }; 65 | 82B6665130DA2C488D5A28D6 /* UIApplication+MRSDK.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIApplication+MRSDK.m"; sourceTree = ""; }; 66 | 82B666AAC9E92CB781AAC2F5 /* MRMailAuthParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MRMailAuthParameters.h; sourceTree = ""; }; 67 | 82B66A7994D5940842FC6499 /* NSURL+MRSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+MRSDK.h"; sourceTree = ""; }; 68 | 82B66A9D6C72BB44A8B9216C /* MRMailAuthParameters+QueryItems.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MRMailAuthParameters+QueryItems.m"; sourceTree = ""; }; 69 | 82B66AAE30DDA0E84ED875A4 /* MRInternalAuthHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MRInternalAuthHandler.h; sourceTree = ""; }; 70 | 82B66BA82B60C450E0983236 /* MRMailSDK+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MRMailSDK+Private.h"; sourceTree = ""; }; 71 | 82B66C23B51518EBD3292DA0 /* NSError+MRSDK.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSError+MRSDK.m"; sourceTree = ""; }; 72 | 82B66C68AEDF4F16CB28442C /* MRWebViewAuthHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MRWebViewAuthHandler.m; sourceTree = ""; }; 73 | 82B66D367795919A6D6086E7 /* MRMailAuthParameters+Protected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MRMailAuthParameters+Protected.h"; sourceTree = ""; }; 74 | 82B66EA28A5BC39FF35993FA /* UIApplication+MRSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication+MRSDK.h"; sourceTree = ""; }; 75 | 82B66FAB6995601B80F69382 /* MRMailSDKConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MRMailSDKConstants.h; sourceTree = ""; }; 76 | 8552367D2063BF730072BFFC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/MRMailSDKUI.strings; sourceTree = ""; }; 77 | 8552367F2063BF800072BFFC /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/MRMailSDKUI.strings; sourceTree = ""; }; 78 | 858E0F4F2063F7A000286AFC /* NSBundle+MRSDK.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSBundle+MRSDK.h"; sourceTree = ""; }; 79 | 858E0F502063F7A000286AFC /* NSBundle+MRSDK.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+MRSDK.m"; sourceTree = ""; }; 80 | 85CC3EC92063A4580012559E /* module.map */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.map; sourceTree = ""; }; 81 | 85CC3ECA2063A68C0012559E /* MRMailSignInButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MRMailSignInButton.h; sourceTree = ""; }; 82 | 85CC3ECB2063A68C0012559E /* MRMailSignInButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MRMailSignInButton.m; sourceTree = ""; }; 83 | 85CC3ECE2063B33E0012559E /* MRMailSDKUI.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = MRMailSDKUI.xcassets; sourceTree = ""; }; 84 | 8F2AFCCA22BA20FF0015AE50 /* MRMailSDK+MailSignIn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MRMailSDK+MailSignIn.h"; sourceTree = ""; }; 85 | 8F2CA4291F263C7800C1B94F /* MRSafariSessionAuthHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MRSafariSessionAuthHandler.h; sourceTree = ""; }; 86 | 8F2CA42A1F263C7800C1B94F /* MRSafariSessionAuthHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MRSafariSessionAuthHandler.m; sourceTree = ""; }; 87 | 8F3EFB5522FACE4300136617 /* NSMutableURLRequest+MRSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableURLRequest+MRSDK.h"; sourceTree = ""; }; 88 | 8F3EFB5622FACE4400136617 /* NSMutableURLRequest+MRSDK.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableURLRequest+MRSDK.m"; sourceTree = ""; }; 89 | 8F3EFB5922FAD3DA00136617 /* MRSDKOAuthTokenResponseParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MRSDKOAuthTokenResponseParser.h; sourceTree = ""; }; 90 | 8F3EFB5A22FAD3DA00136617 /* MRSDKOAuthTokenResponseParser.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MRSDKOAuthTokenResponseParser.m; sourceTree = ""; }; 91 | 8F4486991F26310900E7D646 /* MRMailAuthRedirectURLParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MRMailAuthRedirectURLParser.h; sourceTree = ""; }; 92 | 8F44869A1F26310900E7D646 /* MRMailAuthRedirectURLParser.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MRMailAuthRedirectURLParser.m; sourceTree = ""; }; 93 | 8F6C3B9F22FAB6E800B524B6 /* MRSDKAuthorizationResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MRSDKAuthorizationResult.h; sourceTree = ""; }; 94 | 8F6C3BA522FABF6000B524B6 /* MRSDKAuthorizationResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MRSDKAuthorizationResult.m; sourceTree = ""; }; 95 | 8F6C3B9B22F9DD8500B524B6 /* NSData+MRSDK.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+MRSDK.h"; sourceTree = ""; }; 96 | 8F6C3B9C22F9DD8500B524B6 /* NSData+MRSDK.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+MRSDK.m"; sourceTree = ""; }; 97 | AC1136421EB22CFA007E5E37 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = "mr-mail-sdk/Info.plist"; sourceTree = SOURCE_ROOT; }; 98 | AC2000511ECC9B69005064F4 /* SafariServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SafariServices.framework; path = System/Library/Frameworks/SafariServices.framework; sourceTree = SDKROOT; }; 99 | AC20FFEA1ECAFC0B005064F4 /* MRMailSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MRMailSDK.h; sourceTree = ""; }; 100 | AC20FFEB1ECAFC0B005064F4 /* MRMailSDK.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MRMailSDK.m; sourceTree = ""; }; 101 | ACC49BDE1ECD8D870021C69C /* MRMailWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MRMailWebViewController.h; sourceTree = ""; }; 102 | ACC49BDF1ECD8D870021C69C /* MRMailWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MRMailWebViewController.m; sourceTree = ""; }; 103 | ACC49BE41ECD95520021C69C /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 104 | ACF85C341EB0A6FB00534CE4 /* MRMailSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MRMailSDK.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 105 | /* End PBXFileReference section */ 106 | 107 | /* Begin PBXFrameworksBuildPhase section */ 108 | ACF85C301EB0A6FB00534CE4 /* Frameworks */ = { 109 | isa = PBXFrameworksBuildPhase; 110 | buildActionMask = 2147483647; 111 | files = ( 112 | ACB655011ECEE9CF0049D6F0 /* SafariServices.framework in Frameworks */, 113 | ACC49BE51ECD95520021C69C /* WebKit.framework in Frameworks */, 114 | ); 115 | runOnlyForDeploymentPostprocessing = 0; 116 | }; 117 | /* End PBXFrameworksBuildPhase section */ 118 | 119 | /* Begin PBXGroup section */ 120 | 82B660F80EC64A0894E987F6 /* utils */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 82B6665130DA2C488D5A28D6 /* UIApplication+MRSDK.m */, 124 | 82B66EA28A5BC39FF35993FA /* UIApplication+MRSDK.h */, 125 | 82B661F5FB0AE87744780F05 /* NSError+MRSDK.h */, 126 | 82B66C23B51518EBD3292DA0 /* NSError+MRSDK.m */, 127 | 82B6616467A0F15C0632D82D /* NSURL+MRSDK.m */, 128 | 82B66A7994D5940842FC6499 /* NSURL+MRSDK.h */, 129 | 858E0F4F2063F7A000286AFC /* NSBundle+MRSDK.h */, 130 | 858E0F502063F7A000286AFC /* NSBundle+MRSDK.m */, 131 | 8F3EFB5522FACE4300136617 /* NSMutableURLRequest+MRSDK.h */, 132 | 8F3EFB5622FACE4400136617 /* NSMutableURLRequest+MRSDK.m */, 133 | 8F6C3B9B22F9DD8500B524B6 /* NSData+MRSDK.h */, 134 | 8F6C3B9C22F9DD8500B524B6 /* NSData+MRSDK.m */, 135 | ); 136 | path = utils; 137 | sourceTree = ""; 138 | }; 139 | 82B6638007C6A5674DDF380B /* core */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 82B661947CBF290DAA686618 /* MRMailAuthParameters.m */, 143 | 82B666AAC9E92CB781AAC2F5 /* MRMailAuthParameters.h */, 144 | 82B66D367795919A6D6086E7 /* MRMailAuthParameters+Protected.h */, 145 | 82B66A9D6C72BB44A8B9216C /* MRMailAuthParameters+QueryItems.m */, 146 | 82B6606ED58CFC8C86042972 /* MRMailAuthParameters+QueryItems.h */, 147 | 8F4486991F26310900E7D646 /* MRMailAuthRedirectURLParser.h */, 148 | 8F44869A1F26310900E7D646 /* MRMailAuthRedirectURLParser.m */, 149 | 8F3EFB5922FAD3DA00136617 /* MRSDKOAuthTokenResponseParser.h */, 150 | 8F3EFB5A22FAD3DA00136617 /* MRSDKOAuthTokenResponseParser.m */, 151 | ); 152 | path = core; 153 | sourceTree = ""; 154 | }; 155 | 82B66C09E3CDA812DDFDF859 /* ui */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | 82B66AAE30DDA0E84ED875A4 /* MRInternalAuthHandler.h */, 159 | ACC49BDE1ECD8D870021C69C /* MRMailWebViewController.h */, 160 | ACC49BDF1ECD8D870021C69C /* MRMailWebViewController.m */, 161 | 82B66C68AEDF4F16CB28442C /* MRWebViewAuthHandler.m */, 162 | 82B664D620887EE994A51830 /* MRWebViewAuthHandler.h */, 163 | 82B662F53D6AE4E67ACAB6BD /* MRSafariAuthHandler.m */, 164 | 82B66431373E020E81F348CE /* MRSafariAuthHandler.h */, 165 | 8F2CA4291F263C7800C1B94F /* MRSafariSessionAuthHandler.h */, 166 | 8F2CA42A1F263C7800C1B94F /* MRSafariSessionAuthHandler.m */, 167 | 85CC3ECA2063A68C0012559E /* MRMailSignInButton.h */, 168 | 85CC3ECB2063A68C0012559E /* MRMailSignInButton.m */, 169 | 8552367E2063BF730072BFFC /* MRMailSDKUI.strings */, 170 | 85CC3ECE2063B33E0012559E /* MRMailSDKUI.xcassets */, 171 | ); 172 | path = ui; 173 | sourceTree = ""; 174 | }; 175 | 8F5EB0BC22BBBED900141465 /* mail-sign-in */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 8F2AFCCA22BA20FF0015AE50 /* MRMailSDK+MailSignIn.h */, 179 | ); 180 | path = "mail-sign-in"; 181 | sourceTree = ""; 182 | }; 183 | AC2000501ECC9B69005064F4 /* Frameworks */ = { 184 | isa = PBXGroup; 185 | children = ( 186 | ACC49BE41ECD95520021C69C /* WebKit.framework */, 187 | AC2000511ECC9B69005064F4 /* SafariServices.framework */, 188 | ); 189 | name = Frameworks; 190 | sourceTree = ""; 191 | }; 192 | AC20FFE91ECAF91E005064F4 /* sources */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | 8F5EB0BC22BBBED900141465 /* mail-sign-in */, 196 | 82B6638007C6A5674DDF380B /* core */, 197 | 82B66C09E3CDA812DDFDF859 /* ui */, 198 | 82B660F80EC64A0894E987F6 /* utils */, 199 | 82B664E33F259CADD8564C0D /* MRMailSDKConstants.m */, 200 | 82B66FAB6995601B80F69382 /* MRMailSDKConstants.h */, 201 | AC20FFEA1ECAFC0B005064F4 /* MRMailSDK.h */, 202 | AC20FFEB1ECAFC0B005064F4 /* MRMailSDK.m */, 203 | 82B66BA82B60C450E0983236 /* MRMailSDK+Private.h */, 204 | 8F6C3B9F22FAB6E800B524B6 /* MRSDKAuthorizationResult.h */, 205 | 8F6C3BA522FABF6000B524B6 /* MRSDKAuthorizationResult.m */, 206 | ); 207 | name = sources; 208 | path = "mr-mail-sdk/sources"; 209 | sourceTree = SOURCE_ROOT; 210 | }; 211 | ACF85C2A1EB0A6FB00534CE4 = { 212 | isa = PBXGroup; 213 | children = ( 214 | ACF85C361EB0A6FB00534CE4 /* mr-mail-sdk */, 215 | ACF85C351EB0A6FB00534CE4 /* Products */, 216 | AC2000501ECC9B69005064F4 /* Frameworks */, 217 | ); 218 | sourceTree = ""; 219 | }; 220 | ACF85C351EB0A6FB00534CE4 /* Products */ = { 221 | isa = PBXGroup; 222 | children = ( 223 | ACF85C341EB0A6FB00534CE4 /* MRMailSDK.framework */, 224 | ); 225 | name = Products; 226 | sourceTree = ""; 227 | }; 228 | ACF85C361EB0A6FB00534CE4 /* mr-mail-sdk */ = { 229 | isa = PBXGroup; 230 | children = ( 231 | AC20FFE91ECAF91E005064F4 /* sources */, 232 | AC1136421EB22CFA007E5E37 /* Info.plist */, 233 | 85CC3EC92063A4580012559E /* module.map */, 234 | ); 235 | path = "mr-mail-sdk"; 236 | sourceTree = ""; 237 | }; 238 | /* End PBXGroup section */ 239 | 240 | /* Begin PBXHeadersBuildPhase section */ 241 | ACF85C311EB0A6FB00534CE4 /* Headers */ = { 242 | isa = PBXHeadersBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | 8F6C3BA122FAB6E800B524B6 /* MRSDKAuthorizationResult.h in Headers */, 246 | 8F3EFB5722FACE4400136617 /* NSMutableURLRequest+MRSDK.h in Headers */, 247 | 85CC3ECC2063A68C0012559E /* MRMailSignInButton.h in Headers */, 248 | AC20FFEC1ECAFC0B005064F4 /* MRMailSDK.h in Headers */, 249 | 82B66913D7B040638A91E01E /* UIApplication+MRSDK.h in Headers */, 250 | ACC49BE11ECD8D870021C69C /* MRMailWebViewController.h in Headers */, 251 | 8F3EFB5B22FAD3DA00136617 /* MRSDKOAuthTokenResponseParser.h in Headers */, 252 | 82B661D67BDFA6B3A84B70A6 /* MRMailAuthParameters.h in Headers */, 253 | 82B66E508277F1634F11CFD0 /* MRMailAuthParameters+Protected.h in Headers */, 254 | 82B661CE2326C333FEF6D58E /* MRMailAuthParameters+QueryItems.h in Headers */, 255 | 8F2CA42B1F263C7800C1B94F /* MRSafariSessionAuthHandler.h in Headers */, 256 | 858E0F512063F7A000286AFC /* NSBundle+MRSDK.h in Headers */, 257 | 82B665A9657B42563FD6E8DC /* MRMailSDKConstants.h in Headers */, 258 | 82B663FCE82AF0111156A281 /* NSError+MRSDK.h in Headers */, 259 | 82B669CB8EBD1C6E043F7098 /* MRInternalAuthHandler.h in Headers */, 260 | 8F6C3B9D22F9DD8500B524B6 /* NSData+MRSDK.h in Headers */, 261 | 82B669885D88BD29E04E28C8 /* MRWebViewAuthHandler.h in Headers */, 262 | 82B66B32D87BEAF216CDD281 /* NSURL+MRSDK.h in Headers */, 263 | 8F44869B1F26310900E7D646 /* MRMailAuthRedirectURLParser.h in Headers */, 264 | 82B6695881C8CBA239F21167 /* MRSafariAuthHandler.h in Headers */, 265 | 8F2AFCCB22BA20FF0015AE50 /* MRMailSDK+MailSignIn.h in Headers */, 266 | 82B66CF9E4E32AC4FD42E5F2 /* MRMailSDK+Private.h in Headers */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | /* End PBXHeadersBuildPhase section */ 271 | 272 | /* Begin PBXNativeTarget section */ 273 | ACF85C331EB0A6FB00534CE4 /* mr-mail-sdk */ = { 274 | isa = PBXNativeTarget; 275 | buildConfigurationList = ACF85C3C1EB0A6FB00534CE4 /* Build configuration list for PBXNativeTarget "mr-mail-sdk" */; 276 | buildPhases = ( 277 | ACF85C2F1EB0A6FB00534CE4 /* Sources */, 278 | ACF85C301EB0A6FB00534CE4 /* Frameworks */, 279 | ACF85C311EB0A6FB00534CE4 /* Headers */, 280 | ACF85C321EB0A6FB00534CE4 /* Resources */, 281 | ); 282 | buildRules = ( 283 | ); 284 | dependencies = ( 285 | ); 286 | name = "mr-mail-sdk"; 287 | productName = "auth-sdk"; 288 | productReference = ACF85C341EB0A6FB00534CE4 /* MRMailSDK.framework */; 289 | productType = "com.apple.product-type.framework"; 290 | }; 291 | /* End PBXNativeTarget section */ 292 | 293 | /* Begin PBXProject section */ 294 | ACF85C2B1EB0A6FB00534CE4 /* Project object */ = { 295 | isa = PBXProject; 296 | attributes = { 297 | LastUpgradeCheck = 0920; 298 | ORGANIZATIONNAME = Mail.Ru; 299 | TargetAttributes = { 300 | ACF85C331EB0A6FB00534CE4 = { 301 | CreatedOnToolsVersion = 8.3.2; 302 | ProvisioningStyle = Automatic; 303 | }; 304 | }; 305 | }; 306 | buildConfigurationList = ACF85C2E1EB0A6FB00534CE4 /* Build configuration list for PBXProject "mr-mail-sdk" */; 307 | compatibilityVersion = "Xcode 3.2"; 308 | developmentRegion = English; 309 | hasScannedForEncodings = 0; 310 | knownRegions = ( 311 | English, 312 | en, 313 | ru, 314 | ); 315 | mainGroup = ACF85C2A1EB0A6FB00534CE4; 316 | productRefGroup = ACF85C351EB0A6FB00534CE4 /* Products */; 317 | projectDirPath = ""; 318 | projectRoot = ""; 319 | targets = ( 320 | ACF85C331EB0A6FB00534CE4 /* mr-mail-sdk */, 321 | ); 322 | }; 323 | /* End PBXProject section */ 324 | 325 | /* Begin PBXResourcesBuildPhase section */ 326 | ACF85C321EB0A6FB00534CE4 /* Resources */ = { 327 | isa = PBXResourcesBuildPhase; 328 | buildActionMask = 2147483647; 329 | files = ( 330 | 85CC3ECF2063B33E0012559E /* MRMailSDKUI.xcassets in Resources */, 331 | 8552367C2063BF730072BFFC /* MRMailSDKUI.strings in Resources */, 332 | ); 333 | runOnlyForDeploymentPostprocessing = 0; 334 | }; 335 | /* End PBXResourcesBuildPhase section */ 336 | 337 | /* Begin PBXSourcesBuildPhase section */ 338 | ACF85C2F1EB0A6FB00534CE4 /* Sources */ = { 339 | isa = PBXSourcesBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | 8F3EFB5822FACE4400136617 /* NSMutableURLRequest+MRSDK.m in Sources */, 343 | 8F6C3B9E22F9DD8500B524B6 /* NSData+MRSDK.m in Sources */, 344 | AC20FFED1ECAFC0B005064F4 /* MRMailSDK.m in Sources */, 345 | 82B6606E80161CAC496D27E3 /* UIApplication+MRSDK.m in Sources */, 346 | 82B66E9BB01F7629D86EED96 /* MRMailAuthParameters.m in Sources */, 347 | ACC49BE21ECD8D870021C69C /* MRMailWebViewController.m in Sources */, 348 | 858E0F522063F7A000286AFC /* NSBundle+MRSDK.m in Sources */, 349 | 8F6C3BA622FABF6000B524B6 /* MRSDKAuthorizationResult.m in Sources */, 350 | 8F2CA42C1F263C7800C1B94F /* MRSafariSessionAuthHandler.m in Sources */, 351 | 8F44869C1F26310900E7D646 /* MRMailAuthRedirectURLParser.m in Sources */, 352 | 82B66FE702049C5DE0F66B14 /* MRMailAuthParameters+QueryItems.m in Sources */, 353 | 82B6653120EE503D7EFD073E /* MRMailSDKConstants.m in Sources */, 354 | 82B662E62FF73E77D9E554B9 /* NSError+MRSDK.m in Sources */, 355 | 82B66CE63DE49EA273817E86 /* MRWebViewAuthHandler.m in Sources */, 356 | 82B660FA56E4400954A92B6A /* NSURL+MRSDK.m in Sources */, 357 | 85CC3ECD2063A68C0012559E /* MRMailSignInButton.m in Sources */, 358 | 82B6666286F582FE3B413A6F /* MRSafariAuthHandler.m in Sources */, 359 | 8F3EFB5C22FAD3DA00136617 /* MRSDKOAuthTokenResponseParser.m in Sources */, 360 | ); 361 | runOnlyForDeploymentPostprocessing = 0; 362 | }; 363 | /* End PBXSourcesBuildPhase section */ 364 | 365 | /* Begin PBXVariantGroup section */ 366 | 8552367E2063BF730072BFFC /* MRMailSDKUI.strings */ = { 367 | isa = PBXVariantGroup; 368 | children = ( 369 | 8552367D2063BF730072BFFC /* en */, 370 | 8552367F2063BF800072BFFC /* ru */, 371 | ); 372 | name = MRMailSDKUI.strings; 373 | sourceTree = ""; 374 | }; 375 | /* End PBXVariantGroup section */ 376 | 377 | /* Begin XCBuildConfiguration section */ 378 | ACF85C3A1EB0A6FB00534CE4 /* Debug */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ALWAYS_SEARCH_USER_PATHS = NO; 382 | CLANG_ANALYZER_LOCALIZABILITY_EMPTY_CONTEXT = YES; 383 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 384 | CLANG_ANALYZER_NONNULL = YES; 385 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 386 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 387 | CLANG_CXX_LIBRARY = "libc++"; 388 | CLANG_ENABLE_MODULES = YES; 389 | CLANG_ENABLE_OBJC_ARC = YES; 390 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 391 | CLANG_WARN_BOOL_CONVERSION = YES; 392 | CLANG_WARN_COMMA = YES; 393 | CLANG_WARN_CONSTANT_CONVERSION = YES; 394 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 395 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 396 | CLANG_WARN_EMPTY_BODY = YES; 397 | CLANG_WARN_ENUM_CONVERSION = YES; 398 | CLANG_WARN_INFINITE_RECURSION = YES; 399 | CLANG_WARN_INT_CONVERSION = YES; 400 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 401 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 402 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 403 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 404 | CLANG_WARN_STRICT_PROTOTYPES = YES; 405 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 406 | CLANG_WARN_UNREACHABLE_CODE = YES; 407 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 408 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 409 | COPY_PHASE_STRIP = NO; 410 | CURRENT_PROJECT_VERSION = 1; 411 | DEBUG_INFORMATION_FORMAT = dwarf; 412 | ENABLE_STRICT_OBJC_MSGSEND = YES; 413 | ENABLE_TESTABILITY = YES; 414 | GCC_C_LANGUAGE_STANDARD = gnu99; 415 | GCC_DYNAMIC_NO_PIC = NO; 416 | GCC_NO_COMMON_BLOCKS = YES; 417 | GCC_OPTIMIZATION_LEVEL = 0; 418 | GCC_PREPROCESSOR_DEFINITIONS = ( 419 | "DEBUG=1", 420 | "$(inherited)", 421 | ); 422 | GCC_TREAT_WARNINGS_AS_ERRORS = YES; 423 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 424 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 425 | GCC_WARN_UNDECLARED_SELECTOR = YES; 426 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 427 | GCC_WARN_UNUSED_FUNCTION = YES; 428 | GCC_WARN_UNUSED_VARIABLE = YES; 429 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 430 | MTL_ENABLE_DEBUG_INFO = YES; 431 | ONLY_ACTIVE_ARCH = YES; 432 | SDKROOT = iphoneos; 433 | TARGETED_DEVICE_FAMILY = "1,2"; 434 | VERSIONING_SYSTEM = "apple-generic"; 435 | VERSION_INFO_PREFIX = ""; 436 | }; 437 | name = Debug; 438 | }; 439 | ACF85C3B1EB0A6FB00534CE4 /* Release */ = { 440 | isa = XCBuildConfiguration; 441 | buildSettings = { 442 | ALWAYS_SEARCH_USER_PATHS = NO; 443 | CLANG_ANALYZER_LOCALIZABILITY_EMPTY_CONTEXT = YES; 444 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 445 | CLANG_ANALYZER_NONNULL = YES; 446 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 447 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 448 | CLANG_CXX_LIBRARY = "libc++"; 449 | CLANG_ENABLE_MODULES = YES; 450 | CLANG_ENABLE_OBJC_ARC = YES; 451 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 452 | CLANG_WARN_BOOL_CONVERSION = YES; 453 | CLANG_WARN_COMMA = YES; 454 | CLANG_WARN_CONSTANT_CONVERSION = YES; 455 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 456 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 457 | CLANG_WARN_EMPTY_BODY = YES; 458 | CLANG_WARN_ENUM_CONVERSION = YES; 459 | CLANG_WARN_INFINITE_RECURSION = YES; 460 | CLANG_WARN_INT_CONVERSION = YES; 461 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 462 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 463 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 464 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 465 | CLANG_WARN_STRICT_PROTOTYPES = YES; 466 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 467 | CLANG_WARN_UNREACHABLE_CODE = YES; 468 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 469 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 470 | COPY_PHASE_STRIP = NO; 471 | CURRENT_PROJECT_VERSION = 1; 472 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 473 | ENABLE_NS_ASSERTIONS = NO; 474 | ENABLE_STRICT_OBJC_MSGSEND = YES; 475 | GCC_C_LANGUAGE_STANDARD = gnu99; 476 | GCC_NO_COMMON_BLOCKS = YES; 477 | GCC_TREAT_WARNINGS_AS_ERRORS = YES; 478 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 479 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 480 | GCC_WARN_UNDECLARED_SELECTOR = YES; 481 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 482 | GCC_WARN_UNUSED_FUNCTION = YES; 483 | GCC_WARN_UNUSED_VARIABLE = YES; 484 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 485 | MTL_ENABLE_DEBUG_INFO = NO; 486 | SDKROOT = iphoneos; 487 | TARGETED_DEVICE_FAMILY = "1,2"; 488 | VALIDATE_PRODUCT = YES; 489 | VERSIONING_SYSTEM = "apple-generic"; 490 | VERSION_INFO_PREFIX = ""; 491 | }; 492 | name = Release; 493 | }; 494 | ACF85C3D1EB0A6FB00534CE4 /* Debug */ = { 495 | isa = XCBuildConfiguration; 496 | buildSettings = { 497 | CODE_SIGN_IDENTITY = ""; 498 | DEFINES_MODULE = YES; 499 | DYLIB_COMPATIBILITY_VERSION = 1; 500 | DYLIB_CURRENT_VERSION = 1; 501 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 502 | INFOPLIST_FILE = "$(SRCROOT)/mr-mail-sdk/Info.plist"; 503 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 504 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 505 | MARKETING_VERSION = 1.0; 506 | MODULEMAP_FILE = "$(SRCROOT)/mr-mail-sdk/module.map"; 507 | PRODUCT_BUNDLE_IDENTIFIER = "ru.mail.auth-sdk"; 508 | PRODUCT_NAME = MRMailSDK; 509 | SKIP_INSTALL = YES; 510 | }; 511 | name = Debug; 512 | }; 513 | ACF85C3E1EB0A6FB00534CE4 /* Release */ = { 514 | isa = XCBuildConfiguration; 515 | buildSettings = { 516 | CODE_SIGN_IDENTITY = ""; 517 | DEFINES_MODULE = YES; 518 | DYLIB_COMPATIBILITY_VERSION = 1; 519 | DYLIB_CURRENT_VERSION = 1; 520 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 521 | INFOPLIST_FILE = "$(SRCROOT)/mr-mail-sdk/Info.plist"; 522 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 523 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 524 | MARKETING_VERSION = 1.0; 525 | MODULEMAP_FILE = "$(SRCROOT)/mr-mail-sdk/module.map"; 526 | PRODUCT_BUNDLE_IDENTIFIER = "ru.mail.auth-sdk"; 527 | PRODUCT_NAME = MRMailSDK; 528 | SKIP_INSTALL = YES; 529 | }; 530 | name = Release; 531 | }; 532 | /* End XCBuildConfiguration section */ 533 | 534 | /* Begin XCConfigurationList section */ 535 | ACF85C2E1EB0A6FB00534CE4 /* Build configuration list for PBXProject "mr-mail-sdk" */ = { 536 | isa = XCConfigurationList; 537 | buildConfigurations = ( 538 | ACF85C3A1EB0A6FB00534CE4 /* Debug */, 539 | ACF85C3B1EB0A6FB00534CE4 /* Release */, 540 | ); 541 | defaultConfigurationIsVisible = 0; 542 | defaultConfigurationName = Release; 543 | }; 544 | ACF85C3C1EB0A6FB00534CE4 /* Build configuration list for PBXNativeTarget "mr-mail-sdk" */ = { 545 | isa = XCConfigurationList; 546 | buildConfigurations = ( 547 | ACF85C3D1EB0A6FB00534CE4 /* Debug */, 548 | ACF85C3E1EB0A6FB00534CE4 /* Release */, 549 | ); 550 | defaultConfigurationIsVisible = 0; 551 | defaultConfigurationName = Release; 552 | }; 553 | /* End XCConfigurationList section */ 554 | }; 555 | rootObject = ACF85C2B1EB0A6FB00534CE4 /* Project object */; 556 | } 557 | --------------------------------------------------------------------------------