SYOnlineSession Class Reference

#import <SYOnlineSession.h>

Inheritance diagram for SYOnlineSession:
Collaboration diagram for SYOnlineSession:

Instance Methods

((unavailable("Use +[SYOnlineSession sharedSession] instead.") - __attribute__
 SYOnlineSession is singleton, use [SYOnlineSession sharedSession] to access singleton instance. More...
 
(nonnull SYTask *) - setOnlineMapsDisabledWithCompletion:
 
(nonnull SYTask *) - setOnlineMapsEnabledWithCompletion:
 
(void) - signInWithSygicAccount:password:completion:
 Sign in with Sygic account. After successful authentication, Sygic server will consider the current user identity and the provided Sygic account as one user identity. More...
 
(void) - signInWithFacebookToken:completion:
 Sign in with Facebook token. Will let Sygic server know that the current user identity is connected to the provided Facebook account represented by the Facebook token. Sygic server will consider them as one user identity. More...
 
(void) - signInWithGoogleToken:completion:
 Sign in with Google token. Will let Sygic server know that the current user identity is connected to the Google account represented by the Google token. Sygic server will consider them as one user identity. More...
 
(void) - signInWithAppleToken:completion:
 Sign in with Apple token. Will let Sygic server know that the current user identity is connected to the Apple account represented by the Apple token. Sygic server will consider them as one user identity. More...
 
(void) - signInWithAppleToken:name:email:completion:
 Sign in with Apple token. Will let Sygic server know that the current user identity is connected to the Apple account represented by the Apple token. Sygic server will consider them as one user identity. More...
 
(void) - signOutWithCompletion:
 Sign out, stop using the currently authenticated user identity and forget the access token for it. More...
 
(void) - requestAuthenticationRefresh
 Ask SYOnlineSession to refresh the access token for the currently authenticated user identity. This could be necessary for some online services to apply license changes (e.g. after purchase of some features). @discussion buildHeaders can be called immediately (or any time later) after requestAuthenticationRefresh, buildHeaders will complete the refresh and return headers based on the new token. More...
 
(void) - notifyAuthenticationRejected
 Lets SYOnlineSession know, that one of Sygic services has rejected the authentication of the current user identity. More...
 
(void) - getUserProfileWithCompletion:
 Request account information of the currently authenticated user. Will return error if not authenticated with account. First call will retrieve data from server, all subsequent calls will reuse cached data. The cached data is cleared after signIn, signOut, requestAuthenticationRefresh. More...
 
(void) - buildHeadersWithCompletion:
 Prepare authentication headers to communicate with Sygic online services. Authentication headers are to be added to NSURLRequest which is sent to Sygic online services. This method is expected to be called for each request. More...
 

Class Methods

(nullable SYOnlineSession *) + sharedSession
 SYOnlineSession singleton object. Returns nil if SYContext not initialized. More...
 
((unavailable("Use +[SYOnlineSession sharedSession] instead.") + __attribute__
 

Properties

id< SYOnlineSessionDelegatedelegate
 Current SYOnlineSession delegate. More...
 
SYOnlineSessionState state
 Current authentication state. Signed out - authentication is not connected to an account, user identity is represented by device code. Signed in - authentication is connected to an account (Sygic, Google, Facebook, Apple, or other). More...
 
BOOL onlineMapsEnabled
 Indicates whether Sygic SDK is allowed to access online maps services. More...
 

Method Documentation

◆ sharedSession

+ (nullable SYOnlineSession*) sharedSession

SYOnlineSession singleton object. Returns nil if SYContext not initialized.

◆ __attribute__ [1/2]

- ((unavailable("Use +[SYOnlineSession sharedSession] instead.") __attribute__

SYOnlineSession is singleton, use [SYOnlineSession sharedSession] to access singleton instance.

◆ __attribute__ [2/2]

+ ((unavailable("Use +[SYOnlineSession sharedSession] instead.") __attribute__

◆ setOnlineMapsDisabledWithCompletion:

- (nonnull SYTask*) setOnlineMapsDisabledWithCompletion: (nonnull void(^)(SYMapStreamingError *_Nullable error))  completion

◆ setOnlineMapsEnabledWithCompletion:

- (nonnull SYTask*) setOnlineMapsEnabledWithCompletion: (nonnull void(^)(SYMapStreamingError *_Nullable error))  completion

◆ signInWithSygicAccount:password:completion:

- (void) signInWithSygicAccount: (nonnull NSString *)  username
password: (nonnull NSString *)  password
completion: (nonnull SYOnlineSignInCompletionBlock)  completion 

Sign in with Sygic account. After successful authentication, Sygic server will consider the current user identity and the provided Sygic account as one user identity.

Parameters
usernameuser name, usually it's an email
passwordSygic account password
completioncalled asynchronously on main queue when the operation is finished.

◆ signInWithFacebookToken:completion:

- (void) signInWithFacebookToken: (nonnull NSString *)  token
completion: (nonnull SYOnlineSignInCompletionBlock)  completion 

Sign in with Facebook token. Will let Sygic server know that the current user identity is connected to the provided Facebook account represented by the Facebook token. Sygic server will consider them as one user identity.

Parameters
tokenFacebook token
completioncalled asynchronously on main queue when the operation is finished.

◆ signInWithGoogleToken:completion:

- (void) signInWithGoogleToken: (nonnull NSString *)  token
completion: (nonnull SYOnlineSignInCompletionBlock)  completion 

Sign in with Google token. Will let Sygic server know that the current user identity is connected to the Google account represented by the Google token. Sygic server will consider them as one user identity.

Parameters
tokenGoogle token
completioncalled asynchronously on main queue when the operation is finished.

◆ signInWithAppleToken:completion:

- (void) signInWithAppleToken: (nonnull NSString *)  token
completion: (nonnull SYOnlineSignInCompletionBlock)  completion 

Sign in with Apple token. Will let Sygic server know that the current user identity is connected to the Apple account represented by the Apple token. Sygic server will consider them as one user identity.

Parameters
tokenApple token
completioncalled asynchronously on main queue when the operation is finished.

◆ signInWithAppleToken:name:email:completion:

- (void) signInWithAppleToken: (nonnull NSString *)  token
name: (nullable NSString *)  name
email: (nullable NSString *)  email
completion: (nonnull SYOnlineSignInCompletionBlock)  completion 

Sign in with Apple token. Will let Sygic server know that the current user identity is connected to the Apple account represented by the Apple token. Sygic server will consider them as one user identity.

Parameters
tokenApple token
nameOptional user name. If the current user signs in for the first time, the value will be stored in the account.
emailOptional user e-mail. If the current user signs in for the first time, the value will be stored in the account.
completioncalled asynchronously on main queue when the operation is finished.

◆ signOutWithCompletion:

- (void) signOutWithCompletion: (nonnull void(^)(void))  completion

Sign out, stop using the currently authenticated user identity and forget the access token for it.

Parameters
completioncalled asynchronously on main queue when the operation is finished. @discussion It's not necessary to wait until sign out is finished before calling other methods, all subsequent asynchronous calls can presume that the operation is already done.

◆ requestAuthenticationRefresh

- (void) requestAuthenticationRefresh

Ask SYOnlineSession to refresh the access token for the currently authenticated user identity. This could be necessary for some online services to apply license changes (e.g. after purchase of some features). @discussion buildHeaders can be called immediately (or any time later) after requestAuthenticationRefresh, buildHeaders will complete the refresh and return headers based on the new token.

◆ notifyAuthenticationRejected

- (void) notifyAuthenticationRejected

Lets SYOnlineSession know, that one of Sygic services has rejected the authentication of the current user identity.

◆ getUserProfileWithCompletion:

- (void) getUserProfileWithCompletion: (nonnull SYOnlineUserProfileCompletionBlock)  completion

Request account information of the currently authenticated user. Will return error if not authenticated with account. First call will retrieve data from server, all subsequent calls will reuse cached data. The cached data is cleared after signIn, signOut, requestAuthenticationRefresh.

Parameters
completionblock is called asynchronously on main queue when the information is available.

◆ buildHeadersWithCompletion:

- (void) buildHeadersWithCompletion: (nonnull SYOnlineBuildHeadersCompletionBlock)  completion

Prepare authentication headers to communicate with Sygic online services. Authentication headers are to be added to NSURLRequest which is sent to Sygic online services. This method is expected to be called for each request.

Parameters
completionblock is called asynchronously on main queue when headers are ready. @discussion Typically the headers are prepared quickly based on the cached access token, but if the token expired or doesn't exist (e.g. after signOut or requestAuthenticationRefresh), SYOnlineSession will make a network request to obtain the new access token and then call the completion.

Property Documentation

◆ delegate

- (id<SYOnlineSessionDelegate>) delegate
readwritenonatomicweak

Current SYOnlineSession delegate.

◆ state

- (SYOnlineSessionState) state
readnonatomicassign

Current authentication state. Signed out - authentication is not connected to an account, user identity is represented by device code. Signed in - authentication is connected to an account (Sygic, Google, Facebook, Apple, or other).

◆ onlineMapsEnabled

- (BOOL) onlineMapsEnabled
readnonatomicassign

Indicates whether Sygic SDK is allowed to access online maps services.


The documentation for this class was generated from the following file: