For some use cases it may be beneficial to offer users the possibility to remove a specific personalized XignIn-Manager from the SDK instead of a complete app reset, e.g. when the app allows handling of multiple activations simultaneously.
For this purpose the SDK offers a function that only requires the idmIdentifier of the manager which is currently
personalized. This stems from the fact that the SDK supports only one activation per XignIn-Manager at once.
This function will remove all persistent data saved to an identity manager from the SDK. After this no further action can be performed that is related to the depersonalized identity manager until a new personalization has been performed. All other activations will not be affected at all, though.
Note: This will NOT delete the user's registration on the respective XignIn-Manager.
internal func removeSpecificPersonalization(idmIdentifier: String) throws {
// Retrieve the personalizer that handles the removal of activations
let personalizer: Personalizer = XignSdk.shared.personalizer
do {
// Remove the personalized XignIn-Manager.
let removedIdm: String = try personalizer.depersonalizeIdentityManagerSynchronous(
idmIdentifier: idmIdentifier
)
if removedIdm == idmIdentifier {
// The intended XignIn-Manager has been depersonalized.
// No further handling is needed, but at least the user should be notified.
YourImplementation.notifyUserAboutDepersonalization(idmIdentifier)
} else {
// This should not happen, but this case could be
// explicitly handled as an error just to be sure.
throw YourError.yourErrorCase
}
} catch {
// Activation could not be removed - handle errors
}
}
internal fun removeSpecificPersonalization(idmIdentifier: String) {
// Retrieve the personalizer that handles the removal of activations
val personalizer: Personalizer = XignSdk.shared.personalizer
try {
// Remove the personalized XignIn-Manager.
val removedIdm: String = personalizer.depersonalizeIdentityManagerSynchronous(
idmIdentifier = idmIdentifier
)
if (removedIdm == idmIdentifier) {
// The intended XignIn-Manager has been depersonalized.
// No further handling is needed, but at least the user should be notified.
YourImplementation.notifyUserAboutDepersonalization(idmIdentifier)
} else {
// This should not happen, but this case could be
// explicitly handled as an error just to be sure.
throw YourException()
}
} catch (t: Throwable) {
// Activation could not be removed - handle errors
}
}