Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:grimity/presentation/album_edit/provider/album_edit_provider.dar

void showAlbumDeleteDialog(BuildContext context, WidgetRef ref, Album album) {
final alert = GdsAlert(
type: GdsAlertType.content,
size: context.isMobile ? GdsAlertSize.md : GdsAlertSize.xl,
title: '앨범을 삭제할까요?',
description: '앨범을 삭제하면\n그림은 전체 항목으로 이동돼요',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class AlbumOrganizeBodyView extends HookConsumerWidget with AlbumOrganizeMixin {
}

final alert = GdsAlert(
type: GdsAlertType.content,
size: context.isMobile ? GdsAlertSize.md : GdsAlertSize.xl,
title: '선택한 그림을 삭제할까요?',
description: '삭제 이후 되돌릴 수 없어요',
Expand Down
3 changes: 1 addition & 2 deletions lib/presentation/app_update/show_app_update_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:gds/gds.dart';
import 'package:grimity/app/update/update_factory.dart';

Future<void> showAppUpdateDialog(BuildContext context) {
final alert = GdsAlert(
type: GdsAlertType.normal,
size: context.isMobile ? GdsAlertSize.md : GdsAlertSize.xl,
title: 'Grimity 업데이트 알림',
description: '더 나은 서비스를 위해 그리미티 앱이\n업데이트 되었습니다. 최신 앱을 설치해주세요.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:grimity/domain/dto/chat_request_params.dart';

Future<T?> showDeleteChatsDialog<T>({required BuildContext context, required List<String> chatIds}) {
final alert = GdsAlert(
type: GdsAlertType.content,
size: context.isMobile ? GdsAlertSize.md : GdsAlertSize.xl,
title: '채팅방을 나가시겠어요?',
description: '지금까지 대화한 내용이 모두 사라지고\n복구가 불가능합니다.',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:gds/gds.dart';
import 'package:go_router/go_router.dart';
import 'package:grimity/app/di/di_setup.dart';
import 'package:grimity/data/data_source/remote/chat_api.dart';

Future<T?> showDeleteChatDialog<T>({required BuildContext context, required String chatId}) {
final alert = GdsAlert(
type: GdsAlertType.content,
size: context.isMobile ? GdsAlertSize.md : GdsAlertSize.xl,
title: '채팅방을 나가시겠어요?',
description: '지금까지 대화한 내용이 모두 사라지고\n복구가 불가능합니다.',
Expand Down
4 changes: 2 additions & 2 deletions lib/presentation/chat_message/view/chat_message_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gds/gds.dart';
import 'package:go_router/go_router.dart';
import 'package:grimity/app/config/app_router.dart';
import 'package:grimity/app/enum/report.enum.dart';
import 'package:grimity/presentation/chat_message/components/show_delete_chat_dialog.dart';
import 'package:grimity/presentation/chat_message/provider/chat_message_provider.dart';
import 'package:grimity/presentation/report/report_page.dart';

class ChatMessageAppBar extends ConsumerWidget {
const ChatMessageAppBar({super.key, required this.chatId});
Expand All @@ -24,7 +24,7 @@ class ChatMessageAppBar extends ConsumerWidget {
onBack: () => context.pop(),
onReport: () {
// 신고 페이지로 이동.
ReportRoute(refType: ReportRefType.chat, refId: chatId).push(context);
ReportPage.push(context, refType: ReportRefType.chat, refId: chatId);
},
onSignOut: () => showDeleteChatDialog(context: context, chatId: chatId),
);
Expand Down
3 changes: 2 additions & 1 deletion lib/presentation/comment/widget/comment_fragment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:grimity/presentation/comment/provider/comments_data_provider.dar
import 'package:grimity/presentation/common/hook/layer_link.dart';
import 'package:grimity/presentation/common/provider/user_auth_provider.dart';
import 'package:grimity/presentation/common/widget/popup/grimity_menu_popup.dart';
import 'package:grimity/presentation/report/report_page.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

class CommentFragment extends HookConsumerWidget {
Expand Down Expand Up @@ -153,7 +154,7 @@ class CommentFragment extends HookConsumerWidget {
label: '신고하기',
onTap: () {
context.pop();
ReportRoute(refType: commentType.reportRefType, refId: comment.id).push(context);
ReportPage.push(context, refId: comment.id, refType: commentType.reportRefType);
},
),
GdsMenuItem(
Expand Down
1 change: 0 additions & 1 deletion lib/presentation/common/dialog/cancel_upload_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';

Future<T?> showCancelUploadDialog<T>(BuildContext context) {
final alert = GdsAlert(
type: GdsAlertType.content,
size: context.isMobile ? GdsAlertSize.md : GdsAlertSize.xl,
title: '업로드를 취소하고 나가시겠어요?',
description: '작성한 내용들은 모두 초기화돼요',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:grimity/app/config/app_color.dart';
import 'package:grimity/app/config/app_router.dart';
import 'package:grimity/app/config/app_typeface.dart';
import 'package:grimity/app/enum/report.enum.dart';
import 'package:grimity/presentation/common/widget/grimity_gesture.dart';
import 'package:grimity/presentation/report/report_page.dart';

class GrimityModalBottomSheet extends StatelessWidget {
final List<GrimityModalButtonModel> buttons;
Expand Down Expand Up @@ -68,7 +68,7 @@ class GrimityModalButtonModel {
title: '신고하기',
onTap: () {
context.pop();
ReportRoute(refType: refType, refId: refId).push(context);
ReportPage.push(context, refId: refId, refType: refType);
},
);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/presentation/feed_detail/view/feed_content_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'package:grimity/presentation/common/widget/popup/grimity_menu_popup.dart
import 'package:grimity/presentation/common/widget/popup/grimity_share_popup.dart';
import 'package:grimity/presentation/feed_detail/widget/feed_detail_delete_dialog.dart';
import 'package:grimity/presentation/feed_detail/widget/feed_util_bar.dart';
import 'package:grimity/presentation/report/report_page.dart';

/// 피드 본문 View
class FeedContentView extends ConsumerWidget {
Expand Down Expand Up @@ -128,7 +129,7 @@ class FeedContentView extends ConsumerWidget {
label: '신고하기',
onTap: () {
context.pop();
ReportRoute(refType: ReportRefType.feed, refId: feed.id).push(context);
ReportPage.push(context, refId: feed.id, refType: ReportRefType.feed);
},
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Future<void> showDeleteFeedAlert(String feedId, BuildContext context, WidgetRef
final router = ref.read(routerProvider);

final alert = GdsAlert(
type: GdsAlertType.content,
size: context.isMobile ? GdsAlertSize.md : GdsAlertSize.xl,
title: '게시글을 삭제할까요?',
description: '삭제 이후 되돌릴 수 없어요',
Expand Down
8 changes: 8 additions & 0 deletions lib/presentation/report/provider/report_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ part 'report_provider.freezed.dart';

@riverpod
class Report extends _$Report {
bool get enabled {
final isOther = state.type == ReportType.other;
final isNotUploading = state.uploading == false;
final isContentNotEmpty = state.content?.isNotEmpty ?? false;
Comment thread
MTtankkeo marked this conversation as resolved.
Outdated

return isNotUploading && state.type != null && (isOther ? isContentNotEmpty : true);
}

@override
ReportState build(ReportRefType refType, String refId) {
return ReportState(refType: refType, refId: refId);
Expand Down
48 changes: 30 additions & 18 deletions lib/presentation/report/report_page.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gds/gds.dart';
import 'package:grimity/app/config/app_router.dart';
import 'package:grimity/app/enum/report.enum.dart';
import 'package:grimity/presentation/report/provider/report_argument_provider.dart';
import 'package:grimity/presentation/common/widget/navigation/grimity_drawer.dart';
import 'package:grimity/presentation/common/widget/navigation/grimity_title_top_navigation.dart';
import 'package:grimity/presentation/report/report_view.dart';
import 'package:grimity/presentation/report/widget/report_app_bar.dart';
import 'package:grimity/presentation/report/view/report_body_view.dart';
import 'package:grimity/presentation/report/widget/report_send_button.dart';

class ReportPage extends StatelessWidget {
final ReportRefType refType;
final String refId;
const ReportPage({
super.key,
required this.refId,
required this.refType,
});

const ReportPage({super.key, required this.refType, required this.refId});
final String refId;
final ReportRefType refType;

@override
Widget build(BuildContext context) {
return ProviderScope(
overrides: [
reportRefTypeArgumentProvider.overrideWithValue(refType),
reportRefIdArgumentProvider.overrideWithValue(refId),
],
child: ReportView(
reportAppBar: ReportAppBar(),
reportBodyView: ReportBodyView(),
reportSendButton: ReportSendButton(),
),
return GdsScaffold(
appBar: GrimityTitleTopNavigation(title: '신고하기', showIcons: false),
drawer: GrimityDrawer(),
body: ReportView(refId: refId, refType: refType, isModal: false),
);
}

static Future<T?> push<T>(
BuildContext context, {
required String refId,
required ReportRefType refType,
}) {
if (context.isMobile) {
return ReportRoute(refType: refType, refId: refId).push(context);
} else {
final child = ReportView(refId: refId, refType: refType, isModal: true);
final modal = GdsModal(title: '신고하기', body: child);

return modal.open(context);
}
}
}
24 changes: 17 additions & 7 deletions lib/presentation/report/report_view.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:grimity/app/enum/report.enum.dart';
import 'package:grimity/presentation/report/provider/report_argument_provider.dart';
import 'package:grimity/presentation/report/view/report_body_view.dart';

class ReportView extends StatelessWidget {
const ReportView({
super.key,
required this.reportAppBar,
required this.reportBodyView,
required this.reportSendButton,
required this.refId,
required this.refType,
required this.isModal,
});

final PreferredSizeWidget reportAppBar;
final Widget reportBodyView;
final Widget reportSendButton;
final String refId;
final ReportRefType refType;
final bool isModal;

@override
Widget build(BuildContext context) {
return Scaffold(appBar: reportAppBar, body: reportBodyView, bottomNavigationBar: reportSendButton);
return ProviderScope(
overrides: [
reportRefIdArgumentProvider.overrideWithValue(refId),
reportRefTypeArgumentProvider.overrideWithValue(refType),
],
child: ReportBodyView(isModal: isModal),
);
}
}
69 changes: 69 additions & 0 deletions lib/presentation/report/view/report_action_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gds/gds.dart';
import 'package:go_router/go_router.dart';
import 'package:grimity/presentation/report/provider/report_provider.dart';
import 'package:grimity/presentation/report/widget/report_confirm_alert.dart';
import 'package:grimity/presentation/report/widget/report_suceess_alert.dart';

class ReportActionView extends ConsumerWidget with ReportMixin {
const ReportActionView({
super.key,
required this.isModal,
});

final bool isModal;

@override
Widget build(BuildContext context, WidgetRef ref) {
final notifier = reportNotifier(ref);

final Widget child = Row(
mainAxisSize: MainAxisSize.min,
spacing: GdsSpacing.spacing8,
children: [
Expanded(
child: GdsOutlinedButton(
size: GdsOutlinedButtonSize.large,
text: '닫기',
expanded: true,
onPressed: context.pop,
),
),
Expanded(
child: GdsSolidButton(
size: GdsSolidButtonSize.large,
text: '신고하기',
enabled: notifier.enabled,
expanded: true,
onPressed: () async {
final isAgreed = await showConfirmReportAlert(context);

// 사용자가 신고하는 것을 최종적으로 동의한 경우
if (isAgreed ?? false) {
final isSucceeded = await notifier.sendReport();

// 사용자가 신고에 최종적으로 성공한 경우
if (isSucceeded && context.mounted) {
showSuccessReportAlert(context);
}
}
},
),
),
],
);

if (isModal) return child;

return Padding(
padding: EdgeInsets.only(
top: GdsSpacing.spacing8,
left: GdsSpacing.spacing16,
right: GdsSpacing.spacing16,
bottom: GdsSpacing.spacing24,
),
child: child,
);
}
}
Loading
Loading