diff --git a/README.md b/README.md index a86d6e3..40a8163 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/fake/src/qtfirebaseadmob.h b/fake/src/qtfirebaseadmob.h index 9051b5f..2232f5a 100644 --- a/fake/src/qtfirebaseadmob.h +++ b/fake/src/qtfirebaseadmob.h @@ -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 */ diff --git a/qtfirebase_register.h b/qtfirebase_register.h index 990b9d1..8aa1de7 100644 --- a/qtfirebase_register.h +++ b/qtfirebase_register.h @@ -90,7 +90,6 @@ static void registerQtFirebase() { qmlRegisterType("QtFirebase", 1, 0, "AdMob"); qmlRegisterType("QtFirebase", 1, 0, "AdMobRequest"); qmlRegisterType("QtFirebase", 1, 0, "AdMobBanner"); - qmlRegisterType("QtFirebase", 1, 0, "AdMobNativeExpressAd"); qmlRegisterType("QtFirebase", 1, 0, "AdMobInterstitial"); qmlRegisterType("QtFirebase", 1, 0, "AdMobRewardedVideoAd"); #endif diff --git a/src/qtfirebase_plugin.cpp b/src/qtfirebase_plugin.cpp index 86336b2..c0f6f58 100644 --- a/src/qtfirebase_plugin.cpp +++ b/src/qtfirebase_plugin.cpp @@ -53,7 +53,6 @@ void QtFirebasePlugin::registerTypes(const char *uri) qmlRegisterType(uri, 1, 0, "AdMob"); qmlRegisterType(uri, 1, 0, "AdMobRequest"); qmlRegisterType(uri, 1, 0, "AdMobBanner"); - qmlRegisterType(uri, 1, 0, "AdMobNativeExpressAd"); qmlRegisterType(uri, 1, 0, "AdMobInterstitial"); qmlRegisterType(uri, 1, 0, "AdMobRewardedVideoAd"); #endif diff --git a/src/qtfirebaseadmob.cpp b/src/qtfirebaseadmob.cpp index 6fe2ffa..d7e61cc 100644 --- a/src/qtfirebaseadmob.cpp +++ b/src/qtfirebaseadmob.cpp @@ -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(_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 * diff --git a/src/qtfirebaseadmob.h b/src/qtfirebaseadmob.h index 4d5b418..427ed73 100644 --- a/src/qtfirebaseadmob.h +++ b/src/qtfirebaseadmob.h @@ -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" @@ -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 */