Skip to content

Commit

Permalink
* Configured AdMob and release signing keys on Android.
Browse files Browse the repository at this point in the history
  • Loading branch information
micer committed Jan 27, 2021
1 parent 1901897 commit 6244882
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 41 deletions.
19 changes: 16 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
compileSdkVersion 30

Expand All @@ -42,14 +48,21 @@ android {
multiDexEnabled true
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/page/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class _AboutDialog extends StatelessWidget {
final repoLinkText = "source code";
final privacyLinkText = "privacy policy";
final mainText =
"Feel free to check out the source code of this app if you're interested. Mandatory link to privacy policy belongs here too.\n\n🐵 Please DO NOT feed the monkeys! 🐵";
"Feel free to check out the source code of this app if you're interested. Mandatory link to privacy policy belongs here too.";
final repoLinkIndex = mainText.indexOf(repoLinkText);
final repoLinkIndexEnd = repoLinkIndex + repoLinkText.length;
final privacyLinkIndex = mainText.indexOf(privacyLinkText);
Expand Down
62 changes: 26 additions & 36 deletions lib/page/flights.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import 'package:gibraltar_flights/util/scrappy.dart';
import 'package:intl/intl.dart' hide TextDirection;
import 'package:pull_to_refresh/pull_to_refresh.dart';

// const String testDevice = '77773931FCB634D6B0C83152B6D99482';
const String testDevice = null;

class FlightsPage extends StatefulWidget {
const FlightsPage({Key key, @required this.title}) : super(key: key);
final title;
Expand All @@ -22,14 +25,18 @@ class FlightsPage extends StatefulWidget {
class _FlightsPageState extends State<FlightsPage> {
Flights flights;
RefreshController _refreshController =
RefreshController(initialRefresh: true);
RefreshController(initialRefresh: true);
double _refreshButtonOpacity = 1;
BannerAd _bannerAd;

static const MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
testDevices: testDevice != null ? <String>[testDevice] : null);

static BannerAd createBannerAd() {
return BannerAd(
adUnitId: "ca-app-pub-3670766355752604/4950986030",
size: AdSize.banner,
targetingInfo: targetingInfo,
listener: (MobileAdEvent event) {
print("BannerAd event $event");
},
Expand All @@ -40,7 +47,9 @@ class _FlightsPageState extends State<FlightsPage> {
void initState() {
super.initState();
flights = Flights(items: []);
FirebaseAdMob.instance.initialize(appId: FirebaseAdMob.testAppId);
FirebaseAdMob.instance
.initialize(appId: "ca-app-pub-3670766355752604~8697825200");

_bannerAd = createBannerAd()
..load()
..show();
Expand All @@ -63,19 +72,17 @@ class _FlightsPageState extends State<FlightsPage> {
Icons.info_outline,
color: Colors.white,
),
onPressed: () =>
about.showAboutDialog(context: context)
)
onPressed: () => about.showAboutDialog(context: context))
],
),
body: Center(
child: SmartRefresher(
enablePullDown: true,
enablePullUp: false,
controller: _refreshController,
onRefresh: () => _onRefresh(context),
child: _listView(),
)));
enablePullDown: true,
enablePullUp: false,
controller: _refreshController,
onRefresh: () => _onRefresh(context),
child: _listView(),
)));
}

Widget _listView() {
Expand Down Expand Up @@ -104,9 +111,7 @@ class _FlightsPageState extends State<FlightsPage> {
child: Text("refresh".toUpperCase()),
style: TextButton.styleFrom(
primary: Colors.white,
backgroundColor: Theme
.of(context)
.accentColor,
backgroundColor: Theme.of(context).accentColor,
onSurface: Colors.grey,
)),
),
Expand Down Expand Up @@ -200,9 +205,7 @@ class _FlightsPageState extends State<FlightsPage> {

void _showError(BuildContext context, String message) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(message), backgroundColor: Theme
.of(context)
.errorColor));
content: Text(message), backgroundColor: Theme.of(context).errorColor));
}
}

Expand Down Expand Up @@ -263,20 +266,13 @@ class HeadingItem implements ListItem {
return Container(
child: Text(
heading,
style: Theme
.of(context)
.textTheme
.headline5,
style: Theme.of(context).textTheme.headline5,
),
alignment: Alignment.center,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Theme
.of(context)
.primaryColorLight,
border: Border.all(color: Theme
.of(context)
.accentColor),
color: Theme.of(context).primaryColorLight,
border: Border.all(color: Theme.of(context).accentColor),
borderRadius: BorderRadius.circular(8)),
);
}
Expand Down Expand Up @@ -315,9 +311,7 @@ class FlightItem implements ListItem {
textDirection: TextDirection.ltr,
child: SvgPicture.asset(
type == "arrival" ? IconNames.arrivals : IconNames.departures,
color: Theme
.of(context)
.accentColor,
color: Theme.of(context).accentColor,
matchTextDirection: true,
)),
);
Expand All @@ -331,18 +325,14 @@ class FlightItem implements ListItem {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(time, style: Theme
.of(context)
.textTheme
.headline5),
Text(time, style: Theme.of(context).textTheme.headline5),
Container(
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: _getStatusColor(),
borderRadius: BorderRadius.circular(4)),
child: Text(status,
style: Theme
.of(context)
style: Theme.of(context)
.textTheme
.caption
.apply(color: Colors.white)),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dev_dependencies:
sdk: flutter
integration_test:
sdk: flutter
flutter_launcher_icons: "^0.8.1"
flutter_launcher_icons: ^0.8.1

flutter_icons:
ios: true
Expand Down

0 comments on commit 6244882

Please sign in to comment.