-
Notifications
You must be signed in to change notification settings - Fork 16
Added image preview in notification for Android. #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
|
|
||
| #include "HardwareUtils_Android.h" | ||
| #include "notificationservice.h" | ||
| #include "../src/Common.h" | ||
| #include <QtAndroidExtras/QAndroidJniObject> | ||
| #include <QtAndroidExtras/QAndroidJniEnvironment> | ||
| #include <jni.h> | ||
|
|
@@ -56,8 +58,9 @@ class FbListener: public ::firebase::messaging::Listener | |
|
|
||
| virtual void OnMessage(const ::firebase::messaging::Message &message) | ||
| { | ||
| Q_UNUSED(message) | ||
| qDebug() << "Received FCM message"; | ||
| NotificationService *ns = new NotificationService(); | ||
| ns->handleMessage(message); | ||
| } | ||
|
|
||
| private: | ||
|
|
@@ -78,6 +81,16 @@ static ::firebase::InitResult firebaseInitializeMessaging(::firebase::App *app, | |
| return res; | ||
| } | ||
|
|
||
|
|
||
|
ryancrunchi marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| HardwareUtilsAndroid::HardwareUtilsAndroid(QObject *parent): | ||
| HardwareUtils(parent), | ||
| fcmListener(new FbListener()) | ||
|
|
@@ -88,6 +101,11 @@ HardwareUtilsAndroid::~HardwareUtilsAndroid() | |
| { | ||
| } | ||
|
|
||
| HardwareUtilsAndroid *HardwareUtilsAndroid::Instance(QObject *parent) | ||
| { | ||
| return static_cast<HardwareUtilsAndroid*>(HardwareUtils::Instance(parent)); | ||
|
ryancrunchi marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| void HardwareUtilsAndroid::platformInit(QQmlApplicationEngine *e) | ||
| { | ||
| HardwareUtils::platformInit(e); | ||
|
|
@@ -154,6 +172,66 @@ void HardwareUtilsAndroid::inputTextDialog(const QString &title, const QString & | |
| jMessage.object<jstring>()); | ||
| } | ||
|
|
||
| void HardwareUtilsAndroid::loadAuthKeychain(QString &email, QString &pass) | ||
| { | ||
| this->HardwareUtils::loadAuthKeychain(email, pass); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inutile d'appeler la classe
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pour moi, HardwareUtilsAndroid est une sous classe et le fait d'appeler
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oui, mais dans le cas ici on veut soit utiliser le stockage par defaut des identifiants, soit dans dans la version géré dans la sous classe
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Je viens de me rendre compte que ca ne marche pas en fait. |
||
| QAndroidJniObject::callStaticMethod<void>("fr/calaos/calaoshome/HardwareUtils", "loadAuthKeychain"); | ||
| } | ||
|
|
||
| void HardwareUtilsAndroid::saveAuthKeychain(const QString &email, const QString &pass) | ||
| { | ||
| this->HardwareUtils::saveAuthKeychain(email, pass); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idem: Inutile d'appeler la classe |
||
| QAndroidJniObject jEmail = QAndroidJniObject::fromString(email); | ||
| QAndroidJniObject jPass = QAndroidJniObject::fromString(pass); | ||
| QAndroidJniObject::callStaticMethod<void>("fr/calaos/calaoshome/HardwareUtils", "saveAuthKeychain", "(Ljava/lang/String;Ljava/lang/String;)V", | ||
| jEmail.object<jstring>(), | ||
| jPass.object<jstring>() | ||
| ); | ||
| } | ||
|
|
||
| void HardwareUtilsAndroid::setConfigOption(QString key, QString value) | ||
| { | ||
| this->HardwareUtils::setConfigOption(key, value); | ||
|
raoulh marked this conversation as resolved.
Outdated
|
||
| QAndroidJniObject jKey = QAndroidJniObject::fromString(key); | ||
| QAndroidJniObject jValue = QAndroidJniObject::fromString(value); | ||
| QAndroidJniObject::callStaticMethod<void>("fr/calaos/calaoshome/HardwareUtils", "setConfigOption", "(Ljava/lang/String;Ljava/lang/String;)V", | ||
| jKey.object<jstring>(), | ||
| jValue.object<jstring>() | ||
| ); | ||
| } | ||
|
|
||
| QString HardwareUtilsAndroid::getConfigOption(QString key) | ||
|
ryancrunchi marked this conversation as resolved.
Outdated
|
||
| { | ||
| return this->HardwareUtils::getConfigOption(key); | ||
| } | ||
|
|
||
| void HardwareUtilsAndroid::resetAuthKeychain() | ||
| { | ||
| this->HardwareUtils::resetAuthKeychain(); | ||
| QAndroidJniObject::callStaticMethod<void>("fr/calaos/calaoshome/HardwareUtils", "resetAuthKeychain", "()V"); | ||
| } | ||
|
|
||
|
|
||
|
ryancrunchi marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| // JNI // | ||
|
|
||
| static void emitDialogTextValid(JNIEnv *env, jobject obj, jstring text) | ||
| { | ||
| Q_UNUSED(env); | ||
|
|
@@ -174,10 +252,40 @@ static void emitDialogCancel(JNIEnv *env, jobject obj) | |
| Qt::QueuedConnection); | ||
| } | ||
|
|
||
| static jstring getDemoUser(JNIEnv *env, jobject obj) | ||
| { | ||
| Q_UNUSED(env); | ||
|
ryancrunchi marked this conversation as resolved.
Outdated
|
||
| Q_UNUSED(obj); | ||
| auto stduser = Common::getDemoUser().toStdString(); | ||
| const char* ret = stduser.c_str(); | ||
| return env->NewStringUTF(ret); | ||
| } | ||
|
|
||
| static jstring getDemoPass(JNIEnv *env, jobject obj) | ||
| { | ||
| Q_UNUSED(env); | ||
|
ryancrunchi marked this conversation as resolved.
Outdated
|
||
| Q_UNUSED(obj); | ||
| auto stdpass = Common::getDemoPass().toStdString(); | ||
| const char* ret = stdpass.c_str(); | ||
| return env->NewStringUTF(ret); | ||
| } | ||
|
|
||
| static jstring getDemoHost(JNIEnv *env, jobject obj) | ||
| { | ||
| Q_UNUSED(env); | ||
|
ryancrunchi marked this conversation as resolved.
Outdated
|
||
| Q_UNUSED(obj); | ||
| auto stdhost = Common::getDemoHost().toStdString(); | ||
| const char* ret = stdhost.c_str(); | ||
| return env->NewStringUTF(ret); | ||
| } | ||
|
|
||
| static JNINativeMethod jniMethods[] = | ||
| { | ||
| { "emitDialogTextValid", "(Ljava/lang/String;)V", reinterpret_cast<void *>(emitDialogTextValid) }, | ||
| { "emitDialogCancel", "()V", reinterpret_cast<void *>(emitDialogCancel) }, | ||
| { "getDemoUser", "()Ljava/lang/String;", reinterpret_cast<void *>(getDemoUser) }, | ||
| { "getDemoPass", "()Ljava/lang/String;", reinterpret_cast<void *>(getDemoPass) }, | ||
| { "getDemoHost", "()Ljava/lang/String;", reinterpret_cast<void *>(getDemoHost) }, | ||
| }; | ||
|
|
||
| // this method is called automatically by Java after the .so file is loaded | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.