Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft.Maui.Devices.Flashlight: Check if supported #13703

Merged
merged 8 commits into from
Mar 27, 2023
Merged

Microsoft.Maui.Devices.Flashlight: Check if supported #13703

merged 8 commits into from
Mar 27, 2023

Conversation

vividos
Copy link
Contributor

@vividos vividos commented Mar 4, 2023

Description of Change

This adds the CheckIsSupported() call to the Microsoft.Maui.Devices.Flashlight API, as discussed in #13458.

Issues Fixed

Fixes #13458

@jfversluis Feel free to change the name of the added method. In #13458 we didn't have a clear consent what name to use. Thanks!

@ghost ghost added the community ✨ Community Contribution label Mar 4, 2023
@ghost
Copy link

ghost commented Mar 4, 2023

Hey there @vividos! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@jfversluis
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D:\a\_work\1\s\src\Essentials\src\Flashlight\Flashlight.ios.cs(16,11): error CS0029: Cannot implicitly convert type 'bool' to 'System.Threading.Tasks.Task<bool>' [D:\a\_work\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net7.0-ios]
D:\a\_work\1\s\src\Essentials\src\Flashlight\Flashlight.ios.cs(16,11): error CS0029: Cannot implicitly convert type 'bool' to 'System.Threading.Tasks.Task<bool>' [D:\a\_work\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net7.0-maccatalyst]
    69 Warning(s)
    2 Error(s)

@Eilon Eilon added the area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info label Mar 6, 2023
@jfversluis jfversluis self-assigned this Mar 6, 2023
src/Essentials/src/Flashlight/Flashlight.ios.cs Outdated Show resolved Hide resolved
src/Essentials/src/Flashlight/Flashlight.uwp.cs Outdated Show resolved Hide resolved
@vividos
Copy link
Contributor Author

vividos commented Mar 7, 2023

Thanks for all the review comments, I'll apply the changes on next Saturday

@jfversluis
Copy link
Member

jfversluis commented Mar 8, 2023

Take your time @vividos ! Thank you for this! And thanks everyone for the input 😄

There was also 2 build errors:

D:\a_work\1\s\src\Essentials\src\Flashlight\Flashlight.ios.cs(16,11): error CS0029: Cannot implicitly convert type 'bool' to 'System.Threading.Tasks.Task' [D:\a_work\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net7.0-ios]
D:\a_work\1\s\src\Essentials\src\Flashlight\Flashlight.ios.cs(16,11): error CS0029: Cannot implicitly convert type 'bool' to 'System.Threading.Tasks.Task' [D:\a_work\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net7.0-maccatalyst]

@jfversluis jfversluis added the s/pr-needs-author-input PR needs an update from the author label Mar 8, 2023
@ghost
Copy link

ghost commented Mar 8, 2023

Hi @vividos. We have added the "s/pr-needs-author-input" label to this issue, which indicates that we have an open question/action for you before we can take further action. This PRwill be closed automatically in 14 days if we do not hear back from you by then - please feel free to re-open it if you come back to this PR after that time.

@vividos
Copy link
Contributor Author

vividos commented Mar 11, 2023

I fixed the iOS compile error (I changed the TargetFrameworks in Essentials.csproj a bit for compiling and was missing iOS errors) and also did the other requested changes. The PR should be ready now.

@rmarinho
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@rmarinho
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

/// Checks if the flashlight is available and can be turned on or off.
/// </summary>
/// <returns><see langword="true"/> when the flashlight is available, or <see langword="false"/> when not</returns>
public Task<bool> CheckIsSupportedAsync() => Task.FromResult(IsSupported);
Copy link
Member

@rmarinho rmarinho Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this API be only IsSupportedAsync ? @mattleibow @Redth ?
so

IsSupported = await Flashlight.IsSupportedAsync();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already discussed this in #13458 and didn't come to a consent. So please discuss the name and I'll change that afterwards.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsSupportedAsync sounds good too!

@vividos
Copy link
Contributor Author

vividos commented Mar 20, 2023

@jfversluis How do we proceed with this PR? Someone has to decide how to name that method...

@jfversluis
Copy link
Member

I'm in favor of losing the Check. So just IsSupportedAsync() seems good to me! Thank you for your patience here again :)

@vividos
Copy link
Contributor Author

vividos commented Mar 20, 2023

No problem, I'll rename the method.

@vividos vividos requested review from rmarinho and mandel-macaque and removed request for mandel-macaque and rmarinho March 21, 2023 09:42
@rmarinho
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@jfversluis
Copy link
Member

Thank you for another wonderful PR @vividos !

@jfversluis jfversluis dismissed mandel-macaque’s stale review March 27, 2023 18:28

Minor changes were requested which are addressed

@jfversluis jfversluis merged commit b5266fc into dotnet:main Mar 27, 2023
@jfversluis jfversluis added t/breaking 💥 and removed s/pr-needs-author-input PR needs an update from the author labels Mar 27, 2023
@ghost
Copy link

ghost commented Mar 27, 2023

🚨 API change(s) detected @davidbritch FYI

@vividos vividos deleted the flashlight-supported-check branch March 27, 2023 21:04
@vividos
Copy link
Contributor Author

vividos commented Mar 27, 2023

You're welcome ☺️

@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info community ✨ Community Contribution fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! t/breaking 💥
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Microsoft.Maui.Devices.Flashlight: Check if supported
8 participants