Automattic / Gravatar-SDK-iOS

Gravatar SDK is a Swift library that allows you to integrate Gravatar features into your own iOS applications.
https://gravatar.com
Mozilla Public License 2.0
36 stars 1 forks source link

Extract Grid view from Picker view #351

Closed etoledom closed 1 month ago

etoledom commented 1 month ago

Closes #

Description

This PR tries to simplify the logic on AvatarPickerView and AvatarPickerViewModel.

I don't think this is a big simplification, but there's one big conceptual change which I like:

The avatar grid itself is now completely independent of the AvatarPickerView, with its own model which managed the status of the grid as a whole and of individual avatar cells, including avatar loading, selection, and (in the future) error state.

Avatar Grid model and view are independent of any networking (expect of image loading). All requests are managed by the AvatarPickerViewModel, and updates the grid accordingly.

AvatarPickerViewModel holds a reference to the GridModel and updates it as needed, while AvatarPickerView will pass the grid model reference to the grid view.

In this way AvatarPickerViewModel is not responsible for holding the list of avatars, which avatar is selected, or individual avatar cell status, but it still holds the responses from networking.

Testing Steps

wpmobilebot commented 1 month ago
Gravatar SwiftUI Prototype Build📲 You can test the changes from this Pull Request in Gravatar SwiftUI Prototype Build by scanning the QR code below to install the corresponding build.
App NameGravatar SwiftUI Prototype Build Gravatar SwiftUI Prototype Build
Build Number1079
Version1.0
Bundle IDcom.automattic.gravatar-sdk-demo-swiftui.prototype-build
Commit62f22104ac71b0d00fd64cb936a03541743f7d42
App Center BuildGravatar SDK Demo - SwiftUI #27
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.
wpmobilebot commented 1 month ago
Gravatar UIKit Prototype Build📲 You can test the changes from this Pull Request in Gravatar UIKit Prototype Build by scanning the QR code below to install the corresponding build.
App NameGravatar UIKit Prototype Build Gravatar UIKit Prototype Build
Build Number1079
Version1.0
Bundle IDcom.automattic.gravatar-sdk-demo-uikit.prototype-build
Commit62f22104ac71b0d00fd64cb936a03541743f7d42
App Center BuildGravatar SDK Demo - UIKit #28
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.