forked from organicmaps/organicmaps
[authorization] Clang-format.
This commit is contained in:
parent
72a4f1991a
commit
2952e07a78
3 changed files with 44 additions and 43 deletions
|
@ -21,55 +21,54 @@ BOOL isNightMode = NO;
|
|||
|
||||
CGFloat scaled(CGFloat f) { return f / 255.; }
|
||||
NSDictionary<NSString *, UIColor *> * night = @{
|
||||
@"primaryDark" :
|
||||
@"primaryDark":
|
||||
[UIColor colorWithRed:scaled(25.) green:scaled(30) blue:scaled(35.) alpha:alpha100],
|
||||
@"primary" : [UIColor colorWithRed:scaled(45.) green:scaled(50.) blue:scaled(55.) alpha:alpha100],
|
||||
@"primary": [UIColor colorWithRed:scaled(45.) green:scaled(50.) blue:scaled(55.) alpha:alpha100],
|
||||
// Light green color
|
||||
@"primaryLight" :
|
||||
@"primaryLight":
|
||||
[UIColor colorWithRed:scaled(65.) green:scaled(70.) blue:scaled(75.) alpha:alpha100],
|
||||
@"menuBackground" :
|
||||
@"menuBackground":
|
||||
[UIColor colorWithRed:scaled(45.) green:scaled(50.) blue:scaled(55.) alpha:alpha80],
|
||||
@"downloadBadgeBackground" :
|
||||
@"downloadBadgeBackground":
|
||||
[UIColor colorWithRed:scaled(230.) green:scaled(70.) blue:scaled(60.) alpha:alpha100],
|
||||
// Background color && press color
|
||||
@"pressBackground" :
|
||||
@"pressBackground":
|
||||
[UIColor colorWithRed:scaled(50.) green:scaled(54.) blue:scaled(58.) alpha:alpha100],
|
||||
// Red color (use for status closed in place page)
|
||||
@"red" : [UIColor colorWithRed:scaled(230.) green:scaled(70.) blue:scaled(60.) alpha:alpha100],
|
||||
@"errorPink" :
|
||||
@"red": [UIColor colorWithRed:scaled(230.) green:scaled(70.) blue:scaled(60.) alpha:alpha100],
|
||||
@"errorPink":
|
||||
[UIColor colorWithRed:scaled(246.) green:scaled(60.) blue:scaled(51.) alpha:alpha26],
|
||||
// Orange color (use for status 15 min in place page)
|
||||
@"orange" :
|
||||
[UIColor colorWithRed:scaled(250.) green:scaled(190.) blue:scaled(10.) alpha:alpha100],
|
||||
@"orange": [UIColor colorWithRed:scaled(250.) green:scaled(190.) blue:scaled(10.) alpha:alpha100],
|
||||
// Blue color (use for links and phone numbers)
|
||||
@"linkBlue" :
|
||||
@"linkBlue":
|
||||
[UIColor colorWithRed:scaled(80.) green:scaled(195.) blue:scaled(240.) alpha:alpha100],
|
||||
@"linkBlueHighlighted" :
|
||||
@"linkBlueHighlighted":
|
||||
[UIColor colorWithRed:scaled(60.) green:scaled(155.) blue:scaled(190.) alpha:alpha30],
|
||||
@"linkBlueDark" :
|
||||
@"linkBlueDark":
|
||||
[UIColor colorWithRed:scaled(75.) green:scaled(185.) blue:scaled(230.) alpha:alpha100],
|
||||
@"buttonRed" :
|
||||
@"buttonRed":
|
||||
[UIColor colorWithRed:scaled(244.) green:scaled(67.) blue:scaled(67.) alpha:alpha100],
|
||||
@"buttonRedHighlighted" :
|
||||
@"buttonRedHighlighted":
|
||||
[UIColor colorWithRed:scaled(183.) green:scaled(28.) blue:scaled(28.) alpha:alpha100],
|
||||
@"blackPrimaryText" : [UIColor colorWithWhite:1. alpha:alpha90],
|
||||
@"blackSecondaryText" : [UIColor colorWithWhite:1. alpha:alpha70],
|
||||
@"blackHintText" : [UIColor colorWithWhite:1. alpha:alpha30],
|
||||
@"blackDividers" : [UIColor colorWithWhite:1. alpha:alpha12],
|
||||
@"white" : [UIColor colorWithRed:scaled(60.) green:scaled(64.) blue:scaled(68.) alpha:alpha100],
|
||||
@"whiteSecondaryText" : [UIColor colorWithWhite:0. alpha:alpha70],
|
||||
@"whiteHintText" : [UIColor colorWithWhite:0. alpha:alpha26],
|
||||
@"buttonDisabledBlueText" :
|
||||
@"blackPrimaryText": [UIColor colorWithWhite:1. alpha:alpha90],
|
||||
@"blackSecondaryText": [UIColor colorWithWhite:1. alpha:alpha70],
|
||||
@"blackHintText": [UIColor colorWithWhite:1. alpha:alpha30],
|
||||
@"blackDividers": [UIColor colorWithWhite:1. alpha:alpha12],
|
||||
@"white": [UIColor colorWithRed:scaled(60.) green:scaled(64.) blue:scaled(68.) alpha:alpha100],
|
||||
@"whiteSecondaryText": [UIColor colorWithWhite:0. alpha:alpha70],
|
||||
@"whiteHintText": [UIColor colorWithWhite:0. alpha:alpha26],
|
||||
@"buttonDisabledBlueText":
|
||||
[UIColor colorWithRed:scaled(255.) green:scaled(230.) blue:scaled(140.) alpha:alpha30],
|
||||
@"alertBackground" :
|
||||
@"alertBackground":
|
||||
[UIColor colorWithRed:scaled(60.) green:scaled(64.) blue:scaled(68.) alpha:alpha90],
|
||||
@"blackOpaque" : [UIColor colorWithWhite:1. alpha:alpha04],
|
||||
@"bannerBackground" :
|
||||
@"blackOpaque": [UIColor colorWithWhite:1. alpha:alpha04],
|
||||
@"bannerBackground":
|
||||
[UIColor colorWithRed:scaled(71.) green:scaled(75.) blue:scaled(80.) alpha:alpha100],
|
||||
@"bannerButtonBackground" :
|
||||
@"bannerButtonBackground":
|
||||
[UIColor colorWithRed:scaled(45.) green:scaled(48.) blue:scaled(50.) alpha:alpha100],
|
||||
@"toastBackground" : [UIColor colorWithWhite:0. alpha:alpha87],
|
||||
@"statusBarBackground" : [UIColor colorWithWhite:0. alpha:alpha32]
|
||||
@"toastBackground": [UIColor colorWithWhite:0. alpha:alpha87],
|
||||
@"statusBarBackground": [UIColor colorWithWhite:0. alpha:alpha32]
|
||||
};
|
||||
|
||||
NSDictionary<NSString *, UIColor *> * day = @{
|
||||
|
|
|
@ -6,6 +6,6 @@ typedef NS_ENUM(NSInteger, MWMSocialTokenType) {
|
|||
@interface MWMAuthorizationViewModel : NSObject
|
||||
|
||||
+ (BOOL)isAuthenticated;
|
||||
+ (void)authenticateWithToken:(NSString* _Nonnull)token type:(enum MWMSocialTokenType)type;
|
||||
+ (void)authenticateWithToken:(NSString * _Nonnull)token type:(enum MWMSocialTokenType)type;
|
||||
|
||||
@end
|
||||
|
|
|
@ -6,17 +6,21 @@
|
|||
|
||||
@implementation MWMAuthorizationViewModel
|
||||
|
||||
+ (BOOL)isAuthenticated {
|
||||
if (GetFramework().GetUser().IsAuthenticated()) return YES;
|
||||
+ (BOOL)isAuthenticated
|
||||
{
|
||||
if (GetFramework().GetUser().IsAuthenticated())
|
||||
return YES;
|
||||
|
||||
auto googleToken = [GIDSignIn sharedInstance].currentUser.authentication.idToken;
|
||||
if (googleToken) {
|
||||
if (googleToken)
|
||||
{
|
||||
[self authenticateWithToken:googleToken type:MWMSocialTokenTypeGoogle];
|
||||
return YES;
|
||||
}
|
||||
|
||||
auto fbToken = [FBSDKAccessToken currentAccessToken].tokenString;
|
||||
if (fbToken) {
|
||||
if (fbToken)
|
||||
{
|
||||
[self authenticateWithToken:fbToken type:MWMSocialTokenTypeFacebook];
|
||||
return YES;
|
||||
}
|
||||
|
@ -24,16 +28,14 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
+ (void)authenticateWithToken:(NSString* _Nonnull)token type:(enum MWMSocialTokenType)type {
|
||||
auto& user = GetFramework().GetUser();
|
||||
+ (void)authenticateWithToken:(NSString * _Nonnull)token type:(enum MWMSocialTokenType)type
|
||||
{
|
||||
auto & user = GetFramework().GetUser();
|
||||
User::SocialTokenType socialTokenType;
|
||||
switch (type) {
|
||||
case MWMSocialTokenTypeGoogle:
|
||||
socialTokenType = User::SocialTokenType::Google;
|
||||
break;
|
||||
case MWMSocialTokenTypeFacebook:
|
||||
socialTokenType = User::SocialTokenType::Facebook;
|
||||
break;
|
||||
switch (type)
|
||||
{
|
||||
case MWMSocialTokenTypeGoogle: socialTokenType = User::SocialTokenType::Google; break;
|
||||
case MWMSocialTokenTypeFacebook: socialTokenType = User::SocialTokenType::Facebook; break;
|
||||
}
|
||||
user.Authenticate(token.UTF8String, socialTokenType);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue