-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add "Get Projects" and "Find By Id" from Production Service #251
base: main
Are you sure you want to change the base?
Conversation
… given project by ID. Includes the refactors and improvements that get this done
425a423
to
f67d088
Compare
|
||
public static class DependencyFactory | ||
{ | ||
public static IRelayService GetRelayService(ILoggerFactory loggerFactory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wondering why not use the standard dependency injection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! I chose this approach because the number of dependencies is still relatively small and adding a DI container felt like overengineering at this stage. However, if you think we should switch to standard DI, I can prepare a PR with the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes definitely we will use DI look at the client project and how we utilize the DI there we should do the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to use use of Microsoft.Extensions.DependencyInjection. It's done and it works perfectly, but I think that change should be done in a follow-up PR. It's a bit of scope and I'd like to keep it separated. What do you think?
src/Angor/Avalonia/Angor.Model.Implementation/Projects/ProjectService.cs
Outdated
Show resolved
Hide resolved
namespace Angor.Model.Implementation; | ||
|
||
// TODO: This is copied from Angor.Client | ||
public class NetworkConfiguration : INetworkConfiguration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I dont like this, but it is temporary code then I guess it is ok for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's why I decided to copy it
public class Stage : IStage | ||
{ | ||
public DateOnly ReleaseDate { get; set; } | ||
public uint Amount { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
money we represent as long normally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless this is the stage representation so it is a percent in which case it should be a decimal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the stage representation and it's a number in sats internally, that can be converted to whatever we need in the UI (BTC or sats)
); | ||
|
||
lookupResultsHelper = Lookup | ||
.ObserveOn(RxApp.MainThreadScheduler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need to use a schedular MainThreadScheduler
? is it because there are calls over the wire?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ViewModels needs to ensure properties are modified in the UI thread, because they are bound to the UI. Avalonia (and other GUI technologies) requires this.
But those calls to ObserveOn are not needed in this case because ReactiveUI handles this internally.
@@ -0,0 +1,20 @@ | |||
using AngorApp.Model; | |||
|
|||
namespace Angor.Model.Implementation.Projects; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This model belongs to the UI only right? perhaps the namespace should reflect that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, absolutely. I've modified the namespaced to reflect that.
037f8a3
to
02df556
Compare
Implement service to get projects from the real service and to find a given project by ID.
Includes the refactors and improvements that get this done.