Skip to content

Commit

Permalink
Merge pull request #6 from Giriraj1200/master
Browse files Browse the repository at this point in the history
Release version 5.4.2
  • Loading branch information
giriraj12000 authored Aug 27, 2020
2 parents ab8005d + c547424 commit 3e3b6ea
Show file tree
Hide file tree
Showing 30 changed files with 202 additions and 92 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
5.4.2 Release notes (2020-08-27)
=============================================================

### Enhancements
* Changed nil unwrapping process for SourceApplication as Apple returns nil for SourceApplication in iOS 13
* Added a new optional parameter to native social login methods for supporting multiple social apps for same provider
* Upgraded Eureka version to 5.2.1 for crashing in Swift demo on Xcode v11.4 or above

5.4.1 Release notes (2020-05-08)
=============================================================

Expand Down
8 changes: 4 additions & 4 deletions Example/ObjCDemo/ObjCDemo/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDiction
return canOpen;
}

/* Google Native Sign in
// Google Native Sign in
/*
- (void)signIn:(GIDSignIn *)signIn
didSignInForUser:(GIDGoogleUser *)user
withError:(NSError *)error {
Expand All @@ -99,8 +99,8 @@ - (void)signIn:(GIDSignIn *)signIn
NSString *clientID = user.authentication.clientID;
UIViewController *currentVC = [(UINavigationController *)[[self window] rootViewController] topViewController];
[[LoginRadiusSocialLoginManager sharedInstance] convertGoogleTokenToLRToken:googleToken google_refresh_token:refreshToken google_client_id:clientID inController:currentVC completionHandler:^(NSDictionary * _Nullable data, NSError * _Nullable error) {
id safeData = (data) ? data : [NSNull null];
[[LoginRadiusSocialLoginManager sharedInstance] convertGoogleTokenToLRToken:googleToken google_refresh_token:refreshToken google_client_id:clientID withSocialAppName:@"" inController:currentVC completionHandler:^(NSDictionary * _Nullable data, NSError * _Nullable error) {
id safeData =x (data) ? data : [NSNull null];
id safeError = (error) ? error : [NSNull null];
[[NSNotificationCenter defaultCenter] postNotificationName:@"userAuthenticatedFromNativeGoogle" object:nil userInfo:@{@"data":safeData,@"error":safeError}];
Expand Down
6 changes: 3 additions & 3 deletions Example/ObjCDemo/ObjCDemo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ - (void) updateSocialLoadingText

- (void) setupForm
{
[[[self navigationController] navigationBar] topItem].title = @"LoginRadius ObjCDemo 5.4.1 🇮🇳";
[[[self navigationController] navigationBar] topItem].title = @"LoginRadius ObjCDemo 5.4.2 🇮🇳";

XLFormDescriptor * form;
XLFormSectionDescriptor * section;
Expand Down Expand Up @@ -529,7 +529,7 @@ - (void) showNativeTwitterLogin
[[TWTRTwitter sharedInstance] logInWithCompletion:
^(TWTRSession * _Nullable session, NSError * _Nullable error) {
if (session){
[[LoginRadiusSocialLoginManager sharedInstance] convertTwitterTokenToLRToken:session.authToken twitterSecret:session.authTokenSecret inController:self completionHandler:^(NSDictionary * _Nullable data, NSError * _Nullable error) {
[[LoginRadiusSocialLoginManager sharedInstance] convertTwitterTokenToLRToken:session.authToken twitterSecret:session.authTokenSecret withSocialAppName:@"" inController:self completionHandler:^(NSDictionary * _Nullable data, NSError * _Nullable error) {
if (error){
[self showAlert:@"ERROR" message:error.localizedDescription];
}else{
Expand All @@ -544,7 +544,7 @@ - (void) showNativeTwitterLogin

- (void) showNativeFacebookLogin
{
[[LoginRadiusSocialLoginManager sharedInstance] nativeFacebookLoginWithPermissions:@{@"facebookPermissions":@[@"public_profile",@"email"]} inController:self completionHandler: ^(NSDictionary *data, NSError *error){
[[LoginRadiusSocialLoginManager sharedInstance] nativeFacebookLoginWithPermissions:@{@"facebookPermissions":@[@"public_profile",@"email"]} withSocialAppName:@"" inController:self completionHandler: ^(NSDictionary *data, NSError *error){
if(error)
{
[self errorMessage:data error:error];
Expand Down
4 changes: 2 additions & 2 deletions Example/SwiftDemo/SwiftDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = SwiftDemo/SwiftDemo.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -441,7 +441,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = SwiftDemo/SwiftDemo.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
Expand Down
9 changes: 5 additions & 4 deletions Example/SwiftDemo/SwiftDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate
/* Twitter Native Sign in
canOpen = (canOpen || TWTRTwitter.sharedInstance().application(app, open: url, options: options))
*/

canOpen = (canOpen || LoginRadiusSDK.sharedInstance().application(app, open: url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as! String, annotation: options[UIApplication.OpenURLOptionsKey.annotation]))



canOpen = (canOpen || LoginRadiusSDK.sharedInstance().application(app, open: url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplication.OpenURLOptionsKey.annotation]))

return canOpen
}

Expand All @@ -104,7 +105,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate
if let navVC = self.window?.rootViewController as? UINavigationController,
let currentVC = navVC.topViewController
{
LoginRadiusSocialLoginManager.sharedInstance().convertGoogleToken(toLRToken: googleToken,google_refresh_token:refreshToken, google_client_id:clientID, in:currentVC, completionHandler: {( data , error) -> Void in
LoginRadiusSocialLoginManager.sharedInstance().convertGoogleToken(toLRToken: googleToken,google_refresh_token:refreshToken, google_client_id:clientID, withSocialAppName:"", in:currentVC, completionHandler: {( data , error) -> Void in
NotificationCenter.default.post(name: Notification.Name("userAuthenticatedFromNativeGoogle"), object: nil, userInfo: ["data":data as Any,"error":error as Any])
})
Expand Down
10 changes: 5 additions & 5 deletions Example/SwiftDemo/SwiftDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class ViewController: FormViewController

func setupForm()
{
self.navigationController?.navigationBar.topItem?.title = "LoginRadius SwiftDemo 5.4.1 🇨🇦"
self.navigationController?.navigationBar.topItem?.title = "LoginRadius SwiftDemo 5.4.2 🇨🇦"
self.form = Form()

//These is the just rules to toggle visibility of the UI elements
Expand Down Expand Up @@ -796,11 +796,11 @@ class ViewController: FormViewController

func showNativeTwitterLogin()
{

/* Twitter Native Sign in
TWTRTwitter.sharedInstance().logIn(completion: { (session, error) in
if let session = session {
LoginRadiusSocialLoginManager.sharedInstance().convertTwitterToken(toLRToken: session.authToken, twitterSecret: session.authTokenSecret, in: self, completionHandler: {(data, error) in
LoginRadiusSocialLoginManager.sharedInstance().convertTwitterToken(toLRToken: session.authToken, twitterSecret: session.authTokenSecret, withSocialAppName:"", in: self, completionHandler: {(data, error) in
if let _ = data
{
let access_token = data!["access_token"] as! NSString
Expand All @@ -825,7 +825,7 @@ class ViewController: FormViewController

func showNativeFacebookLogin()
{
LoginRadiusSocialLoginManager.sharedInstance().nativeFacebookLogin(withPermissions: ["facebookPermissions": ["public_profile"]], in: self, completionHandler: {( data, error) -> Void in
LoginRadiusSocialLoginManager.sharedInstance().nativeFacebookLogin(withPermissions: ["facebookPermissions": ["public_profile"]], withSocialAppName:"", in: self, completionHandler: {( data, error) -> Void in

if let err = error {
self.errorAlert(data:data, error:err)
Expand Down Expand Up @@ -1001,7 +1001,7 @@ extension ViewController: ASAuthorizationControllerDelegate {

// Convert apple Code to LoginRadius Acess Token

LoginRadiusSocialLoginManager.sharedInstance()?.convertAppleCode(toLRToken:code, completionHandler: {(data, error) in
LoginRadiusSocialLoginManager.sharedInstance()?.convertAppleCode(toLRToken:code, withSocialAppName:"", completionHandler: {(data, error) in

if let _ = data
{
Expand Down
2 changes: 1 addition & 1 deletion LoginRadiusSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'LoginRadiusSDK'
s.version = '5.4.1'
s.version = '5.4.2'
s.summary = 'Official LoginRadius SDK for iOS to integrate User Registration Service or Social Login in your app.'

s.description = <<-DESC
Expand Down
Empty file modified LoginRadiusSDK.xcodeproj/project.pbxproj
100755 → 100644
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6884DF371CC9FC8A0071EFFB"
BuildableName = "LoginRadiusSDK.framework"
BlueprintName = "LoginRadiusSDK"
ReferencedContainer = "container:LoginRadiusSDK.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6884DF371CC9FC8A0071EFFB"
BuildableName = "LoginRadiusSDK.framework"
BlueprintName = "LoginRadiusSDK"
ReferencedContainer = "container:LoginRadiusSDK.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Empty file modified LoginRadiusSDK.xcworkspace/contents.xcworkspacedata
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ end
target 'SwiftDemo' do
project 'Example/SwiftDemo/SwiftDemo.xcodeproj'
pod 'LoginRadiusSDK', :path => './'
pod 'Eureka', '<= 5.0.0'
pod 'Eureka', '<= 5.2.1'
pod 'SwiftyJSON', '<= 4.0'
pod 'Alamofire', '<= 4.8.2'
#pod 'Google/SignIn', '<= 4.1.0'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform : ios, '9.0'
target 'TargetName' do
pod 'LoginRadiusSDK', '~> 5.4.1'
pod 'LoginRadiusSDK', '~> 5.4.2'
end
```
Expand Down
Empty file modified Sources/Api/OneTouchLoginAPI.h
100644 → 100755
Empty file.
Empty file modified Sources/Api/OneTouchLoginAPI.m
100644 → 100755
Empty file.
Empty file modified Sources/Api/PasswordlessLoginAPI.h
100644 → 100755
Empty file.
Empty file modified Sources/Api/PasswordlessLoginAPI.m
100644 → 100755
Empty file.
Empty file modified Sources/Api/SmartLoginAPI.h
100644 → 100755
Empty file.
Empty file modified Sources/Api/SmartLoginAPI.m
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion Sources/LoginRadiusSDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ typedef void (^LRServiceCompletionHandler)(BOOL success, NSError * _Nullable err

- (BOOL)application:(UIApplication *_Nonnull)application
openURL:(NSURL *_Nonnull)url
sourceApplication:(NSString *_Nonnull)sourceApplication
sourceApplication:(NSString *_Nullable)sourceApplication
annotation:(id _Nullable )annotation;

- (void)applicationDidBecomeActive:(UIApplication *_Nonnull)application;
Expand Down
16 changes: 9 additions & 7 deletions Sources/NativeLogin/LoginRadiusFacebookLogin.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
* Login
*
* @param controller controller is needed for FB native login
* @param params params should have the permissons array and login behaviour
* @param handler serive completion handler
* @param params params should have the permissons array and login behaviour
* @param socialAppName should have unique social app name as a provider in case of multiple social apps for the same provider (eg. facebook_<social app name> )
* @param handler service completion handler
*/

- (void)loginfromViewController:(UIViewController*)controller
parameters:(NSDictionary*)params
handler:(LRAPIResponseHandler)handler;
parameters:(NSDictionary*)params
withSocialAppName:(NSString * _Nullable)socialAppName
handler:(LRAPIResponseHandler)handler;

/**
* Log out the user
Expand All @@ -44,8 +46,8 @@
* Call this for facebook login to work properly
*/
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation;
openURL:(NSURL *)url
sourceApplication:(NSString * _Nullable)sourceApplication
annotation:(id _Nullable)annotation;

@end
21 changes: 14 additions & 7 deletions Sources/NativeLogin/LoginRadiusFacebookLogin.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ @implementation LoginRadiusFacebookLogin

- (void)loginfromViewController:(UIViewController*)controller
parameters:(NSDictionary*)params
withSocialAppName:(NSString *)socialAppName
handler:(LRAPIResponseHandler)handler {

BOOL permissionsAllowed = YES;
Expand All @@ -39,7 +40,7 @@ - (void)loginfromViewController:(UIViewController*)controller
login.loginBehavior = params[@"facebookLoginBehavior"] || FBSDKLoginBehaviorBrowser;

void (^handleLogin)(FBSDKLoginManagerLoginResult *result, NSError *error) = ^void(FBSDKLoginManagerLoginResult *result, NSError *error) {
[self onLoginResult:result error:error controller:controller];
[self onLoginResult:result error:error withSocialAppName:socialAppName controller:controller];
};

if (token) {
Expand All @@ -62,7 +63,7 @@ - (void)loginfromViewController:(UIViewController*)controller
if ([[[LoginRadiusSDK sharedInstance] session] isLoggedIn]){
[self finishLogin:[[[LoginRadiusSDK sharedInstance] session] userProfile] withError:nil];
}else{
[self convertFacebookTokenToLRToken:[token tokenString] inController:controller];
[self convertFacebookTokenToLRToken:[token tokenString] withSocialAppName:socialAppName inController:controller];
}
} else if (publishPermissionFound && readPermissionFound) {
// Mix of permissions, not allowed
Expand All @@ -88,6 +89,7 @@ - (void)loginfromViewController:(UIViewController*)controller

- (void) onLoginResult:(FBSDKLoginManagerLoginResult *) result
error:(NSError *)error
withSocialAppName:(NSString *)socialAppName
controller:(UIViewController *) controller{
if (error) {
[self finishLogin:nil withError:error];
Expand All @@ -98,16 +100,21 @@ - (void) onLoginResult:(FBSDKLoginManagerLoginResult *) result
NSString *accessToken = [[FBSDKAccessToken currentAccessToken] tokenString];
// Get loginradius access_token for facebook access_token

[self convertFacebookTokenToLRToken:accessToken inController:controller];
[self convertFacebookTokenToLRToken:accessToken withSocialAppName:socialAppName inController:controller];

}
}

- (void)convertFacebookTokenToLRToken :(NSString*)fb_token
withSocialAppName:(NSString *)socialAppName
inController:(UIViewController *)controller {

[[LoginRadiusREST apiInstance] sendGET:@"api/v2/access_token/facebook" queryParams:@{@"key": [LoginRadiusSDK apiKey], @"fb_access_token" : fb_token} completionHandler:^(NSDictionary *data, NSError *error) {
self.handler(data, error);
NSMutableDictionary *dictParam = [NSMutableDictionary dictionaryWithDictionary:@{@"key": [LoginRadiusSDK apiKey], @"fb_access_token" : fb_token}];
if(socialAppName && [socialAppName length]) {
[dictParam setValue:socialAppName forKey:@"socialappname"];
}


[[LoginRadiusREST apiInstance] sendGET:@"api/v2/access_token/facebook" queryParams:dictParam completionHandler:^(NSDictionary *data, NSError *error) {
self.handler(data, error);
}];
}

Expand Down
6 changes: 5 additions & 1 deletion Sources/NativeLogin/LoginRadiusTwitterLogin.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@

/**
* Login
*
* @param twitter_token access token from Twitter
* @param twitter_secret secret from Twitter
* @param socialAppName should have unique social app name as a provider in case of multiple social apps for the same provider (eg. twitter_<social app name> )
* @param controller controller is needed for Twitter native login
* @param handler service completion handler
*/
- (void)getLRTokenWithTwitterToken:(NSString*)twitter_token
twitterSecret:(NSString*)twitter_secret
withSocialAppName:(NSString * _Nullable)socialAppName
inController:(UIViewController *)controller
handler:(LRAPIResponseHandler)handler;
@end
14 changes: 10 additions & 4 deletions Sources/NativeLogin/LoginRadiusTwitterLogin.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ @implementation LoginRadiusTwitterLogin

- (void)getLRTokenWithTwitterToken:(NSString*)twitter_token
twitterSecret:(NSString*)twitter_secret
withSocialAppName:(NSString *)socialAppName
inController:(UIViewController *)controller
handler:(LRAPIResponseHandler)handler{
self.handler = handler;
self.viewController = controller;
NSMutableDictionary *dictParam = [NSMutableDictionary dictionaryWithDictionary:@{@"key": [LoginRadiusSDK apiKey],
@"tw_access_token" : twitter_token,
@"tw_token_secret":twitter_secret
}];
if(socialAppName && [socialAppName length]) {
[dictParam setValue:socialAppName forKey:@"socialappname"];
}

[[LoginRadiusREST apiInstance] sendGET:@"api/v2/access_token/twitter"
queryParams:@{@"key": [LoginRadiusSDK apiKey],
@"tw_access_token" : twitter_token,
@"tw_token_secret":twitter_secret
}
queryParams:dictParam
completionHandler:^(NSDictionary *data, NSError *error) {

[self finishLogin:data withError:error];
Expand Down
2 changes: 1 addition & 1 deletion Sources/SocialLogin/LoginRadiusSafariLogin.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
completionHandler:(LRAPIResponseHandler)handler;


- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString * _Nullable)sourceApplication annotation:(id)annotation;
@end
Loading

0 comments on commit 3e3b6ea

Please sign in to comment.