Skip to content

Commit

Permalink
fix ads
Browse files Browse the repository at this point in the history
  • Loading branch information
tooxo committed Aug 2, 2020
1 parent 847db8a commit 2ddd27a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
- sed -i "s|RewardedVideoAd.testAdUnitId|\"$ANDROID_REWARDED_ID\"|g" ./lib/utils/ad.dart
- sed -i "s|BannerAd.testAdUnitId|\"$ANDROID_BANNER_ID\"|g" ./lib/menus/difficulty.dart
script:
- flutter analyze --no-preamble --no-congratulate > linting_results.txt
- curl -XPOST 'https://hastebin.com/documents' --upload-file linting_results.txt > hastebin.txt && fastlane publishLintingErrors
- flutter analyze --no-preamble --no-congratulate > linting_results.txt || echo ""
- curl -XPOST 'https://hastebin.com/documents' --upload-file linting_results.txt > hastebin.txt && fastlane publishLintingErrors || echo ""
- flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi --build-number "$TRAVIS_BUILD_NUMBER"
- flutter build appbundle --target-platform android-arm,android-arm64,android-x64 --build-number "$TRAVIS_BUILD_NUMBER"
# zipalign all the apks and bundles
Expand Down
15 changes: 0 additions & 15 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

require "json"
default_platform(:android)

Expand Down
3 changes: 2 additions & 1 deletion lib/utils/ad.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ const String AD_DIALOG_SETTING = "SHOULD_SHOW_AD_DIALOG_SETTING";
const String LAST_AD_DISPLAY = "LAST_TIME_AD_WAS_DISPLAYED_STORE";

Future<bool> shouldShowAds() async {
if (!ADS_ENABLED_BUQF1EVY) return false;
SharedPreferences preferences = await SharedPreferences.getInstance();
int lastMillisSinceEpoch = preferences.getInt(ADS_SETTING) != null
? preferences.getInt(ADS_SETTING)
: 0;
DateTime lastDate = DateTime.fromMillisecondsSinceEpoch(lastMillisSinceEpoch);
DateTime nowDate = DateTime.now();

return nowDate.difference(lastDate).inMinutes > 60 || !ADS_ENABLED_BUQF1EVY;
return nowDate.difference(lastDate).inMinutes > 60;
}

Future<bool> shouldShowAdDialog() async {
Expand Down

0 comments on commit 2ddd27a

Please sign in to comment.