Git Product home page Git Product logo

eshop-mobile-client's People

Contributors

borjasanes avatar dependabot[bot] avatar erjain avatar ievangelist avatar jamesmontemagno avatar junian avatar mairaw avatar michaelstonis avatar nishanil avatar tjain-ms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eshop-mobile-client's Issues

How do you test services?

I'm trying to do TDD but I'm finding it hard to deal with Preferences and Shell.Current objects that can't be injected and are created by Maui at running time.
I reviewed your brilliant application and found that you access all of them through services, freeing the View Models of references.

But, isn't it just passing the buck? At the end, the services aren't tested. I can test MVVM fine, but not Services.

Is that the case? You don't have a way to test your services in your code?

To illustrate:
This comes from the Settings Service:

public string AuthAccessToken
{
get => Preferences.Get(AccessToken, AccessTokenDefault);
set => Preferences.Set(AccessToken, value);
}

Now, I don't know a way to mock or stub the Preferences static class in the last two lines. If I want to test the service, I can't, because the Preferences static object is not injected but created behind the scenes.

[Mobile] Question regarding the implementation of InternalNavigateToAsync and AutoWire

In NavigationService's InternalNavigateToAsync method, I see that InitializeAsync is called after the Page instance is created. This can result in a NullReferenceException if the Page's ViewModel, which is created by AutoWire, is not initialized by InitializeAsync and Page starts binding to ViewModel's properties.
For example, this would crash:

public int OrderPrice => Order.Price;

because Order can be initialized only when InitializeAsync is called using navigationData

Should every ViewModel be responsible for handling the possibility of uninitialized data?
For example:

public int OrderPrice => Order?.Price ?? 0;

The conditional logic could be avoided if we InitializeAsync first, before assigning BindingContext to the Page.

Can nullable reference types be enabled in this project?

All project templates starting with .NET 6 (C# 10) enable the nullable context for the project. Projects created with earlier templates don't include this element, and these features are off unless you enable them in the project file or use pragmas.
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-reference-types

It would be nice if the reference applications showed how to use nullable reference types as it is the default setting in the latest project templates.
eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj has nullable set to enable, but eShopOnContainers/eShopOnContainers.csproj does not.

Basically same issue as: dotnet-architecture/eShopOnContainers#1681

up graded app to net 7 and ran nuget packages updated ok but get this warning now

Severity Code Description Project File Line Suppression State
Warning CS0618 'MessagingCenter' is obsolete: 'We recommend migrating to CommunityToolkit.MVVM.WeakReferenceMessenger: https://www.nuget.org/packages/CommunityToolkit.Mvvm' eShopOnContainers (net7.0-android) ~Source\Repos\eshop-mobile-client\eShopOnContainers\ViewModels\CatalogViewModel.cs 148 Active

the associated text also has chapter on messaging centre what changes are quired to make it work

Login Not Working

In SignInAsync() @ LoginViewModel.cs, didn't we miss a call something like AuthorizeAsync()?
SignInAsync() creates a "request", but does not send the request anywhere.

Need to use correct end points for actual microservices

When we provide the actual mobile aggregator endpoint (http://<HOST_DNS>/mobileshoppingagg/swagger/index.html) in the settings and login to the App, we see the following exception.

image

Also, when we go to the catalog page, none of the product items get listed. That's because the catalog service endpoint mentioned in the below code snippet expects the catalog-api endpoint through the mobile aggregator, which is not present.

private const string ApiUrlBase = "api/v1/c/catalog";

Users will also see the similar problem when they visit their profile pages where the Ordering service is getting referred.

private const string ApiUrlBase = "api/v1/o/orders";

How to logout?

I've successfully logged in to the application, but how can I log out to reconfigure the settings?

image

.Net MAUI

With the new tech in town, .Net MAUI, are we going to get an update for this?

DataTriggers for Entry controls on LogInView.xaml don't fire when the item to which they are bound changes

    <Entry IsPassword="True" Text="{Binding Password.Value, Mode=TwoWay}">
        <Entry.Style>
            <OnPlatform x:TypeArguments="Style">
                <On Platform="iOS, Android" Value="{StaticResource EntryStyle}" />
                <On Platform="WinUI" Value="{StaticResource WinUIEntryStyle}" />
            </OnPlatform>
        </Entry.Style>
        <Entry.Behaviors>
            <mct:EventToCommandBehavior EventName="TextChanged" Command="{Binding ValidatePasswordCommand}" />
        </Entry.Behaviors>
        <Entry.Triggers>
            <DataTrigger TargetType="Entry" Binding="{Binding Password.IsValid}" Value="True">
                <Setter Property="BackgroundColor" Value="{StaticResource ErrorColor}" />
            </DataTrigger>
        </Entry.Triggers>
    </Entry>

File: LoginView.cs, lines 202-224

I'm trying very hard to learn the method taught in the book (and in this accompanying code) for performing validations in .NET MAUI and MVVM. Now I've studied this quite a bit, and I think I understand everything (or at least most of it). But there appears to be a problem with the DataTriggers not firing in the Entry controls for UserName and Password in the login View.

For example, in the code above, we see that the DataTrigger in the Entry control for Password is bound to Password.IsValid in the login ViewModel, and we know that Password is a ValidatableObject in the ViewModel. Okay, so Password is a ValidatableObject and will therefore notify any bound controls in the View when the value for Password changes. But does Password.IsValid work in the same way? I mean, will Password.IsValid (not Password) also notify any bound controls in the View when the value for Password.IsValid (not Password) changes? I really don't think so. In my tests, I'm seeing that when the value for Password.IsValid changes from True to False, the DataTrigger in the View doesn't fire--presumably because it doesn't get notified about the change to Password.IsValid.

Is this a bug? Or what's another way to handle this, so that the intended effect occurs (i.e. the background color of the Entry control gets changed in the View) when Password.IsValid changes in the ViewModel?

Using the real microservices endpoint for the mobile app

After setting up the actual microservices URLs in the placeholder of Identity Url and Web Shopping Gateway Url, when we click on the [ Login ] button, nothing happens.

image

Do we need to update any further configuration in the codebase?

Filter

if you use filter and select just brand and not 2nd line then apply you get system.nullReferenceException : object reference not set to instance of object

Tight coupling view/viewmodels through routes

It seems there's still a dependency of the view models on the views: When the view models call INavigationService.NavigateToAsync(), they pass the route key. However these route keys are defined in the AppShell which I would consider to be part of the view layer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.