From d7a93cca8289ad997af9ad2c1540877d5bd50879 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 24 Jun 2020 22:49:00 +0300 Subject: WIP --- Juick.xcodeproj/project.pbxproj | 6 +++++ Juick/Helpers/JJJAuthorizationField.h | 19 +++++++++++++++ Juick/Helpers/JJJAuthorizationField.m | 38 +++++++++++++++++++++++++++++ Juick/Juick.entitlements | 4 +++ Juick/Main.storyboard | 19 ++++++++++----- Juick/Model/Message.m | 4 +-- Juick/ViewControllers/LoginViewController.h | 6 +++-- Juick/ViewControllers/LoginViewController.m | 23 +++++++++++++++++ 8 files changed, 109 insertions(+), 10 deletions(-) create mode 100644 Juick/Helpers/JJJAuthorizationField.h create mode 100644 Juick/Helpers/JJJAuthorizationField.m diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index dcb9060..1c88425 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -41,6 +41,7 @@ 776C41BD1FD3EF180063B82E /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 776C41BB1FD3EF180063B82E /* MessageCell.m */; }; 776C41BE1FD3EF180063B82E /* MessageCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 776C41BC1FD3EF180063B82E /* MessageCell.xib */; }; 776C41C11FD3FF6E0063B82E /* FeedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 776C41C01FD3FF6E0063B82E /* FeedViewController.m */; }; + 7779B38F246EC88D003EF2F6 /* JJJAuthorizationField.m in Sources */ = {isa = PBXBuildFile; fileRef = 7779B38E246EC88D003EF2F6 /* JJJAuthorizationField.m */; }; 778560602343D24E00BB37A2 /* NSData+Hex.m in Sources */ = {isa = PBXBuildFile; fileRef = 7785605F2343D24E00BB37A2 /* NSData+Hex.m */; }; 778560632344CF6F00BB37A2 /* JuickNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 778560622344CF6F00BB37A2 /* JuickNavigationController.m */; }; 77975A1D182B6E9A00410C2B /* NewPostViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77975A1C182B6E9A00410C2B /* NewPostViewController.m */; }; @@ -157,6 +158,8 @@ 776C41BC1FD3EF180063B82E /* MessageCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MessageCell.xib; sourceTree = ""; }; 776C41BF1FD3FF6E0063B82E /* FeedViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FeedViewController.h; sourceTree = ""; }; 776C41C01FD3FF6E0063B82E /* FeedViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeedViewController.m; sourceTree = ""; }; + 7779B38D246EC88D003EF2F6 /* JJJAuthorizationField.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JJJAuthorizationField.h; sourceTree = ""; }; + 7779B38E246EC88D003EF2F6 /* JJJAuthorizationField.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JJJAuthorizationField.m; sourceTree = ""; }; 7785605E2343D24E00BB37A2 /* NSData+Hex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+Hex.h"; sourceTree = ""; }; 7785605F2343D24E00BB37A2 /* NSData+Hex.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+Hex.m"; sourceTree = ""; }; 778560612344CF6F00BB37A2 /* JuickNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JuickNavigationController.h; sourceTree = ""; }; @@ -382,6 +385,8 @@ 7785605F2343D24E00BB37A2 /* NSData+Hex.m */, 774746AB239F82A10001C7F9 /* NSDate+TimeAgo.h */, 774746AC239F82A10001C7F9 /* NSDate+TimeAgo.m */, + 7779B38D246EC88D003EF2F6 /* JJJAuthorizationField.h */, + 7779B38E246EC88D003EF2F6 /* JJJAuthorizationField.m */, ); path = Helpers; sourceTree = ""; @@ -595,6 +600,7 @@ 7761133821766A3000D350CD /* ContentLoadingCell.m in Sources */, 77E61A5E1FD4682B00B4E304 /* QuoteView.m in Sources */, 77317BBC181BBE8500D60005 /* AppDelegate.m in Sources */, + 7779B38F246EC88D003EF2F6 /* JJJAuthorizationField.m in Sources */, 776C41C11FD3FF6E0063B82E /* FeedViewController.m in Sources */, 77FCADDF1D6A50DA00CBA649 /* API.m in Sources */, 77A0954A181F1F25002BDECD /* Message.m in Sources */, diff --git a/Juick/Helpers/JJJAuthorizationField.h b/Juick/Helpers/JJJAuthorizationField.h new file mode 100644 index 0000000..d5118e0 --- /dev/null +++ b/Juick/Helpers/JJJAuthorizationField.h @@ -0,0 +1,19 @@ +// +// JJJAuthorizationField.h +// Juick +// +// Created by Vitaly Takmazov on 15.05.2020. +// Copyright © 2020 com.juick. All rights reserved. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN +IB_DESIGNABLE +API_AVAILABLE(ios(13.0)) +@interface JJJAuthorizationField : UIView +@property (nonatomic, strong) IBInspectable ASAuthorizationAppleIDButton *button; +@end + +NS_ASSUME_NONNULL_END diff --git a/Juick/Helpers/JJJAuthorizationField.m b/Juick/Helpers/JJJAuthorizationField.m new file mode 100644 index 0000000..1173d8b --- /dev/null +++ b/Juick/Helpers/JJJAuthorizationField.m @@ -0,0 +1,38 @@ +// +// JJJAuthorizationField.m +// Juick +// +// Created by Vitaly Takmazov on 15.05.2020. +// Copyright © 2020 com.juick. All rights reserved. +// + +#import "JJJAuthorizationField.h" + +@implementation JJJAuthorizationField + +- (instancetype)initWithCoder:(NSCoder *)coder +{ + self = [super initWithCoder:coder]; + if (self) { + [self setup]; + } + return self; +} + +- (void)setup +{ + self.button = [ASAuthorizationAppleIDButton new]; + [self addSubview:self.button]; + self.translatesAutoresizingMaskIntoConstraints = NO; + self.button.translatesAutoresizingMaskIntoConstraints = NO; + [NSLayoutConstraint activateConstraints:@[ + [self.widthAnchor constraintEqualToConstant:250.0], + [self.heightAnchor constraintEqualToConstant:46.0], + [self.button.topAnchor constraintEqualToAnchor:self.button.superview.topAnchor constant:0.0], + [self.button.bottomAnchor constraintEqualToAnchor:self.self.button.superview.bottomAnchor constant:0.0], + [self.button.trailingAnchor constraintEqualToAnchor:self.self.button.superview.trailingAnchor constant:0.0], + [self.button.leadingAnchor constraintEqualToAnchor:self.self.button.superview.leadingAnchor constant:0.0] + ]]; +} + +@end diff --git a/Juick/Juick.entitlements b/Juick/Juick.entitlements index d8c59dc..0a01181 100644 --- a/Juick/Juick.entitlements +++ b/Juick/Juick.entitlements @@ -4,6 +4,10 @@ aps-environment development + com.apple.developer.applesignin + + Default + com.apple.developer.associated-domains webcredentials:juick.com diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard index 5d99c97..eba0978 100644 --- a/Juick/Main.storyboard +++ b/Juick/Main.storyboard @@ -100,19 +100,23 @@ - + + + + + - + @@ -120,15 +124,15 @@ - + -