Merge v0.6.0 and v0.6.1 #29
11 changed files with 101 additions and 27 deletions
|
@ -69,17 +69,14 @@
|
||||||
<meta-data android:name="android.app.extract_android_style" android:value="default"/>
|
<meta-data android:name="android.app.extract_android_style" android:value="default"/>
|
||||||
<!-- extract android style -->
|
<!-- extract android style -->
|
||||||
<!-- Handle shared incoming urls -->
|
<!-- Handle shared incoming urls -->
|
||||||
<intent-filter>
|
<intent-filter android:autoVerify="true">
|
||||||
<action android:name="android.intent.action.SEND"/>
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
<data android:mimeType="*/*"/>
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
<data android:mimeType="*/*"/>
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
<data android:scheme="file"/>
|
<!-- Accepts URIs that begin with "https://l.bluerock.dev/” -->
|
||||||
<data android:scheme="content"/>
|
<data android:scheme="https" android:host="l.bluerock.dev" android:pathPattern=".*"/>
|
||||||
|
<!-- Accepts URIs that begin with "https://app.bluerock.dev” -->
|
||||||
|
<data android:scheme="https" android:host="app.bluerock.dev" android:pathPattern=".*"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
|
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
|
||||||
|
@ -89,5 +86,5 @@
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
|
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -39,6 +39,8 @@ public class MainActivity extends QtActivity
|
||||||
// native - must be implemented in Cpp via JNI
|
// native - must be implemented in Cpp via JNI
|
||||||
// 'file' scheme or resolved from 'content' scheme:
|
// 'file' scheme or resolved from 'content' scheme:
|
||||||
public static native void setFileUrlReceived(String url);
|
public static native void setFileUrlReceived(String url);
|
||||||
|
//
|
||||||
|
public static native void setOtherUrlReceived(String url, String scheme);
|
||||||
// InputStream from 'content' scheme:
|
// InputStream from 'content' scheme:
|
||||||
public static native void setFileReceivedAndSaved(String url);
|
public static native void setFileReceivedAndSaved(String url);
|
||||||
//
|
//
|
||||||
|
@ -178,6 +180,7 @@ public class MainActivity extends QtActivity
|
||||||
}
|
}
|
||||||
if(!intentScheme.equals("content")){
|
if(!intentScheme.equals("content")){
|
||||||
Log.d("ekkescorner Intent URI unknown scheme: ", intentScheme);
|
Log.d("ekkescorner Intent URI unknown scheme: ", intentScheme);
|
||||||
|
setOtherUrlReceived(intentUri.toString(), intentScheme);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// ok - it's a content scheme URI
|
// ok - it's a content scheme URI
|
||||||
|
|
|
@ -48,8 +48,9 @@ private:
|
||||||
|
|
||||||
ShareUtils* _shareUtils;
|
ShareUtils* _shareUtils;
|
||||||
const QStringList _validBaseDomains = {"digitalrock.de", "bluerock.dev"};
|
const QStringList _validBaseDomains = {"digitalrock.de", "bluerock.dev"};
|
||||||
|
bool _pendingIntentsChecked;
|
||||||
signals:
|
signals:
|
||||||
|
Q_INVOKABLE void openedViaUrl(QString url, QString scheme);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
@ -57,6 +58,9 @@ public slots:
|
||||||
QVariantMap getParamsFromUrl(QString url);
|
QVariantMap getParamsFromUrl(QString url);
|
||||||
void shareResultsAsUrl(QString url, QString compName);
|
void shareResultsAsUrl(QString url, QString compName);
|
||||||
void shareResultsAsPoster(QString url, QString compName);
|
void shareResultsAsPoster(QString url, QString compName);
|
||||||
|
#if defined(Q_OS_ANDROID)
|
||||||
|
void onApplicationStateChanged(Qt::ApplicationState applicationState);
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setFileUrlReceived(const QString &url);
|
void setFileUrlReceived(const QString &url);
|
||||||
|
void setOtherUrlReceived(const QString &url, const QString &scheme);
|
||||||
void setFileReceivedAndSaved(const QString &url);
|
void setFileReceivedAndSaved(const QString &url);
|
||||||
bool checkFileExits(const QString &url);
|
bool checkFileExits(const QString &url);
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ signals:
|
||||||
void shareNoAppAvailable(int requestCode);
|
void shareNoAppAvailable(int requestCode);
|
||||||
void shareError(int requestCode, QString message);
|
void shareError(int requestCode, QString message);
|
||||||
void fileUrlReceived(QString url);
|
void fileUrlReceived(QString url);
|
||||||
|
void otherUrlReceived(QString url, QString scheme);
|
||||||
void fileReceivedAndSaved(QString url);
|
void fileReceivedAndSaved(QString url);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -32,6 +32,7 @@ signals:
|
||||||
void shareNoAppAvailable(int requestCode);
|
void shareNoAppAvailable(int requestCode);
|
||||||
void shareError(int requestCode, QString message);
|
void shareError(int requestCode, QString message);
|
||||||
void fileUrlReceived(QString url);
|
void fileUrlReceived(QString url);
|
||||||
|
void otherUrlReceived(QString url, QString scheme);
|
||||||
void fileReceivedAndSaved(QString url);
|
void fileReceivedAndSaved(QString url);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -40,6 +41,7 @@ public slots:
|
||||||
void onShareNoAppAvailable(int requestCode);
|
void onShareNoAppAvailable(int requestCode);
|
||||||
void onShareError(int requestCode, QString message);
|
void onShareError(int requestCode, QString message);
|
||||||
void onFileUrlReceived(QString url);
|
void onFileUrlReceived(QString url);
|
||||||
|
void onOtherUrlReceived(QString url, QString scheme);
|
||||||
void onFileReceivedAndSaved(QString url);
|
void onFileReceivedAndSaved(QString url);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -110,10 +110,17 @@ DataListView {
|
||||||
initFilters()
|
initFilters()
|
||||||
initFavorites()
|
initFavorites()
|
||||||
|
|
||||||
if(model){
|
console.log(JSON.stringify(widgetData))
|
||||||
|
|
||||||
|
if(model && widgetData["competitions"].length > 0){
|
||||||
control.status = 200
|
control.status = 200
|
||||||
control.ready = true
|
control.ready = true
|
||||||
}
|
}
|
||||||
|
else if(widgetData["competitions"].length === 0) {
|
||||||
|
control.status = 404
|
||||||
|
control.ready = false
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
control.ready = false
|
control.ready = false
|
||||||
control.status = 901
|
control.status = 901
|
||||||
|
|
|
@ -134,7 +134,7 @@ Window {
|
||||||
//app.openAthlete() // dorian: 53139 , rustam: 6933 , helen: 53300
|
//app.openAthlete() // dorian: 53139 , rustam: 6933 , helen: 53300
|
||||||
//openWidget({nation:'GER'})
|
//openWidget({nation:'GER'})
|
||||||
//mainStack.push("Pages/AthleteSearchPage.qml")
|
//mainStack.push("Pages/AthleteSearchPage.qml")
|
||||||
openWidget({comp: 11651, cat: 26})
|
//openWidget({comp: 11651, cat: 26})
|
||||||
//openWidget({person: 6623})
|
//openWidget({person: 6623})
|
||||||
//console.log(JSON.stringify(serverConn.getParamsFromUrl("")))
|
//console.log(JSON.stringify(serverConn.getParamsFromUrl("")))
|
||||||
}
|
}
|
||||||
|
@ -157,6 +157,10 @@ Window {
|
||||||
|
|
||||||
BlueRockBackend {
|
BlueRockBackend {
|
||||||
id: serverConn
|
id: serverConn
|
||||||
|
|
||||||
|
onOpenedViaUrl: {
|
||||||
|
app.openWidgetFromUrl(url)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AppSettings {
|
AppSettings {
|
||||||
|
|
|
@ -18,26 +18,28 @@
|
||||||
|
|
||||||
#include "headers/bluerockbackend.h"
|
#include "headers/bluerockbackend.h"
|
||||||
|
|
||||||
BlueRockBackend::BlueRockBackend(QObject *parent) : QObject(parent)
|
BlueRockBackend::BlueRockBackend(QObject *parent) : QObject(parent), _pendingIntentsChecked(false)
|
||||||
{
|
{
|
||||||
this->_shareUtils = new ShareUtils(this);
|
this->_shareUtils = new ShareUtils(this);
|
||||||
|
connect(this->_shareUtils, &ShareUtils::otherUrlReceived, this, &BlueRockBackend::openedViaUrl);
|
||||||
|
|
||||||
|
#if defined(Q_OS_ANDROID)
|
||||||
|
connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onApplicationStateChanged(Qt::ApplicationState)));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant BlueRockBackend::getWidgetData(QVariantMap params) {
|
QVariant BlueRockBackend::getWidgetData(QVariantMap params) {
|
||||||
QString requestUrl;
|
QString requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?";
|
||||||
|
QStringList nations = {"ICC", "GER", "SUI"};
|
||||||
if(params["nation"].toString() == "ICC") {
|
if(params["nation"].toString() == "ICC") {
|
||||||
requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?";
|
|
||||||
params["nation"] = "";
|
params["nation"] = "";
|
||||||
}
|
}
|
||||||
else if (params["nation"].toString() == "GER") {
|
else if(params["nation"].toString() == "") {
|
||||||
requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?";
|
|
||||||
}
|
|
||||||
else if (params["nation"].toString() == "SUI") {
|
|
||||||
requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
params.remove("nation");
|
params.remove("nation");
|
||||||
requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?";
|
}
|
||||||
|
else if(!nations.contains(params["nation"].toString())) {
|
||||||
|
// a non-empty nation which ist not one of the above is invalid
|
||||||
|
return QVariantMap({{"status", 404}});
|
||||||
}
|
}
|
||||||
|
|
||||||
for(QVariantMap::const_iterator iter = params.begin(); iter != params.end(); ++iter) {
|
for(QVariantMap::const_iterator iter = params.begin(); iter != params.end(); ++iter) {
|
||||||
|
@ -203,9 +205,27 @@ QVariantMap BlueRockBackend::_senddata(QUrl serviceUrl, QUrlQuery pdata)
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(Q_OS_ANDROID)
|
||||||
|
void BlueRockBackend::onApplicationStateChanged(Qt::ApplicationState applicationState)
|
||||||
|
{
|
||||||
|
qDebug() << "S T A T E changed into: " << applicationState;
|
||||||
|
if(applicationState == Qt::ApplicationState::ApplicationSuspended) {
|
||||||
|
// nothing to do
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(applicationState == Qt::ApplicationState::ApplicationActive) {
|
||||||
|
// if App was launched from VIEW or SEND Intent
|
||||||
|
// there's a race collision: the event will be lost,
|
||||||
|
// because App and UI wasn't completely initialized
|
||||||
|
// workaround: QShareActivity remembers that an Intent is pending
|
||||||
|
if(!_pendingIntentsChecked) {
|
||||||
|
_pendingIntentsChecked = true;
|
||||||
|
_shareUtils->checkPendingIntents(this->_shareUtils->getTemporaryFileLocationPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// -------------------------
|
// -------------------------
|
||||||
// --- Functions for QML ---
|
// --- Functions for QML ---
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -236,6 +236,18 @@ void AndroidShareUtils::setFileUrlReceived(const QString &url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AndroidShareUtils::setOtherUrlReceived(const QString &url, const QString &scheme)
|
||||||
|
{
|
||||||
|
if(url.isEmpty()) {
|
||||||
|
qWarning() << "setFileUrlReceived: we got an empty URL";
|
||||||
|
emit shareError(0, tr("Empty URL received"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
qDebug() << "AndroidShareUtils setOtherUrlReceived: we got the Other URL from JAVA: " << url;
|
||||||
|
|
||||||
|
emit otherUrlReceived(url, scheme);
|
||||||
|
}
|
||||||
|
|
||||||
void AndroidShareUtils::setFileReceivedAndSaved(const QString &url)
|
void AndroidShareUtils::setFileReceivedAndSaved(const QString &url)
|
||||||
{
|
{
|
||||||
if(url.isEmpty()) {
|
if(url.isEmpty()) {
|
||||||
|
@ -311,6 +323,21 @@ Java_de_itsblue_blueROCK_MainActivity_setFileUrlReceived(JNIEnv *env,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_de_itsblue_blueROCK_MainActivity_setOtherUrlReceived(JNIEnv *env,
|
||||||
|
jobject obj,
|
||||||
|
jstring url,
|
||||||
|
jstring scheme)
|
||||||
|
{
|
||||||
|
const char *urlStr = env->GetStringUTFChars(url, NULL);
|
||||||
|
const char *schemeStr = env->GetStringUTFChars(scheme, NULL);
|
||||||
|
Q_UNUSED (obj)
|
||||||
|
AndroidShareUtils::getInstance()->setOtherUrlReceived(urlStr, schemeStr);
|
||||||
|
env->ReleaseStringUTFChars(url, urlStr);
|
||||||
|
env->ReleaseStringUTFChars(scheme, schemeStr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_de_itsblue_blueROCK_MainActivity_setFileReceivedAndSaved(JNIEnv *env,
|
Java_de_itsblue_blueROCK_MainActivity_setFileReceivedAndSaved(JNIEnv *env,
|
||||||
jobject obj,
|
jobject obj,
|
||||||
|
|
|
@ -38,6 +38,9 @@ ShareUtils::ShareUtils(QObject *parent)
|
||||||
connectResult = connect(mPlatformShareUtils, &PlatformShareUtils::fileUrlReceived, this, &ShareUtils::onFileUrlReceived);
|
connectResult = connect(mPlatformShareUtils, &PlatformShareUtils::fileUrlReceived, this, &ShareUtils::onFileUrlReceived);
|
||||||
Q_ASSERT(connectResult);
|
Q_ASSERT(connectResult);
|
||||||
|
|
||||||
|
connectResult = connect(mPlatformShareUtils, &PlatformShareUtils::otherUrlReceived, this, &ShareUtils::onOtherUrlReceived);
|
||||||
|
Q_ASSERT(connectResult);
|
||||||
|
|
||||||
connectResult = connect(mPlatformShareUtils, &PlatformShareUtils::fileReceivedAndSaved, this, &ShareUtils::onFileReceivedAndSaved);
|
connectResult = connect(mPlatformShareUtils, &PlatformShareUtils::fileReceivedAndSaved, this, &ShareUtils::onFileReceivedAndSaved);
|
||||||
Q_ASSERT(connectResult);
|
Q_ASSERT(connectResult);
|
||||||
|
|
||||||
|
@ -109,6 +112,11 @@ void ShareUtils::onFileUrlReceived(QString url)
|
||||||
emit fileUrlReceived(url);
|
emit fileUrlReceived(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShareUtils::onOtherUrlReceived(QString url, QString scheme)
|
||||||
|
{
|
||||||
|
emit otherUrlReceived(url, scheme);
|
||||||
|
}
|
||||||
|
|
||||||
void ShareUtils::onFileReceivedAndSaved(QString url)
|
void ShareUtils::onFileReceivedAndSaved(QString url)
|
||||||
{
|
{
|
||||||
emit fileReceivedAndSaved(url);
|
emit fileReceivedAndSaved(url);
|
||||||
|
|
Loading…
Reference in a new issue