Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time displaying modes #399

Merged
merged 31 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1f37cd4
Transfer changes from `new-design-preview`
krida2000 Apr 6, 2023
a217477
Merge remote-tracking branch 'origin/main' into time-insite-message
krida2000 Apr 6, 2023
3c3396e
Fix text selection
krida2000 Apr 6, 2023
cb41ce1
Add changelog & fix E2E test
krida2000 Apr 7, 2023
7115c86
Merge remote-tracking branch 'origin/main' into time-insite-message
SleepySquash Apr 11, 2023
3d9249e
Corrections
SleepySquash Apr 11, 2023
2cc53ea
Rephrase CHANGELOG entry
SleepySquash Apr 11, 2023
4856bd1
Refactor `ChatCall` a bit
SleepySquash Apr 11, 2023
bb1993c
Make `ChatCall` behave like `ChatMessage`
SleepySquash Apr 11, 2023
73b9e1f
Corrections
krida2000 Apr 12, 2023
579bf08
Disable file attachments selection
krida2000 Apr 12, 2023
235a636
Fix E2E tests
krida2000 Apr 13, 2023
2f1e0fa
Merge remote-tracking branch 'origin/main' into time-insite-message
SleepySquash Apr 13, 2023
fb47ab3
Corrections
SleepySquash Apr 13, 2023
f775a61
Corrections
krida2000 Apr 14, 2023
e5eb99d
Fix fmt
krida2000 Apr 14, 2023
4bf14a6
Fix E2E & widget tests
krida2000 Apr 14, 2023
909740a
Remove empty file
krida2000 Apr 14, 2023
b0a16d7
Fix fmt
krida2000 Apr 14, 2023
fd60126
Merge remote-tracking branch 'origin/main' into time-insite-message
SleepySquash Apr 17, 2023
f4df2d5
Minor corrections
SleepySquash Apr 17, 2023
d81e37d
Corrections
krida2000 Apr 18, 2023
af01e20
Merge remote-tracking branch 'origin/main' into time-insite-message
krida2000 Apr 18, 2023
79d79a4
Add extension searching text in RichText
krida2000 Apr 18, 2023
96dad00
Minor correction
krida2000 Apr 18, 2023
d063829
Remove unused key
krida2000 Apr 19, 2023
5c6d35c
Corrections
SleepySquash Apr 19, 2023
7c1ed32
Increase `PlatformUtilsMock.download` timeout
SleepySquash Apr 20, 2023
214d69b
FIx E2E test
SleepySquash Apr 20, 2023
3668a44
Add scrolls to some E2E tests
SleepySquash Apr 20, 2023
b867bad
Revert back `toUtc`
SleepySquash Apr 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ All user visible changes to this project will be documented in this file. This p
- Chat page:
- Redesigned info and call messages. ([#357])
- Redesigned file attachments. ([#362])
- Message timestamps. ([#399])
- Media panel:
- Position and size persistence. ([#270], [#264])
- Proportionally resizing secondary panel. ([#393], [#356], [#258])
Expand Down Expand Up @@ -59,6 +60,7 @@ All user visible changes to this project will be documented in this file. This p
[#380]: /../../pull/380
[#388]: /../../pull/388
[#393]: /../../pull/393
[#399]: /../../pull/399



Expand Down
4 changes: 4 additions & 0 deletions assets/l10n/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ label_app_background = Application background
label_application = Application
label_are_you_sure_no = No
label_are_you_sure_yes = Yes
label_as_timeline = As timeline
label_attachments = [{$count} { $count ->
[1] attachment
*[other] attachments
Expand Down Expand Up @@ -476,6 +477,7 @@ label_direct_chat_link_in_chat_description =
- send messages to group chat,
- make calls
label_disabled = Disabled
label_display_timestamps = Display time stamps
label_download = Download
label_download_application = Download application
label_draft = Draft
Expand Down Expand Up @@ -522,6 +524,7 @@ label_hint_drag_n_drop_video =
label_hint_from_gapopa = Hint from Gapopa
label_image_downloaded = Image downloaded.
label_image_saved_to_gallery = Image saved to gallery.
label_in_message = In message
label_incoming_call = Incoming call
label_introduction_description =
Password is not set. Access to an account without a password is retained for one year from the time the account was created or until:
Expand Down Expand Up @@ -671,6 +674,7 @@ label_subtitle_participants = participants
label_tab_chats = Chats
label_tab_contacts = Contacts
label_tab_menu = Menu
label_timeline_style = Timeline style
label_transition_count = Transitions: {$count}
label_typing = Typing
label_unconfirmed = Unconfirmed
Expand Down
4 changes: 4 additions & 0 deletions assets/l10n/ru-RU.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ label_app_background = Фон приложения
label_application = Приложение
label_are_you_sure_no = Нет
label_are_you_sure_yes = Да
label_as_timeline = Как таймлайн
label_attachments = [{$count} { $count ->
[1] прикрепление
[few] прикрепления
Expand Down Expand Up @@ -492,6 +493,7 @@ label_direct_chat_link_in_chat_description =
- отправлять сообщения в чат группы,
- совершать звонки
label_disabled = Отключены
label_display_timestamps = Отображать метки времени
label_download = Скачать
label_download_application = Скачать приложение
label_draft = Черновик
Expand Down Expand Up @@ -538,6 +540,7 @@ label_hint_drag_n_drop_video =
label_hint_from_gapopa = Подсказка от Gapopa
label_image_downloaded = Изображение загружено.
label_image_saved_to_gallery = Изображение сохранено в галерею.
label_in_message = В сообщении
label_incoming_call = Входящий звонок
label_introduction_description =
Пароль не задан. Доступ к аккаунту без пароля сохраняется в течении одного года с момента создания аккаунта или пока:
Expand Down Expand Up @@ -691,6 +694,7 @@ label_subtitle_participants = участников
label_tab_chats = Чаты
label_tab_contacts = Контакты
label_tab_menu = Меню
label_timeline_style = Стиль метки времени
label_transition_count = Переходов: {$count}
label_typing = Печатает
label_unconfirmed = Неподтвержденный
Expand Down
6 changes: 6 additions & 0 deletions lib/domain/model/application_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ApplicationSettings extends HiveObject {
this.showDragAndDropButtonsHint = false,
this.sortContactsByName = true,
this.loadImages = true,
this.timelineEnabled = false,
});

/// Indicator whether [OngoingCall]s are preferred to be displayed in the
Expand Down Expand Up @@ -75,4 +76,9 @@ class ApplicationSettings extends HiveObject {
/// Indicator whether [ImageAttachment]s should be loaded automatically.
@HiveField(8)
bool loadImages;

/// Indicator whether [ChatItem.at] labels should be displayed as a timeline
/// in a [Chat].
@HiveField(9)
bool timelineEnabled;
}
3 changes: 3 additions & 0 deletions lib/domain/repository/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,7 @@ abstract class AbstractSettingsRepository {
/// Returns the [Rect] preferences of an [OngoingCall] happening in the
/// specified [Chat].
Rect? getCallRect(ChatId id);

/// Sets the [ApplicationSettings.timelineEnabled] value.
Future<void> setTimelineEnabled(bool enabled);
}
7 changes: 7 additions & 0 deletions lib/provider/hive/application_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,11 @@ class ApplicationSettingsHiveProvider
0,
(box.get(0) ?? ApplicationSettings())..loadImages = enabled,
);

/// Stores a new [enabled] value of [ApplicationSettings.timelineEnabled]
/// to [Hive].
Future<void> setTimelineEnabled(bool enabled) => putSafe(
0,
(box.get(0) ?? ApplicationSettings())..timelineEnabled = enabled,
);
}
1 change: 1 addition & 0 deletions lib/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ enum ProfileTab {
signing,
link,
background,
chats,
calls,
media,
notifications,
Expand Down
2 changes: 2 additions & 0 deletions lib/store/chat_rx.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,8 @@ class AwaitableTimer {
_timer = Timer(d, () async {
try {
_completer.complete(await callback());
} on StateError {
// No-op, as [Future] is allowed to be completed.
} catch (e, stackTrace) {
_completer.completeError(e, stackTrace);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/store/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ class SettingsRepository extends DisposableInterface
@override
Rect? getCallRect(ChatId id) => _callRectLocal.get(id);

@override
Future<void> setTimelineEnabled(bool enabled) =>
_settingsLocal.setTimelineEnabled(enabled);

/// Initializes [MediaSettingsHiveProvider.boxEvents] subscription.
Future<void> _initMediaSubscription() async {
_mediaSubscription = StreamIterator(_mediaLocal.boxEvents);
Expand Down
41 changes: 23 additions & 18 deletions lib/ui/page/home/page/chat/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -268,24 +268,26 @@ class _ChatViewState extends State<ChatView>
],
),
body: Listener(
onPointerSignal: (s) {
if (s is PointerScrollEvent) {
if ((s.scrollDelta.dy.abs() < 3 &&
s.scrollDelta.dx.abs() > 3) ||
c.isHorizontalScroll.value) {
double value =
_animation.value + s.scrollDelta.dx / 100;
_animation.value = value.clamp(0, 1);

if (_animation.value == 0 ||
_animation.value == 1) {
_resetHorizontalScroll(c, 10.milliseconds);
} else {
_resetHorizontalScroll(c);
onPointerSignal: c.settings.value?.timelineEnabled == true
? (s) {
if (s is PointerScrollEvent) {
if ((s.scrollDelta.dy.abs() < 3 &&
s.scrollDelta.dx.abs() > 3) ||
c.isHorizontalScroll.value) {
double value =
_animation.value + s.scrollDelta.dx / 100;
_animation.value = value.clamp(0, 1);

if (_animation.value == 0 ||
_animation.value == 1) {
_resetHorizontalScroll(c, 10.milliseconds);
} else {
_resetHorizontalScroll(c);
}
}
}
}
}
}
},
: null,
onPointerPanZoomUpdate: (s) {
if (c.scrollOffset.dx.abs() < 7 &&
c.scrollOffset.dy.abs() < 7) {
Expand All @@ -309,7 +311,8 @@ class _ChatViewState extends State<ChatView>
child: RawGestureDetector(
behavior: HitTestBehavior.translucent,
gestures: {
if (c.isSelecting.isFalse)
if (c.isSelecting.isFalse &&
c.settings.value?.timelineEnabled == true)
AllowMultipleHorizontalDragGestureRecognizer:
GestureRecognizerFactoryWithHandlers<
AllowMultipleHorizontalDragGestureRecognizer>(
Expand Down Expand Up @@ -599,6 +602,7 @@ class _ChatViewState extends State<ChatView>
user: u.data,
getUser: c.getUser,
animation: _animation,
timestamp: c.settings.value?.timelineEnabled != true,
onHide: () => c.hideChatItem(e.value),
onDelete: () => c.deleteMessage(e.value),
onReply: () {
Expand Down Expand Up @@ -651,6 +655,7 @@ class _ChatViewState extends State<ChatView>
user: u.data,
getUser: c.getUser,
animation: _animation,
timestamp: c.settings.value?.timelineEnabled != true,
onHide: () async {
final List<Future> futures = [];

Expand Down
Loading