|
2 | 2 |
|
3 | 3 | This guide provides detailed instructions on how to upgrade between versions of the Chat SDK. |
4 | 4 |
|
| 5 | +## 0.8.x to 0.9.x |
| 6 | + |
| 7 | +### MessageAction Enum |
| 8 | + |
| 9 | +**Expected Impact: Low** |
| 10 | + |
| 11 | +The `MessageAction` enum no longer includes internal `Meta` and `Summary` values. These values were not part of the public API and should not have been used in application code. The enum now only contains the three public action types: `MessageCreate`, `MessageUpdate`, and `MessageDelete`. |
| 12 | + |
| 13 | +No code changes are required unless you were incorrectly using these internal values. |
| 14 | + |
| 15 | +### Listener Functions |
| 16 | + |
| 17 | +**Expected Impact: Low** |
| 18 | + |
| 19 | +Interface-based listeners have been replaced with Kotlin function types for a more idiomatic API. |
| 20 | +This affects binary-compatibility mostly for all subscription methods throughout the SDK. |
| 21 | + |
| 22 | +This change applies to all subscription methods including: |
| 23 | +- `Messages.subscribe()` |
| 24 | +- `Presence.subscribe()` |
| 25 | +- `RoomReactions.subscribe()` |
| 26 | +- `Occupancy.subscribe()` |
| 27 | +- `Typing.subscribe()` |
| 28 | +- `Room.onStatusChange()` |
| 29 | +- `Connection.onStatusChange()` |
| 30 | + |
| 31 | +### Exception Handling |
| 32 | + |
| 33 | +**Expected Impact: Medium** |
| 34 | + |
| 35 | +The Chat SDK now throws `ChatException` instead of `AblyException`. This provides better error handling specificity for chat-related operations. |
| 36 | + |
| 37 | +#### Code Changes Required |
| 38 | + |
| 39 | +**Before** |
| 40 | + |
| 41 | +```kotlin |
| 42 | +import io.ably.lib.types.AblyException |
| 43 | + |
| 44 | +try { |
| 45 | + room.attach() |
| 46 | +} catch (e: AblyException) { |
| 47 | + // Handle error |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +**After** |
| 52 | + |
| 53 | +```kotlin |
| 54 | +import com.ably.chat.* |
| 55 | + |
| 56 | +try { |
| 57 | + room.attach() |
| 58 | +} catch (e: ChatException) { |
| 59 | + // Handle error |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +### Status Properties |
| 64 | + |
| 65 | +**Expected Impact: Medium** |
| 66 | + |
| 67 | +Status properties have been changed from `current()` function to `current` property for cleaner, more idiomatic Kotlin syntax. |
| 68 | + |
| 69 | +#### Code Changes Required |
| 70 | + |
| 71 | +**Before** |
| 72 | + |
| 73 | +```kotlin |
| 74 | +val occupancyData = occupancy.current() |
| 75 | +val typingClients = typing.current() |
| 76 | +``` |
| 77 | + |
| 78 | +**After** |
| 79 | + |
| 80 | +```kotlin |
| 81 | +val occupancyData = occupancy.current |
| 82 | +val typingClients = typing.current |
| 83 | +``` |
| 84 | + |
| 85 | +This change applies to: |
| 86 | +- `Occupancy.current` |
| 87 | +- `Typing.current` |
| 88 | + |
| 89 | +### Import Path Changes |
| 90 | + |
| 91 | +**Expected Impact: High** |
| 92 | + |
| 93 | +Several types now import from `com.ably.chat` instead of their previous locations. This ensures consistency and clarity about which types are part of the Chat SDK public API. |
| 94 | + |
| 95 | +#### Code Changes Required |
| 96 | + |
| 97 | +**Before** |
| 98 | + |
| 99 | +```kotlin |
| 100 | +import io.ably.lib.types.ErrorInfo |
| 101 | +import io.ably.lib.types.MessageAction |
| 102 | +``` |
| 103 | + |
| 104 | +**After** |
| 105 | + |
| 106 | +```kotlin |
| 107 | +import com.ably.chat.* |
| 108 | +``` |
| 109 | + |
| 110 | +### Compose Extension |
| 111 | + |
| 112 | +**Expected Impact: Low** |
| 113 | + |
| 114 | +The `chat-compose-extension` module has been promoted from experimental to stable. |
| 115 | +Made extensions return `State<*>` instead of plain objects to avoid unnecessary recompositions: |
| 116 | + |
| 117 | +**Before** |
| 118 | + |
| 119 | +```kotlin |
| 120 | +val roomStatus = room.collectAsStatus() |
| 121 | +val connectionStatus = connection.collectAsStatus() |
| 122 | +val currentlyTyping = room.collectAsCurrentlyTyping() |
| 123 | +val presentMembers = room.collectAsPresenceMembers() |
| 124 | +val occupancy = room.collectAsOccupancy() |
| 125 | +``` |
| 126 | + |
| 127 | +**After** |
| 128 | + |
| 129 | +```kotlin |
| 130 | +val roomStatus by room.collectAsStatus() |
| 131 | +val connectionStatus by connection.collectAsStatus() |
| 132 | +val currentlyTyping by room.collectAsCurrentlyTyping() |
| 133 | +val presentMembers by room.collectAsPresenceMembers() |
| 134 | +val occupancy by room.collectAsOccupancy() |
| 135 | +``` |
| 136 | + |
5 | 137 | ## 0.7.x to 0.8.x |
6 | 138 |
|
7 | 139 | ### Protocol v4 changes |
|
0 commit comments