Run initial check on creation of FileProviderSettingsController

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-09-06 14:20:29 +08:00
parent 5f059a23ce
commit f5b80e9ec1
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -50,6 +50,8 @@ public:
{
q = parent;
_userDefaults = NSUserDefaults.standardUserDefaults;
initialCheck();
};
~MacImplementation() = default;
@ -129,6 +131,18 @@ private:
return (NSArray<NSString *> *)[_userDefaults objectForKey:accsKey];
}
void initialCheck()
{
NSArray<NSString *> *const vfsEnabledAccounts = nsEnabledAccounts();
if (vfsEnabledAccounts != nil) {
return;
}
qCDebug(lcFileProviderSettingsController) << "Initial check for file provider settings found nil enabled vfs accounts array."
<< "Enabling all accounts on initial setup.";
[[maybe_unused]] const auto result = enableVfsForAllAccounts();
}
FileProviderSettingsController *q = nullptr;
NSUserDefaults *_userDefaults = nil;
};