Skip to content

Commit

Permalink
Merge branch '0.2.7' of github.com:thunder-app/thunder into feature/c…
Browse files Browse the repository at this point in the history
…ollapse-post
  • Loading branch information
hjiangsu committed Nov 21, 2023
2 parents e2ab406 + 9a31358 commit 5f6db69
Show file tree
Hide file tree
Showing 42 changed files with 1,217 additions and 298 deletions.
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug report
about: Create a report to help us improve
name: Bug Report
about: Noticed a bug with Thunder? Create a report
title: ''
labels: 'bug'
assignees: ''
Expand All @@ -13,7 +13,7 @@ A clear and concise description of what the bug is.
**How to Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
2. Tap on '....'
3. Scroll down to '....'
4. See error

Expand All @@ -24,9 +24,9 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Device & App Version:**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Version [e.g. 22]
- Device: [e.g. Pixel 8, iPhone 13 Pro]
- OS: [e.g. Android 13, iOS 17.2]
- App Version [e.g. 0.2.5]

**Additional Context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## Unreleased
### Fixed
- Fixed rendering issues with markdown link parsing
- Fixed issue where TOTP token was not sent properly

## 0.2.5+25 - 2023-11-15
### Added
- Improved account switching logic - contribution from @micahmo
- Added anonymous browsing mode for any instance - contribution from @micahmo
Expand Down
682 changes: 661 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/account/pages/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class _LoginPageState extends State<LoginPage> with SingleTickerProviderStateMix
instanceError = AppLocalizations.of(context)!.instanceHasAlreadyBenAdded(currentInstance ?? '');
});
} else {
context.read<AuthBloc>().add(LogOutOfAllAccounts());
context.read<AuthBloc>().add(const LogOutOfAllAccounts());
context.read<ThunderBloc>().add(OnAddAnonymousInstance(_instanceTextEditingController.text));
context.read<ThunderBloc>().add(OnSetCurrentAnonymousInstance(_instanceTextEditingController.text));
widget.popRegister();
Expand Down
2 changes: 1 addition & 1 deletion lib/account/widgets/profile_modal_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class _ProfileSelectState extends State<ProfileSelect> {
onTap: (currentAccountId == null && currentAnonymousInstance == anonymousInstances![realIndex].instance)
? null
: () async {
context.read<AuthBloc>().add(LogOutOfAllAccounts());
context.read<AuthBloc>().add(const LogOutOfAllAccounts());
context.read<ThunderBloc>().add(OnSetCurrentAnonymousInstance(anonymousInstances![realIndex].instance));
context.read<AuthBloc>().add(InstanceChanged(instance: anonymousInstances![realIndex].instance));
context.pop();
Expand Down
2 changes: 0 additions & 2 deletions lib/community/widgets/post_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import 'package:thunder/thunder/bloc/thunder_bloc.dart';
import 'package:thunder/utils/navigate_post.dart';
import 'package:thunder/utils/swipe.dart';

import '../../user/bloc/user_bloc.dart';

class PostCard extends StatefulWidget {
final PostViewMedia postViewMedia;
final bool communityMode;
Expand Down
6 changes: 3 additions & 3 deletions lib/community/widgets/post_card_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import 'package:lemmy_api_client/v3.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';

import 'package:thunder/core/enums/font_scale.dart';
import 'package:thunder/community/bloc/community_bloc_old.dart';
import 'package:thunder/community/widgets/post_card.dart';
import 'package:thunder/core/models/post_view_media.dart';
import 'package:thunder/shared/text/scalable_text.dart';
import 'package:thunder/thunder/bloc/thunder_bloc.dart';
import 'package:thunder/user/bloc/user_bloc.dart';

Expand Down Expand Up @@ -135,11 +135,11 @@ class _PostCardListState extends State<PostCardList> {
Container(
color: theme.dividerColor.withOpacity(0.1),
padding: const EdgeInsets.symmetric(vertical: 32.0),
child: Text(
child: ScalableText(
'Hmmm. It seems like you\'ve reached the bottom.',
textAlign: TextAlign.center,
style: theme.textTheme.titleSmall,
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
fontScale: state.metadataFontSizeScale,
),
),
const SizedBox(
Expand Down
47 changes: 16 additions & 31 deletions lib/community/widgets/post_card_metadata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lemmy_api_client/v3.dart';

import 'package:thunder/core/enums/font_scale.dart';
import 'package:thunder/feed/feed.dart';
import 'package:thunder/feed/utils/utils.dart';
import 'package:thunder/shared/community_icon.dart';
import 'package:thunder/shared/icon_text.dart';
import 'package:thunder/shared/text/scalable_text.dart';
import 'package:thunder/thunder/bloc/thunder_bloc.dart';
import 'package:thunder/utils/date_time.dart';
import 'package:thunder/utils/instance.dart';
Expand Down Expand Up @@ -55,7 +54,7 @@ class PostCardMetaData extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
IconText(
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
fontScale: state.metadataFontSizeScale,
text: formatNumberToK(score),
textColor: voteType == 1
? upVoteColor
Expand All @@ -73,7 +72,7 @@ class PostCardMetaData extends StatelessWidget {
),
const SizedBox(width: 10.0),
IconText(
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
fontScale: state.metadataFontSizeScale,
icon: Icon(
/*unreadComments != 0 && unreadComments != comments ? Icons.mark_unread_chat_alt_rounded :*/ Icons.chat,
size: 15.0,
Expand All @@ -88,7 +87,7 @@ class PostCardMetaData extends StatelessWidget {
),
const SizedBox(width: 10.0),
IconText(
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
fontScale: state.metadataFontSizeScale,
icon: Icon(
hasBeenEdited ? Icons.edit : Icons.history_rounded,
size: 15.0,
Expand All @@ -107,7 +106,7 @@ class PostCardMetaData extends StatelessWidget {
message: hostURL,
preferBelow: false,
child: IconText(
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
fontScale: state.metadataFontSizeScale,
icon: Icon(
Icons.public,
size: 15.0,
Expand Down Expand Up @@ -160,26 +159,8 @@ class PostViewMetaData extends StatelessWidget {
Row(
mainAxisSize: MainAxisSize.min,
children: [
/*Container(
child: unreadComments != 0 && unreadComments != comments ? Row(
children: [
IconText(
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
icon: Icon(
Icons.mark_unread_chat_alt_rounded,
size: 17.0,
color: theme.primaryColor,
),
text: '+${formatNumberToK(unreadComments)}',
textColor: theme.primaryColor,
padding: 5.0,
),
const SizedBox(width: 10.0),
],
) : null,
),*/
IconText(
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
fontScale: state.metadataFontSizeScale,
icon: Icon(
Icons.chat,
size: 17.0,
Expand All @@ -191,7 +172,7 @@ class PostViewMetaData extends StatelessWidget {
),
const SizedBox(width: 10.0),
IconText(
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
fontScale: state.metadataFontSizeScale,
icon: Icon(
hasBeenEdited ? Icons.refresh_rounded : Icons.history_rounded,
size: 19.0,
Expand Down Expand Up @@ -261,11 +242,15 @@ class PostCommunityAndAuthor extends StatelessWidget {
InkWell(
borderRadius: BorderRadius.circular(6),
onTap: (compactMode && !state.tappableAuthorCommunity) ? null : () => navigateToUserPage(context, userId: postView.creator.id),
child: Text('$creatorName', textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor, style: textStyleAuthor)),
child: ScalableText(
'$creatorName',
fontScale: state.metadataFontSizeScale,
style: textStyleAuthor,
)),
if (!communityMode)
Text(
ScalableText(
' to ',
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
fontScale: state.metadataFontSizeScale,
style: theme.textTheme.bodyMedium?.copyWith(
color: theme.textTheme.bodyMedium?.color?.withOpacity(0.4),
),
Expand All @@ -279,9 +264,9 @@ class PostCommunityAndAuthor extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
if (!communityMode)
Text(
ScalableText(
'${postView.community.name} · ${fetchInstanceNameFromUrl(postView.community.actorId)}',
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
fontScale: state.metadataFontSizeScale,
style: textStyleCommunity,
),
if (showCommunitySubscription)
Expand Down
2 changes: 1 addition & 1 deletion lib/community/widgets/post_card_type_badge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TypeBadge extends StatelessWidget {
left: 2.5,
top: 2.5,
),
child: postViewMedia == null || postViewMedia.media.isEmpty
child: postViewMedia.media.isEmpty
? Material(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(4),
Expand Down
10 changes: 5 additions & 5 deletions lib/community/widgets/post_card_view_comfortable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import 'package:thunder/community/widgets/post_card_metadata.dart';
import 'package:thunder/core/enums/font_scale.dart';
import 'package:thunder/core/models/post_view_media.dart';
import 'package:thunder/core/theme/bloc/theme_bloc.dart';
import 'package:thunder/feed/bloc/feed_bloc.dart';
import 'package:thunder/shared/media_view.dart';
import 'package:thunder/shared/text/scalable_text.dart';
import 'package:thunder/thunder/bloc/thunder_bloc.dart';

class PostCardViewComfortable extends StatelessWidget {
Expand Down Expand Up @@ -150,7 +150,7 @@ class PostCardViewComfortable extends StatelessWidget {
),
],
),
textScaleFactor: MediaQuery.of(context).textScaleFactor * textScaleFactor,
textScaler: TextScaler.linear(textScaleFactor),
),
),
if (postViewMedia.media.isNotEmpty && edgeToEdgeImages)
Expand Down Expand Up @@ -211,17 +211,17 @@ class PostCardViewComfortable extends StatelessWidget {
),
],
),
textScaleFactor: MediaQuery.of(context).textScaleFactor * textScaleFactor,
textScaler: TextScaler.linear(textScaleFactor),
)),
Visibility(
visible: showTextContent && textContent.isNotEmpty,
child: Padding(
padding: const EdgeInsets.only(bottom: 6.0, left: 12.0, right: 12.0),
child: Text(
child: ScalableText(
textContent,
maxLines: 4,
overflow: TextOverflow.ellipsis,
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.contentFontSizeScale.textScaleFactor,
fontScale: state.contentFontSizeScale,
style: theme.textTheme.bodyMedium?.copyWith(
color: readColor,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/community/widgets/post_card_view_compact.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class PostCardViewCompact extends StatelessWidget {
),
],
),
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.titleFontSizeScale.textScaleFactor,
textScaler: TextScaler.linear(state.titleFontSizeScale.textScaleFactor),
),
const SizedBox(height: 6.0),
PostCommunityAndAuthor(
Expand Down
6 changes: 3 additions & 3 deletions lib/feed/view/feed_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:thunder/community/bloc/community_bloc.dart';
import 'package:thunder/community/widgets/community_header.dart';
import 'package:thunder/community/widgets/community_sidebar.dart';
import 'package:thunder/core/auth/bloc/auth_bloc.dart';
import 'package:thunder/core/enums/font_scale.dart';
import 'package:thunder/core/models/post_view_media.dart';
import 'package:thunder/core/singletons/lemmy_client.dart';
import 'package:thunder/feed/bloc/feed_bloc.dart';
Expand All @@ -25,6 +24,7 @@ import 'package:thunder/feed/widgets/feed_page_app_bar.dart';
import 'package:thunder/instance/bloc/instance_bloc.dart';
import 'package:thunder/shared/common_markdown_body.dart';
import 'package:thunder/shared/snackbar.dart';
import 'package:thunder/shared/text/scalable_text.dart';
import 'package:thunder/thunder/bloc/thunder_bloc.dart';
import 'package:thunder/utils/cache.dart';

Expand Down Expand Up @@ -558,11 +558,11 @@ class FeedReachedEnd extends StatelessWidget {
Container(
color: theme.dividerColor.withOpacity(0.1),
padding: const EdgeInsets.symmetric(vertical: 32.0),
child: Text(
child: ScalableText(
'Hmmm. It seems like you\'ve reached the bottom.',
textAlign: TextAlign.center,
style: theme.textTheme.titleSmall,
textScaleFactor: MediaQuery.of(context).textScaleFactor * state.metadataFontSizeScale.textScaleFactor,
fontScale: state.metadataFontSizeScale,
),
),
const SizedBox(height: 160)
Expand Down
4 changes: 3 additions & 1 deletion lib/feed/view/feed_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:thunder/core/models/post_view_media.dart';
import 'package:thunder/feed/bloc/feed_bloc.dart';
import 'package:thunder/feed/view/feed_page.dart';
import 'package:thunder/post/enums/post_action.dart';
import 'package:thunder/thunder/bloc/thunder_bloc.dart';

class FeedPostList extends StatelessWidget {
final bool tabletMode;
Expand All @@ -21,6 +22,7 @@ class FeedPostList extends StatelessWidget {

@override
Widget build(BuildContext context) {
final ThunderState thunderState = context.read<ThunderBloc>().state;
final FeedState state = context.read<FeedBloc>().state;

// Widget representing the list of posts on the feed
Expand Down Expand Up @@ -66,7 +68,7 @@ class FeedPostList extends StatelessWidget {
context.read<FeedBloc>().add(FeedItemActionedEvent(postId: postViewMedias[index].postView.post.id, postAction: PostAction.read, value: read));
},
listingType: state.postListingType,
indicateRead: true,
indicateRead: thunderState.dimReadPosts,
)
: null,
);
Expand Down
1 change: 0 additions & 1 deletion lib/feed/widgets/feed_fab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import 'package:thunder/shared/gesture_fab.dart';
import 'package:thunder/shared/snackbar.dart';
import 'package:thunder/shared/sort_picker.dart';
import 'package:thunder/thunder/bloc/thunder_bloc.dart';
import 'package:thunder/thunder/thunder_icons.dart';

class FeedFAB extends StatelessWidget {
const FeedFAB({super.key, this.heroTag});
Expand Down
2 changes: 1 addition & 1 deletion lib/globals.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const String currentVersion = '0.2.5-4+24';
const String currentVersion = '0.2.6-2+27';
1 change: 0 additions & 1 deletion lib/inbox/widgets/inbox_replies_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class _InboxRepliesViewState extends State<InboxRepliesView> {
@override
Widget build(BuildContext context) {
final DateTime now = DateTime.now().toUtc();
final theme = Theme.of(context);

if (widget.replies.isEmpty) {
return Align(alignment: Alignment.topCenter, heightFactor: (MediaQuery.of(context).size.height / 27), child: const Text('No replies'));
Expand Down
2 changes: 1 addition & 1 deletion lib/post/bloc/post_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ class PostBloc extends Bloc<PostEvent, PostState> {

return emit(
state.copyWith(status: PostStatus.success, comments: state.comments, moddingCommentId: -1, selectedCommentId: state.selectedCommentId, selectedCommentPath: state.selectedCommentPath));
} catch (e, s) {
} catch (e) {
return emit(state.copyWith(status: PostStatus.failure, errorMessage: e.toString(), moddingCommentId: -1));
}
}
Expand Down
7 changes: 3 additions & 4 deletions lib/post/pages/create_comment_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ import 'package:markdown_editable_textinput/markdown_buttons.dart';
import 'package:markdown_editable_textinput/markdown_text_input_field.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:thunder/community/bloc/image_bloc.dart';
import 'package:thunder/core/enums/font_scale.dart';

import 'package:thunder/core/models/comment_view_tree.dart';
import 'package:thunder/core/models/post_view_media.dart';
import 'package:thunder/inbox/bloc/inbox_bloc.dart';
import 'package:thunder/post/bloc/post_bloc.dart';
import 'package:thunder/shared/common_markdown_body.dart';
import 'package:thunder/shared/input_dialogs.dart';
import 'package:thunder/shared/media_view.dart';
import 'package:thunder/shared/snackbar.dart';
import 'package:thunder/shared/text/scalable_text.dart';
import 'package:thunder/thunder/bloc/thunder_bloc.dart';
import 'package:thunder/user/widgets/user_indicator.dart';
import 'package:thunder/utils/image.dart';
Expand Down Expand Up @@ -274,9 +273,9 @@ class _CreateCommentPageState extends State<CreateCommentPage> {
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Text(
child: ScalableText(
widget.postView?.postView.post.name ?? '',
textScaleFactor: MediaQuery.of(context).textScaleFactor * thunderState.titleFontSizeScale.textScaleFactor,
fontScale: thunderState.titleFontSizeScale,
style: theme.textTheme.titleMedium,
),
),
Expand Down
Loading

0 comments on commit 5f6db69

Please sign in to comment.