Resolve #299 due to changes of #287

This commit is contained in:
the-djmaze 2022-03-22 15:36:10 +01:00
parent 13f270f426
commit 1833388ea4
3 changed files with 25 additions and 22 deletions

View file

@ -225,10 +225,12 @@ class Actions
APP_PRIVATE_DATA . 'storage', 'storage-local' === $sName); APP_PRIVATE_DATA . 'storage', 'storage-local' === $sName);
break; break;
case 'settings': case 'settings':
// RainLoop\Providers\Settings\ISettings
$mResult = new Providers\Settings\DefaultSettings($this->StorageProvider());
break;
case 'settings-local': case 'settings-local':
// RainLoop\Providers\Settings\ISettings // RainLoop\Providers\Settings\ISettings
$mResult = new Providers\Settings\DefaultSettings( $mResult = new Providers\Settings\DefaultSettings($this->LocalStorageProvider());
$this->StorageProvider('settings-local' === $sName));
break; break;
case 'login': case 'login':
// Providers\Login\LoginInterface // Providers\Login\LoginInterface
@ -267,7 +269,7 @@ class Actions
// Always give the file provider as last for identities, it is the override // Always give the file provider as last for identities, it is the override
if ('identities' === $sName) { if ('identities' === $sName) {
$mResult[] = new Providers\Identities\FileIdentities($this->StorageProvider(true)); $mResult[] = new Providers\Identities\FileIdentities($this->LocalStorageProvider());
} }
foreach (\is_array($mResult) ? $mResult : array($mResult) as $oItem) { foreach (\is_array($mResult) ? $mResult : array($mResult) as $oItem) {
@ -444,23 +446,22 @@ class Actions
return $this->oMailClient; return $this->oMailClient;
} }
public function StorageProvider(bool $bLocal = false): Providers\Storage // Stores data in AdditionalAccount else MainAccount
public function LocalStorageProvider(): Providers\Storage
{ {
if ($bLocal) {
if (!$this->oLocalStorageProvider) { if (!$this->oLocalStorageProvider) {
$this->oLocalStorageProvider = new Providers\Storage( $this->oLocalStorageProvider = new Providers\Storage($this->fabrica('storage-local'));
$this->fabrica('storage-local'));
} }
return $this->oLocalStorageProvider; return $this->oLocalStorageProvider;
} else {
if (!$this->oStorageProvider) {
$this->oStorageProvider = new Providers\Storage(
$this->fabrica('storage'));
} }
return $this->oStorageProvider; // Stores data in MainAccount
public function StorageProvider(): Providers\Storage
{
if (!$this->oStorageProvider) {
$this->oStorageProvider = new Providers\Storage($this->fabrica('storage'));
} }
return $this->oStorageProvider;
} }
public function SettingsProvider(bool $bLocal = false): Providers\Settings public function SettingsProvider(bool $bLocal = false): Providers\Settings

View file

@ -224,7 +224,7 @@ trait Accounts
$this->SetAccounts($oAccount, $aAccounts); $this->SetAccounts($oAccount, $aAccounts);
} }
return $this->DefaultResponse(__FUNCTION__, $this->StorageProvider()->Put( return $this->DefaultResponse(__FUNCTION__, $this->LocalStorageProvider()->Put(
$this->getAccountFromToken(), $this->getAccountFromToken(),
StorageType::CONFIG, StorageType::CONFIG,
'identities_order', 'identities_order',
@ -260,7 +260,7 @@ trait Accounts
$identities = $this->IdentitiesProvider()->GetIdentities($oAccount, $allowMultipleIdentities); $identities = $this->IdentitiesProvider()->GetIdentities($oAccount, $allowMultipleIdentities);
// Sort identities // Sort identities
$orderString = $this->StorageProvider()->Get($oAccount, StorageType::CONFIG, 'identities_order'); $orderString = $this->LocalStorageProvider()->Get($oAccount, StorageType::CONFIG, 'identities_order');
$old = false; $old = false;
if (!$orderString) { if (!$orderString) {
$orderString = $this->StorageProvider()->Get($oAccount, StorageType::CONFIG, 'accounts_identities_order'); $orderString = $this->StorageProvider()->Get($oAccount, StorageType::CONFIG, 'accounts_identities_order');
@ -279,7 +279,7 @@ trait Accounts
} }
if ($old) { if ($old) {
$this->StorageProvider()->Put( $this->LocalStorageProvider()->Put(
$oAccount, $oAccount,
StorageType::CONFIG, StorageType::CONFIG,
'identities_order', 'identities_order',

View file

@ -98,7 +98,9 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
$sEmail = $mAccount->Email(); $sEmail = $mAccount->Email();
} else if ($mAccount instanceof \RainLoop\Model\AdditionalAccount) { } else if ($mAccount instanceof \RainLoop\Model\AdditionalAccount) {
$sEmail = $mAccount->ParentEmail(); $sEmail = $mAccount->ParentEmail();
if ($this->bLocal) {
$sSubFolder = $mAccount->Email(); $sSubFolder = $mAccount->Email();
}
} else if (\is_string($mAccount)) { } else if (\is_string($mAccount)) {
$sEmail = $mAccount; $sEmail = $mAccount;
} }