# Migration guide

# IncdOnboarding migration guide

## Migration to 5.39.0

- Removed `enableRotationOnRetakeScreen` parameter from `addIdScan` method. Document in the review screen is shown in vertical orientation always.
- Renamed `showRetakeScreen` into `showRetakeScreenForManualCapture` in `addIdScan` method.
- Renamed `showAutoCaptureRetakeScreen` into `showRetakeScreenForAutoCapture` in `addIdScan` method.

## Migration to 5.38.0

- Renamed `FaceAuthenticationConfiguration` struct field `showTutorial` to `showTutorials` in order to perserve consistent parameter naming with other modules.
-  Deprecated `enableIdSummaryScreen` parameter from addIdProcess. Now function signature is now `addIdProcess(idCategory: IDCategory)`. Screen will not appear when using v2 UI. IdSummaryScreen will be removed in future update.

## Migration to 5.37.0

End-to-end-encryption (E2EE) no longer requires a separate "-e2ee" SDK variant and has also dropped the dependency on the `OpenSSL` framework. The separate "-e2ee" SDK variant has been deprecated.

## Migration to 5.34.0

The `brightnessThreshold` parameter has been removed in the following methods:
- IncdOnboardingFlowConfiguration - addSelfieScan
- IncdOnboardingManager - startFaceLogin
- IncdOnboardingManager - startKioskSelfieScan
Migrate by removing the parameter from these methods. 

## Migration to 5.30.0

- Removed `.hybrid` mode from `FaceAuthMode`. `.hybrid` mode can safely be replaced with `.server` when calling `startFaceLogin`. 

## Migration to 5.21.0

- `FaceMatchResult.idCategory` field is now named `idCategories`

## Migration to 5.19.0

- Removed the '-m' variant for face mask check. From version 5.19.0 onward, local mask check is standard in all variants. Migrate by omitting the '-m'; e.g. update '5.18.0-d-l-m' to '5.19.0-d-l'.

## Migration to 5.18.0

Starting from version 5.18.0, IncdOnboarding utilizes Lottie vector animations in JSON format for displaying tutorials. If you have been using your own tutorials in .mp4 format, you will need to provide the corresponding animations in JSON format. For more information on setting up your own tutorials, please visit the following page [Change tutorial videos](USER_GUIDE_CUSTOMIZATION.md#change-tutorial-videos)

## Migration to 5.16.0

- Callback method for NFC Scan module has been renamed from `onPassportNFCScanCompleted(_ result: NFCScanResult)` to `onNFCScanCompleted(_ result: NFCScanResult)` in order to support NFC scan on IDs.
- `NFCScanResult`'s fields have also been renamed:
  - `passportFacePhoto` to `facePhoto`
  - `passportDG1` to `dg1`
  - `passportNFCScanError` to `error`
- `PassportNFCScanError` type is also renamed, now it is `NFCScanError`.
- `userPassportHasNoChip` error is now `userDocumentHasNoChip`.

- `HelpButtonConfiguration` is removed in favor of an improved `ButtonConfiguration`:

Old way:
```swift
  private var helpButton: HelpButtonConfiguration {

    return HelpButtonConfiguration(cornerRadius: 35,
                                   backgroundColor: Colors.background,
                                   textColor: Colors.primary,
                                   iconColor: Colors.primary,
                                   width: 140,
                                   height: 70,
                                   iconTitlePadding: 4,
                                   verticalPadding: 6,
                                   horizontalPadding: 8)
```

New way:

```swift
private var helpButton: ButtonConfiguration {
    let normal = ButtonThemedState(alpha: 1.0,
                                   backgroundColor: .incdBackground,
                                   borderColor: .incdPrimary,
                                   borderWidth: 1.0,
                                   textColor: .incdPrimary,
                                   iconImageName: "incdOnboarding.help.clipped",
                                   iconTintColor: .incdPrimary,
                                   iconPosition: .right,
                                   iconPadding: 8)
    return ButtonConfiguration(states: .init(normal: normal))
  }
```

## Migration to 5.15.0

- **Breaking Change:** The function `onEvent(_ event: Event, data: [String: Any])` has been replaced with a more comprehensive function to handle multiple events along with their associated data. 
 - New Function: `onEvents(_ eventsWithDetails: [EventWithDetails])`

   - `EventWithDetails` is a typealias for a tuple containing an Event and its associated data.

   - This change provides improved capability for processing multiple events and their associated data together.

 ***Note**: This function is intended for analytics or informative purposes only, and should not be used as an indication that all events and their effects have been executed and completed.*

Old way:
```swift
func onEvent(_ event: Event, data: [String: Any])
```

New way:
```swift
 func onEvents(_ eventsWithDetails: [EventWithDetails])
```

## Migration to 5.12.0

- `addMachineLearningConsent` parameter `type` is now one of the `RegulationType` options, instead of a `ConsentType`. `.gdpr` and `.us` options are still available.

## Migration to 5.5.0

- Renamed setting `serverSelfieFaceMaskCheck: Bool` to `faceMaskCheck: Bool`. In case of framework variant which includes local face mask check, user can specify via `IncdOnboardingManage.shared.faceMaskCheckMode` to use either server or local. Default is `.local`.

## Migration to 5.x

### Start Onboarding

Parameters `interviewId`, `configurationId`, `onboardingValidationModules`, `customFields`, `externalId` are removed.

These parameters are now provided via `IncdOnboardingSessionConfiguration`:

```swift
let sessionConfig = IncdOnboardingSessionConfiguration(configurationId: "confId",
                                                                 validationModules: [],
                                                                 customFields: ["customKey": "customData"],
                                                                 interviewId: "interviewId",
                                                                 externalId: "externalId")
```

`IncdOnboardingConfiguration` is removed, use `IncdOnboardingFlowConfiguration` instead to add modules:
```swift
let flowConfig = IncdOnboardingFlowConfiguration()
          flowConfig.addIdScan()
          ...
```

Now you can provide these to the `startOnboarding` method:
```swift
  IncdOnboardingManager.shared.startOnboarding(sessionConfig: sessionConfig, flowConfig: flowConfig, delegate: self)
```

### Setup Onboarding Session

Removed API methods:
- `createNewOnboаrdingSession`
- `setOnboardingSession`

Use the `setupOnboardingSession` instead. All the parameters of `createNewOnboаrdingSession` and `setOnboardingSession` methods are now part of `IncdOnboardingSessionConfiguration`:

```swift
let sessionConfig = IncdOnboardingSessionConfiguration(region: "ALL",
                                                       queue: .aristotle,
                                                       configurationId: "confId",
                                                       validationModules: [],
                                                       customFields: ["customKey": "customData"],
                                                       interviewId: "interviewId",
                                                       token: "token",
                                                       externalId: "externalId")

IncdOnboardingManager.shared.setupOnboardingSession(sessionConfig: sessionConfig) { sessionResult in
            
}
```

### Starting Onboarding Section

- `flowTag` is removed from `IncdOnboardingFlowConfiguration`, and is now a parameter inside `startOnboardingSection`:

```swift
let flowConfig = IncdOnboardingFlowConfiguration()
flowConfig.addIdScan()
IncdOnboardingManager.shared.startOnboardingSection(flowConfig: flowConfig, sectionTag: "MyTag", delegate: self)
```

## Migration to 4.7.1

- Colors passed to `IncdTheme` are not `UIColor` instead of `CGColor`. For more information please visit [IncdTheme Guide](USER_GUIDE_INCD_THEME.md).

## Migration to 4.5.0

- Added `CustomComponents` to `IncdTheme` which holds a UI customization configuration for the Camera Feedback View. For more information please visit [IncdTheme Guide](USER_GUIDE_INCD_THEME.md).
- Changed several localization keys to match style and consistency:
  ```
  "incdOnboarding.btnCancel" -> "incdOnboarding.global.button.cancel"
  "incdOnboarding.btnContinue" -> "incdOnboarding.global.button.continue"
  "incdOnboarding.btnDone" -> "incdOnboarding.global.button.done"
  "incdOnboarding.btnNext" -> "incdOnboarding.global.button.next"
  "incdOnboarding.dialog.cameraPermissionsBtnOpenSettings" -> "incdOnboarding.global.dialog.cameraPermissionsBtnOpenSettings"
  "incdOnboarding.dialog.cameraPermissionsMandatorySubtitle" -> "incdOnboarding.global.dialog.cameraPermissionsMandatorySubtitle"
  "incdOnboarding.dialog.cameraPermissionsMandatoryTitle" -> "incdOnboarding.global.dialog.cameraPermissionsMandatoryTitle"
  "incdOnboarding.dialog.ok" -> "incdOnboarding.global.dialog.ok"
  "incdOnboarding.dialog.permission.finishProcess" -> "incdOnboarding.global.dialog.permission.finishProcess"
  "incdOnboarding.err.oooops.msg" -> "incdOnboarding.global.error.generic.message"
  "incdOnboarding.err.oooops.title" -> "incdOnboarding.global.error.generic.title"
  "incdOnboarding.processing" -> "incdOnboarding.global.processing"
  "incdOnboarding.uploading" -> "incdOnboarding.global.uploading"
  "incdOnboarding.qr.scanningDone" -> "incdOnboarding.qr.scanning_done"
  "incdOnboarding.qr.scanningError" -> "incdOnboarding.qr.scanning_error"
  "incdOnboarding.govValidation.inProgress" -> "incdOnboarding.govValidation.in_progress"
  "incdOnboarding.govValidation.startedSuccessfully" -> "incdOnboarding.govValidation.startedSuccessfully"
  "incdOnboarding.govValidation.success" -> "incdOnboarding.govValidation.success"
  "incdOnboarding.govValidation.failure" -> "incdOnboarding.govValidation.failure"
  "incdOnboarding.govValidation.error.connection" -> "incdOnboarding.govValidation.connection_error"
  "incdOnboarding.govValidation.error.ineInfrastructure" -> "incdOnboarding.govValidation.ine_infrastructure_error"
  "incdOnboarding.govValidation.error.moduleNotSupported" -> "incdOnboarding.govValidation.module_not_supported_error"
  "incdOnboarding.govValidation.error.missingDocumentIdentifier" -> "incdOnboarding.govValidation.missing_document_identifier_error"
  "incdOnboarding.govValidation.error.missingSelfie" -> "incdOnboarding.govValidation.missing_selfie_error"
  "incdOnboarding.govValidation.error.userNotFound" -> "incdOnboarding.govValidation.user_not_found_error"
  "incdOnboarding.govValidation.error.userNotInDatabase" -> "incdOnboarding.govValidation.user_not_in_database"
  "incdOnboarding.govValidation.error.insufficientLookupData" -> "incdOnboarding.govValidation.insufficient_lookup_data"
  ```
  For the full instructions on the localization please visit [Localization Guide](LOCALIZATION_GUIDE.md).

## Migration to 4.1.0

- Updated Document Scan flow that supports the option to upload a PDF or image from the device. Potentially breaking change: `.document` is now `.addressStatement`.
- Tutorials for Document Scan are now disabled by default, and the document provider screen is enabled by default. Many of the texts have been updated so please take a look at the full list [here](USER_GUIDE_CUSTOMIZATION.md#change-the-texts).

## Migration to 4.0.0

- Individual functions are removed:
	- Please use sections API instead and add a module via `IncdOnboardingFlowConfiguration.add<module>()` method.
- Removed any deprecated API which was using parameter `vc: UIViewController`. Please switch to the same functioins without the `vc` parameter.
- If you are using ID Scan module, it is required to switch to a new result structure `IdScanResult`. Check [User Guide](USER_GUIDE.md) for more info.

## Migration from 1.10.x to 1.11.0

For version 1.11.0 ID and Selfie capture are customized via IncdTheme.
If you are using UI customization please visit [IncdTheme Guide](USER_GUIDE_INCD_THEME.md).

- New option - 
Allow users to cancel ID or Selfie capture by showing close (X) button:

```
IncdOnboardingManager.shared.allowUserToCancel
```
Default is `false`.

## Migration from 1.9.x to 1.10.x

`vc: UIViewController` parameter is now deprecated in most of calls. 
Please assign the `vc:` parameter to `IncdOnboardingManager.shared.presentingViewController` and remove the `vc:` parameter from the API.

Example:

1.9.x
```
IncdOnboardingManager.shared.startOnboarding(vc: self)
```
1.10.x
```
IncdOnboardingManager.shared.presentingViewController = self
IncdOnboardingManager.shared.startOnboarding()
```
## Project Migration Guide from 1.9.42 to 1.9.46

Framework is now being delivered as a static IncdOnboarding.xcframework, so that only `opencv2` and `OpenTok` frameworks need to be added to the project alongside main `IncdOnboarding.xcframework`

### Make sure `git lfs` is installed

Some framework files exceed 100MBs, so Git Large File Storage is needed to be setup. Please find the instrcutions here:
https://docs.github.com/en/github/managing-large-files/versioning-large-files/installing-git-large-file-storage

### Framework files update
- Remove IncdNetwork, IncdFaceDetection, IncdRecogKit, IncdUIKit frameworks and IncdUIKit.bundle (also remove any imports in code from these modules if you have them)
- Add opencv2.framework
- Replace current OpenTok.framework and IncdOnboarding.xcframework
- Replace current IncdOnboarding.bundle

### Change Project Settings  
1. Add following to the `Other Linker Flags`:
`-l “stdc++” -l “iconv” - framework “VideoToolbox”`
2. IncdOnboarding.xcframework, opencv2.framework and OpenTok.framework should be set to `Do not Embed’`

### Code updates 

Error handling has been improved and simplifed, in particular:

- `IncdOnboardingDelegate` and its `onError` callback now return `IncdFlowError` instead of `IncdOnboardingError`. You'll be notified here about all the possible errors that abort the flow.
- `IncdOnboardingDeletegate` and some of its callback methods once the steps are completed no longer have `ResultCode` field used to determine if the step finished successfully or not. You can always check if the `error` field in the result is `nil` to identify successful step completion, or see if some error occured.

## 1.9.14 -> 1.9.25
### Migration steps:
Moving ID auto-capture timeouot configuration to server. 
1. Remove `idAutoCaptureTimeout` parameter if present anywhere. Timeout can be set on server through REST API. 

## 1.8.x -> 1.9.14
### Migration steps:
1. Remove OpenTok from Cocoapods. If that was your only Pod then you can deintegrate Cocoapods altogether.
2. Remove the “models” folder from the project and from the file system.
3. Remove the “models” from the target’s “Build Phases” -> “Copy Bundle Resources” section.

## 1.6.x -> 1.8.x
### Migration steps:
1. Document type `.addressproof` has been renamed to `.document` for scanning documents using `addDocumentScan(: DocumentType)`.
2. Usage of `IncdRegion` is deprecated. `IncdOnboardingConfiguration` init now takes a `regionCode: String` as a parameter. Before it was `IncdRegion`.
