Skip to content

Commit 2dcaa0e

Browse files
committed
feat: daily update
1 parent a13783c commit 2dcaa0e

File tree

19 files changed

+240
-132
lines changed

19 files changed

+240
-132
lines changed

.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ ATTACHMENT_SIZE_LIMIT=5242880
1717

1818
# [other]
1919
HELP_URL=https://www.chatwoot.com/help-center
20-
PAGE_SIZE=10
20+
PAGE_SIZE=15

lib/app.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class AppState extends State<App> {
4242
content: Text(t.error_message(error.toString())),
4343
actions: [
4444
TextButton(
45-
onPressed: () => Get.back(),
45+
onPressed: () => Get.close(),
4646
child: Text(t.quit),
4747
)
4848
],

lib/config/constants.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ enum ContactSortBy implements Comparable<ContactSortBy> {
307307
case ContactSortBy.phone_number:
308308
return t.phone_number;
309309
case ContactSortBy.company_name:
310-
return t.company_name;
310+
return t.company;
311311
case ContactSortBy.country:
312312
return t.country;
313313
case ContactSortBy.city:

lib/imports.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export 'widgets/bottom_sheet.dart';
9797
export 'widgets/button.dart';
9898
export 'widgets/common.dart';
9999
export 'widgets/image.dart';
100-
export 'widgets/profile.dart';
101100

102101
export 'screens/custom_attributes/controllers/index.dart';
103102
export 'screens/labels/controllers/index.dart';

lib/l10n/app_en.arb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"save_changes": "Save changes",
44
"profile": "Profile",
55
"upload": "Upload",
6-
"phone_number": "phone_number",
7-
"company_name": "company_name",
6+
"phone_number": "Phone number",
7+
"company": "Company name",
88
"country": "country",
9-
"city": "city",
10-
"last_activity_at": "last_activity_at",
11-
"created_at": "created_at",
9+
"city": "City",
10+
"last_activity_at": "Last activity",
11+
"created_at": "Created at",
1212
"name": "Name",
1313
"ascending": "Ascending",
1414
"descending": "Descending",
@@ -161,6 +161,8 @@
161161
"labels": "Labels",
162162
"labels_description": "Labels help you categorize and prioritize conversations and leads. You can assign a label to a conversation or contact using the side panel.",
163163
"labels_add": "Add label",
164+
"labels_search": "Search labels",
165+
"labels_search_hint": "Type something...",
164166
"attributes": "Attributes",
165167
"custom_attributes": "Custom Attributes",
166168
"custom_attributes_title": "Custom Attributes",
@@ -293,6 +295,9 @@
293295
"browser": "Browser",
294296
"operating_system": "Operating system",
295297
"add": "Add",
298+
"modify": "Modify",
296299
"assignee": "Assignee",
297-
"actions": "Actions"
300+
"actions": "Actions",
301+
"location": "Location",
302+
"phone": "Phone"
298303
}

lib/models/team.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ class TeamInfo {
55
final String name;
66
final String description;
77
final bool allow_auto_assign;
8-
final int account_id;
8+
final int? account_id;
99
final bool is_member;
1010

1111
const TeamInfo({
1212
required this.id,
1313
required this.name,
1414
required this.description,
1515
required this.allow_auto_assign,
16-
required this.account_id,
16+
this.account_id,
1717
required this.is_member,
1818
});
1919

2020
factory TeamInfo.fromJson(dynamic json) {
2121
return TeamInfo(
2222
id: json['id'],
2323
name: json['name'],
24-
description: json['description'],
25-
allow_auto_assign: json['allow_auto_assign'],
24+
description: json['description'] ?? '',
25+
allow_auto_assign: json['allow_auto_assign'] ?? false,
2626
account_id: json['account_id'],
27-
is_member: json['is_member'],
27+
is_member: json['is_member'] ?? false,
2828
);
2929
}
3030
}

lib/screens/custom_attributes/views/index.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class CustomAttributesView extends GetView<CustomAttributesController> {
6565
return Obx(() {
6666
final items =
6767
controller.items.value.where((e) => e.attribute_model == model);
68+
6869
return ListView.builder(
6970
padding: EdgeInsets.zero,
7071
itemCount: items.length,
@@ -77,6 +78,7 @@ class CustomAttributesView extends GetView<CustomAttributesController> {
7778

7879
Widget buildItem(BuildContext context, CustomAttribute info) {
7980
final isAdmin = auth.profile.value!.role == UserRole.administrator;
81+
8082
return ListTile(
8183
title: Text(info.attribute_display_name),
8284
subtitle: Text(info.attribute_description),

lib/screens/labels/controllers/index.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import '../widgets/picker.dart';
12
import '/imports.dart';
23

34
class LabelsController extends GetxController {
@@ -40,4 +41,13 @@ class LabelsController extends GetxController {
4041
}
4142

4243
Future<void> addLabel() async {}
44+
45+
Future<List<LabelInfo>> showPicker({List<String>? selected}) async {
46+
final result = await Get.bottomSheet<List<LabelInfo>?>(
47+
LabelsPicker(
48+
selected: selected,
49+
),
50+
);
51+
return result ?? [];
52+
}
4353
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import '/imports.dart';
2+
3+
class LabelsPickerController extends GetxController {
4+
final labels = Get.find<LabelsController>();
5+
final selected = RxList<LabelInfo>();
6+
7+
LabelsPickerController({List<String>? selected}) {
8+
selected ??= [];
9+
this.selected.value =
10+
labels.items.where((e) => selected!.contains(e.title)).toList();
11+
}
12+
13+
void toggle(LabelInfo info) {
14+
if (selected.contains(info)) {
15+
selected.remove(info);
16+
return;
17+
}
18+
selected.add(info);
19+
}
20+
}
21+
22+
class LabelsPicker extends StatelessWidget {
23+
final LabelsPickerController c;
24+
final labels = Get.find<LabelsController>();
25+
26+
final bool multiple;
27+
LabelsPicker({super.key, List<String>? selected, bool? multiple})
28+
: c = Get.put(LabelsPickerController(selected: selected)),
29+
multiple = multiple ?? false;
30+
31+
@override
32+
Widget build(BuildContext context) {
33+
return bottomSheet(
34+
context,
35+
child: Obx(() {
36+
final items = labels.items.value;
37+
38+
return Column(
39+
children: [
40+
TextField(
41+
decoration: InputDecoration(
42+
prefixIcon: Icon(Icons.search_outlined),
43+
label: Text(t.labels_search),
44+
hintText: t.labels_search_hint,
45+
),
46+
),
47+
Expanded(
48+
child: ListView.builder(
49+
itemCount: items.length,
50+
itemBuilder: (_, i) {
51+
return buildItem(items[i]);
52+
},
53+
),
54+
),
55+
Padding(
56+
padding: const EdgeInsets.all(8.0),
57+
child: primaryButton(
58+
block: true,
59+
label: t.save_changes,
60+
onPressed: () => Navigator.of(context).pop(c.selected.value),
61+
),
62+
),
63+
],
64+
);
65+
}),
66+
);
67+
}
68+
69+
Widget buildItem(LabelInfo info) {
70+
return Obx(() {
71+
final selected = c.selected.value;
72+
73+
return ListTile(
74+
title: Text(info.title),
75+
subtitle: Text(
76+
info.description,
77+
maxLines: 1,
78+
overflow: TextOverflow.ellipsis,
79+
),
80+
trailing: Checkbox(
81+
value: selected.contains(info),
82+
onChanged: (next) => c.toggle(info),
83+
),
84+
onTap: () => c.toggle(info),
85+
);
86+
});
87+
}
88+
}

lib/screens/login/controllers/change_url.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class ChangeUrlController extends GetxController {
1111
@override
1212
void onReady() {
1313
super.onReady();
14+
1415
baseUrl.text = Uri.parse(_api.baseUrl.value).host;
1516
}
1617

@@ -20,12 +21,14 @@ class ChangeUrlController extends GetxController {
2021
_logger.i('submit()');
2122

2223
try {
23-
var finalUrl = 'https://${baseUrl.text}';
24-
var result = await _api.getInfo(baseUrl: finalUrl);
25-
var info = result.getOrThrow();
24+
final finalUrl = 'https://${baseUrl.text}';
25+
final result = await _api.getInfo(baseUrl: finalUrl);
26+
final info = result.getOrThrow();
27+
2628
_logger.i('submit() => successful! version: ${info.version}');
2729
_api.baseUrl.value = finalUrl;
28-
Get.back(result: true);
30+
31+
Get.back();
2932
} catch (error) {
3033
if (error is! ApiError) _logger.e(error);
3134
errorHandler(error);

0 commit comments

Comments
 (0)