1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

iOS: Fixes #2301: Removed filesystem sync option, which was not supported

This commit is contained in:
Laurent Cozic 2020-02-08 11:59:19 +00:00
parent 1606076b4e
commit 0229686203
9 changed files with 38 additions and 22 deletions

View File

@ -0,0 +1,11 @@
// Flags are parsed properly in BaseApplication, however it's better to have
// the env as early as possible to enable debugging capabilities.
function envFromArgs(args) {
if (!args) return 'prod';
const envIndex = args.indexOf('--env');
const devIndex = args.indexOf('dev');
if (envIndex === devIndex - 1) return 'dev';
return 'prod';
}
module.exports = envFromArgs;

View File

@ -8,22 +8,13 @@ const { ElectronAppWrapper } = require('./ElectronAppWrapper');
const { initBridge } = require('./bridge');
const { Logger } = require('lib/logger.js');
const { FsDriverNode } = require('lib/fs-driver-node.js');
const envFromArgs = require('./envFromArgs');
process.on('unhandledRejection', (reason, p) => {
console.error('Unhandled promise rejection', p, 'reason:', reason);
process.exit(1);
});
// Flags are parsed properly in BaseApplication, however it's better to have
// the env as early as possible to enable debugging capabilities.
function envFromArgs(args) {
if (!args) return 'prod';
const envIndex = args.indexOf('--env');
const devIndex = args.indexOf('dev');
if (envIndex === devIndex - 1) return 'dev';
return 'prod';
}
// Likewise, we want to know if a profile is specified early, in particular
// to save the window state data.
function profileFromArgs(args) {

View File

@ -40,13 +40,6 @@ const SearchEngine = require('lib/services/SearchEngine');
const KvStore = require('lib/services/KvStore');
const MigrationService = require('lib/services/MigrationService');
SyncTargetRegistry.addClass(SyncTargetFilesystem);
SyncTargetRegistry.addClass(SyncTargetOneDrive);
SyncTargetRegistry.addClass(SyncTargetOneDriveDev);
SyncTargetRegistry.addClass(SyncTargetNextcloud);
SyncTargetRegistry.addClass(SyncTargetWebDAV);
SyncTargetRegistry.addClass(SyncTargetDropbox);
class BaseApplication {
constructor() {
this.logger_ = new Logger();
@ -580,6 +573,13 @@ class BaseApplication {
Setting.setConstant('resourceDir', resourceDir);
Setting.setConstant('tempDir', tempDir);
SyncTargetRegistry.addClass(SyncTargetFilesystem);
SyncTargetRegistry.addClass(SyncTargetOneDrive);
if (Setting.value('env') === 'dev') SyncTargetRegistry.addClass(SyncTargetOneDriveDev);
SyncTargetRegistry.addClass(SyncTargetNextcloud);
SyncTargetRegistry.addClass(SyncTargetWebDAV);
SyncTargetRegistry.addClass(SyncTargetDropbox);
await shim.fsDriver().remove(tempDir);
await fs.mkdirp(profileDir, 0o755);

View File

@ -33,6 +33,11 @@ class BaseSyncTarget {
return this.db_;
}
// If [] is returned it means all platforms are supported
static unsupportedPlatforms() {
return [];
}
async isAuthenticated() {
return false;
}

View File

@ -18,6 +18,10 @@ class SyncTargetFilesystem extends BaseSyncTarget {
return _('File system');
}
static unsupportedPlatforms() {
return ['ios'];
}
async isAuthenticated() {
return true;
}

View File

@ -35,11 +35,15 @@ class SyncTargetRegistry {
return this.idToMetadata(id).name;
}
static idAndLabelPlainObject() {
static idAndLabelPlainObject(os) {
let output = {};
for (let n in this.reg_) {
if (!this.reg_.hasOwnProperty(n)) continue;
output[n] = this.reg_[n].label;
const info = this.reg_[n];
if (info.classRef.unsupportedPlatforms().indexOf(os) >= 0) {
continue;
}
output[n] = info.label;
}
return output;
}

View File

@ -62,7 +62,7 @@ class Setting extends BaseModel {
return appType !== 'cli' ? null : _('The target to synchonise to. Each sync target may have additional parameters which are named as `sync.NUM.NAME` (all documented below).');
},
options: () => {
return SyncTargetRegistry.idAndLabelPlainObject();
return SyncTargetRegistry.idAndLabelPlainObject(platform);
},
},

View File

@ -33,7 +33,7 @@ shim.isMac = () => {
};
shim.platformName = function() {
if (shim.isReactNative()) return 'mobile';
if (shim.isReactNative()) return shim.mobilePlatform();
if (shim.isMac()) return 'darwin';
if (shim.isWindows()) return 'win32';
if (shim.isLinux()) return 'linux';

View File

@ -70,8 +70,9 @@ const SyncTargetOneDriveDev = require('lib/SyncTargetOneDriveDev.js');
const SyncTargetNextcloud = require('lib/SyncTargetNextcloud.js');
const SyncTargetWebDAV = require('lib/SyncTargetWebDAV.js');
const SyncTargetDropbox = require('lib/SyncTargetDropbox.js');
SyncTargetRegistry.addClass(SyncTargetOneDrive);
SyncTargetRegistry.addClass(SyncTargetOneDriveDev);
if (__DEV__) SyncTargetRegistry.addClass(SyncTargetOneDriveDev);
SyncTargetRegistry.addClass(SyncTargetNextcloud);
SyncTargetRegistry.addClass(SyncTargetWebDAV);
SyncTargetRegistry.addClass(SyncTargetDropbox);