Skip to content

Commit

Permalink
docs: update docs layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Oct 25, 2024
1 parent 939ce3a commit 3bd12aa
Show file tree
Hide file tree
Showing 18 changed files with 205 additions and 149 deletions.
62 changes: 0 additions & 62 deletions docs/plugins/essentials/permissions.md

This file was deleted.

62 changes: 62 additions & 0 deletions docs/plugins/essentials/permissions/permissions-manager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
uid: Plugins.Essentials.Permissions
---

# App Permissions

The Permissions API in Prism.Plugin.Essentials allows you to request and check permissions across Android, iOS, MacCatalyst and WinUI on both .NET MAUI and Uno Platform. As with other API's in Prism.Essentials this is automatically registered when Registering Prism Essentials.

## Getting Started

To use the Permissions Manager you can inject the `IPermissionsManager` into your services or ViewModels.

```cs
public class MyViewModel(IPermissionsManager permissions) : BindableBase
{
}
```

To check the state of a given permission you simply need to pass the permission type to the Permission Manager's Check or Request method like:

```cs
var status = await permissions.CheckStatusAsync<LocationAlways>();

if (status != PermissionStatus.NotSupported && status != PermissionStatus.Granted)
{
status = await permissions.RequestAsync<LocationAlways>();
}
```

A permission status of `NotSupported` may be returned when the underlying platform does not require authorization for a specific permission.

## Supported Permissions

| Permission | Android | iOS | MacCatalyst | WinUI |
|------------|:-------:|:---:|:-----------:|:-----:|
| Battery | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| Bluetooth | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| CalendarRead | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| CalendarWrite | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| Camera | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| ContactsRead | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) |
| ContactsWrite | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) |
| Flashlight | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| LaunchApp | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| LocationAlways | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) |
| LocationWhenInUse | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) |
| Maps | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| Media | ![Not Supported](../../../images/cross_red_circle.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| Microphone | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| NearbyWifiDevices | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| NetworkState | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| Phone | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| Photos | ![Not Supported](../../../images/cross_red_circle.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| PhotosAddOnly | ![Not Supported](../../../images/cross_red_circle.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| PostNotifications | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| Reminders | ![Not Supported](../../../images/cross_red_circle.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| Sensors | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) |
| Sms | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| Speech | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| StorageRead | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| StorageWrite | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
| Vibrate | ![Supported](../../../images/circle_green_checkmark.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) | ![Not Supported](../../../images/cross_red_circle.png) |
2 changes: 2 additions & 0 deletions docs/plugins/essentials/permissions/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: Permissions Manager
href: permissions-manager.md
2 changes: 1 addition & 1 deletion docs/plugins/essentials/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
- name: Notifications
href: notifications/toc.yml
- name: Permissions
href: permissions.md
href: permissions/toc.yml
- name: Threading
href: threading/toc.yml
81 changes: 13 additions & 68 deletions docs/plugins/logging/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,71 +119,16 @@ In the above example we can see that we have a single Debug log generated which

Prism provides a number of logging providers available out of the box for you with additional providers currently under consideration. If we do not have integration for a provider that you would like please let us know on Discord.

### AppCenter

As previously mentioned, Prism.Plugin.Logging has a couple of interfaces which help users better map to the sort of calls that you might be used to with the AppCenter SDK. This can really help you in 2 critical ways.

1) By removing the static references to the AppCenter SDK from your codebase, your code becomes easier to manage over time as you have the ability to swap out providers or inject a mock for Unit Testing.
2) Since AppCenter is nearing EOL, it will be critical for businesses to continue using App Center while they evaluate other options. Prism.Plugin.Logging will help you to do just that by combining the AppCenter provider with the AggregateLogger as you evaluate other providers.

```cs
// By Default this registers Analytics and Crashes
containerRegistry.RegisterAppCenterLogger("appSecret");

// If you need to customize the list with other providers
containerRegistry.RegisterAppCenterLogger("appSecret", typeof(Analytics), typeof(Crashes), typeof(Distribution));
```

### Console Logger

By installing the `Prism.Plugin.Logging.Console` package you get access to the generic Console Logger. This will literally call `System.Console.WriteLine` to write logging messages.

```cs
containerRegistry.UsePrismLogging(logging => {
logging.AddConsole();
});
```

### Debug Logger

Similar to the Console Logger is the Debug Logger. This will use `System.Diagnostics.Debug.WriteLine`, and will only write to `Debug.WriteLine` when the Debugger is currently attached. This is a great logger to use for debugging in your IDE and will not produce any logs in the device console if you forget to remove it for production.

```cs
containerRegistry.UsePrismLogging(logging => {
logging.AddDebug();
});
```

### Graylog (GELF)

For more information see the [Gelf docs](xref:Plugins.Logging.Gelf).

### Microsoft.Extensions.Logging Interoperability

For more information see the [Microsoft.Extensions.Logging Interoperability docs](xref:Plugins.Logging.Microsoft).

### Raygun

For more information see the [Prism Logging docs for Raygun](xref:Plugins.Logging.Raygun).

### Sentry

```cs
containerRegistry.UsePrismLogging(logging => {
logging.AddSentry("sentryDsn");
});
```

### Testing

For more information on Unit Testing support see the [Prism.Plugin.Logging.Testing docs](xref:Plugins.Logging.Testing).

### Xunit

Unit testing is critical to catching bugs early. But the logging that you might have in your application you probably don't want to have used in your unit tests. For this reason we have an Xunit provider that enables logging using the ITestOutputHelper. This will help to ensure that logs collected during a unit test are associated with the test and makes it easier to view the logged output from your tests.

```cs
containerRegistry.UsePrismLogging(logging => {
logging.AddXunit(testOutputHelper);
});
```
- [AppCenter](xref:Plugins.Logging.AppCenter)
- [Console](xref:Plugins.Logging.Console)
- [Debug](xref:Plugins.Logging.Debug)
- [Graylog (GELF)](xref:Plugins.Logging.Gelf)
- [Raygun](xref:Plugins.Logging.Raygun)
- [Sentry](xref:Plugins.Logging.Sentry)
- [Testing](xref:Plugins.Logging.Testing)
- [Xunit](xref:Plugins.Logging.Xunit)

## Interop Extensions

- [Microsoft.Extensions.Logging Interoperability](xref:Plugins.Logging.Microsoft)
- [Prism.Plugins.Essentials](xref:Plugins.Logging.Essentials)
6 changes: 6 additions & 0 deletions docs/plugins/logging/interop/essentials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
uid: Plugins.Logging.Essentials
---

# Logging Interop with Prism.Plugin.Essentials

Loading

0 comments on commit 3bd12aa

Please sign in to comment.