AwaitablePopups 1.0.0

Create your own DisplayAlerts using XAML,
or use the DisplayAlerts,LoaderDialogs and LoginViews that's included!
Powered by AsyncAwaitBestPractices and Rg.Plugins.Popup

There is a newer version of this package available.
See the version list below for details.
Install-Package AwaitablePopups -Version 1.0.0
dotnet add package AwaitablePopups --version 1.0.0
<PackageReference Include="AwaitablePopups" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AwaitablePopups --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

WARNING

This version is based on the following PR. Which may have changes in the future. As a result. please read through this PR for API changes.
https://github.com/LuckyDucko/AwaitablePopups/pull/10

I will update the documentation as soon as I find the time

<!-- ABOUT THE PROJECT -->

About The Project

Awaitable Popups is a neat blend of the Rg.Plugins.Popup and AsyncAwaitBestPractices plugins to bring you a quick way to add popups into your Xamarin Forms App using familiar concepts

Built With

<!-- GETTING STARTED -->

Getting Started

First, you must follow the initialisation
guide set out by Rg.Plugins.Popup, once you have that, have a look at usage down below

Installation

You can install the nuget by looking up 'AwaitablePopups' in your nuget package manager, or by getting it here

<!-- USAGE EXAMPLES -->

Usage

here is an example of what this plugin makes easy (Looks slow due to giphy)

Gif Example

I have included the older, 'safer' example, and the new simplfied example.

New Example

To Use the plugin for its inbuilt popup pages (Dual/Single Response, TextInput and loader.) All you need are these one liners

SingleResponse Popup Page

return await SingleResponseViewModel.GeneratePopup(new PopupButton(Color.Goldenrod, Color.Black, "Okay"), Color.Gray, "Your Phone Number or Pin is incorrect, please try again.", "NoSource.png");

DualResponse Popup Page

return await DualResponseViewModel.GeneratePopup(new PopupButton(Color.Green, Color.Black, "I Accept"), new PopupButton(Color.Red, Color.Black, "I decline"), Color.Gray, "Do you accept the terms and conditions?", "NoSource.png");

Loader Popup Page

  await PopupService.WrapTaskInLoader(Task.Delay(10000), Color.Blue, Color.White, LoadingReasons(), Color.Black);

Text Input PopupPage

await TextInputViewModel.GeneratePopup(new PopupButton(Color.Green, Color.Black, "I Accept"), new PopupButton(Color.Red, Color.Black, "I decline"), Color.Green, "TEXT HERE", "Placeholder");

LoginPage is currently going through some testing, come back soon.
LoginPage PopupPage

await LoginPageViewModel.GeneratePopup(CHECK DOCUMENTATION);

or, to return from the loader a value

await PopupService.WrapReturnableTaskInLoader<bool>(IndepthCheckAgainstDatabase(), Color.Blue, Color.White, LoadingReasons(), Color.Black);

you can also add in synchronous functions, however they are wrapped in a task


private bool LongRunningFunction(int millisecondDelay)
{
    Thread.Sleep(millisecondDelay);
    return true;
}
await PopupService.WrapReturnableFuncInLoader(LongRunningFunction, 6000, Color.Blue, Color.White, LoadingReasons(), Color.Black);

<!-- CONTRIBUTING -->

Contributing

Coming soon, but if you have any ideas or anything, please feel free to make an issue or PR.

<!-- LICENSE -->

License

This project uses the MIT License

<!-- CONTACT -->

Contact

My Github,
or reach me on the Xamarin Slack,
or on my E-mail

Project Link: AwaitablePopups

<!-- ACKNOWLEDGEMENTS -->

Acknowledgements

  • Brimmick has been a model to follow (might steal his hackernews app for an example)

WARNING

This version is based on the following PR. Which may have changes in the future. As a result. please read through this PR for API changes.
https://github.com/LuckyDucko/AwaitablePopups/pull/10

I will update the documentation as soon as I find the time

<!-- ABOUT THE PROJECT -->

About The Project

Awaitable Popups is a neat blend of the Rg.Plugins.Popup and AsyncAwaitBestPractices plugins to bring you a quick way to add popups into your Xamarin Forms App using familiar concepts

Built With

<!-- GETTING STARTED -->

Getting Started

First, you must follow the initialisation
guide set out by Rg.Plugins.Popup, once you have that, have a look at usage down below

Installation

You can install the nuget by looking up 'AwaitablePopups' in your nuget package manager, or by getting it here

<!-- USAGE EXAMPLES -->

Usage

here is an example of what this plugin makes easy (Looks slow due to giphy)

Gif Example

I have included the older, 'safer' example, and the new simplfied example.

New Example

To Use the plugin for its inbuilt popup pages (Dual/Single Response, TextInput and loader.) All you need are these one liners

SingleResponse Popup Page

return await SingleResponseViewModel.GeneratePopup(new PopupButton(Color.Goldenrod, Color.Black, "Okay"), Color.Gray, "Your Phone Number or Pin is incorrect, please try again.", "NoSource.png");

DualResponse Popup Page

return await DualResponseViewModel.GeneratePopup(new PopupButton(Color.Green, Color.Black, "I Accept"), new PopupButton(Color.Red, Color.Black, "I decline"), Color.Gray, "Do you accept the terms and conditions?", "NoSource.png");

Loader Popup Page

  await PopupService.WrapTaskInLoader(Task.Delay(10000), Color.Blue, Color.White, LoadingReasons(), Color.Black);

Text Input PopupPage

await TextInputViewModel.GeneratePopup(new PopupButton(Color.Green, Color.Black, "I Accept"), new PopupButton(Color.Red, Color.Black, "I decline"), Color.Green, "TEXT HERE", "Placeholder");

LoginPage is currently going through some testing, come back soon.
LoginPage PopupPage

await LoginPageViewModel.GeneratePopup(CHECK DOCUMENTATION);

or, to return from the loader a value

await PopupService.WrapReturnableTaskInLoader<bool>(IndepthCheckAgainstDatabase(), Color.Blue, Color.White, LoadingReasons(), Color.Black);

you can also add in synchronous functions, however they are wrapped in a task


private bool LongRunningFunction(int millisecondDelay)
{
    Thread.Sleep(millisecondDelay);
    return true;
}
await PopupService.WrapReturnableFuncInLoader(LongRunningFunction, 6000, Color.Blue, Color.White, LoadingReasons(), Color.Black);

<!-- CONTRIBUTING -->

Contributing

Coming soon, but if you have any ideas or anything, please feel free to make an issue or PR.

<!-- LICENSE -->

License

This project uses the MIT License

<!-- CONTACT -->

Contact

My Github,
or reach me on the Xamarin Slack,
or on my E-mail

Project Link: AwaitablePopups

<!-- ACKNOWLEDGEMENTS -->

Acknowledgements

  • Brimmick has been a model to follow (might steal his hackernews app for an example)

Release Notes

Fixed a bug concerning LoaderView and how it wouldnt exit properly

Changed the underlying workings of the push pop to be FAR more reliable. However, this change may impact custom dialogs based on this.

Added in the ability to change height/width for custom views. i will look into making it easy to add this for other views aswell.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.0 53 8/7/2020
1.0.2 130 7/21/2020
1.0.1 98 7/3/2020
1.0.0 100 7/1/2020
0.3.8 121 6/8/2020
0.3.5 153 5/4/2020
0.3.4 106 4/20/2020
0.3.3 126 4/20/2020
0.3.1 130 4/20/2020
0.3.1-Alpha 126 4/17/2020
0.3.0 159 3/24/2020
0.2.5 242 3/23/2020
0.2.4 291 3/23/2020
0.2.3 287 3/23/2020
0.2.1 289 3/23/2020
0.2.0 193 3/20/2020
0.1.9 291 3/20/2020
0.1.8 208 3/11/2020
0.1.7 234 3/9/2020
0.1.6 252 2/24/2020
0.1.5 253 2/10/2020
0.1.3 534 1/31/2020
0.1.2 472 1/31/2020