Hot-Swapping implementation – GBG IDscan Documentation

Hot-Swapping implementation

Install selected profile, for this you need .zip path and selected TAG. Tags can be any name selected by you. Few examples EUROPE, ASIA, France, Belgium, EUROPE_ID_CARDS or COLECTION1.  

Please note, that once you install the profile we extract the zip file into the filesystem private Library folder, hence if you don’t need the profile anymore, please use utility method to remove them.

Swift

do {
      try IDESProfileManager.install((profilePath?.path)!, withTag: tagName)
      UIAlertController.showPopup(title: "Install Profile", message: "Successfuly installed profile: (tagName)", presenter: self)
 } catch {
      UIAlertController.showPopup(title: "Install Profile", message: "Failed to install profile: (tagName) \n(error.localizedDescription)", presenter: self)
 }

Please Note: IDESProfileManager.install function handles profiles updates too. If you provide never version of the profile with the same tag, it will check versions and update if needed, hence you can always call install.

Tell MJCS that you want to use this profile.

Swift

MJCS.swap(with: profile, withCompletion: { (success: Bool, exception: NSException?) in
                 if let exception = exception {
                     UIAlertController.showPopup(title: "Select Profile Exception", message: exception.reason, presenter: self)
                 } else {
                     UIAlertController.showPopup(title: "Select Profile", message: "Succesfully selected profile: (profile.tag)", presenter: self)
                 }
 })

Launch IDSDocumentScannerController or IDSCustomerJouneyController

Please Note: TAG can be any name except “default” as this is reserved and used if you switching back to default profile.  

If you want to switch back to the default profile

Swift

MJCS.swap(withTag: IDESDefaultProfile, withCompletion: nil)
Was this page helpful?