Skip to content

Commit ad33020

Browse files
committed
feat(neon_framework): Enable viewing and editing profile properties
Signed-off-by: provokateurin <[email protected]>
1 parent 3228df6 commit ad33020

10 files changed

+1027
-60
lines changed

packages/neon_framework/lib/l10n/en.arb

+27
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,33 @@
201201
}
202202
}
203203
},
204+
"accountOptionsCategoryProfile": "Profile",
205+
"accountOptionsProfileDisplayNameLabel": "Full name",
206+
"accountOptionsProfileDisplayNameHint": "Your full name",
207+
"accountOptionsProfileEmailLabel": "Email",
208+
"accountOptionsProfileEmailHint": "Primary email for password reset and notifications",
209+
"accountOptionsProfilePhoneLabel": "Phone number",
210+
"accountOptionsProfilePhoneHint": "Your phone number",
211+
"accountOptionsProfileAddressLabel": "Location",
212+
"accountOptionsProfileAddressHint": "Your city",
213+
"accountOptionsProfileWebsiteLabel": "Website",
214+
"accountOptionsProfileWebsiteHint": "Your website",
215+
"accountOptionsProfileTwitterLabel": "X (formerly Twitter)",
216+
"accountOptionsProfileTwitterHint": "Your X (formerly Twitter) handle",
217+
"accountOptionsProfileFediverseLabel": "Fediverse (e.g. Mastodon)",
218+
"accountOptionsProfileFediverseHint": "Your handle",
219+
"accountOptionsProfileOrganisationLabel": "Organisation",
220+
"accountOptionsProfileOrganisationHint": "Your organisation",
221+
"accountOptionsProfileRoleLabel": "Role",
222+
"accountOptionsProfileRoleHint": "Your role",
223+
"accountOptionsProfileHeadlineLabel": "Headline",
224+
"accountOptionsProfileHeadlineHint": "Your headline",
225+
"accountOptionsProfileBiographyLabel": "About",
226+
"accountOptionsProfileBiographyHint": "Your biography",
227+
"accountOptionsProfileScopePrivate": "Only visible to people matched via phone number integration through Talk on mobile",
228+
"accountOptionsProfileScopeLocal": "Only visible to people on this instance and guests",
229+
"accountOptionsProfileScopeFederated": "Only synchronize to trusted servers",
230+
"accountOptionsProfileScopePublished": "Synchronize to trusted servers and the global and public address book",
204231
"accountOptionsInitialApp": "App to show initially",
205232
"accountOptionsAutomatic": "Automatic",
206233
"licenses": "Licenses",

packages/neon_framework/lib/l10n/localizations.dart

+162
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,168 @@ abstract class NeonLocalizations {
725725
/// **'{used} used of {total} ({relative}%)'**
726726
String accountOptionsQuotaUsedOf(String used, String total, String relative);
727727

728+
/// No description provided for @accountOptionsCategoryProfile.
729+
///
730+
/// In en, this message translates to:
731+
/// **'Profile'**
732+
String get accountOptionsCategoryProfile;
733+
734+
/// No description provided for @accountOptionsProfileDisplayNameLabel.
735+
///
736+
/// In en, this message translates to:
737+
/// **'Full name'**
738+
String get accountOptionsProfileDisplayNameLabel;
739+
740+
/// No description provided for @accountOptionsProfileDisplayNameHint.
741+
///
742+
/// In en, this message translates to:
743+
/// **'Your full name'**
744+
String get accountOptionsProfileDisplayNameHint;
745+
746+
/// No description provided for @accountOptionsProfileEmailLabel.
747+
///
748+
/// In en, this message translates to:
749+
/// **'Email'**
750+
String get accountOptionsProfileEmailLabel;
751+
752+
/// No description provided for @accountOptionsProfileEmailHint.
753+
///
754+
/// In en, this message translates to:
755+
/// **'Primary email for password reset and notifications'**
756+
String get accountOptionsProfileEmailHint;
757+
758+
/// No description provided for @accountOptionsProfilePhoneLabel.
759+
///
760+
/// In en, this message translates to:
761+
/// **'Phone number'**
762+
String get accountOptionsProfilePhoneLabel;
763+
764+
/// No description provided for @accountOptionsProfilePhoneHint.
765+
///
766+
/// In en, this message translates to:
767+
/// **'Your phone number'**
768+
String get accountOptionsProfilePhoneHint;
769+
770+
/// No description provided for @accountOptionsProfileAddressLabel.
771+
///
772+
/// In en, this message translates to:
773+
/// **'Location'**
774+
String get accountOptionsProfileAddressLabel;
775+
776+
/// No description provided for @accountOptionsProfileAddressHint.
777+
///
778+
/// In en, this message translates to:
779+
/// **'Your city'**
780+
String get accountOptionsProfileAddressHint;
781+
782+
/// No description provided for @accountOptionsProfileWebsiteLabel.
783+
///
784+
/// In en, this message translates to:
785+
/// **'Website'**
786+
String get accountOptionsProfileWebsiteLabel;
787+
788+
/// No description provided for @accountOptionsProfileWebsiteHint.
789+
///
790+
/// In en, this message translates to:
791+
/// **'Your website'**
792+
String get accountOptionsProfileWebsiteHint;
793+
794+
/// No description provided for @accountOptionsProfileTwitterLabel.
795+
///
796+
/// In en, this message translates to:
797+
/// **'X (formerly Twitter)'**
798+
String get accountOptionsProfileTwitterLabel;
799+
800+
/// No description provided for @accountOptionsProfileTwitterHint.
801+
///
802+
/// In en, this message translates to:
803+
/// **'Your X (formerly Twitter) handle'**
804+
String get accountOptionsProfileTwitterHint;
805+
806+
/// No description provided for @accountOptionsProfileFediverseLabel.
807+
///
808+
/// In en, this message translates to:
809+
/// **'Fediverse (e.g. Mastodon)'**
810+
String get accountOptionsProfileFediverseLabel;
811+
812+
/// No description provided for @accountOptionsProfileFediverseHint.
813+
///
814+
/// In en, this message translates to:
815+
/// **'Your handle'**
816+
String get accountOptionsProfileFediverseHint;
817+
818+
/// No description provided for @accountOptionsProfileOrganisationLabel.
819+
///
820+
/// In en, this message translates to:
821+
/// **'Organisation'**
822+
String get accountOptionsProfileOrganisationLabel;
823+
824+
/// No description provided for @accountOptionsProfileOrganisationHint.
825+
///
826+
/// In en, this message translates to:
827+
/// **'Your organisation'**
828+
String get accountOptionsProfileOrganisationHint;
829+
830+
/// No description provided for @accountOptionsProfileRoleLabel.
831+
///
832+
/// In en, this message translates to:
833+
/// **'Role'**
834+
String get accountOptionsProfileRoleLabel;
835+
836+
/// No description provided for @accountOptionsProfileRoleHint.
837+
///
838+
/// In en, this message translates to:
839+
/// **'Your role'**
840+
String get accountOptionsProfileRoleHint;
841+
842+
/// No description provided for @accountOptionsProfileHeadlineLabel.
843+
///
844+
/// In en, this message translates to:
845+
/// **'Headline'**
846+
String get accountOptionsProfileHeadlineLabel;
847+
848+
/// No description provided for @accountOptionsProfileHeadlineHint.
849+
///
850+
/// In en, this message translates to:
851+
/// **'Your headline'**
852+
String get accountOptionsProfileHeadlineHint;
853+
854+
/// No description provided for @accountOptionsProfileBiographyLabel.
855+
///
856+
/// In en, this message translates to:
857+
/// **'About'**
858+
String get accountOptionsProfileBiographyLabel;
859+
860+
/// No description provided for @accountOptionsProfileBiographyHint.
861+
///
862+
/// In en, this message translates to:
863+
/// **'Your biography'**
864+
String get accountOptionsProfileBiographyHint;
865+
866+
/// No description provided for @accountOptionsProfileScopePrivate.
867+
///
868+
/// In en, this message translates to:
869+
/// **'Only visible to people matched via phone number integration through Talk on mobile'**
870+
String get accountOptionsProfileScopePrivate;
871+
872+
/// No description provided for @accountOptionsProfileScopeLocal.
873+
///
874+
/// In en, this message translates to:
875+
/// **'Only visible to people on this instance and guests'**
876+
String get accountOptionsProfileScopeLocal;
877+
878+
/// No description provided for @accountOptionsProfileScopeFederated.
879+
///
880+
/// In en, this message translates to:
881+
/// **'Only synchronize to trusted servers'**
882+
String get accountOptionsProfileScopeFederated;
883+
884+
/// No description provided for @accountOptionsProfileScopePublished.
885+
///
886+
/// In en, this message translates to:
887+
/// **'Synchronize to trusted servers and the global and public address book'**
888+
String get accountOptionsProfileScopePublished;
889+
728890
/// No description provided for @accountOptionsInitialApp.
729891
///
730892
/// In en, this message translates to:

packages/neon_framework/lib/l10n/localizations_en.dart

+83
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,89 @@ class NeonLocalizationsEn extends NeonLocalizations {
370370
return '$used used of $total ($relative%)';
371371
}
372372

373+
@override
374+
String get accountOptionsCategoryProfile => 'Profile';
375+
376+
@override
377+
String get accountOptionsProfileDisplayNameLabel => 'Full name';
378+
379+
@override
380+
String get accountOptionsProfileDisplayNameHint => 'Your full name';
381+
382+
@override
383+
String get accountOptionsProfileEmailLabel => 'Email';
384+
385+
@override
386+
String get accountOptionsProfileEmailHint => 'Primary email for password reset and notifications';
387+
388+
@override
389+
String get accountOptionsProfilePhoneLabel => 'Phone number';
390+
391+
@override
392+
String get accountOptionsProfilePhoneHint => 'Your phone number';
393+
394+
@override
395+
String get accountOptionsProfileAddressLabel => 'Location';
396+
397+
@override
398+
String get accountOptionsProfileAddressHint => 'Your city';
399+
400+
@override
401+
String get accountOptionsProfileWebsiteLabel => 'Website';
402+
403+
@override
404+
String get accountOptionsProfileWebsiteHint => 'Your website';
405+
406+
@override
407+
String get accountOptionsProfileTwitterLabel => 'X (formerly Twitter)';
408+
409+
@override
410+
String get accountOptionsProfileTwitterHint => 'Your X (formerly Twitter) handle';
411+
412+
@override
413+
String get accountOptionsProfileFediverseLabel => 'Fediverse (e.g. Mastodon)';
414+
415+
@override
416+
String get accountOptionsProfileFediverseHint => 'Your handle';
417+
418+
@override
419+
String get accountOptionsProfileOrganisationLabel => 'Organisation';
420+
421+
@override
422+
String get accountOptionsProfileOrganisationHint => 'Your organisation';
423+
424+
@override
425+
String get accountOptionsProfileRoleLabel => 'Role';
426+
427+
@override
428+
String get accountOptionsProfileRoleHint => 'Your role';
429+
430+
@override
431+
String get accountOptionsProfileHeadlineLabel => 'Headline';
432+
433+
@override
434+
String get accountOptionsProfileHeadlineHint => 'Your headline';
435+
436+
@override
437+
String get accountOptionsProfileBiographyLabel => 'About';
438+
439+
@override
440+
String get accountOptionsProfileBiographyHint => 'Your biography';
441+
442+
@override
443+
String get accountOptionsProfileScopePrivate =>
444+
'Only visible to people matched via phone number integration through Talk on mobile';
445+
446+
@override
447+
String get accountOptionsProfileScopeLocal => 'Only visible to people on this instance and guests';
448+
449+
@override
450+
String get accountOptionsProfileScopeFederated => 'Only synchronize to trusted servers';
451+
452+
@override
453+
String get accountOptionsProfileScopePublished =>
454+
'Synchronize to trusted servers and the global and public address book';
455+
373456
@override
374457
String get accountOptionsInitialApp => 'App to show initially';
375458

packages/neon_framework/lib/src/blocs/user_details.dart

+33
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ abstract class UserDetailsBloc implements InteractiveBloc {
2121

2222
/// Contains the user details.
2323
BehaviorSubject<Result<provisioning_api.UserDetails>> get userDetails;
24+
25+
/// Updates a property of the [userDetails].
26+
void updateProperty(String key, String value);
2427
}
2528

2629
class _UserDetailsBloc extends InteractiveBloc implements UserDetailsBloc {
@@ -54,4 +57,34 @@ class _UserDetailsBloc extends InteractiveBloc implements UserDetailsBloc {
5457
unwrap: (response) => response.body.ocs.data,
5558
);
5659
}
60+
61+
@override
62+
Future<void> updateProperty(String key, String value) async {
63+
await wrapAction(
64+
() async {
65+
userDetails.add(userDetails.valueOrNull?.asLoading() ?? Result.loading());
66+
67+
await account.client.provisioningApi.users.editUser(
68+
userId: account.username,
69+
$body: provisioning_api.UsersEditUserRequestApplicationJson(
70+
(b) => b
71+
..key = key
72+
..value = value,
73+
),
74+
);
75+
76+
var data = userDetails.valueOrNull?.data;
77+
if (data == null) {
78+
return;
79+
}
80+
81+
final raw = data.toJson();
82+
raw[key] = value;
83+
data = provisioning_api.UserDetails.fromJson(raw);
84+
85+
userDetails.add(Result.success(data));
86+
},
87+
refresh: () async {},
88+
);
89+
}
5790
}

0 commit comments

Comments
 (0)