Skip to content

Commit

Permalink
Fixed ads visible in desktop builds
Browse files Browse the repository at this point in the history
  • Loading branch information
hmziqrs committed May 17, 2021
1 parent 30c69a5 commit 32a46c1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/configs/App.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'AppTheme.dart';
class App {
static BuildContext ctx;
static bool isLtr;
static final bool showAds = true;
static bool showAds = true;

static init(BuildContext context) {
AppDimensions.init(context);
Expand Down
8 changes: 2 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart'
show debugDefaultTargetPlatformOverride;

import 'package:flutter_uis/Navigator.dart';
import 'package:flutter_uis/io/io.dart';
import 'package:flutter_uis/configs/App.dart';

import 'package:hive/hive.dart';
import 'package:hive_flutter/hive_flutter.dart';
Expand All @@ -17,13 +15,11 @@ void mainTest(NavigatorObserver observer) {
}

void _main(NavigatorObserver observer) async {
App.showAds = false;
WidgetsFlutterBinding.ensureInitialized();
await Hive.initFlutter();
await Hive.openBox('app');

if (Platform.isWindows || Platform.isLinux) {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
}
FlutterError.onError = (FlutterErrorDetails err) {};
final List<NavigatorObserver> observers = [];

Expand Down
1 change: 1 addition & 0 deletions lib/screens/UIDetail/UIDetail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class _Body extends StatelessWidget {
@override
Widget build(BuildContext context) {
final UIItem uiItem = ModalRoute.of(context).settings.arguments;

return WillPopScope(
onWillPop: () async {
this.onClose(context);
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/UIDetail/widgets/UIDetailContent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class _UIDetailContentState extends State<UIDetailContent> {

void openApp(BuildContext context) {
final r = Random().nextInt(4);
if (r == 2) {
if (r == 2 && App.showAds) {
this.interstitialAd.show();
return;
}
Expand Down

0 comments on commit 32a46c1

Please sign in to comment.