Fix: android scam warning not showing on toggling screen capture (#6750)

* fix scam warning not showing on toggling screen capture

* fix scam warning not showing on toggling screen capture

* fix scam warning not showing on toggling screen capture

* fix scam warning not showing on toggling screen capture
This commit is contained in:
Sahil Yeole 2023-12-26 07:49:05 +05:30 committed by GitHub
parent 6d0953dca4
commit bdf6f5c3b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -212,7 +212,7 @@ class ServiceNotRunningNotification extends StatelessWidget {
icon: const Icon(Icons.play_arrow),
onPressed: () {
if (gFFI.userModel.userName.value.isEmpty && bind.mainGetLocalOption(key: "show-scam-warning") != "N") {
_showScamWarning(context, serverModel);
showScamWarning(context, serverModel);
} else {
serverModel.toggleService();
}
@ -222,14 +222,6 @@ class ServiceNotRunningNotification extends StatelessWidget {
));
}
void _showScamWarning(BuildContext context, ServerModel serverModel) {
showDialog(
context: context,
builder: (BuildContext context) {
return ScamWarningDialog(serverModel: serverModel);
},
);
}
}
class ScamWarningDialog extends StatefulWidget {
@ -558,7 +550,9 @@ class _PermissionCheckerState extends State<PermissionChecker> {
.marginOnly(bottom: 8)
: SizedBox.shrink(),
PermissionRow(translate("Screen Capture"), serverModel.mediaOk,
serverModel.toggleService),
!serverModel.mediaOk && gFFI.userModel.userName.value.isEmpty && bind.mainGetLocalOption(key: "show-scam-warning") != "N"
? () => showScamWarning(context, serverModel)
: serverModel.toggleService),
PermissionRow(translate("Input Control"), serverModel.inputOk,
serverModel.toggleInput),
PermissionRow(translate("Transfer file"), serverModel.fileOk,
@ -800,4 +794,13 @@ void androidChannelInit() {
}
return "";
});
}
void showScamWarning(BuildContext context, ServerModel serverModel) {
showDialog(
context: context,
builder: (BuildContext context) {
return ScamWarningDialog(serverModel: serverModel);
},
);
}