1
0
forked from baron/baron-sso

dev 반영 code-check 오류 수정

This commit is contained in:
2026-03-31 13:03:16 +09:00
parent 98bb6be549
commit e927fa8ea0
8 changed files with 304 additions and 110 deletions

View File

@@ -8,11 +8,7 @@ class AuthTokenStoreBackend {
AuthTokenStoreBackend({
required AuthTokenStorageTarget localTarget,
required AuthTokenStorageTarget sessionTarget,
}) : _targets = [
localTarget,
sessionTarget,
_MemoryStorageTarget(),
];
}) : _targets = [localTarget, sessionTarget, _MemoryStorageTarget()];
static const _tokenKey = 'baron_auth_token';
static const _providerKey = 'baron_auth_provider';

View File

@@ -91,7 +91,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
@override
void initState() {
super.initState();
_tabController = TabController(length: 3, vsync: this, initialIndex: 1);
_tabController = TabController(length: 3, vsync: this, initialIndex: 0);
_tabController.addListener(_handleTabSelection);
_drySendEnabled =
_parseBoolParam(Uri.base.queryParameters['drySend']) &&

View File

@@ -768,6 +768,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
}) {
final isEditing = _editingField == field;
final displayValue = value.isEmpty ? '-' : value;
final isCompact = MediaQuery.of(context).size.width < 640;
if (!isEditing) {
return ListTile(
@@ -784,57 +785,64 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
final hasChanged = _hasFieldChanged(profile, field);
final inputField = TextField(
key: Key('profile-$field-input'),
controller: controller,
focusNode: field == 'name' ? _nameFocus : _departmentFocus,
textInputAction: TextInputAction.done,
onSubmitted: (_) => _saveField(profile),
onChanged: (_) {
setState(() {
_fieldSaveError = null;
});
},
decoration: InputDecoration(
border: const OutlineInputBorder(),
hintText: label,
errorText: _fieldSaveError,
),
);
final saveButton = ElevatedButton(
key: Key('profile-$field-save-button'),
onPressed: isUpdating || !hasChanged || _isSavingField
? null
: () => _saveField(profile),
child: _isSavingField
? const SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(strokeWidth: 2),
)
: Text(tr('ui.common.save')),
);
final cancelButton = OutlinedButton(
key: Key('profile-$field-cancel-button'),
onPressed: isUpdating || _isSavingField
? null
: () => _cancelEditing(profile),
child: Text(tr('ui.common.cancel')),
);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label, style: const TextStyle(fontWeight: FontWeight.w600)),
const SizedBox(height: 8),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: TextField(
key: Key('profile-$field-input'),
controller: controller,
focusNode: field == 'name' ? _nameFocus : _departmentFocus,
textInputAction: TextInputAction.done,
onSubmitted: (_) => _saveField(profile),
onChanged: (_) {
setState(() {
_fieldSaveError = null;
});
},
decoration: InputDecoration(
border: const OutlineInputBorder(),
hintText: label,
errorText: _fieldSaveError,
),
),
),
const SizedBox(width: 12),
ElevatedButton(
key: Key('profile-$field-save-button'),
onPressed: isUpdating || !hasChanged || _isSavingField
? null
: () => _saveField(profile),
child: _isSavingField
? const SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(strokeWidth: 2),
)
: Text(tr('ui.common.save')),
),
const SizedBox(width: 8),
OutlinedButton(
key: Key('profile-$field-cancel-button'),
onPressed: isUpdating || _isSavingField
? null
: () => _cancelEditing(profile),
child: Text(tr('ui.common.cancel')),
),
],
),
if (isCompact) ...[
inputField,
const SizedBox(height: 12),
Wrap(spacing: 8, runSpacing: 8, children: [saveButton, cancelButton]),
] else
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: inputField),
const SizedBox(width: 12),
saveButton,
const SizedBox(width: 8),
cancelButton,
],
),
],
);
}

View File

@@ -5,7 +5,9 @@ void main() {
group('AuthTokenStoreBackend', () {
test('local 저장소가 실패하면 session 저장소에서 토큰을 읽는다', () {
final local = _FakeTarget(throwsOnRead: true);
final session = _FakeTarget(readSeed: {'baron_auth_token': 'session-jwt'});
final session = _FakeTarget(
readSeed: {'baron_auth_token': 'session-jwt'},
);
final store = AuthTokenStoreBackend(
localTarget: local,
sessionTarget: session,