Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/firebase_admob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: firebase_admob

on:
pull_request:
paths:
- "packages/firebase_admob/**"
- ".github/workflows/firebase_admob.yaml"
push:
branches:
- master
paths-ignore:
- "docs/**"

env:
FLUTTERFIRE_PLUGIN_SCOPE: "*firebase_admob*"
FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE: "*firebase_admob_example*"

jobs:
android:
runs-on: macos-latest
if: github.event_name == 'pull_request'
timeout-minutes: 30
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 0
- name: "Install Flutter"
run: ./.github/workflows/scripts/install-flutter.sh stable
- name: "Install Tools"
run: ./.github/workflows/scripts/install-tools.sh
- name: "Build Example"
run: ./.github/workflows/scripts/build-example.sh android ./lib/main.dart
# TODO Add test driver - pending AdMob rework.
# - name: "Drive Example"
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: 28
# arch: x86_64
# target: google_apis
# profile: Nexus 5X
# script: ./.github/workflows/scripts/drive-example.sh android

apple:
runs-on: macos-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 0
- name: "Install Flutter"
run: ./.github/workflows/scripts/install-flutter.sh dev
- name: "Install Tools"
run: |
./.github/workflows/scripts/install-tools.sh
flutter config --enable-macos-desktop
- name: "Build iOS Example"
run: ./.github/workflows/scripts/build-example.sh ios ./lib/main.dart
# TODO Add test driver - pending AdMob rework.
# - name: "Drive iOS Example"
# run: ./.github/workflows/scripts/drive-example.sh ios
# - name: "Build MacOS Example"
# run: ./.github/workflows/scripts/build-example.sh macos
# - name: "Drive MacOS Example"
# run: ./.github/workflows/scripts/drive-example.sh macos
12 changes: 9 additions & 3 deletions .github/workflows/scripts/build-example.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
#!/bin/bash

DEFAULT_TARGET="./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart"

ACTION=$1
TARGET_FILE=${2:-$DEFAULT_TARGET}

melos bootstrap

if [ "$ACTION" == "android" ]
then
melos exec -c 1 --scope="$FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE" -- \
flutter build apk --debug --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart
flutter build apk --debug --target="$TARGET_FILE"
exit
fi

if [ "$ACTION" == "ios" ]
then
melos exec -c 1 --scope="$FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE" -- \
flutter build ios --no-codesign --simulator --debug --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart
flutter build ios --no-codesign --simulator --debug --target="$TARGET_FILE"
exit
fi

if [ "$ACTION" == "macos" ]
then
# TODO Flutter dev branch is currently broken so we're unable to test MacOS.
echo "TODO: Skipping macOS testing due to Flutter dev branch issue."
exit
melos exec -c 1 --scope="$FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE" -- \
flutter build macos --debug --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart
flutter build macos --debug --target="$TARGET_FILE"
exit
fi
5 changes: 4 additions & 1 deletion .github/workflows/scripts/drive-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ACTION=$1
if [ "$ACTION" == "android" ]
then
# Sleep to allow emulator to settle.
sleep 15
sleep 15
melos exec -c 1 --fail-fast --scope="$FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE" --dir-exists=test_driver -- \
flutter drive --no-pub --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart
exit
Expand All @@ -29,6 +29,9 @@ fi

if [ "$ACTION" == "macos" ]
then
# TODO Flutter dev branch is currently broken so we're unable to test MacOS.
echo "TODO: Skipping macOS testing due to Flutter dev branch issue."
exit
melos exec -c 1 --fail-fast --scope="$FLUTTERFIRE_PLUGIN_SCOPE_EXAMPLE" --dir-exists=test_driver -- \
flutter drive -d macos --no-pub --target=./test_driver/MELOS_PARENT_PACKAGE_NAME_e2e.dart
exit
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/scripts/install-flutter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@

BRANCH=$1

if [ "$BRANCH" == "dev" ]
then
# TODO Flutter dev branch is currently broken so we're unable to test MacOS.
echo "TODO: Skipping macOS testing due to Flutter dev branch issue. Switching branch to stable."
BRANCH=stable
fi

git clone https://github.com/flutter/flutter.git --depth 1 -b $BRANCH _flutter
echo "::add-path::$GITHUB_WORKSPACE/_flutter/bin"
1 change: 1 addition & 0 deletions docs/migration-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ dependencies:
cloud_firestore: "^{{ plugins.cloud_firestore }}"
# Updated to work with new core only plugins (no new changes):
cloud_functions: "^{{ plugins.cloud_functions }}"
firebase_admob: "^{{ plugins.firebase_admob }}"
firebase_analytics: "^{{ plugins.firebase_analytics }}"
firebase_database: "^{{ plugins.firebase_database }}"
firebase_dynamic_links: "^{{ plugins.firebase_dynamic_links }}"
Expand Down
9 changes: 9 additions & 0 deletions packages/firebase_admob/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 0.10.0-dev.1

* Depend on `firebase_core` 0.5.0.
* Firebase iOS SDK versions are now locked to use the same version defined in
`firebase_core`.
* Firebase Android SDK versions are now using the Firebase Bill of Materials (BoM)
to specify individual SDK versions. BoM version is also sourced from
`firebase_core`.

## 0.9.3+4

* Bump Dart version requirement.
Expand Down
19 changes: 17 additions & 2 deletions packages/firebase_admob/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

Expand All @@ -21,6 +21,19 @@ rootProject.allprojects {

apply plugin: 'com.android.library'

def firebaseCoreProject = findProject(':firebase_core')
if (firebaseCoreProject == null) {
throw new GradleException('Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec?')
} else if (!firebaseCoreProject.properties['FirebaseSDKVersion']) {
throw new GradleException('A newer version of the firebase_core FlutterFire plugin is required, please update your firebase_core pubspec dependency.')
}

def getRootProjectExtOrCoreProperty(name, firebaseCoreProject) {
if (!rootProject.ext.has('FlutterFire')) return firebaseCoreProject.properties[name]
if (!rootProject.ext.get('FlutterFire')[name]) return firebaseCoreProject.properties[name]
return rootProject.ext.get('FlutterFire').get(name)
}

android {
compileSdkVersion 28

Expand All @@ -32,7 +45,9 @@ android {
disable 'InvalidPackage'
}
dependencies {
api 'com.google.firebase:firebase-ads:18.1.1'
api firebaseCoreProject
implementation platform("com.google.firebase:firebase-bom:${getRootProjectExtOrCoreProperty("FirebaseSDKVersion", firebaseCoreProject)}")
implementation 'com.google.firebase:firebase-ads'
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/firebase_admob/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {

defaultConfig {
applicationId "io.flutter.plugins.firebaseadmobexample"
minSdkVersion 16
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand All @@ -55,6 +55,7 @@ flutter {

dependencies {
testImplementation 'junit:junit:4.12'
api 'com.google.firebase:firebase-ads'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>
<activity android:name=".MainActivity"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".EmbeddingV1Activity"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
</activity>
<activity android:name="io.flutter.embedding.android.FlutterActivity"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data android:name="flutterEmbedding" android:value="2"/>
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@
package io.flutter.plugins.firebaseadmobexample;

import android.os.Bundle;
import dev.flutter.plugins.e2e.E2EPlugin;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebase.core.FlutterFirebaseCorePlugin;
import io.flutter.plugins.firebaseadmob.FirebaseAdMobPlugin;
import io.flutter.plugins.firebaseadmob.FirebaseAdMobPlugin.NativeAdFactory;

public class EmbeddingV1Activity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
FlutterFirebaseCorePlugin.registerWith(
registrarFor("io.flutter.plugins.firebase.core.FlutterFirebaseCorePlugin"));
// TODO(Salakar) rename as part of re-work FirebaseAdMobPlugin -> FlutterFirebaseAdMobPlugin
FirebaseAdMobPlugin.registerWith(
registrarFor("io.flutter.plugins.firebaseadmob.FirebaseAdMobPlugin"));
E2EPlugin.registerWith(registrarFor("dev.flutter.plugins.e2e.E2EPlugin"));

final NativeAdFactory factory = new NativeAdFactoryExample(getLayoutInflater());
FirebaseAdMobPlugin.registerNativeAdFactory(this, "adFactoryExample", factory);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
2 changes: 1 addition & 1 deletion packages/firebase_admob/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
sdk: flutter
firebase_admob:
path: ../
firebase_core: ^0.4.2+1
firebase_core: ^0.5.0

dev_dependencies:
pedantic: ^1.8.0
Expand Down
Loading