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

Mirego-base-setup 3 of X: MVVM pattern #44

Merged
merged 9 commits into from
Nov 24, 2023

Conversation

OlivierPineau
Copy link

📖 Description

Add our basic MVVM pattern
View, ViewModel, UseCase, Repository
Also added datasources and Apollo to query a Mirego GraphQL api

🦀 Dispatch

  • #dispatch/kmp

@mirego-builds
Copy link

🦀 Requesting reviewers for this pull request:

🦀 Mentionning users for this pull request:

import okio.Path.Companion.toPath
import okio.buffer

class ApolloGraphQLDiskDataSource<R : ApolloGraphQLDataSourceRequest<T>, T : Query.Data>(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should instead use Apollo's built-in normalized cache instead of implementing our own caching solution.

Copy link
Author

Choose a reason for hiding this comment

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

Does any of our projects use the Apollo cache now? I now we had issues with it in the past

Copy link
Contributor

@sdetilly sdetilly Nov 24, 2023

Choose a reason for hiding this comment

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

In transat, we used normalized cache in the beginning but switched to Trikot datasources afterwards. If I remember correctly, there were 2 reasons:

  1. Noticeable performance issues (might be fixed now I suppose, since this was in mid-end of 2022)
  2. There were no easy way to manage states (Loading, Error, Data but also Pending with data, Error with data, expiring data, etc...))

I feel like, for now, we should stick to Trikot datasources in the boilerplate until more projects uses normalized cache (and can vouch that everything works great!)

import kotlinx.serialization.json.Json
import kotlin.time.Duration.Companion.minutes

open class GenericDataSource<T>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't these generic datasources be provided directly in the com.mirego.trikot.datasources library?

Copy link
Author

Choose a reason for hiding this comment

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

Agreed that we need those in the lib

Base automatically changed from feature/mirego-base-setup-bootstrapper to mirego November 24, 2023 14:36
@sdetilly sdetilly force-pushed the feature/mirego-base-setup-mvvm branch from 67ebe16 to a83f0c9 Compare November 24, 2023 19:13
@sdetilly sdetilly merged commit a15802b into mirego Nov 24, 2023
1 check passed
@sdetilly sdetilly deleted the feature/mirego-base-setup-mvvm branch November 24, 2023 19:32
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.

4 participants