Merge pull request #5664 from sahilyeole/add/scam_warning

Add mobile scam warning window
This commit is contained in:
RustDesk 2023-09-13 13:41:22 +08:00 committed by GitHub
commit 75f5212661
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 405 additions and 1 deletions

BIN
flutter/assets/scam.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 KiB

View File

@ -210,11 +210,199 @@ class ServiceNotRunningNotification extends StatelessWidget {
.marginOnly(bottom: 8),
ElevatedButton.icon(
icon: const Icon(Icons.play_arrow),
onPressed: serverModel.toggleService,
onPressed: () {
if (gFFI.userModel.userName.value.isEmpty && bind.mainGetLocalOption(key: "show-scam-warning") != "N") {
_showScamWarning(context, serverModel);
} else {
serverModel.toggleService();
}
},
label: Text(translate("Start Service")))
],
));
}
void _showScamWarning(BuildContext context, ServerModel serverModel) {
showDialog(
context: context,
builder: (BuildContext context) {
return ScamWarningDialog(serverModel: serverModel);
},
);
}
}
class ScamWarningDialog extends StatefulWidget {
final ServerModel serverModel;
ScamWarningDialog({required this.serverModel});
@override
_ScamWarningDialogState createState() => _ScamWarningDialogState();
}
class _ScamWarningDialogState extends State<ScamWarningDialog> {
int _countdown = 12;
bool show_warning = false;
late Timer _timer;
late ServerModel _serverModel;
@override
void initState() {
super.initState();
_serverModel = widget.serverModel;
startCountdown();
}
void startCountdown() {
const oneSecond = Duration(seconds: 1);
_timer = Timer.periodic(oneSecond, (timer) {
setState(() {
_countdown--;
if (_countdown <= 0) {
timer.cancel();
}
});
});
}
@override
void dispose() {
_timer.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
final isButtonLocked = _countdown > 0;
return AlertDialog(
content: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
Color(0xffe242bc),
Color(0xfff4727c),
],
),
borderRadius: BorderRadius.circular(20.0),
),
padding: EdgeInsets.all(25.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
Icons.warning_amber_sharp,
color: Colors.white,
),
SizedBox(width: 10),
Text(
translate("Warning"),
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
),
],
),
SizedBox(height: 20),
Center(
child: Image.asset('assets/scam.png',
width: 180,
),
),
SizedBox(height: 18),
Text(
translate("scam_title"),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 22.0,
),
),
SizedBox(height: 18),
Text(
translate("scam_text1")+"\n\n"
+translate("scam_text2")+"\n",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16.0,
),
),
Row(
children: <Widget>[
Checkbox(
value: show_warning,
onChanged: (value) {
setState((){
show_warning = value!;
});
},
),
Text(
translate("Don't show again"),
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15.0,
),
),
],
),
SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: isButtonLocked
? null
: () {
Navigator.of(context).pop();
_serverModel.toggleService();
if (show_warning) {
bind.mainSetLocalOption(key: "show-scam-warning", value: "N");
}
},
style: ElevatedButton.styleFrom(
primary: Colors.blueAccent,
),
child: Text(
isButtonLocked ? translate("I Agree")+" (${_countdown}s)" : translate("I Agree"),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 13.0,
),
),
),
SizedBox(width: 15),
ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
},
style: ElevatedButton.styleFrom(
primary: Colors.blueAccent,
),
child: Text(
translate("Decline"),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 13.0,
),
),
),
],
)])),
contentPadding: EdgeInsets.all(0.0),
);
}
}
class ServerInfo extends StatelessWidget {

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", "安装失败!"),
("Reverse mouse wheel", "鼠标滚轮反向"),
("{} sessions", "{}个会话"),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", "Installation fehlgeschlagen!"),
("Reverse mouse wheel", "Mausrad rückwärts drehen"),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -82,5 +82,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Start session recording", "Start Session Recording"),
("Stop session recording", "Stop Session Recording"),
("Enable remote configuration modification", "Enable Remote Configuration Modification"),
("scam_title", "You May Be Being SCAMMED!"),
("scam_text1", "If you are on the phone with someone you DON'T know AND TRUST who has asked you to use RustDesk and start the service, do not proceed and hang up immediately."),
("scam_text2", "They are likely a scammer trying to steal your money or other private information."),
("Don't show again", "Don't show again"),
("I Agree", "I Agree"),
("Decline", "Decline"),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", "La instalación ha fallado"),
("Reverse mouse wheel", "Invertir rueda del ratón"),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", "Instalasi gagal!"),
("Reverse mouse wheel", "Balikkan arah scroll mouse!"),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", "Installazione fallita"),
("Reverse mouse wheel", "Rotella mouse inversa"),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", "Instalacja nie powiodła się"),
("Reverse mouse wheel", "Odwróć rolkę myszki"),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", "Установка не выполнена!"),
("Reverse mouse wheel", "Реверсировать колесо мыши"),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree",""),
("Decline",""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}

View File

@ -545,5 +545,11 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Installation failed!", ""),
("Reverse mouse wheel", ""),
("{} sessions", ""),
("scam_title", ""),
("scam_text1", ""),
("scam_text2", ""),
("Don't show again", ""),
("I Agree", ""),
("Decline", ""),
].iter().cloned().collect();
}