From 58ce740f8d65e2fe9467729faf948e97ceeca33c Mon Sep 17 00:00:00 2001 From: Dominik Titl <78549750+morning4coffe-dev@users.noreply.github.com> Date: Tue, 10 Dec 2024 20:45:35 +0100 Subject: [PATCH 1/4] docs: Add `CameraCaptureUI` page --- .../features/windows-media-capture.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 doc/articles/features/windows-media-capture.md diff --git a/doc/articles/features/windows-media-capture.md b/doc/articles/features/windows-media-capture.md new file mode 100644 index 000000000000..36bc1ce76c99 --- /dev/null +++ b/doc/articles/features/windows-media-capture.md @@ -0,0 +1,62 @@ +--- +uid: Uno.Features.Capture +--- + +# Device Information + +> [!TIP] +> This article covers Uno-specific information for the `Windows.Media.Capture` namespace. For a full description of the feature and instructions on using it, see [Windows.Media.Capture Namespace](https://learn.microsoft.com/uwp/api/windows.media.capture). + +- The `Windows.Media.Capture` namespace provides classes for the capture of photos, audio recordings, and videos. + +## `CameraCaptureUI` + +`CameraCaptureUI` is currently only supported on Android, iOS, and UWP. On other platforms, `CaptureFile` will return `null`. + +### Platform-specific + +#### Android + +If you are planning to use the `CameraCaptureUI`, your app must declare `android.permission.CAMERA` and `android.permission.WRITE_EXTERNAL_STORAGE` permissions, otherwise the functionality will not work as expected: + +```csharp +[assembly: UsesPermission("android.permission.CAMERA")] +[assembly: UsesPermission("android.permission.WRITE_EXTERNAL_STORAGE")] +``` + +#### iOS + +On iOS, `CameraCaptureUI` uses the native UIImagePickerController for capturing media. Ensure that the `NSCameraUsageDescription` and `NSMicrophoneUsageDescription` keys are added to the `Info.plist` file to request the necessary permissions. + +#### WinUI/UWP + +On UWP, `CameraCaptureUI` provides a unified interface for capturing photos and videos, fully leveraging the platform's APIs. WinUI support is coming with v1.7+. + +### Example + +```csharp +#if __ANDROID__ || __IOS__ || __WINDOWS__ +using Windows.Media.Capture; +#endif + +public async Task CapturePhotoAsync() +{ +#if __ANDROID__ || __IOS__ || __WINDOWS__ + var captureUI = new CameraCaptureUI(); + captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg; + + var file = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo); + + if (file != null) + { + // Handle the captured file (e.g., save or display it) + } + else + { + // Handle the cancellation or error + } +#endif +} +``` + +You can also check out our [sample](https://github.com/unoplatform/Uno.Samples/tree/master/UI/CameraCaptureUI) for more details. From d0db2a25b982e55043773c97c8cdf4131d233eff Mon Sep 17 00:00:00 2001 From: Dominik Titl <78549750+morning4coffe-dev@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:04:12 +0100 Subject: [PATCH 2/4] chore: Add page to toc --- doc/articles/features/windows-media-capture.md | 2 +- doc/articles/toc.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/articles/features/windows-media-capture.md b/doc/articles/features/windows-media-capture.md index 36bc1ce76c99..01c90f1eece5 100644 --- a/doc/articles/features/windows-media-capture.md +++ b/doc/articles/features/windows-media-capture.md @@ -2,7 +2,7 @@ uid: Uno.Features.Capture --- -# Device Information +# Capture > [!TIP] > This article covers Uno-specific information for the `Windows.Media.Capture` namespace. For a full description of the feature and instructions on using it, see [Windows.Media.Capture Namespace](https://learn.microsoft.com/uwp/api/windows.media.capture). diff --git a/doc/articles/toc.yml b/doc/articles/toc.yml index 481d4237870c..255799d53813 100644 --- a/doc/articles/toc.yml +++ b/doc/articles/toc.yml @@ -606,6 +606,8 @@ href: features/windows-system-power.md - name: Bluetooth href: features/bluetoothdevice.md + - name: Capture (Camera) + href: features/windows-media-capture.md - name: Clipboard href: features/clipboard.md - name: Compass From 565d097416a9a3dc83c40b19538c03afb328d237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Laban?= Date: Fri, 13 Dec 2024 15:16:58 -0500 Subject: [PATCH 3/4] chore: Filter scheduled actions to the main repo --- .github/workflows/codeql.yml | 1 + .github/workflows/labeler.yml | 1 + .github/workflows/no-response.yml | 1 + .github/workflows/scorecard.yml | 1 + 4 files changed, 4 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 7144510086ce..02c6f87c1086 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -21,6 +21,7 @@ on: jobs: analyze: + if: github.repository == 'unoplatform/uno' name: Analyze (${{ matrix.language }}) # Runner size impacts CodeQL analysis time. To learn more, please see: # - https://gh.io/recommended-hardware-resources-for-running-codeql diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 4cdeaa6672b0..25bae584e6ca 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -4,6 +4,7 @@ on: jobs: triage: + if: github.repository == 'unoplatform/uno' permissions: contents: read pull-requests: write diff --git a/.github/workflows/no-response.yml b/.github/workflows/no-response.yml index d5491846c53f..b9d4639eca83 100644 --- a/.github/workflows/no-response.yml +++ b/.github/workflows/no-response.yml @@ -11,6 +11,7 @@ on: jobs: noResponse: + if: github.repository == 'unoplatform/uno' runs-on: ubuntu-latest steps: - uses: lee-dohm/no-response@9bb0a4b5e6a45046f00353d5de7d90fb8bd773bb # 0.5.0 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 76145136eae9..fc6097509379 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -19,6 +19,7 @@ permissions: read-all jobs: analysis: + if: github.repository == 'unoplatform/uno' name: Scorecard analysis runs-on: ubuntu-latest permissions: From 10db86dd4851fc6d418cd4b71b0d2fa03b15451d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Laban?= Date: Fri, 13 Dec 2024 15:19:21 -0500 Subject: [PATCH 4/4] chore: Disable uwp convert for forks --- .github/workflows/uwp-autoconvert.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/uwp-autoconvert.yml b/.github/workflows/uwp-autoconvert.yml index 0170b8d66328..9677acb1ac33 100644 --- a/.github/workflows/uwp-autoconvert.yml +++ b/.github/workflows/uwp-autoconvert.yml @@ -17,6 +17,7 @@ env: jobs: build: + if: github.repository == 'unoplatform/uno' name: update-uwp-branch runs-on: windows-latest steps: