Przejdź do głównej zawartości

Podsumoweanie pierwszego sprintu.

Dziś szybkie podsumowanie sprintu.
Generalnie prace polegały na testowaniu funkcjonalności zaimplementowanej już przeze mnie.
Aplikacja działa prawidłowo, zgodnie ze scenariuszami Gherkin.
Dane użytkownika konta google chcę wykorzystać do tego aby zapisywać pomiary każdego użytkownika, co pozwoli użytkownikom na śledzenie swoich postępów.
Wybrałem gotowy system logowania google zamiast samodzielnie implementować mechanizm rejestracji, zmiany hasła, logowania. Nie chcę też przechowywać wszystkich danych użytkowników a jedynie ich pomiary, które będziemy prezentować na wykresach.
Do zaimplementowania były scenariusze:


# language: pl

Właściwość:
Jako użytkownik aplikacji mobilnej
chcę ekran logowania
aby mieć możliwość zapisywania swoich postępów

Scenariusz: Prawidłowe logowanie do aplikacji
Mając aktywne konto google
Jeśli na ekranie logowania podam swój login i hasło
I zatwierdze dane odpowiednim przyciskiem
Wtedy będę miał dostęp do wszystkich funkcjonalności aplikacji

Scenariusz: Nieprawidłowe logowanie do aplikacji
Mając brak konta google
Jeśli na ekranie logowania podam nieistniejący login i hasło
I zatwierdze dane odpowiednim przyciskiem
Wtedy nie będę miał dostępu do żadnej funkcjonalności aplikacji
I zostanę przeniesiony na ekran mówiący o nieudanej próbie logowania


Klasa Renderer, którą omówię po weekendzie wygląda tak:

public class AuthenticationPageRenderer : PageRenderer
{
bool isShown;

protected override void OnElementChanged(ElementChangedEventArgs e)
{

base.OnElementChanged(e);

var accounts = AccountStore.Create(Context).FindAccountsForService(App.AppName);
var account = accounts.FirstOrDefault();

if (account == null)
{
if (!isShown)
{
isShown = true;
var auth = new OAuth2Authenticator(
Constants.ClientId,
Constants.ClientSecret,
Constants.Scope,
new Uri(Constants.AuthorizeUrl),
new Uri(Constants.RedirectUrl),
new Uri(Constants.AccessTokenUrl));

auth.Completed += OnAuthenticationCompleted;

var activity = Context as Activity;
activity.StartActivity(auth.GetUI(activity));
}
}
else
{
if (!isShown)
{
App.User.Email = account.Username;
App.SuccessfulLoginAction.Invoke();
}
}
}

async void OnAuthenticationCompleted(object sender, AuthenticatorCompletedEventArgs e)
{
if (e.IsAuthenticated)
{
var request = new OAuth2Request("GET", new Uri(Constants.UserInfoUrl), null, e.Account);
var response = await request.GetResponseAsync();
if (response != null)
{
string userJson = response.GetResponseText();
App.User = JsonConvert.DeserializeObject(userJson);
e.Account.Username = App.User.Email;
AccountStore.Create(Context).Save(e.Account, App.AppName);
}
}
App.SuccessfulLoginAction.Invoke();
}

Komentarze

Popularne posty z tego bloga

Unleash the power of ChatGPT in your C# applications with NGpt - C# OpenAI GPT client

Meet NGpt - OpenAI GPT C# client library that will make your conversations with ChatGPT a breeze! Have you ever been struggling building your own smart AI application in C#? Well, now you can use ChatGpt inside your application! Introducing NGpt, the powerful .NET library that lets you integrate ChatGPT seamlessly into your C# applications. No more nigts spent on building your own AI solitions, no more convoluted logic and building complex business rules - just pure AI bliss. In this blog post, we'll dive into the wonderful world of NGpt and show you how easy it is to use. You might even find a few laughs along the way. The Magic of NGpt NGpt is a transient fault-tolerant .NET 6 OpenAI client that simplifies ChatGPT integration for C# developers. It's like your friendly neighborhood Spider-Man - always there to help you out when you need it most. With just your OpenAI API key, you can start coding AI applications in C# faster than you can say "Peter Parker." Let...

Learning e24cloud.com API

Today I'll show you how to use API in order to create virtual server in the cloud directly from your code. We're going write a script in PHP language and use Amazon SDK API to connect with e24cloud.com, which is the biggest and most modern hosting provider in Poland. First we need to install Amazon SDK http://docs.aws.amazon.com/aws-sdk-php/v3/guide/getting-started/installation.html One important note: We can use the latest version of amazon SDK but we also need to do one trick. We'll use signatureV2 instead ov Signaturev4 as e24cloud doesn't support SitnatureV4 yet. You can download it here: https://github.com/aws/aws-sdk-php-v3-bridge We need to download SDK and the bridge which allows us to use Signaturev2 to the same folder, so that require instruction work seamlessly in the form that I provided in the example below. Then go to your admin panel in e24cloud.com to find two values: a key and a secret. In the following code you need to paste those 2 values. ...

Aplikacja 'Perfect Life' - planowanie funkcjonalności

W poprzednim wpisie przedstawiłem budowę historii użytkownika(ang. User Story). Dzisiaj korzystając z tego narzędzia zaplanujemy kilka funkcjonalności. Czas na zaplanowanie funkcjonalności aplikacji mobilnej Perfect Life. Aplikacja jest tworzona w oparciu o technologię Xamarin.Forms. Póki co jednak abstrahując od rozwiązań technologicznych skupimy się na funkcjonalnościach. Dobre planowanie swojej pracy to podstawa sukcesu każdego projektu programistycznego. US1: Jako użytkownik aplikacji mobilnej chcę ekran logowania aby mieć możliwość zapisywania swoich postępów US2: Jako użytkownik aplikacji mobilnej chcę mieć kalkulator wskaźnika BMI aby móc mierzyć poziom swojej kondycji US3: Jako użytkownik aplikacji mobilnej chcę widzieć wykresy aby móc wizualnie interpretować swoje postępy US4: Jako użytkownik aplikacji mobilnej chcę mieć możliwość rozwiązania quizu, żeby zbadać wskaźnik Body Age US5: Jako użytkownik aplikacji mobilnej chcę pobierać pliki PDF aby mieć dostęp do planó...