FabriBertani / Plugin.Maui.ScreenSecurity

Safeguard your .NET MAUI app effortlessly by preventing content exposure, screenshots, and recordings with ease.
MIT License
160 stars 12 forks source link

not working after FilePicker.Default.PickAsync #21

Closed vahidsoufi closed 5 months ago

vahidsoufi commented 11 months ago

hi, i have an issue

ScreenSecurity.Default.ActivateScreenSecurityProtection();
var result = await FilePicker.Default.PickAsync(options);

this code works for me.

but

var result = await FilePicker.Default.PickAsync(options);
ScreenSecurity.Default.ActivateScreenSecurityProtection();

screen security will not activate after await FilePicker.Default.PickAsync.

can u help me? everything is ok on windows. my problem is on android

i want to activate screen security on some file types not for all of them.

FabriBertani commented 11 months ago

Hi @vahidsoufi, can you explain further what are you trying to archive? Also, check if the awaited call to FilePicker is not breaking at some point which can mess with the execution of the code after that line.

vahidsoufi commented 11 months ago

thx for reply bro, everything is ok on windows. FilePicker is awaited, file picks truely, after that if file extension is mp4 i want to activate security plugin, but not working on android. at this moment i didnt test it on ios. therefore i did my job with window flags secure mode. but thats wonder for me why pluging not working after FilePick. i used .net7 can u test it? another question? can you do anything for mac? do u have any solution?

at the end, thanks for your nice efforts

FabriBertani commented 5 months ago

Hi @vahidsoufi, hope you're doing well.

I've tested this and you are correct, for some reason, it doesn't work in that order, I didn't investigate this issue further, but if you use the plugin as you mention here, it works correctly:

ScreenSecurity.Default.ActivateScreenSecurityProtection(); var result = await FilePicker.Default.PickAsync(options);

this code works for me.