Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModelEntryChangeTracker introduced, removed dependency on contact model's onItemChanged #16758

Merged
merged 6 commits into from
Nov 14, 2024

Conversation

micieslak
Copy link
Member

@micieslak micieslak commented Nov 13, 2024

What does the PR do

Closes: #16754

Affected areas

ModelUtils, ActivityNotificationMessage with subclasses

Architecture compliance

@status-im-auto
Copy link
Member

status-im-auto commented Nov 13, 2024

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6b1f0e5 #1 2024-11-13 17:04:52 ~7 min tests/nim 📄log
✔️ 6b1f0e5 #1 2024-11-13 17:04:56 ~7 min macos/aarch64 🍎dmg
✔️ 6b1f0e5 #1 2024-11-13 17:10:05 ~12 min tests/ui 📄log
✔️ 6b1f0e5 #1 2024-11-13 17:13:11 ~15 min macos/x86_64 🍎dmg
✔️ 6b1f0e5 #1 2024-11-13 17:18:35 ~21 min linux-nix/x86_64 📦tgz
✔️ 6b1f0e5 #1 2024-11-13 17:18:50 ~21 min linux/x86_64 📦tgz
✔️ 6b1f0e5 #1 2024-11-13 17:25:37 ~28 min windows/x86_64 💿exe
✔️ 447a7d0 #2 2024-11-14 09:14:00 ~4 min macos/aarch64 🍎dmg
✔️ 447a7d0 #2 2024-11-14 09:16:52 ~7 min tests/nim 📄log
✔️ 447a7d0 #2 2024-11-14 09:20:37 ~11 min macos/x86_64 🍎dmg
✔️ 447a7d0 #2 2024-11-14 09:22:08 ~12 min tests/ui 📄log
✔️ 447a7d0 #2 2024-11-14 09:27:55 ~18 min linux-nix/x86_64 📦tgz
✔️ 447a7d0 #2 2024-11-14 09:28:50 ~19 min linux/x86_64 📦tgz
✔️ 447a7d0 #2 2024-11-14 09:34:51 ~25 min windows/x86_64 💿exe

readonly property var myContactsModelConnection: Connections {
target: root.contactsStore.myContactsModel ?? null
enabled: d.activeChatType === Constants.chatType.oneToOne
StatusQUtils.ModelEntryChangeTracker {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we need the ModelEntryChangeTracker. In this case we can use something like this:

property ContactDetails oneToOneChatContact: ContactDetails {
        publicKey: d.activeChatId
        contactsStore: root.contactsStore
        profileStore: root.profileStore
}

Have you found other usages as well?

If this is the only usage, I'd advise against ModelEntryChangeTracker usage. The complete solution should be coming from the ContactDetails component.

Copy link
Member Author

@micieslak micieslak Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two usages right now: Chat/RootStore and ActivityNotificationMessage.

I fully agree it's not a final solution. Right now it's the least invasive method to unblock #16667 which is providing significant simplifications related to contacts models. In the next step we will remove ModelEntryChangeTracker which is only temporary replacement for nim's model onItemChanged signal, releasing dependency on that custom feature of backend's model. The target is to use ContactDetails or join models at early stage to provide all necessary details via models.

Regarding the ContactDetails in this particular context I see also some other problems we should consider:

  • ContactDetails depends on ProfileStore so it would introduce unnecessary dependency to this RootStore even though its totally not needed here
  • ContactDetails should not be used in store as it's breaking contract that stores are just a thin layer over backend's functionality

So I'm still assuming it's temporary solution on the way towards further simplifications/cleanup. Just trying to fix everything at once triggers too many changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree! Glad it's another step forward and not the final solution 😄
ContactDetails dependencies should be simplified as well at some point if we can extract the user profile from the model and we don't need the profileStore anymore.

Ideally it would work only with a model. The purpose of the component is just to provide some default values on top of ModelEntry.

Copy link
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@micieslak micieslak merged commit 325d358 into master Nov 14, 2024
9 checks passed
@micieslak micieslak deleted the feat/issue-16754 branch November 14, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce ModelEntryChangeTracker utility component
4 participants