Skip to content

//ios-sdk/SmartWall

CLASS

SmartWall

public class SmartWall: NSObject

Methods

show(articleUid:navigationController:onUnlockHandler:)

public func show(articleUid: String, navigationController: UINavigationController, onUnlockHandler: @escaping UnlockCompletionHandler)

Swift

Displays current smartwall as bottom modal overlay.

Example

smartWall.show(articleUid: "article-1", navigationController: self.navigationController!) { response in
  switch response {
    case .unlockSuccess:
      print("Wall unlocked with success")
      break;
    case .unlockCancelledByUser, .paymentCancelledByUser:
      self.navigationController?.popViewController(animated: true)
    case .unlockFailure(let error):
      print(error.localizedDescription)
    case .noInternetConnection:
      let alert = UIAlertController(title: "No connection", message: "Oops looks like you have no internet connection, maybe try later", preferredStyle: .alert)
      alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { action in
        self.navigationController?.popViewController(animated: true)
      }))
      self.present(alert, animated: true)
  }
}

Parameters

Name Description
articleUid The article identifier
navigationController The navigation controller instance on which the modal should be pushed
onUnlockHandler Completion block to handle the smarwall result params

show(articleUid:navigationController:onUnlockHandler:)

public func show(articleUid: String, navigationController: UINavigationController, onUnlockHandler: @escaping UnlockResultHanlerObjC)

Objective-C

Displays current smartwall as bottom modal overlay.

Example

[sw showWithArticleUid:@"article-1" navigationController:self.navigationController onUnlockHandler:^(enum UnlockResultObjC response, NSError * error) {
     switch (response) {
       case UnlockResultObjCUnlockSuccess: {
         NSLog(@"Wall unlocked with success");
         break;
       }
       case UnlockResultObjCUnlockCancelledByUser: {
         [self.navigationController popViewControllerAnimated:true];
       }
       case UnlockResultObjCPaymentCancelledByUser: {
         [self.navigationController popViewControllerAnimated:true];
       }
       case UnlockResultObjCUnlockFailure: {
         if (error) {
           if ([error code] == SWErrorObjCProductNotFound) {
             // Do something
           }
           return NSLog(@"%@", [error localizedDescription]);
         }
       }
     }
}];

Parameters

Name Description
articleUid The article identifier
navigationController The navigation controller instance on which the modal should be pushed
onUnlockHandler Objective-C completion block to handle the smarwall result params