Building a dialog wrapper service to prompt the user

If you recall from Chapter 1Get Into Shape with @NgModule, recording is a feature that should only be available to authenticated users. Therefore, we will want to prompt the user with a login dialog when they tap the Record button on each track. If they are already logged in, we will want to prompt them to confirm if they want to re-record the track for good usability.

We could handle this dialog directly in the Component by importing a NativeScript dialog service that provides a consistent API across both platforms. The ui/dialogs module from the NativeScript framework (https://docs.nativescript.org/ui/dialogs) is a very convenient service, allowing you to create native alerts, confirms, ...

Get NativeScript for Angular Mobile Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.