Skip to content

Commit

Permalink
Removed deprecated AdMob Native Express ads from codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon committed Jun 14, 2018
1 parent 5abfa6c commit 4e217cc
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 206 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ Up until commit [cb52be83](https://github.com/Larpon/QtFirebase/commit/cb52be832
**Base, AdMob, Analytics, RemoteConfig, Cloud Messaging, Authentication, Realtime Database**
* v4.1.0
* v4.2.0
* v4.5.0 **NOTE** Native Express ads are deprecated from this release
* v4.5.1
* v5.0.0

We recommend you build against the latest version of the Firebase C++ SDK.

Expand Down
88 changes: 0 additions & 88 deletions fake/src/qtfirebaseadmob.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,94 +222,6 @@ public slots:
void moveTo(int position) { Q_UNUSED(position); }
};

/*
* AdMobNativeExpressAd
*/
class QtFirebaseAdMobNativeExpressAd : public QObject
{
Q_OBJECT

Q_PROPERTY(bool ready READ ready NOTIFY readyChanged)
Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)

Q_PROPERTY(QString adUnitId READ adUnitId WRITE setAdUnitId NOTIFY adUnitIdChanged)

Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)

Q_PROPERTY(int x READ getX WRITE setX NOTIFY xChanged)
Q_PROPERTY(int y READ getY WRITE setY NOTIFY yChanged)
Q_PROPERTY(int width READ getWidth WRITE setWidth NOTIFY widthChanged)
Q_PROPERTY(int height READ getHeight WRITE setHeight NOTIFY heightChanged)

Q_PROPERTY(QtFirebaseAdMobRequest* request READ request WRITE setRequest NOTIFY requestChanged)

public:
enum Position
{
PositionTopCenter,
PositionTopLeft,
PositionTopRight,
PositionBottomCenter,
PositionBottomLeft,
PositionBottomRight
};
Q_ENUM(Position)

QtFirebaseAdMobNativeExpressAd(QObject* parent = 0) { Q_UNUSED(parent); }
~QtFirebaseAdMobNativeExpressAd() {}

bool ready() { return false; }
void setReady(bool ready) { Q_UNUSED(ready); }

bool loaded() { return false; }
void setLoaded(bool loaded) { Q_UNUSED(loaded); }

QString adUnitId() { return QString(); }
void setAdUnitId(const QString &adUnitId) { Q_UNUSED(adUnitId); }

bool visible() { return false; }
void setVisible(bool visible) { Q_UNUSED(visible); }

int getX() { return 0; }
void setX(const int &x) { Q_UNUSED(x); }

int getY() { return 0; }
void setY(const int &y) { Q_UNUSED(y); }

int getWidth() {return 0; }
void setWidth(const int &width) { Q_UNUSED(width); }

int getHeight() { return 0; }
void setHeight(const int &height) { Q_UNUSED(height); }

QtFirebaseAdMobRequest* request() { return 0; }
void setRequest(QtFirebaseAdMobRequest *request) { Q_UNUSED(request); }

signals:
void readyChanged();
void loadedChanged();
void adUnitIdChanged();

void visibleChanged();
void xChanged();
void yChanged();
void widthChanged();
void heightChanged();
void requestChanged();

void loading();

void error(int code);

public slots:
void load() {}
void show() {}
void hide() {}
void moveTo(int x, int y) { Q_UNUSED(x); Q_UNUSED(y); }
void moveTo(int position) { Q_UNUSED(position); }

};

/*
* AdMobInterstitial
*/
Expand Down
1 change: 0 additions & 1 deletion qtfirebase_register.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ static void registerQtFirebase() {
qmlRegisterType<QtFirebaseAdMob>("QtFirebase", 1, 0, "AdMob");
qmlRegisterType<QtFirebaseAdMobRequest>("QtFirebase", 1, 0, "AdMobRequest");
qmlRegisterType<QtFirebaseAdMobBanner>("QtFirebase", 1, 0, "AdMobBanner");
qmlRegisterType<QtFirebaseAdMobNativeExpressAd>("QtFirebase", 1, 0, "AdMobNativeExpressAd");
qmlRegisterType<QtFirebaseAdMobInterstitial>("QtFirebase", 1, 0, "AdMobInterstitial");
qmlRegisterType<QtFirebaseAdMobRewardedVideoAd>("QtFirebase", 1, 0, "AdMobRewardedVideoAd");
#endif
Expand Down
1 change: 0 additions & 1 deletion src/qtfirebase_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ void QtFirebasePlugin::registerTypes(const char *uri)
qmlRegisterType<QtFirebaseAdMob>(uri, 1, 0, "AdMob");
qmlRegisterType<QtFirebaseAdMobRequest>(uri, 1, 0, "AdMobRequest");
qmlRegisterType<QtFirebaseAdMobBanner>(uri, 1, 0, "AdMobBanner");
qmlRegisterType<QtFirebaseAdMobNativeExpressAd>(uri, 1, 0, "AdMobNativeExpressAd");
qmlRegisterType<QtFirebaseAdMobInterstitial>(uri, 1, 0, "AdMobInterstitial");
qmlRegisterType<QtFirebaseAdMobRewardedVideoAd>(uri, 1, 0, "AdMobRewardedVideoAd");
#endif
Expand Down
86 changes: 0 additions & 86 deletions src/qtfirebaseadmob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,92 +836,6 @@ firebase::FutureBase QtFirebaseAdMobBanner::moveToInternal(Position position)
return firebase::FutureBase();
}


/*
* AdMobNativeExpressAd
*
*/
QtFirebaseAdMobNativeExpressAd::QtFirebaseAdMobNativeExpressAd(QObject *parent) : QtFirebaseAdMobBannerBase(parent)
{
}

QtFirebaseAdMobNativeExpressAd::~QtFirebaseAdMobNativeExpressAd()
{
if(_ready) {
_nativeAd->Destroy();
qFirebase->waitForFutureCompletion(_nativeAd->DestroyLastResult()); // TODO MAYBE move or duplicate to QtFirebaseAdMob with admob::kAdMobError* checking? (Will save ALOT of cycles on errors)
qDebug() << this << "::~QtFirebaseAdMobNativeExpressAd" << "Destroyed";
}
}

firebase::FutureBase QtFirebaseAdMobNativeExpressAd::setVisibleInternal(bool visible)
{
return visible ? _nativeAd->Show() : _nativeAd->Hide();
}

firebase::FutureBase QtFirebaseAdMobNativeExpressAd::setXInternal(int x)
{
return _nativeAd->MoveTo(x, _y);
}

firebase::FutureBase QtFirebaseAdMobNativeExpressAd::setYInternal(int y)
{
return _nativeAd->MoveTo(_x, y);
}

firebase::FutureBase QtFirebaseAdMobNativeExpressAd::initInternal()
{
_nativeAd = new admob::NativeExpressAdView();

admob::AdSize ad_size;
ad_size.ad_size_type = admob::kAdSizeStandard;
ad_size.width = getWidth();
ad_size.height = getHeight();

// A reference to an iOS UIView or an Android Activity.
// This is the parent UIView or Activity of the native express ad view.
qDebug() << this << "::init initializing with AdUnitID" << __adUnitIdByteArray.constData();
return _nativeAd->Initialize(static_cast<admob::AdParent>(_nativeUIElement), __adUnitIdByteArray.constData(), ad_size);
}

firebase::FutureBase QtFirebaseAdMobNativeExpressAd::loadInternal()
{
admob::AdRequest request = _request->asAdMobRequest();
return _nativeAd->LoadAd(request);
}

firebase::FutureBase QtFirebaseAdMobNativeExpressAd::moveToInternal(int x, int y)
{
return _nativeAd->MoveTo(x, y);
}

firebase::FutureBase QtFirebaseAdMobNativeExpressAd::moveToInternal(Position position)
{
switch (position) {
case PositionTopCenter:
qDebug() << this << "::moveTo position top-center";
return _nativeAd->MoveTo(admob::NativeExpressAdView::kPositionTop);
case PositionTopLeft:
qDebug() << this << "::moveTo position top-left";
return _nativeAd->MoveTo(admob::NativeExpressAdView::kPositionTopLeft);
case PositionTopRight:
qDebug() << this << "::moveTo position top-right";
return _nativeAd->MoveTo(admob::NativeExpressAdView::kPositionTopRight);
case PositionBottomCenter:
qDebug() << this << "::moveTo position bottom-center";
return _nativeAd->MoveTo(admob::NativeExpressAdView::kPositionBottom);
case PositionBottomLeft:
qDebug() << this << "::moveTo position bottom-left";
return _nativeAd->MoveTo(admob::NativeExpressAdView::kPositionBottomLeft);
case PositionBottomRight:
qDebug() << this << "::moveTo position bottom-right";
return _nativeAd->MoveTo(admob::NativeExpressAdView::kPositionBottomRight);
}

qDebug() << this << "::moveTo position unknown" << position;
return firebase::FutureBase();
}

/*
* AdMobInterstitial
*
Expand Down
30 changes: 0 additions & 30 deletions src/qtfirebaseadmob.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "firebase/admob.h"
#include "firebase/admob/types.h"
#include "firebase/admob/banner_view.h"
#include "firebase/admob/native_express_ad_view.h"
#include "firebase/admob/interstitial_ad.h"
#include "firebase/admob/rewarded_video.h"

Expand Down Expand Up @@ -368,35 +367,6 @@ class QtFirebaseAdMobBanner : public QtFirebaseAdMobBannerBase
firebase::admob::BannerView* _banner;
};

/*
* AdMobNativeExpressAd
*/
class QtFirebaseAdMobNativeExpressAd : public QtFirebaseAdMobBannerBase
{
Q_OBJECT

public:

QtFirebaseAdMobNativeExpressAd(QObject* parent = 0);
~QtFirebaseAdMobNativeExpressAd();

private:
firebase::FutureBase initInternal() override;
firebase::FutureBase loadInternal() override;

firebase::FutureBase moveToInternal(int x, int y) override;
firebase::FutureBase moveToInternal(Position position) override;

firebase::FutureBase setXInternal(int x) override;
firebase::FutureBase setYInternal(int y) override;

firebase::FutureBase setVisibleInternal(bool visible) override;

private:
firebase::admob::NativeExpressAdView* _nativeAd;

};

/*
* AdMobInterstitial
*/
Expand Down

0 comments on commit 4e217cc

Please sign in to comment.