Commit ca9961d8 authored by Nicolas Fella's avatar Nicolas Fella

Implement onNewIntent

Summary: Importing a reservation from an intent only worked when that intent started the app. When the app is already running onNewIntent is called, but since we didn't override it nothing was imported.

Test Plan: Open app. Send reservation via KDE Connect. Previously nothing happend. Now the reservation is added to the list

Reviewers: vkrause

Reviewed By: vkrause

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D17993
parent 3b9ff192
...@@ -59,8 +59,16 @@ static void importReservation(JNIEnv *env, jobject that, jstring data) ...@@ -59,8 +59,16 @@ static void importReservation(JNIEnv *env, jobject that, jstring data)
ApplicationController::instance()->importData(env->GetStringUTFChars(data, 0)); ApplicationController::instance()->importData(env->GetStringUTFChars(data, 0));
} }
static void importFromIntent(JNIEnv *env, jobject that, jobject data)
{
Q_UNUSED(that);
Q_UNUSED(env)
ApplicationController::instance()->importFromIntent(data);
}
static const JNINativeMethod methods[] = { static const JNINativeMethod methods[] = {
{"importReservation", "(Ljava/lang/String;)V", (void*)importReservation} {"importReservation", "(Ljava/lang/String;)V", (void*)importReservation},
{"importFromIntent", "(Landroid/content/Intent;)V", (void*)importFromIntent}
}; };
Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void*) Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void*)
......
...@@ -73,6 +73,7 @@ public class Activity extends QtActivity ...@@ -73,6 +73,7 @@ public class Activity extends QtActivity
} }
public native void importReservation(String data); public native void importReservation(String data);
public native void importFromIntent(Intent data);
/** Check the calendar for with JSON-LD data. /** Check the calendar for with JSON-LD data.
* This assumes the custom property serialization format used by DavDroid. * This assumes the custom property serialization format used by DavDroid.
...@@ -128,4 +129,10 @@ public class Activity extends QtActivity ...@@ -128,4 +129,10 @@ public class Activity extends QtActivity
} }
}); });
} }
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
importFromIntent(intent);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment