SHA256
CORE/CONTENT test5593 и адаптация UI
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { t } from '../i18n/index.js';
|
||||
import { openChannelAttachmentManager } from './channel-attachment-manager.js';
|
||||
import { saveProfileAvatar } from '../services/user-profile-params.js';
|
||||
|
||||
export async function openAvatarWizard({
|
||||
login,
|
||||
storagePwd,
|
||||
gateway,
|
||||
navigate,
|
||||
onAvatarSaved,
|
||||
onStatus,
|
||||
} = {}) {
|
||||
const cleanLogin = String(login || '').trim();
|
||||
const cleanStoragePwd = String(storagePwd || '').trim();
|
||||
const cleanGateway = String(gateway || '').trim();
|
||||
if (!cleanLogin || !cleanStoragePwd) {
|
||||
throw new Error(t('screens.avatar_wizard.text_001'));
|
||||
}
|
||||
|
||||
const item = await openChannelAttachmentManager({
|
||||
login: cleanLogin,
|
||||
storagePwd: cleanStoragePwd,
|
||||
gateway: cleanGateway,
|
||||
mode: 'avatar',
|
||||
});
|
||||
|
||||
if (!item?.pr || !item?.size) return false;
|
||||
|
||||
if (typeof onStatus === 'function') {
|
||||
onStatus(t('screens.avatar_wizard.text_002'));
|
||||
}
|
||||
|
||||
await saveProfileAvatar(cleanLogin, item);
|
||||
|
||||
if (typeof onAvatarSaved === 'function') {
|
||||
await onAvatarSaved(item);
|
||||
}
|
||||
|
||||
if (typeof onStatus === 'function') {
|
||||
onStatus('');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user