Rooted Device Check #1
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:jailbreak_root_detection/jailbreak_root_detection.dart';
|
||||
import 'package:kmobile/rooted_screen.dart';
|
||||
import 'di/injection.dart';
|
||||
import 'app.dart';
|
||||
|
||||
@@ -14,5 +16,17 @@ void main() async {
|
||||
|
||||
// Initialize dependencies
|
||||
await setupDependencies();
|
||||
|
||||
final isJailBroken = await JailbreakRootDetection.instance.isJailBroken;
|
||||
final isRealDevice = await JailbreakRootDetection.instance.isRealDevice;
|
||||
if(isJailBroken || !isRealDevice){
|
||||
runApp(const MaterialApp(
|
||||
home: RootedScreen(),
|
||||
debugShowCheckedModeBanner: false,
|
||||
)
|
||||
);
|
||||
}
|
||||
else{
|
||||
runApp(const KMobile());
|
||||
}
|
||||
}
|
||||
|
56
lib/rooted_screen.dart
Normal file
56
lib/rooted_screen.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class RootedScreen extends StatelessWidget {
|
||||
const RootedScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.warning_amber_rounded,
|
||||
color: Colors.red,
|
||||
size: 80,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text(
|
||||
"Rooted Device Detected",
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
const Text(
|
||||
"For security reasons, this app cannot run on rooted devices.",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white70,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
// Optionally close the app
|
||||
},
|
||||
child: const Text("Exit"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user