# 1.29.1 -> 1.30.0

## Migrating your code

### Setting Identity

**API Complete Redesign**

* **Old** :

  ```kotlin
  fun setIdentity(context: Context, identity: Identity?):MutableStateFlow<Result<Unit>>
  ```
* **New** :

  ```swift
  suspend fun setIdentity(context: Context, identity: Identity): Result<Unit>
  ```

  * Changed from callback-based (StateFlow) to suspend function approach
  * Identity parameter is now non-null
  * Removed StateFlow-based Identity Management
    * Returns `Result<Unit>` directly instead of `MutableStateFlow<Result<Unit>>`
  * Removed `currentIdentity: StateFlow<Identity?>`

```kotlin
**Before:**
val identityFlow = ImsSdkManager.setIdentity(context, identity)
identityFlow.collect { result ->
    when {
        result.isSuccess -> // Handle success
        result.isFailure -> // Handle failure
    }
}

**After:**
// In a coroutine
val result = ImsSdkManager.setIdentity(context, identity)
when {
    result.isSuccess -> // Handle success
    result.isFailure -> // Handle failure, identity automatically cleared
}
```

### Clearing identity

While logging out the user, it was possible to use setIdentity with a null value to clear identity. From now on, there is a mandatory `clearIdentity` call for logging out the user.

When logging out please use the following method

```kotlin
**Before:**
ImsSdkManager.setIdentity(context, null)

**After:**
ImsSdkManager.clearIdentity(context)
```

### Removed fields and methods

The following methods/getter have been removed

* `ImsSdkManager.updateSdkConfig(Context)`
* `SdkConfigBuilder.apiKey`
