(Feat): v0.18#81
Open
vickz84259 wants to merge 24 commits into
Open
Conversation
After upgrading my local Flutter version, it autogenerated some files and made updates to others. These changes were largely due to Swift Package Manager becoming default over Cocoapods and Flutter supporting UIScene lifecycle methods. Signed-off-by: Victor Omondi <victor@slick.co.ke>
This commit also includes the switch from using `flutter_apns_only` to using `talkjs_flutter_apns_only`. The reason is that the former does not support Swift Package Manager and UIScene lifecycles. Signed-off-by: Victor Omondi <victor@slick.co.ke>
Signed-off-by: Victor Omondi <victor@slick.co.ke>
The most important change is that I realised we had defined `MessageType` in two separate places. One had the enum values starting with a small case while the other with an upper case. This commit unifies the two definitions. This is a breaking change for users but I feel like it's valid and necessary. The other changes are just quality of life changes that make the enum related code much more ergonomic to use. Also added the .types file that'll store the types used in multiple places. This makes the imports simpler. Right now it wasn't clear what was being imported from where.
These types are referenced in more than one file.
Specify the `@override` annotation to clearly show which methods are being intentionally overridden.
While adding a new chatbox option, I realised that adding more would cause the length of the function to become too long for comfort. This refactor aims to make these functions easier to browse.
A lot of places used `Object.hashAll` which cares about the iteration
order. However, most of the objects in question don't really care about
the order.
For example: The following custom objects should be considered
identical: { "a" : "b", "c" : "d" } & { "c" : "d", "a" : "b" }
In that case it makes sense to use `Object.hashAllUnordered` instead.
Since every class in Dart extends `Object` there is no need to define "operator ==" and "get hashCode" as part of the abstract classes: BaseConversationPredicate and BaseMessagePredicate. Similarly, since we have declared the abstract method `toJson()`, we can specify the `toString()` override in the abstract classes.
In both instances we end up calling `json.encode()` which will in turn call `toJson()` on the objects contained within.
Rename `conversationData` property to `conversation` to match the JSSDK and React Native SDK
This is just to make their names identical to what we have in other SDKs.
bugnano
reviewed
Jul 9, 2026
This removes the custom `fromString()` method in favour of using `Enum.values.byName()`
We realised that calling `Object.hashAllUnordered()` on MapEntry objects does not result in identical hashCodes. To fix this, I ended up using `MapEquality` instead. While fixing the above, I realised that `listEquals()` expects the items to be in the same order. This conflicts with how we were calculating the hashCode for the same lists. So I replaced this with the use of `UnorderedIterableEquality`. I defined these as compile time constants since as an optimisation. No need to create them everytime the hashcode is referenced or the `==` operator is used.
The order of welcomeMessages matters hence we should be using `ListEquality` instead of `UnorderedIterableEquality`
Signed-off-by: Victor Otieno <victor@slick.co.ke>
Signed-off-by: Victor Otieno <victor@slick.co.ke>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A big part of this PR is refactors that I felt were needed just to make the codebase a bit easier to read through and comprehend. With the upcoming components SDK, I speculate that we won't be making many changes to this SDK any time soon. So now felt like a good time to make some of these changes.
Also, adding support for Swift Package Manager to
talkjs_flutter_apns_onlynecessitated an increase in the minimum flutter version supported. Which subsequently also affects this SDK. With this being a breaking change, I felt that I could add a couple more breaking changes in this PR as well.Here's a breakdown of the changes:
MessageTypein two different places. So I unified the two into one definition.customEmojis,onLeaveConversationandonMarkConversationAsUnreadtoChatboxwidget. This also closes issue Unable to react to "Leave" conversation action. #67.Object.hashAll()expects the iteration order to be consistent. However, our use case does not require this. For example: The following custom objects should be consideredidentical:
{ "a" : "b", "c" : "d" }&{ "c" : "d", "a" : "b" }. Therefore it makes sense to useObject.hashAllUnordered()instead.participantstoConversationData. I noticed it was missing.conversationDatatoconversationinConversationActionEvent. I don't know if this changed in the JSSDK or we just missed it when implementing it the first time.BaseMessagePredicateandBaseConversationPredicatetoSimpleMessagePredicateandSimpleConversationPredicaterespectively. Similar to the previous change above, it aligns the naming with the other SDKs.Reviewing
Go through it commit by commit. The commit messages should provide the additional context where necessary.
Also, I haven't migrated the Example app to AGP 9 yet. I'll do that later. I think I also have to upgrade our webview fork: pichillilorenzo/flutter_inappwebview#2846