mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-23 05:19:22 +00:00
Can change group virtual directory
This commit is contained in:
parent
d889321b38
commit
519c68b092
@ -193,6 +193,16 @@ class GroupsHelper {
|
|||||||
return groupInfo.info;
|
return groupInfo.info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check the availability of a virtual directory
|
||||||
|
///
|
||||||
|
/// Throws in case of error
|
||||||
|
static Future<void> checkVirtualDirectoryAvailability(
|
||||||
|
int groupID, String dir) async =>
|
||||||
|
await APIRequest(uri: "groups/checkVirtualDirectory", needLogin: true)
|
||||||
|
.addInt("groupID", groupID)
|
||||||
|
.addString("directory", dir)
|
||||||
|
.execWithThrow();
|
||||||
|
|
||||||
/// Update (set) new group settings
|
/// Update (set) new group settings
|
||||||
///
|
///
|
||||||
/// Throws in case of error
|
/// Throws in case of error
|
||||||
|
@ -28,7 +28,7 @@ class Group {
|
|||||||
final GroupVisibilityLevel visibilityLevel;
|
final GroupVisibilityLevel visibilityLevel;
|
||||||
final GroupRegistrationLevel registrationLevel;
|
final GroupRegistrationLevel registrationLevel;
|
||||||
final GroupPostCreationLevel postCreationLevel;
|
final GroupPostCreationLevel postCreationLevel;
|
||||||
final String virtualDirectory;
|
String virtualDirectory;
|
||||||
bool following;
|
bool following;
|
||||||
|
|
||||||
Group({
|
Group({
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:comunic/helpers/groups_helper.dart';
|
||||||
import 'package:comunic/helpers/settings_helper.dart';
|
import 'package:comunic/helpers/settings_helper.dart';
|
||||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
@ -8,7 +9,7 @@ import 'package:flutter/material.dart';
|
|||||||
///
|
///
|
||||||
/// @author Pierre HUBERT
|
/// @author Pierre HUBERT
|
||||||
|
|
||||||
enum VirtualDirectoryTargetType { USER }
|
enum VirtualDirectoryTargetType { USER, GROUP }
|
||||||
|
|
||||||
enum _CheckStatus { EMPTY, PENDING, VALID, INVALID }
|
enum _CheckStatus { EMPTY, PENDING, VALID, INVALID }
|
||||||
|
|
||||||
@ -122,6 +123,11 @@ class __VirtualDirectoryPickerState extends SafeState<_VirtualDirectoryPicker> {
|
|||||||
case VirtualDirectoryTargetType.USER:
|
case VirtualDirectoryTargetType.USER:
|
||||||
await SettingsHelper.checkUserDirectoryAvailability(value);
|
await SettingsHelper.checkUserDirectoryAvailability(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VirtualDirectoryTargetType.GROUP:
|
||||||
|
await GroupsHelper.checkVirtualDirectoryAvailability(
|
||||||
|
widget.id, value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_currentValue == value) {
|
if (_currentValue == value) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:comunic/helpers/groups_helper.dart';
|
import 'package:comunic/helpers/groups_helper.dart';
|
||||||
import 'package:comunic/models/advanced_group_info.dart';
|
import 'package:comunic/models/advanced_group_info.dart';
|
||||||
|
import 'package:comunic/ui/dialogs/virtual_directory_dialog.dart';
|
||||||
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||||
@ -89,6 +90,25 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
|
|||||||
_groupSettings.name = s;
|
_groupSettings.name = s;
|
||||||
_updateSettings();
|
_updateSettings();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
// Group virtual directory
|
||||||
|
SettingsTile(
|
||||||
|
title: tr("Virtual directory (optional)"),
|
||||||
|
subtitle: _groupSettings.virtualDirectory,
|
||||||
|
onTap: () async {
|
||||||
|
final newDir = await showVirtualDirectoryDialog(
|
||||||
|
context: context,
|
||||||
|
initialDirectory: _groupSettings.virtualDirectory,
|
||||||
|
id: _groupSettings.id,
|
||||||
|
type: VirtualDirectoryTargetType.GROUP,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (newDir == null) return;
|
||||||
|
|
||||||
|
_groupSettings.virtualDirectory = newDir;
|
||||||
|
_updateSettings();
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user