Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into feature/improve-…
Browse files Browse the repository at this point in the history
…spoiler-title
  • Loading branch information
micahmo committed Jan 11, 2024
2 parents 99ee16b + 7045082 commit 375dd0f
Show file tree
Hide file tree
Showing 9 changed files with 406 additions and 383 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
- Added ability to subscribe/unsubscribe to community from long press action on posts
- Added option to hide top app bar on scroll

## Changed
- Small UI adjustments for account switcher

### Fixed
- Fixed issue where Thunder was being locked to 60Hz on 120Hz displays on Android
- Fixed issue where subscriptions list in drawer is not respecting alphabetical order
- Fixed issue where long-pressing bottom navigation account icon would not open account switcher

## 0.2.7 - 2024-01-03
## Added
Expand Down
3 changes: 2 additions & 1 deletion lib/account/utils/profiles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ void showProfileModalSheet(BuildContext context, {bool showLogoutDialog = false}
ThunderBloc thunderBloc = context.read<ThunderBloc>();

showModalBottomSheet(
elevation: 0,
isScrollControlled: true,
context: context,
showDragHandle: true,
Expand All @@ -21,7 +22,7 @@ void showProfileModalSheet(BuildContext context, {bool showLogoutDialog = false}
BlocProvider.value(value: thunderBloc),
],
child: FractionallySizedBox(
heightFactor: 0.9,
heightFactor: 0.8,
child: ProfileModalBody(showLogoutDialog: showLogoutDialog),
),
);
Expand Down
691 changes: 333 additions & 358 deletions lib/account/widgets/profile_modal_body.dart

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/community/pages/create_post_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class _CreatePostPageState extends State<CreatePostPage> {
_titleTextController.text = widget.title ?? '';
_bodyTextController.text = widget.text ?? '';
_urlTextController.text = widget.url ?? '';
_getDataFromLink();
_getDataFromLink(updateTitleField: _titleTextController.text.isEmpty);

if (widget.image != null) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
Expand Down
10 changes: 8 additions & 2 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"@accessibility": {},
"accessibilityProfilesDescription": "Accessibility profiles allows applying several settings at once to accommodate a particular accessibility requirement.",
"@accessibilityProfilesDescription": {},
"account": "Account",
"@account": {},
"account": "{count, plural, zero {Account} one {Account} other {Accounts} } ",
"@account": {
"description": "Describes the user account"
},
"accountSettings": "Account Settings",
"@accountSettings": {},
"actions": "Actions",
Expand Down Expand Up @@ -247,6 +249,10 @@
"@creator": {
"description": "The creator filter for searches."
},
"crossPostedFrom": "cross-posted from: {postUrl}",
"@crossPostedFrom": {
"description": "Initial heading for text-based cross-post"
},
"crossPostedTo": "Cross-posted to",
"@crossPostedTo": {},
"currentLongPress": "Currently set as long press",
Expand Down
20 changes: 20 additions & 0 deletions lib/post/pages/post_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import 'package:thunder/post/pages/post_page_success.dart';
import 'package:thunder/post/pages/create_comment_page.dart';
import 'package:thunder/shared/comment_navigator_fab.dart';
import 'package:thunder/shared/comment_sort_picker.dart';
import 'package:thunder/shared/cross_posts.dart';
import 'package:thunder/shared/error_message.dart';
import 'package:thunder/shared/input_dialogs.dart';
import 'package:thunder/shared/snackbar.dart';
Expand Down Expand Up @@ -201,6 +202,25 @@ class _PostPageState extends State<PostPage> {
showSortBottomSheet(context, state);
},
),
PopupMenuButton(
itemBuilder: (context) => [
PopupMenuItem(
onTap: () => createCrossPost(
context,
title: widget.postView?.postView.post.name ?? '',
url: widget.postView?.postView.post.url,
text: widget.postView?.postView.post.body,
postUrl: widget.postView?.postView.post.apId,
),
child: ListTile(
dense: true,
horizontalTitleGap: 5,
leading: const Icon(Icons.repeat_rounded, size: 20),
title: Text(l10n.createNewCrossPost),
),
),
],
),
],
centerTitle: false,
toolbarHeight: 70.0,
Expand Down
2 changes: 1 addition & 1 deletion lib/settings/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SettingsPage extends StatelessWidget {
SettingTopic(title: l10n.gestures, icon: Icons.swipe, path: '/settings/gestures'),
SettingTopic(title: l10n.floatingActionButton, icon: Icons.settings_applications_rounded, path: '/settings/fab'),
SettingTopic(title: l10n.accessibility, icon: Icons.accessibility, path: '/settings/accessibility'),
SettingTopic(title: l10n.account, icon: Icons.person_rounded, path: '/settings/account'),
SettingTopic(title: l10n.account(0), icon: Icons.person_rounded, path: '/settings/account'),
SettingTopic(title: l10n.about, icon: Icons.info_rounded, path: '/settings/about'),
SettingTopic(title: l10n.debug, icon: Icons.developer_mode_rounded, path: '/settings/debug'),
];
Expand Down
30 changes: 22 additions & 8 deletions lib/shared/cross_posts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,7 @@ class _CrossPostsState extends State<CrossPosts> with SingleTickerProviderStateM
),
widget.isNewPost != true
? InkWell(
onTap: () async {
await navigateToCreatePostPage(
context,
title: widget.originalPost!.postView.post.name,
url: widget.originalPost!.postView.post.url,
prePopulated: true,
);
},
onTap: () => createCrossPost(context, title: widget.originalPost!.postView.post.name, url: widget.originalPost!.postView.post.url),
borderRadius: BorderRadius.circular(10),
child: Padding(
padding: const EdgeInsets.all(5),
Expand All @@ -198,3 +191,24 @@ class _CrossPostsState extends State<CrossPosts> with SingleTickerProviderStateM
);
}
}

void createCrossPost(BuildContext context, {required String title, String? url, String? text, String? postUrl}) async {
assert((text == null) == (postUrl == null));

final AppLocalizations l10n = AppLocalizations.of(context)!;

if (url?.isNotEmpty == true) {
text = null;
} else {
final String? quotedText = text?.split('\n').map((value) => '> $value\n').join();
text = "${l10n.crossPostedFrom(postUrl ?? '')}\n\n$quotedText";
}

await navigateToCreatePostPage(
context,
title: title,
url: url,
text: text,
prePopulated: true,
);
}
27 changes: 15 additions & 12 deletions lib/thunder/widgets/bottom_nav_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class _CustomBottomNavigationBarState extends State<CustomBottomNavigationBar> {

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final theme = Theme.of(context);

final ThunderState state = context.watch<ThunderBloc>().state;
Expand All @@ -100,32 +101,34 @@ class _CustomBottomNavigationBarState extends State<CustomBottomNavigationBar> {
destinations: [
NavigationDestination(
icon: const Icon(Icons.dashboard_rounded),
label: AppLocalizations.of(context)!.feed,
label: l10n.feed,
),
NavigationDestination(
icon: const Icon(Icons.search_rounded),
label: AppLocalizations.of(context)!.search,
label: l10n.search,
),
NavigationDestination(
icon: GestureDetector(
onLongPress: () {
HapticFeedback.mediumImpact();
showProfileModalSheet(context);
},
child: const Icon(Icons.person_rounded)),
label: AppLocalizations.of(context)!.account,
GestureDetector(
onLongPress: () {
HapticFeedback.mediumImpact();
showProfileModalSheet(context);
},
child: NavigationDestination(
icon: const Icon(Icons.person_rounded),
label: l10n.account(1),
tooltip: '', // Disable tooltip so that gesture detector triggers properly
),
),
NavigationDestination(
icon: Badge(
isLabelVisible: inboxState.totalUnreadCount != 0,
label: Text(inboxState.totalUnreadCount > 99 ? '99+' : inboxState.totalUnreadCount.toString()),
child: const Icon(Icons.inbox_rounded),
),
label: AppLocalizations.of(context)!.inbox,
label: l10n.inbox,
),
NavigationDestination(
icon: const Icon(Icons.settings_rounded),
label: AppLocalizations.of(context)!.settings,
label: l10n.settings,
),
],
onDestinationSelected: (index) {
Expand Down

0 comments on commit 375dd0f

Please sign in to comment.