This class hides the complexity of VPN Unlimited SDK by encapsulating most of the needed features.
Extends: NSObject
Declared in: KSVPNUFacade.h
+ (instancetype)defaultFacade;
- (void)accountDevicesWithCompletion:(void(^)(NSError *error, NSArray<VPNUAccountDevice *> *accountDevices))completion;
- (void)accountStatisticsForDevice:(VPNUAccountDevice *)device completion:(void(^)(NSError *error, NSArray<VPNUAccountDeviceStatistics *> *accountStatistics))completion;
VPNUAccountDeviceStatistics
- (void)accountStatusWithCompletion:(void(^)(NSError *error, VPNUAccountStatus *accountStatus))completion;
- (void)authorizeWithLogin:(NSString *)login andPassword:(NSString *)password completion:(void(^)(NSError *error))completion;
nil
.nil
.This method tries to authorize a user with specified login and password. If authorization is successful it automatically sets the currentUserInfo
property.
- (void)changeAccountPasswordWithLogin:(NSString *)login oldPassword:(NSString *)oldPassword newPassword:(NSString *)newPassword completion:(void(^)(NSError *error))completion;
login
parameter.If password was changed successfully it automatically reauthorizes user with new password.
authorizeWithLogin:andPassword:completion:
- (void)connectToVPNAndUseOnDemand:(BOOL)useOnDemand completion:(void(^)(NSError *error))completion;
YES
before connecting.This method returns after VPN tunnel connection process is started and does not signals about the actual success of the VPN connection. In order to obtain the connection status, use the connectionStatus
property.
connectionStatus
- (void)connectToVPNWithCompletion:(void(^)(NSError *error))completion;
connectToVPNAndUseOnDemand
:completion: with useOnDemand
parameter set to YES
.- (void)enableOnDemand:(BOOL)enable completion:(void(^)(NSError *error))completion;
YES
VPN On Demand is turned on, otherwise VPN On Demand is turned off.- (void)enableVPNWithCompletion:(void(^)(NSError *error))completion;
If succeeded, this method disables VPN configurations of other apps.
Available in Mac OS X v10.11. Available in iOS v8.0.
- (void)enterCode:(NSString *)code completion:(void(^)(NSError *error))completion;
- (void)loadPreferencesWithCompletion:(void(^)(NSError *error))completion;
This method loads the preferences for VPN configuration of the current application. You can call this method if you want to retrieve connectionStatus
property before any call to configurator.
- (void)optimalServersListWithCompletion:(void(^)(NSError *error, NSArray<NSDictionary *> *serversList))completion;
- (void)recoveryPasswordForLogin:(NSString *)login completion:(void(^)(NSError *error))completion;
Instructions are sent to the email of user specified in login
parameter.
- (void)registerWithLogin:(NSString *)login andPassword:(NSString *)password completion:(void(^)(NSError *error))completion;
nil
.nil
.This method tries to register a new user with specified login and password synchronously and waits for the response. If registration is successful, it automatically logs in the newly created user.
authorizeWithLogin:andPassword:completion:
- (void)removeProfileWithCompletion:(void(^)(NSError *error))completion;
Available in Mac OS X v10.7. Available in iOS v8.0.
- (void)sendConfirmationEmailWithLogin:(NSString *)login completion:(void(^)(NSError *error))completion;
This method sends an account confirmation letter to user's email.
- (void)serversListWithCompletion:(void(^)(NSError *error, NSArray<VPNUServerItem *> *serversList))completion;
VPNUServerItem
- (void)setApplicationID:(NSString *)appID;
- (void)setApplicationSecret:(NSString *)appSecret;
- (void)setApplicationVersion:(NSString *)appVersion;
- (void)setupVPNWithServerItem:(VPNUServerItem *)serverItem completion:(void(^)(NSError *error, BOOL alreadyInstalled))completion;
nil
.error
if any error occurs and alreadyInstalled
- set to YES
, if VPN profile is already installed (iOS only).This method first retrieves VPN profile information for the specified server item. If this step was succesful, it then tries to install a new VPN profile into the system using the information retrieved in the first step.
- (void)signOutWithCompletion:(void(^)(BOOL successful, NSError *error))completion;
This method clears current session and signals server about sign-out event.
- (void)stopVPNAndUseOnDemand:(BOOL)useOnDemand completion:(void(^)(NSError *error))completion;
NO
before disconnecting.This method returns after VPN tunnel disconnect process is started and does not signals about the actual success of the VPN connection. In order to obtain the connection status, use the connectionStatus
property.
connectionStatus
- (void)stopVPNWithCompletion:(void(^)(NSError *error))completion;
stopVPNAndUseOnDemand
:completion: with useOnDemand
parameter set to YES
.- (void)userInfoWithCompletion:(void(^)(NSError *error, VPNUAccountUserInfo *userInfo))completion;
VPNUAccountUserInfo
- (void)validatePurchaseItem:(VPNUPurchaseItem *)purchaseItem completion:(void(^)(NSError *error))completion;
@property (copy) NSString *appScheme;
Application scheme used by local server.
@property (readonly) VPNUConfigurator *configurator;
Intance of VPNUConfigurator
which is used to configure and control VPN connections.
This object is read-only and created lazily inside KSVPNUFacade
implementation.
@property (strong) VPNUAccountStatus *currentAccountStatus;
Currently logged-in user's account status.
@property (strong) VPNUAccountUserInfo *currentUserInfo;
Info about currently logged-in user.
@property (copy) NSString *profileName;
Custom name for a downloaded VPN profile.
@property (readonly) VPNUTransport *transport;
Intance of VPNUTransport
which is used to send requests to server.
This object is read-only and created lazily inside KSVPNUFacade
implementation.