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.
## 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
* Virtual Joystick: Fix right stick centering. Fix/add support for rover/sub reverse throttle support.
......
......@@ -86,5 +86,6 @@
</dict>
<key>UIFileSharingEnabled</key>
<true/>
</dict>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/></dict>
</plist>
......@@ -53,23 +53,27 @@ DECLARE_SETTINGGROUP(App, "")
SettingsFact* savePathFact = qobject_cast<SettingsFact*>(savePath());
QString appName = qgcApp()->applicationName();
#ifdef __mobile__
// Mobile builds always use the runtime generated location for savePath. The reason is that for example on iOS the save path includes
// 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.
if (true) {
// Mobile builds always use the runtime generated location for savePath.
bool userHasModifiedSavePath = false;
#else
if (savePathFact->rawValue().toString().isEmpty() && _nameToMetaDataMap[savePathName]->rawDefaultValue().toString().isEmpty()) {
bool userHasModifiedSavePath = !savePathFact->rawValue().toString().isEmpty() || !_nameToMetaDataMap[savePathName]->rawDefaultValue().toString().isEmpty();
#endif
if (!userHasModifiedSavePath) {
#ifdef __mobile__
#ifdef __ios__
QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
#else
#ifdef __ios__
// This will expose the directories directly to the File iOs app
QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
savePathFact->setRawValue(rootDir.absolutePath());
#else
QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
#endif
savePathFact->setRawValue(rootDir.filePath(appName));
#endif
savePathFact->setVisible(false);
#else
QDir rootDir = QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
#endif
savePathFact->setRawValue(rootDir.filePath(appName));
#endif
}
connect(savePathFact, &Fact::rawValueChanged, this, &AppSettings::savePathsChanged);
......
......@@ -339,8 +339,7 @@ bool QGCCorePlugin::overrideSettingsGroupVisibility(QString name)
bool QGCCorePlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData)
{
if (settingsGroup != AppSettings::settingsGroup) {
// All changes refer to AppSettings
if (settingsGroup == AppSettings::settingsGroup) {
#if !defined(QGC_ENABLE_PAIRING)
//-- If we don't support pairing, disable it.
if (metaData.name() == AppSettings::usePairingName) {
......@@ -349,36 +348,28 @@ bool QGCCorePlugin::adjustSettingMetaData(const QString& settingsGroup, FactMeta
return false;
}
#endif
return true;
}
//-- Default Palette
if (metaData.name() == AppSettings::indoorPaletteName) {
QVariant outdoorPalette;
//-- Default Palette
if (metaData.name() == AppSettings::indoorPaletteName) {
QVariant outdoorPalette;
#if defined (__mobile__)
outdoorPalette = 0;
outdoorPalette = 0;
#else
outdoorPalette = 1;
outdoorPalette = 1;
#endif
metaData.setRawDefaultValue(outdoorPalette);
return true;
//-- Auto Save Telemetry Logs
} else if (metaData.name() == AppSettings::telemetrySaveName) {
metaData.setRawDefaultValue(outdoorPalette);
return true;
}
#if defined (__mobile__)
metaData.setRawDefaultValue(false);
return true;
#else
metaData.setRawDefaultValue(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;
if (metaData.name() == AppSettings::telemetrySaveName) {
// Mobile devices have limited storage so don't turn on telemtry saving by default
metaData.setRawDefaultValue(false);
return true;
}
#endif
}
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