Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Xamarin.Forms

You're reading from   Mastering Xamarin.Forms App architecture techniques for building multi-platform, native mobile apps with Xamarin.Forms 4

Arrow left icon
Product type Paperback
Published in Dec 2019
Publisher
ISBN-13 9781839213380
Length 200 pages
Edition 3rd Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Ed Snider Ed Snider
Author Profile Icon Ed Snider
Ed Snider
Arrow right icon
View More author details
Toc

Adding a sign-out button

Now that we've added a sign-in feature to our app, we need to give our users a way to sign out as well. Most apps that deal with authenticating users will put a sign-out button somewhere in an account settings or profile screen. Since our app does not have an account settings or profile screen, we'll simply add a Sign out button to the navigation bar on the main page. In addition to allowing the user to sign out, the app should also automatically sign the user out if it receives any 401 (unauthorized) responses from the API.

We'll add support for automatic sign-out first, because we'll be able to repurpose it when we add the sign-out button:

  1. First, add a new Action property to the ITripLogDataService interface named UnauthorizedDelegate. This delegate will work like the AuthorizedDelegate we added earlier in the chapter, except this one will allow callers to take action whenever the app's access to the data service is unauthorized...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime