mirror of
https://github.com/MoxiFoxi411/QuickSSH.git
synced 2026-11-08 19:34:55 +00:00
Added ads
This commit is contained in:
1 parent
eed999d2ab
commit
7c47298cd7
13 files changed
+258
-29
No files matched your search
@@ -5,6 +5,9 @@ import 'add_client.dart';
|
||||
import 'package:QuickSSH/classes/ServerCommand.dart';
|
||||
import 'package:QuickSSH/services/storage_service.dart';
|
||||
import 'package:QuickSSH/screens/settings.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:QuickSSH/main.dart';
|
||||
import 'package:QuickSSH/widgets/ad_banner.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
const HomeScreen({super.key});
|
||||
@@ -20,6 +23,13 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadData();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
bool allowed = await settingsController.checkSecurity();
|
||||
|
||||
if (!allowed) {
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _loadData() async {
|
||||
@@ -106,6 +116,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
);
|
||||
},
|
||||
),
|
||||
bottomNavigationBar: SafeArea(
|
||||
child: MyBannerAd(isEnabled: settingsController.adsEnabled),
|
||||
),
|
||||
backgroundColor: theme.surface,
|
||||
);
|
||||
}
|
||||
@@ -151,7 +164,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
_openSettings() {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const Settings()),
|
||||
);
|
||||
MaterialPageRoute(builder: (context) => Settings()),
|
||||
).then((_) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -115,6 +115,64 @@ class _SettingsState extends State<Settings> {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Biometric Unlock",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: theme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Switch(
|
||||
activeTrackColor: theme.primary,
|
||||
activeThumbColor: theme.onPrimary,
|
||||
inactiveThumbColor: theme.onSurface,
|
||||
inactiveTrackColor: theme.surface,
|
||||
value: settingsController.biometricEnabled,
|
||||
onChanged: (bool value) {
|
||||
settingsController.toggleBiometric(value);
|
||||
if (value) HapticFeedback.mediumImpact();
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Enable Ads",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: theme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Switch(
|
||||
activeTrackColor: theme.primary,
|
||||
activeThumbColor: theme.onPrimary,
|
||||
inactiveThumbColor: theme.onSurface,
|
||||
inactiveTrackColor: theme.surface,
|
||||
value: settingsController.adsEnabled,
|
||||
onChanged: (bool value) {
|
||||
settingsController.toggleAds(value);
|
||||
if (value) HapticFeedback.mediumImpact();
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user