Inbox Authorization allows you to block the inbox from unauthorized users until they succsesfully log in to your app and become authorised to view the inbox.

1. User Authorization

With the usage of the setUserAuthorized(BOOL) method you can easily inform the SDK if the given user is authorized or not. By default an user is always authorized.

Unauthorized users will not be able to enter the inbox via a notification.

🚧

Manually opening the inbox

Please note that if you manually open the inbox using the getFeedNavigationController method the inbox will still open. You must write your own logic to block this.

Example usage

- (IBAction)unauthorizeButtonClick:(id)sender {
    PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];
    [manager setUserAuthorized:NO];
}

- (IBAction)authorizeButtonClick:(id)sender {
    PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];
    [manager setUserAuthorized:YES];
}

2. PULPulsateUnauthorizedManagerDelegate

Pulsate allows you to get callbacks everytime an unauthorized action happens.

Unauthorized user actions:

  1. Entering the app via a card notification
  2. Entering the app via a message notification

Example Usage with Objective-C:
In your AppDelegate.h add the following code

@interface AppDelegate : UIResponder <UIApplicationDelegate, PULPulsateUnauthorizedManagerDelegate>

In your AppDelegate.m

- (void)unauthorizedAction:(NSString *)action {
}

Also in your AppDelegate in the didFinishLaunchingWithOptions method add the following code

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];
    manager.unauthorizedDelegate = self;
    return YES;
}

Now every time an unauthorized user does any of the actions above the unauthorizedAction method will be called.

Example usage in Swift:
In your AppDelegate.swift

import UIKit
import CoreData
import PULPulsate

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, PULPulsateUnauthorizedManagerDelegate {
	
  var window: UIWindow?
    
  func unauthorizedAction(_ action: String!) 
  {
  }
    
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool 
  {
      do {
          let authData: PULAuthorizationData = try PULAuthorizationData(appId: "APP_ID", andAppKey: "APP_KEY")
            
          let pulsateManager = try PULPulsateFactory.getInstanceWith(authData, withLocationEnabled: true, withPushEnabled: true, withLaunchOptions: launchOptions)
          pulsateManager.unauthorizedDelegate = self;           
      } catch {
          print(error)
      }

      return true
    }
}

3. Showing the last blocked unauthorized message

This method allows you to show the last blocked unauthorized message.

If the user clicked a notification with a new card, but was unauthorized the user will not see that card. After setting setUserAuthorized:YES call showLastUnauthorizedMessage and we will redirect the user to the card that was blocked.

If the user clicked a notification with a new message, but was unauthorized the user will not see that message. After setting setUserAuthorized:YES call showLastUnauthorizedMessage and we will redirect the user to the message that was blocked.

- (IBAction)authorizeButtonClick:(id)sender {
    PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];
    [manager setUserAuthorized:YES];
    [manager showLastUnauthorizedMessage];
}

4. Enabling / Disabling In App Notifications

The enableInAppNotification method allows you to enable or disable showing In App Notifications to the user.

Sometimes In App Notifications might contain info that you want only authorized users to see.
If you want to disable In App Notifications just simply call enableInAppNotification:NO to enable them call enableInAppNotification:YES.

PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];
[manager enableInAppNotification:YES/NO];

5. Showing Blocked In App Notifications

The showLastInAppNotification method allows you to show the last In App Notification that came to the user.

When an user has In App Notifications disabled the last In App Notification will be kept in the SDK allowing you to show it later. For example when an user is logged out you call enableInAppNotification:NO to disable In App Notifications, if the user receives an In App Notification it will be blocked. After calling enableInAppNotification:YES you can call showLastInAppNotification to show the user the last blocked In App Notification.

PULPulsateManager* manager = [PULPulsateFactory getDefaultInstance];
[manager enableInAppNotification:YES];
[manager showLastInAppNotification];