diff --git a/.changes/2355-permissions.md b/.changes/2355-permissions.md new file mode 100644 index 000000000000..ac83031cd27f --- /dev/null +++ b/.changes/2355-permissions.md @@ -0,0 +1 @@ +- Access all the permissions of the space in the settings, including ban, invite, kick, redact, for comments, attachments and rsvps \ No newline at end of file diff --git a/app/lib/features/space/actions/update_feature_power_level.dart b/app/lib/features/space/actions/update_feature_power_level.dart index be6b29a303a2..e1309c5b038b 100644 --- a/app/lib/features/space/actions/update_feature_power_level.dart +++ b/app/lib/features/space/actions/update_feature_power_level.dart @@ -16,13 +16,15 @@ Future updateFeatureLevelChangeDialog( Space space, RoomPowerLevels powerLevels, String levelKey, - String featureName, -) async { + String featureName, { + bool isGlobal = false, +}) async { final lang = L10n.of(context); final newPowerLevel = await showDialog( context: context, builder: (BuildContext context) => _ChangePowerLevelDialog( featureName: featureName, + isGlobal: isGlobal, currentPowerLevelName: maxPowerLevel == 100 ? powerLevelName(currentPw) : 'Custom', currentPowerLevel: currentPw, @@ -40,6 +42,7 @@ Future updateFeatureLevelChangeDialog( levelKey, featureName, newPowerLevel, + isGlobal: isGlobal, ); } @@ -48,14 +51,30 @@ Future updateFeatureLevel( Space space, String levelKey, String featureName, - int? newPowerLevel, -) async { + int? newPowerLevel, { + bool isGlobal = false, +}) async { EasyLoading.show(status: lang.changingSettingOf(featureName)); try { - final res = await space.updateFeaturePowerLevels( - levelKey, - newPowerLevel, - ); + bool res; + if (isGlobal) { + if (newPowerLevel == null) { + EasyLoading.showError( + 'You must provide a powerlevel', + duration: const Duration(seconds: 3), + ); + return false; + } + res = await space.updateRegularPowerLevels( + levelKey, + newPowerLevel, + ); + } else { + res = await space.updateFeaturePowerLevels( + levelKey, + newPowerLevel, + ); + } EasyLoading.showToast(lang.powerLevelSubmitted(featureName)); return res; } catch (e, s) { @@ -72,11 +91,13 @@ class _ChangePowerLevelDialog extends StatefulWidget { final String featureName; final int? currentPowerLevel; final String currentPowerLevelName; + final bool isGlobal; const _ChangePowerLevelDialog({ required this.featureName, required this.currentPowerLevelName, this.currentPowerLevel, + this.isGlobal = false, }); @override @@ -128,7 +149,9 @@ class __ChangePowerLevelDialogState extends State<_ChangePowerLevelDialog> { ) : lang.updateFeaturePowerLevelDialogFromDefaultTo; return AlertDialog( - title: Text(lang.updateFeaturePowerLevelDialogTitle(widget.featureName)), + title: widget.isGlobal + ? Text('Update of ${widget.featureName}') + : Text(lang.updateFeaturePowerLevelDialogTitle(widget.featureName)), content: Form( key: _formKey, child: Column( diff --git a/app/lib/features/space/settings/pages/apps_settings_page.dart b/app/lib/features/space/settings/pages/apps_settings_page.dart index 1946f757bba8..f5ebc5ae113e 100644 --- a/app/lib/features/space/settings/pages/apps_settings_page.dart +++ b/app/lib/features/space/settings/pages/apps_settings_page.dart @@ -89,183 +89,6 @@ class SpaceAppsSettingsPage extends ConsumerWidget { final pins = appSettings.pins(); final tasks = appSettings.tasks(); - final moreSections = []; - final labActions = []; - if (news.active()) { - final currentPw = powerLevels.news(); - final pwText = maxPowerLevel == 100 - ? powerLevelName(currentPw) - : 'Custom ($currentPw)'; - moreSections.add( - SettingsSection( - title: Text(lang.boosts), - tiles: [ - SettingsTile( - enabled: canEdit, - title: Text(lang.requiredPowerLevel), - description: Text(lang.minPowerLevelError(lang.boost)), - trailing: Text(currentPw != null ? pwText : defaultDesc), - onPressed: (context) => updateFeatureLevelChangeDialog( - context, - maxPowerLevel, - currentPw, - space, - powerLevels, - powerLevels.newsKey(), - lang.boosts, - ), - ), - SettingsTile.switchTile( - title: Text(lang.commentsOnBoost), - description: Text(lang.notYetSupported), - enabled: false, - initialValue: false, - onToggle: (newVal) {}, - ), - ], - ), - ); - } - if (pins.active()) { - final currentPw = powerLevels.pins(); - final pwText = maxPowerLevel == 100 - ? powerLevelName(currentPw) - : 'Custom ($currentPw)'; - moreSections.add( - SettingsSection( - title: Text(lang.pin), - tiles: [ - SettingsTile( - enabled: canEdit, - title: Text(lang.requiredPowerLevel), - description: Text( - lang.minPowerLevelError(lang.pin), - ), - trailing: Text(currentPw != null ? pwText : defaultDesc), - onPressed: (context) => updateFeatureLevelChangeDialog( - context, - maxPowerLevel, - currentPw, - space, - powerLevels, - powerLevels.pinsKey(), - lang.pins, - ), - ), - SettingsTile.switchTile( - title: Text(lang.commentsOnPin), - description: Text(lang.notYetSupported), - enabled: false, - initialValue: false, - onToggle: (newVal) {}, - ), - ], - ), - ); - } - if (events.active()) { - final currentPw = powerLevels.events(); - final pwText = maxPowerLevel == 100 - ? powerLevelName(currentPw) - : 'Custom ($currentPw)'; - moreSections.add( - SettingsSection( - title: Text(lang.events), - tiles: [ - SettingsTile( - enabled: canEdit, - title: Text(lang.adminPowerLevel), - description: Text( - lang.minPowerLevelError(lang.event), - ), - trailing: Text(currentPw != null ? pwText : defaultDesc), - onPressed: (context) => updateFeatureLevelChangeDialog( - context, - maxPowerLevel, - currentPw, - space, - powerLevels, - powerLevels.eventsKey(), - lang.events, - ), - ), - SettingsTile( - enabled: false, - title: Text(lang.rsvpPowerLevel), - description: Text(lang.minPowerLevelRsvp), - trailing: Text(lang.notYetSupported), - ), - SettingsTile.switchTile( - title: Text(lang.comments), - description: Text(lang.notYetSupported), - enabled: false, - initialValue: false, - onToggle: (newVal) {}, - ), - ], - ), - ); - } - - if (tasks.active()) { - final taskListCurrentPw = powerLevels.taskLists(); - final tasksCurrentPw = powerLevels.tasks(); - final pwTextTL = maxPowerLevel == 100 - ? powerLevelName(taskListCurrentPw) - : 'Custom ($taskListCurrentPw)'; - final pwTextT = maxPowerLevel == 100 - ? powerLevelName(tasksCurrentPw) - : 'Custom ($tasksCurrentPw)'; - moreSections.add( - SettingsSection( - title: Text(lang.tasks), - tiles: [ - SettingsTile( - enabled: canEdit, - title: Text(lang.taskListPowerLevel), - description: Text(lang.minPowerLevelError(lang.taskList)), - trailing: taskListCurrentPw != null - ? Text(pwTextTL) - : Text(defaultDesc), - onPressed: (context) => updateFeatureLevelChangeDialog( - context, - maxPowerLevel, - taskListCurrentPw, - space, - powerLevels, - powerLevels.taskListsKey(), - lang.taskList, - ), - ), - SettingsTile( - enabled: canEdit, - title: Text(lang.tasksPowerLevel), - description: Text(lang.minPowerLevelError(lang.tasks)), - trailing: tasksCurrentPw != null - ? Text(pwTextT) - : Text(defaultDesc), - onPressed: (context) => updateFeatureLevelChangeDialog( - context, - maxPowerLevel, - tasksCurrentPw, - space, - powerLevels, - powerLevels.tasksKey(), - lang.tasks, - ), - ), - SettingsTile.switchTile( - title: Text(lang.comments), - description: Text(lang.notYetSupported), - enabled: false, - initialValue: false, - onToggle: (newVal) {}, - ), - ], - ), - ); - } - return Scaffold( appBar: AppBar( title: Text(lang.appSettings), @@ -333,10 +156,52 @@ class SpaceAppsSettingsPage extends ConsumerWidget { lang.tasks, ), ), - ...labActions, ], ), - ...moreSections, + buildDefaultSection( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + if (news.active()) + buildNewsSection( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + if (pins.active()) + buildPinsSection( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + if (events.active()) + buildEventsSection( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + if (tasks.active()) + buildTasksSection( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), ], ), ); @@ -350,7 +215,517 @@ class SpaceAppsSettingsPage extends ConsumerWidget { child: Text(lang.loadingFailed(e)), ); }, + skipLoadingOnReload: true, + skipLoadingOnRefresh: true, + ), + ); + } + + SettingsSection buildDefaultSection( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + return SettingsSection( + title: Text(L10n.of(context).powerLevelsTitle), + tiles: [ + buildDefaultEventsTile( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + buildDefaultInviteTile( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + buildDefaultKickTile( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + buildDefaultBanTile( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + buildDefaultRedactTile( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + buildCommentsTile( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + buildAttachmentsTile( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + ], + ); + } + + SettingsTile buildDefaultEventsTile( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + final currentLevel = powerLevels.eventsDefault(); + final pwTextTL = maxPowerLevel == 100 + ? powerLevelName(currentLevel) + : 'Custom ($currentLevel)'; + + return SettingsTile( + enabled: canEdit, + title: Text(lang.powerLevelPostEventsTitle), + description: Text(lang.powerLevelPostEventsDesc), + trailing: Text(pwTextTL), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + currentLevel, + space, + powerLevels, + 'events_default', + lang.powerLevelPostEventsTitle, + isGlobal: true, + ), + ); + } + + SettingsTile buildDefaultKickTile( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + final currentLevel = powerLevels.kick(); + final pwTextTL = maxPowerLevel == 100 + ? powerLevelName(currentLevel) + : 'Custom ($currentLevel)'; + + return SettingsTile( + enabled: canEdit, + title: Text(lang.powerLevelKickTitle), + description: Text(lang.powerLevelKickDesc), + trailing: Text(pwTextTL), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + currentLevel, + space, + powerLevels, + 'kick', + lang.powerLevelKickTitle, + isGlobal: true, + ), + ); + } + + SettingsTile buildDefaultInviteTile( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + final currentLevel = powerLevels.invite(); + final pwTextTL = maxPowerLevel == 100 + ? powerLevelName(currentLevel) + : 'Custom ($currentLevel)'; + + return SettingsTile( + enabled: canEdit, + title: Text(lang.powerLevelInviteTitle), + description: Text(lang.powerLevelInviteDesc), + trailing: Text(pwTextTL), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + currentLevel, + space, + powerLevels, + 'invite', + lang.powerLevelInviteTitle, + isGlobal: true, + ), + ); + } + + SettingsTile buildDefaultRedactTile( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + final currentLevel = powerLevels.redact(); + final pwTextTL = maxPowerLevel == 100 + ? powerLevelName(currentLevel) + : 'Custom ($currentLevel)'; + + return SettingsTile( + enabled: canEdit, + title: Text(lang.powerLevelRedactTitle), + description: Text(lang.powerLevelRedactDesc), + trailing: Text(pwTextTL), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + currentLevel, + space, + powerLevels, + 'redact', + lang.powerLevelRedactTitle, + isGlobal: true, ), ); } + + SettingsTile buildDefaultBanTile( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + final currentLevel = powerLevels.ban(); + final pwTextTL = maxPowerLevel == 100 + ? powerLevelName(currentLevel) + : 'Custom ($currentLevel)'; + + return SettingsTile( + enabled: canEdit, + title: Text(lang.powerLevelBanTitle), + description: Text(lang.powerLevelBanDesc), + trailing: Text(pwTextTL), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + currentLevel, + space, + powerLevels, + 'ban', + lang.powerLevelBanDesc, + isGlobal: true, + ), + ); + } + + SettingsTile buildCommentsTile( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + final powerLevel = powerLevels.comments(); + final pwTextTL = maxPowerLevel == 100 + ? powerLevelName(powerLevel) + : 'Custom ($powerLevel)'; + + return SettingsTile( + enabled: canEdit, + title: Text(lang.comments), + description: Text( + lang.minPowerLevelDesc(lang.comments), + ), + trailing: Text(pwTextTL), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + powerLevel, + space, + powerLevels, + powerLevels.commentsKey(), + lang.minPowerLevelDesc(lang.comments), + isGlobal: false, + ), + ); + } + + SettingsTile buildAttachmentsTile( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + final powerLevel = powerLevels.attachments(); + final pwTextTL = maxPowerLevel == 100 + ? powerLevelName(powerLevel) + : 'Custom ($powerLevel)'; + + return SettingsTile( + enabled: canEdit, + title: Text(lang.attachments), + description: Text( + lang.minPowerLevelDesc(lang.attachments), + ), + trailing: Text(pwTextTL), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + powerLevel, + space, + powerLevels, + powerLevels.attachmentsKey(), + lang.minPowerLevelDesc(lang.attachments), + isGlobal: false, + ), + ); + } + + SettingsTile buildRsvpTile( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + final powerLevel = powerLevels.rsvp(); + final pwTextTL = maxPowerLevel == 100 + ? powerLevelName(powerLevel) + : 'Custom ($powerLevel)'; + + return SettingsTile( + enabled: canEdit, + title: Text(lang.rsvpPowerLevel), + description: Text( + lang.minPowerLevelDesc(lang.rsvp), + ), + trailing: Text(pwTextTL), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + powerLevel, + space, + powerLevels, + powerLevels.rsvpKey(), + lang.minPowerLevelDesc(lang.rsvp), + isGlobal: false, + ), + ); + } + + SettingsSection buildNewsSection( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + + final currentPw = powerLevels.news(); + final pwText = maxPowerLevel == 100 + ? powerLevelName(currentPw) + : 'Custom ($currentPw)'; + return SettingsSection( + title: Text(lang.boosts), + tiles: [ + SettingsTile( + enabled: canEdit, + title: Text(lang.requiredPowerLevel), + description: Text(lang.minPowerLevelDesc(lang.boost)), + trailing: Text(currentPw != null ? pwText : defaultDesc), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + currentPw, + space, + powerLevels, + powerLevels.newsKey(), + lang.boosts, + ), + ), + ], + ); + } + + SettingsSection buildPinsSection( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + + final currentPw = powerLevels.pins(); + final pwText = maxPowerLevel == 100 + ? powerLevelName(currentPw) + : 'Custom ($currentPw)'; + return SettingsSection( + title: Text(lang.pin), + tiles: [ + SettingsTile( + enabled: canEdit, + title: Text(lang.requiredPowerLevel), + description: Text( + lang.minPowerLevelDesc(lang.pin), + ), + trailing: Text(currentPw != null ? pwText : defaultDesc), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + currentPw, + space, + powerLevels, + powerLevels.pinsKey(), + lang.pins, + ), + ), + ], + ); + } + + SettingsSection buildEventsSection( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + final currentPw = powerLevels.events(); + final pwText = maxPowerLevel == 100 + ? powerLevelName(currentPw) + : 'Custom ($currentPw)'; + return SettingsSection( + title: Text(lang.events), + tiles: [ + SettingsTile( + enabled: canEdit, + title: Text(lang.adminPowerLevel), + description: Text( + lang.minPowerLevelDesc(lang.event), + ), + trailing: Text(currentPw != null ? pwText : defaultDesc), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + currentPw, + space, + powerLevels, + powerLevels.eventsKey(), + lang.events, + ), + ), + buildRsvpTile( + context, + powerLevels, + space, + maxPowerLevel, + canEdit, + defaultDesc, + ), + ], + ); + } + + SettingsSection buildTasksSection( + BuildContext context, + RoomPowerLevels powerLevels, + Space space, + int maxPowerLevel, + bool canEdit, + String defaultDesc, + ) { + final lang = L10n.of(context); + + final taskListCurrentPw = powerLevels.taskLists(); + final tasksCurrentPw = powerLevels.tasks(); + final pwTextTL = maxPowerLevel == 100 + ? powerLevelName(taskListCurrentPw) + : 'Custom ($taskListCurrentPw)'; + final pwTextT = maxPowerLevel == 100 + ? powerLevelName(tasksCurrentPw) + : 'Custom ($tasksCurrentPw)'; + return SettingsSection( + title: Text(lang.tasks), + tiles: [ + SettingsTile( + enabled: canEdit, + title: Text(lang.taskListPowerLevel), + description: Text(lang.minPowerLevelDesc(lang.taskList)), + trailing: + taskListCurrentPw != null ? Text(pwTextTL) : Text(defaultDesc), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + taskListCurrentPw, + space, + powerLevels, + powerLevels.taskListsKey(), + lang.taskList, + ), + ), + SettingsTile( + enabled: canEdit, + title: Text(lang.tasksPowerLevel), + description: Text(lang.minPowerLevelDesc(lang.tasks)), + trailing: tasksCurrentPw != null ? Text(pwTextT) : Text(defaultDesc), + onPressed: (context) => updateFeatureLevelChangeDialog( + context, + maxPowerLevel, + tasksCurrentPw, + space, + powerLevels, + powerLevels.tasksKey(), + lang.tasks, + ), + ), + ], + ); + } } diff --git a/app/lib/l10n/app_de.arb b/app/lib/l10n/app_de.arb index 21f5b682beac..daf421e729bc 100644 --- a/app/lib/l10n/app_de.arb +++ b/app/lib/l10n/app_de.arb @@ -2216,8 +2216,8 @@ "@editCategory": {}, "deleteCategory": "Kategorie löschen", "@deleteCategory": {}, - "minPowerLevelError": "Minimales Rechtelevel um {featureName} zu posten", - "@minPowerLevelError": {}, + "minPowerLevelDesc": "Minimales Rechtelevel um {featureName} zu posten", + "@minPowerLevelDesc": {}, "tasksPowerLevel": "Aufgaben Rechtelevel", "@tasksPowerLevel": {}, "boost": "Boost", diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index 675d6de0c781..a844d3657ebd 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -912,6 +912,28 @@ "@powerLevelNone": {}, "powerLevelCustom": "Custom", "@powerLevelCustom": {}, + "powerLevelsTitle": "General Permission levels", + "@powerLevelsTitle" :{}, + "powerLevelPostEventsTitle": "Posting Permission Level", + "@powerLevelPostEventsTitle": {}, + "powerLevelPostEventsDesc": "Minimal Permission Level to post anything at all", + "@powerLevelPostEventsDesc": {}, + "powerLevelKickTitle": "Kick Permission Level", + "@powerLevelKickTitle": {}, + "powerLevelKickDesc": "Minimal Permission Level to kick someone", + "@powerLevelKickDesc": {}, + "powerLevelBanTitle": "Ban Permission Level", + "@powerLevelBanTitle": {}, + "powerLevelBanDesc": "Minimal Permission Level to ban someone", + "@powerLevelBanDesc": {}, + "powerLevelInviteTitle": "Invite Permission Level", + "@powerLevelInviteTitle": {}, + "powerLevelInviteDesc": "Minimal Permission Level to invite someone", + "@powerLevelInviteDesc": {}, + "powerLevelRedactTitle": "Redact Permission Level", + "@powerLevelRedactTitle": {}, + "powerLevelRedactDesc": "Minimal Permission Level to redact other peoples content", + "@powerLevelRedactDesc": {}, "preview": "Preview", "@preview": {}, "privacyPolicy": "Privacy Policy", @@ -2237,8 +2259,8 @@ "@boosts": {}, "requiredPowerLevel": "Required PowerLevel", "@requiredPowerLevel": {}, - "minPowerLevelError": "Minimum power level required to post {featureName}", - "@minPowerLevelError": {}, + "minPowerLevelDesc": "Minimum power level required to post {featureName}", + "@minPowerLevelDesc": {}, "minPowerLevelRsvp": "Minimum power level to RSVP to calendar events", "@minPowerLevelRsvp": {}, "commentsOnBoost": "Comments on Boost", diff --git a/app/lib/l10n/app_ur.arb b/app/lib/l10n/app_ur.arb index a5c6db014f2f..a3d400084db2 100644 --- a/app/lib/l10n/app_ur.arb +++ b/app/lib/l10n/app_ur.arb @@ -2224,8 +2224,8 @@ "@boosts": {}, "requiredPowerLevel": "مطلوبہ پاور لیول", "@requiredPowerLevel": {}, - "minPowerLevelError": "{featureName} پوسٹ کرنے کے لیے کم از کم پاور لیول درکار", - "@minPowerLevelError": {}, + "minPowerLevelDesc": "{featureName} پوسٹ کرنے کے لیے کم از کم پاور لیول درکار", + "@minPowerLevelDesc": {}, "minPowerLevelRsvp": "RSVP کرنے میں کیلنڈر ایونٹس کے لیے کم از کم پاور لیول", "@minPowerLevelRsvp": {}, "commentsOnBoost": "بوسٹ پر کمنٹس", diff --git a/native/acter/api.rsh b/native/acter/api.rsh index 158cc96a0650..0cc675ede288 100644 --- a/native/acter/api.rsh +++ b/native/acter/api.rsh @@ -1972,15 +1972,32 @@ object RoomPowerLevels { fn events_key() -> string; fn pins() -> Option; fn pins_key() -> string; - fn events_default() -> i64; - fn users_default() -> i64; - fn max_power_level() -> i64; fn tasks() -> Option; fn tasks_key() -> string; fn task_lists() -> Option; fn task_lists_key() -> string; + + fn rsvp() -> Option; + fn rsvp_key() -> string; + + fn comments() -> Option; + fn comments_key() -> string; + + fn attachments() -> Option; + fn attachments_key() -> string; + + // -- defaults + + fn events_default() -> i64; + fn users_default() -> i64; + fn max_power_level() -> i64; + + fn kick() -> i64; + fn ban() -> i64; + fn redact() -> i64; + fn invite() -> i64; } object SimpleOnOffSetting { @@ -2238,6 +2255,9 @@ object Space { /// update the power level for a feature fn update_feature_power_levels(feature: string, level: Option) -> Future>; + /// update the power level for a regular room feature + fn update_regular_power_levels(feature: string, level: i32) -> Future>; + /// report an event from this room /// score - The score to rate this content as where -100 is most offensive and 0 is inoffensive (optional). /// reason - The reason for the event being reported (optional). diff --git a/native/acter/src/api/settings/space.rs b/native/acter/src/api/settings/space.rs index b1841391a47e..30ff6b4dbf09 100644 --- a/native/acter/src/api/settings/space.rs +++ b/native/acter/src/api/settings/space.rs @@ -4,9 +4,12 @@ pub use acter_core::events::settings::{ TasksSettings, }; use acter_core::events::{ + attachments::AttachmentEventContent, calendar::CalendarEventEventContent, + comments::CommentEventContent, news::NewsEntryEventContent, pins::PinEventContent, + rsvp::RsvpEventContent, settings::ActerAppSettingsContentBuilder, tasks::{TaskEventContent, TaskListEventContent}, }; @@ -86,6 +89,24 @@ impl RoomPowerLevels { pub fn pins_key(&self) -> String { ::TYPE.into() } + pub fn comments(&self) -> Option { + self.get_for_key(::TYPE.into()) + } + pub fn comments_key(&self) -> String { + ::TYPE.into() + } + pub fn attachments(&self) -> Option { + self.get_for_key(::TYPE.into()) + } + pub fn attachments_key(&self) -> String { + ::TYPE.into() + } + pub fn rsvp(&self) -> Option { + self.get_for_key(::TYPE.into()) + } + pub fn rsvp_key(&self) -> String { + ::TYPE.into() + } pub fn events_default(&self) -> i64 { self.inner.events_default.into() } @@ -95,6 +116,18 @@ impl RoomPowerLevels { pub fn max_power_level(&self) -> i64 { self.inner.max().into() } + pub fn kick(&self) -> i64 { + self.inner.kick.into() + } + pub fn ban(&self) -> i64 { + self.inner.ban.into() + } + pub fn invite(&self) -> i64 { + self.inner.invite.into() + } + pub fn redact(&self) -> i64 { + self.inner.redact.into() + } } #[derive(Clone)] @@ -144,6 +177,42 @@ impl Room { .await? } + pub async fn update_regular_power_levels( + &self, + name: String, + power_level: i32, + ) -> Result { + if !self.is_joined() { + bail!("Unable to update a space you aren’t part of"); + } + let mut current_power_levels = self.power_levels_content().await?; + + match name.to_lowercase().as_str() { + "events_default" => { + current_power_levels.events_default = Int::from(power_level); + } + "ban" => { + current_power_levels.ban = Int::from(power_level); + } + "kick" => { + current_power_levels.kick = Int::from(power_level); + } + "redact" => { + current_power_levels.redact = Int::from(power_level); + } + "invite" => { + current_power_levels.invite = Int::from(power_level); + } + "state_default" => { + current_power_levels.state_default = Int::from(power_level); + } + _ => { + bail!("Power level {name} unknown"); + } + } + self.update_power_levels(current_power_levels).await + } + pub async fn update_feature_power_levels( &self, name: String, @@ -175,7 +244,10 @@ impl Room { if !updated { return Ok(false); } + self.update_power_levels(current_power_levels).await + } + async fn update_power_levels(&self, current_power_levels: RumaRoomPowerLevels) -> Result { if !self .get_my_membership() .await? diff --git a/native/test/src/tests/formatted_body.rs b/native/test/src/tests/formatted_body.rs index 3df94560cad1..a1b6b9d90d02 100644 --- a/native/test/src/tests/formatted_body.rs +++ b/native/test/src/tests/formatted_body.rs @@ -79,18 +79,10 @@ fn match_room_msg(msg: &RoomMessage, body: &str) -> Option { if msg.item_type() != "event" { return None; } - let Some(event_item) = msg.event_item() else { - return None; - }; - let Some(msg_content) = event_item.msg_content() else { - return None; - }; - + let event_item = msg.event_item()?; + let msg_content = event_item.msg_content()?; let _fresh_body = msg_content.body(); - - let Some(formatted) = msg_content.formatted_body() else { - return None; - }; + let formatted = msg_content.formatted_body()?; if formatted == body { // exclude the pending msg diff --git a/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart b/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart index 2b4e3af1224e..32223fd9c2cf 100644 --- a/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart +++ b/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart @@ -10123,6 +10123,50 @@ class Api { return tmp7; } + bool? __spaceUpdateRegularPowerLevelsFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _spaceUpdateRegularPowerLevelsFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; + if (tmp8 == 0) { + return null; + } + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; + } + final tmp7 = tmp13 > 0; + return tmp7; + } + bool? __spaceReportContentFuturePoll( int boxed, int postCobject, @@ -23694,6 +23738,111 @@ class Api { _RoomPowerLevelsPinsKeyReturn Function( int, )>(); + late final _roomPowerLevelsTasksPtr = _lookup< + ffi.NativeFunction< + _RoomPowerLevelsTasksReturn Function( + ffi.IntPtr, + )>>("__RoomPowerLevels_tasks"); + + late final _roomPowerLevelsTasks = _roomPowerLevelsTasksPtr.asFunction< + _RoomPowerLevelsTasksReturn Function( + int, + )>(); + late final _roomPowerLevelsTasksKeyPtr = _lookup< + ffi.NativeFunction< + _RoomPowerLevelsTasksKeyReturn Function( + ffi.IntPtr, + )>>("__RoomPowerLevels_tasks_key"); + + late final _roomPowerLevelsTasksKey = _roomPowerLevelsTasksKeyPtr.asFunction< + _RoomPowerLevelsTasksKeyReturn Function( + int, + )>(); + late final _roomPowerLevelsTaskListsPtr = _lookup< + ffi.NativeFunction< + _RoomPowerLevelsTaskListsReturn Function( + ffi.IntPtr, + )>>("__RoomPowerLevels_task_lists"); + + late final _roomPowerLevelsTaskLists = + _roomPowerLevelsTaskListsPtr.asFunction< + _RoomPowerLevelsTaskListsReturn Function( + int, + )>(); + late final _roomPowerLevelsTaskListsKeyPtr = _lookup< + ffi.NativeFunction< + _RoomPowerLevelsTaskListsKeyReturn Function( + ffi.IntPtr, + )>>("__RoomPowerLevels_task_lists_key"); + + late final _roomPowerLevelsTaskListsKey = + _roomPowerLevelsTaskListsKeyPtr.asFunction< + _RoomPowerLevelsTaskListsKeyReturn Function( + int, + )>(); + late final _roomPowerLevelsRsvpPtr = _lookup< + ffi.NativeFunction< + _RoomPowerLevelsRsvpReturn Function( + ffi.IntPtr, + )>>("__RoomPowerLevels_rsvp"); + + late final _roomPowerLevelsRsvp = _roomPowerLevelsRsvpPtr.asFunction< + _RoomPowerLevelsRsvpReturn Function( + int, + )>(); + late final _roomPowerLevelsRsvpKeyPtr = _lookup< + ffi.NativeFunction< + _RoomPowerLevelsRsvpKeyReturn Function( + ffi.IntPtr, + )>>("__RoomPowerLevels_rsvp_key"); + + late final _roomPowerLevelsRsvpKey = _roomPowerLevelsRsvpKeyPtr.asFunction< + _RoomPowerLevelsRsvpKeyReturn Function( + int, + )>(); + late final _roomPowerLevelsCommentsPtr = _lookup< + ffi.NativeFunction< + _RoomPowerLevelsCommentsReturn Function( + ffi.IntPtr, + )>>("__RoomPowerLevels_comments"); + + late final _roomPowerLevelsComments = _roomPowerLevelsCommentsPtr.asFunction< + _RoomPowerLevelsCommentsReturn Function( + int, + )>(); + late final _roomPowerLevelsCommentsKeyPtr = _lookup< + ffi.NativeFunction< + _RoomPowerLevelsCommentsKeyReturn Function( + ffi.IntPtr, + )>>("__RoomPowerLevels_comments_key"); + + late final _roomPowerLevelsCommentsKey = + _roomPowerLevelsCommentsKeyPtr.asFunction< + _RoomPowerLevelsCommentsKeyReturn Function( + int, + )>(); + late final _roomPowerLevelsAttachmentsPtr = _lookup< + ffi.NativeFunction< + _RoomPowerLevelsAttachmentsReturn Function( + ffi.IntPtr, + )>>("__RoomPowerLevels_attachments"); + + late final _roomPowerLevelsAttachments = + _roomPowerLevelsAttachmentsPtr.asFunction< + _RoomPowerLevelsAttachmentsReturn Function( + int, + )>(); + late final _roomPowerLevelsAttachmentsKeyPtr = _lookup< + ffi.NativeFunction< + _RoomPowerLevelsAttachmentsKeyReturn Function( + ffi.IntPtr, + )>>("__RoomPowerLevels_attachments_key"); + + late final _roomPowerLevelsAttachmentsKey = + _roomPowerLevelsAttachmentsKeyPtr.asFunction< + _RoomPowerLevelsAttachmentsKeyReturn Function( + int, + )>(); late final _roomPowerLevelsEventsDefaultPtr = _lookup< ffi.NativeFunction< ffi.Int64 Function( @@ -23727,48 +23876,46 @@ class Api { int Function( int, )>(); - late final _roomPowerLevelsTasksPtr = _lookup< + late final _roomPowerLevelsKickPtr = _lookup< ffi.NativeFunction< - _RoomPowerLevelsTasksReturn Function( + ffi.Int64 Function( ffi.IntPtr, - )>>("__RoomPowerLevels_tasks"); + )>>("__RoomPowerLevels_kick"); - late final _roomPowerLevelsTasks = _roomPowerLevelsTasksPtr.asFunction< - _RoomPowerLevelsTasksReturn Function( + late final _roomPowerLevelsKick = _roomPowerLevelsKickPtr.asFunction< + int Function( int, )>(); - late final _roomPowerLevelsTasksKeyPtr = _lookup< + late final _roomPowerLevelsBanPtr = _lookup< ffi.NativeFunction< - _RoomPowerLevelsTasksKeyReturn Function( + ffi.Int64 Function( ffi.IntPtr, - )>>("__RoomPowerLevels_tasks_key"); + )>>("__RoomPowerLevels_ban"); - late final _roomPowerLevelsTasksKey = _roomPowerLevelsTasksKeyPtr.asFunction< - _RoomPowerLevelsTasksKeyReturn Function( + late final _roomPowerLevelsBan = _roomPowerLevelsBanPtr.asFunction< + int Function( int, )>(); - late final _roomPowerLevelsTaskListsPtr = _lookup< + late final _roomPowerLevelsRedactPtr = _lookup< ffi.NativeFunction< - _RoomPowerLevelsTaskListsReturn Function( + ffi.Int64 Function( ffi.IntPtr, - )>>("__RoomPowerLevels_task_lists"); + )>>("__RoomPowerLevels_redact"); - late final _roomPowerLevelsTaskLists = - _roomPowerLevelsTaskListsPtr.asFunction< - _RoomPowerLevelsTaskListsReturn Function( - int, - )>(); - late final _roomPowerLevelsTaskListsKeyPtr = _lookup< + late final _roomPowerLevelsRedact = _roomPowerLevelsRedactPtr.asFunction< + int Function( + int, + )>(); + late final _roomPowerLevelsInvitePtr = _lookup< ffi.NativeFunction< - _RoomPowerLevelsTaskListsKeyReturn Function( + ffi.Int64 Function( ffi.IntPtr, - )>>("__RoomPowerLevels_task_lists_key"); + )>>("__RoomPowerLevels_invite"); - late final _roomPowerLevelsTaskListsKey = - _roomPowerLevelsTaskListsKeyPtr.asFunction< - _RoomPowerLevelsTaskListsKeyReturn Function( - int, - )>(); + late final _roomPowerLevelsInvite = _roomPowerLevelsInvitePtr.asFunction< + int Function( + int, + )>(); late final _simpleOnOffSettingActivePtr = _lookup< ffi.NativeFunction< ffi.Uint8 Function( @@ -24807,6 +24954,25 @@ class Api { int, int, )>(); + late final _spaceUpdateRegularPowerLevelsPtr = _lookup< + ffi.NativeFunction< + ffi.IntPtr Function( + ffi.IntPtr, + ffi.IntPtr, + ffi.UintPtr, + ffi.UintPtr, + ffi.Int32, + )>>("__Space_update_regular_power_levels"); + + late final _spaceUpdateRegularPowerLevels = + _spaceUpdateRegularPowerLevelsPtr.asFunction< + int Function( + int, + int, + int, + int, + int, + )>(); late final _spaceReportContentPtr = _lookup< ffi.NativeFunction< ffi.IntPtr Function( @@ -30831,6 +30997,21 @@ class Api { int, int, )>(); + late final _spaceUpdateRegularPowerLevelsFuturePollPtr = _lookup< + ffi.NativeFunction< + _SpaceUpdateRegularPowerLevelsFuturePollReturn Function( + ffi.IntPtr, + ffi.IntPtr, + ffi.Int64, + )>>("__Space_update_regular_power_levels_future_poll"); + + late final _spaceUpdateRegularPowerLevelsFuturePoll = + _spaceUpdateRegularPowerLevelsFuturePollPtr.asFunction< + _SpaceUpdateRegularPowerLevelsFuturePollReturn Function( + int, + int, + int, + )>(); late final _spaceReportContentFuturePollPtr = _lookup< ffi.NativeFunction< _SpaceReportContentFuturePollReturn Function( @@ -48552,43 +48733,98 @@ class RoomPowerLevels { return tmp2; } - int eventsDefault() { + int? tasks() { var tmp0 = 0; tmp0 = _box.borrow(); - final tmp1 = _api._roomPowerLevelsEventsDefault( + final tmp1 = _api._roomPowerLevelsTasks( tmp0, ); - final tmp3 = tmp1; - final tmp2 = tmp3; + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + if (tmp3 == 0) { + return null; + } + final tmp2 = tmp4; return tmp2; } - int usersDefault() { + String tasksKey() { var tmp0 = 0; tmp0 = _box.borrow(); - final tmp1 = _api._roomPowerLevelsUsersDefault( + final tmp1 = _api._roomPowerLevelsTasksKey( tmp0, ); - final tmp3 = tmp1; - final tmp2 = tmp3; + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + if (tmp4 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp3_ptr = ffi.Pointer.fromAddress(tmp3); + List tmp3_buf = []; + final tmp3_precast = tmp3_ptr.cast(); + for (int i = 0; i < tmp4; i++) { + int char = tmp3_precast.elementAt(i).value; + tmp3_buf.add(char); + } + final tmp2 = utf8.decode(tmp3_buf, allowMalformed: true); + if (tmp5 > 0) { + final ffi.Pointer tmp3_0; + tmp3_0 = ffi.Pointer.fromAddress(tmp3); + _api.__deallocate(tmp3_0, tmp5 * 1, 1); + } return tmp2; } - int maxPowerLevel() { + int? taskLists() { var tmp0 = 0; tmp0 = _box.borrow(); - final tmp1 = _api._roomPowerLevelsMaxPowerLevel( + final tmp1 = _api._roomPowerLevelsTaskLists( tmp0, ); - final tmp3 = tmp1; - final tmp2 = tmp3; + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + if (tmp3 == 0) { + return null; + } + final tmp2 = tmp4; return tmp2; } - int? tasks() { + String taskListsKey() { var tmp0 = 0; tmp0 = _box.borrow(); - final tmp1 = _api._roomPowerLevelsTasks( + final tmp1 = _api._roomPowerLevelsTaskListsKey( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + if (tmp4 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp3_ptr = ffi.Pointer.fromAddress(tmp3); + List tmp3_buf = []; + final tmp3_precast = tmp3_ptr.cast(); + for (int i = 0; i < tmp4; i++) { + int char = tmp3_precast.elementAt(i).value; + tmp3_buf.add(char); + } + final tmp2 = utf8.decode(tmp3_buf, allowMalformed: true); + if (tmp5 > 0) { + final ffi.Pointer tmp3_0; + tmp3_0 = ffi.Pointer.fromAddress(tmp3); + _api.__deallocate(tmp3_0, tmp5 * 1, 1); + } + return tmp2; + } + + int? rsvp() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPowerLevelsRsvp( tmp0, ); final tmp3 = tmp1.arg0; @@ -48600,10 +48836,10 @@ class RoomPowerLevels { return tmp2; } - String tasksKey() { + String rsvpKey() { var tmp0 = 0; tmp0 = _box.borrow(); - final tmp1 = _api._roomPowerLevelsTasksKey( + final tmp1 = _api._roomPowerLevelsRsvpKey( tmp0, ); final tmp3 = tmp1.arg0; @@ -48629,10 +48865,10 @@ class RoomPowerLevels { return tmp2; } - int? taskLists() { + int? comments() { var tmp0 = 0; tmp0 = _box.borrow(); - final tmp1 = _api._roomPowerLevelsTaskLists( + final tmp1 = _api._roomPowerLevelsComments( tmp0, ); final tmp3 = tmp1.arg0; @@ -48644,10 +48880,54 @@ class RoomPowerLevels { return tmp2; } - String taskListsKey() { + String commentsKey() { var tmp0 = 0; tmp0 = _box.borrow(); - final tmp1 = _api._roomPowerLevelsTaskListsKey( + final tmp1 = _api._roomPowerLevelsCommentsKey( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + if (tmp4 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp3_ptr = ffi.Pointer.fromAddress(tmp3); + List tmp3_buf = []; + final tmp3_precast = tmp3_ptr.cast(); + for (int i = 0; i < tmp4; i++) { + int char = tmp3_precast.elementAt(i).value; + tmp3_buf.add(char); + } + final tmp2 = utf8.decode(tmp3_buf, allowMalformed: true); + if (tmp5 > 0) { + final ffi.Pointer tmp3_0; + tmp3_0 = ffi.Pointer.fromAddress(tmp3); + _api.__deallocate(tmp3_0, tmp5 * 1, 1); + } + return tmp2; + } + + int? attachments() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPowerLevelsAttachments( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + if (tmp3 == 0) { + return null; + } + final tmp2 = tmp4; + return tmp2; + } + + String attachmentsKey() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPowerLevelsAttachmentsKey( tmp0, ); final tmp3 = tmp1.arg0; @@ -48673,6 +48953,83 @@ class RoomPowerLevels { return tmp2; } + int eventsDefault() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPowerLevelsEventsDefault( + tmp0, + ); + final tmp3 = tmp1; + final tmp2 = tmp3; + return tmp2; + } + + int usersDefault() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPowerLevelsUsersDefault( + tmp0, + ); + final tmp3 = tmp1; + final tmp2 = tmp3; + return tmp2; + } + + int maxPowerLevel() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPowerLevelsMaxPowerLevel( + tmp0, + ); + final tmp3 = tmp1; + final tmp2 = tmp3; + return tmp2; + } + + int kick() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPowerLevelsKick( + tmp0, + ); + final tmp3 = tmp1; + final tmp2 = tmp3; + return tmp2; + } + + int ban() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPowerLevelsBan( + tmp0, + ); + final tmp3 = tmp1; + final tmp2 = tmp3; + return tmp2; + } + + int redact() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPowerLevelsRedact( + tmp0, + ); + final tmp3 = tmp1; + final tmp2 = tmp3; + return tmp2; + } + + int invite() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPowerLevelsInvite( + tmp0, + ); + final tmp3 = tmp1; + final tmp2 = tmp3; + return tmp2; + } + /// Manually drops the object and unregisters the FinalizableHandle. void drop() { _box.drop(); @@ -50683,6 +51040,45 @@ class Space { return tmp10; } + /// update the power level for a regular room feature + Future updateRegularPowerLevels( + String feature, + int level, + ) { + final tmp1 = feature; + final tmp5 = level; + var tmp0 = 0; + var tmp2 = 0; + var tmp3 = 0; + var tmp4 = 0; + var tmp6 = 0; + tmp0 = _box.borrow(); + final tmp1_0 = utf8.encode(tmp1); + tmp3 = tmp1_0.length; + + final ffi.Pointer tmp2_0 = _api.__allocate(tmp3 * 1, 1); + final Uint8List tmp2_1 = tmp2_0.asTypedList(tmp3); + tmp2_1.setAll(0, tmp1_0); + tmp2 = tmp2_0.address; + tmp4 = tmp3; + tmp6 = tmp5; + final tmp7 = _api._spaceUpdateRegularPowerLevels( + tmp0, + tmp2, + tmp3, + tmp4, + tmp6, + ); + final tmp9 = tmp7; + final ffi.Pointer tmp9_0 = ffi.Pointer.fromAddress(tmp9); + final tmp9_1 = + _Box(_api, tmp9_0, "__Space_update_regular_power_levels_future_drop"); + tmp9_1._finalizer = _api._registerFinalizer(tmp9_1); + final tmp8 = + _nativeFuture(tmp9_1, _api.__spaceUpdateRegularPowerLevelsFuturePoll); + return tmp8; + } + /// report an event from this room /// score - The score to rate this content as where -100 is most offensive and 0 is inoffensive (optional). /// reason - The reason for the event being reported (optional). @@ -60305,6 +60701,54 @@ class _RoomPowerLevelsTaskListsKeyReturn extends ffi.Struct { external int arg2; } +class _RoomPowerLevelsRsvpReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.Int64() + external int arg1; +} + +class _RoomPowerLevelsRsvpKeyReturn extends ffi.Struct { + @ffi.IntPtr() + external int arg0; + @ffi.UintPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; +} + +class _RoomPowerLevelsCommentsReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.Int64() + external int arg1; +} + +class _RoomPowerLevelsCommentsKeyReturn extends ffi.Struct { + @ffi.IntPtr() + external int arg0; + @ffi.UintPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; +} + +class _RoomPowerLevelsAttachmentsReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.Int64() + external int arg1; +} + +class _RoomPowerLevelsAttachmentsKeyReturn extends ffi.Struct { + @ffi.IntPtr() + external int arg0; + @ffi.UintPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; +} + class _SimpleOnOffSettingBuilderBuildReturn extends ffi.Struct { @ffi.Uint8() external int arg0; @@ -63615,6 +64059,21 @@ class _SpaceUpdateFeaturePowerLevelsFuturePollReturn extends ffi.Struct { external int arg5; } +class _SpaceUpdateRegularPowerLevelsFuturePollReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.Uint8() + external int arg1; + @ffi.IntPtr() + external int arg2; + @ffi.UintPtr() + external int arg3; + @ffi.UintPtr() + external int arg4; + @ffi.Uint8() + external int arg5; +} + class _SpaceReportContentFuturePollReturn extends ffi.Struct { @ffi.Uint8() external int arg0;