mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
android/usb: simply restart the download after receiving permission
If the user tries to download from a device that he hasn't given the app permission to read from, Android will pop up a dialogue asking for that permission. With this after giving the permission we continue (well, technically, restart) the download which is likely the expected behavior. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4619b4932e
commit
0b72495413
5 changed files with 70 additions and 12 deletions
|
@ -181,7 +181,7 @@ Java_org_subsurfacedivelog_mobile_SubsurfaceMobileActivity_setUsbDevice(JNIEnv *
|
|||
if (usbDevice.isValid()) {
|
||||
android_usb_serial_device_descriptor descriptor = getDescriptor(usbDevice);
|
||||
|
||||
LOG(QString("called by intent for device %1").arg(QString::fromStdString(descriptor.uiRepresentation)));
|
||||
LOG(QString("called by connect intent for device %1").arg(QString::fromStdString(descriptor.uiRepresentation)));
|
||||
}
|
||||
#if defined(SUBSURFACE_MOBILE)
|
||||
QMLManager::instance()->showDownloadPage(usbDevice);
|
||||
|
@ -189,6 +189,25 @@ Java_org_subsurfacedivelog_mobile_SubsurfaceMobileActivity_setUsbDevice(JNIEnv *
|
|||
return;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_subsurfacedivelog_mobile_SubsurfaceMobileActivity_restartDownload(JNIEnv *env,
|
||||
jobject obj,
|
||||
jobject javaUsbDevice)
|
||||
{
|
||||
Q_UNUSED (obj)
|
||||
Q_UNUSED (env)
|
||||
QAndroidJniObject usbDevice(javaUsbDevice);
|
||||
if (usbDevice.isValid()) {
|
||||
android_usb_serial_device_descriptor descriptor = getDescriptor(usbDevice);
|
||||
|
||||
LOG(QString("called by permission granted intent for device %1").arg(QString::fromStdString(descriptor.uiRepresentation)));
|
||||
}
|
||||
#if defined(SUBSURFACE_MOBILE)
|
||||
QMLManager::instance()->restartDownload(usbDevice);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/* NOP wrappers to comform with windows.c */
|
||||
int subsurface_rename(const char *path, const char *newpath)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue