Commit 22624461 authored by DonLakeFlyer's avatar DonLakeFlyer

Tweaks to iOS storage location to support display in Files app

parent c83f788d
...@@ -13,7 +13,11 @@ Note: This file only contains high level features or important fixes. ...@@ -13,7 +13,11 @@ Note: This file only contains high level features or important fixes.
## 4.0 ## 4.0
## 4.0.7 - Not yet released ## 4.0.8 - Not yet released
* iOS: Modify QGC file storage location to support new Files app
## 4.0.7 - Stable
* Fix video page sizing * Fix video page sizing
* Virtual Joystick: Fix right stick centering. Fix/add support for rover/sub reverse throttle support. * Virtual Joystick: Fix right stick centering. Fix/add support for rover/sub reverse throttle support.
......
...@@ -86,5 +86,6 @@ ...@@ -86,5 +86,6 @@
</dict> </dict>
<key>UIFileSharingEnabled</key> <key>UIFileSharingEnabled</key>
<true/> <true/>
</dict> <key>LSSupportsOpeningDocumentsInPlace</key>
<true/></dict>
</plist> </plist>
...@@ -53,23 +53,27 @@ DECLARE_SETTINGGROUP(App, "") ...@@ -53,23 +53,27 @@ DECLARE_SETTINGGROUP(App, "")
SettingsFact* savePathFact = qobject_cast<SettingsFact*>(savePath()); SettingsFact* savePathFact = qobject_cast<SettingsFact*>(savePath());
QString appName = qgcApp()->applicationName(); QString appName = qgcApp()->applicationName();
#ifdef __mobile__ #ifdef __mobile__
// Mobile builds always use the runtime generated location for savePath. The reason is that for example on iOS the save path includes // Mobile builds always use the runtime generated location for savePath.
// a UID for the app in it. When you then update the app that UID could change which in turn makes any saved value invalid. bool userHasModifiedSavePath = false;
if (true) {
#else #else
if (savePathFact->rawValue().toString().isEmpty() && _nameToMetaDataMap[savePathName]->rawDefaultValue().toString().isEmpty()) { bool userHasModifiedSavePath = !savePathFact->rawValue().toString().isEmpty() || !_nameToMetaDataMap[savePathName]->rawDefaultValue().toString().isEmpty();
#endif #endif
if (!userHasModifiedSavePath) {
#ifdef __mobile__ #ifdef __mobile__
#ifdef __ios__ #ifdef __ios__
QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); // This will expose the directories directly to the File iOs app
#else QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
savePathFact->setRawValue(rootDir.absolutePath());
#else
QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
#endif savePathFact->setRawValue(rootDir.filePath(appName));
#endif
savePathFact->setVisible(false); savePathFact->setVisible(false);
#else #else
QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)); QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
#endif
savePathFact->setRawValue(rootDir.filePath(appName)); savePathFact->setRawValue(rootDir.filePath(appName));
#endif
} }
connect(savePathFact, &Fact::rawValueChanged, this, &AppSettings::savePathsChanged); connect(savePathFact, &Fact::rawValueChanged, this, &AppSettings::savePathsChanged);
......
...@@ -339,8 +339,7 @@ bool QGCCorePlugin::overrideSettingsGroupVisibility(QString name) ...@@ -339,8 +339,7 @@ bool QGCCorePlugin::overrideSettingsGroupVisibility(QString name)
bool QGCCorePlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData) bool QGCCorePlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData)
{ {
if (settingsGroup != AppSettings::settingsGroup) { if (settingsGroup == AppSettings::settingsGroup) {
// All changes refer to AppSettings
#if !defined(QGC_ENABLE_PAIRING) #if !defined(QGC_ENABLE_PAIRING)
//-- If we don't support pairing, disable it. //-- If we don't support pairing, disable it.
if (metaData.name() == AppSettings::usePairingName) { if (metaData.name() == AppSettings::usePairingName) {
...@@ -349,36 +348,28 @@ bool QGCCorePlugin::adjustSettingMetaData(const QString& settingsGroup, FactMeta ...@@ -349,36 +348,28 @@ bool QGCCorePlugin::adjustSettingMetaData(const QString& settingsGroup, FactMeta
return false; return false;
} }
#endif #endif
return true;
}
//-- Default Palette //-- Default Palette
if (metaData.name() == AppSettings::indoorPaletteName) { if (metaData.name() == AppSettings::indoorPaletteName) {
QVariant outdoorPalette; QVariant outdoorPalette;
#if defined (__mobile__) #if defined (__mobile__)
outdoorPalette = 0; outdoorPalette = 0;
#else #else
outdoorPalette = 1; outdoorPalette = 1;
#endif #endif
metaData.setRawDefaultValue(outdoorPalette); metaData.setRawDefaultValue(outdoorPalette);
return true; return true;
//-- Auto Save Telemetry Logs }
} else if (metaData.name() == AppSettings::telemetrySaveName) {
#if defined (__mobile__) #if defined (__mobile__)
metaData.setRawDefaultValue(false); if (metaData.name() == AppSettings::telemetrySaveName) {
return true; // Mobile devices have limited storage so don't turn on telemtry saving by default
#else metaData.setRawDefaultValue(false);
metaData.setRawDefaultValue(true); return true;
return true; }
#endif
#if defined(__ios__)
} else if (metaData.name() == AppSettings::savePathName) {
QString appName = qgcApp()->applicationName();
QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
metaData.setRawDefaultValue(rootDir.filePath(appName));
return false;
#endif #endif
} }
return true; // Show setting in ui return true; // Show setting in ui
} }
......
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