Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
25 changes: 5 additions & 20 deletions client/deepdame/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "f6ff1529fd6d8af5f706051d9251ac9231c83407"
revision: "00b0c91f06209d9e4a41f71b7a512d6eb3b9c694"
channel: "stable"

project_type: app
Expand All @@ -13,26 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
- platform: android
create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
- platform: ios
create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
- platform: linux
create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
- platform: macos
create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
create_revision: 00b0c91f06209d9e4a41f71b7a512d6eb3b9c694
base_revision: 00b0c91f06209d9e4a41f71b7a512d6eb3b9c694
- platform: web
create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
- platform: windows
create_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
base_revision: f6ff1529fd6d8af5f706051d9251ac9231c83407
create_revision: 00b0c91f06209d9e4a41f71b7a512d6eb3b9c694
base_revision: 00b0c91f06209d9e4a41f71b7a512d6eb3b9c694

# User provided section

Expand Down
217 changes: 100 additions & 117 deletions client/deepdame/lib/features/banned/banned_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:deepdame/core/theme/themes/extensions/status_pill_colors.dart';
import 'package:deepdame/features/auth/application/auth_controller.dart';
import 'package:deepdame/features/shader/swirl_background.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
Expand All @@ -9,150 +9,133 @@ class BannedScreen extends ConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
final cs = Theme.of(context).colorScheme;

final statusColors = Theme.of(
context,
).extension<StatusPillColors>()?.banned;
final banColor = statusColors?.text ?? const Color(0xFFDC2626);
final banBgColor = statusColors?.background ?? const Color(0xFFFEE2E2);

return PopScope(
canPop: false,
child: Scaffold(
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 96,
height: 96,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: banBgColor,
),
child: Icon(
Icons.block_rounded,
size: 48,
color: banColor,
body: SwirlBackground(
variant: SwirlVariant.error,
child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 96,
height: 96,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
),
child: const Icon(
Icons.block_rounded,
size: 48,
color: Colors.red,
),
),
),

const SizedBox(height: 28),
const SizedBox(height: 28),

Text(
'Account banned',
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.w800,
color: banColor,
const Text(
'Account banned',
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.w800,
color: Colors.white,
),
textAlign: TextAlign.center,
),
textAlign: TextAlign.center,
),

const SizedBox(height: 12),
const SizedBox(height: 12),

Text(
'Your account has been suspended by an administrator. '
'If you believe this is a mistake, please contact support.',
style: TextStyle(
fontSize: 15,
color: cs.onSurface.withValues(alpha: 0.6),
height: 1.5,
Text(
'Your account has been suspended by an administrator. '
'If you believe this is a mistake, please contact support.',
style: TextStyle(
fontSize: 15,
color: Colors.white.withValues(alpha: 0.8),
height: 1.5,
),
textAlign: TextAlign.center,
),
textAlign: TextAlign.center,
),

const SizedBox(height: 28),
const SizedBox(height: 28),

Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
),
decoration: BoxDecoration(
color: cs.surface,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: cs.outline.withValues(alpha: 0.2),
Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Reason',
style: TextStyle(
fontSize: 12,
color: cs.onSurface.withValues(alpha: 0.5),
),
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: Colors.white.withValues(alpha: 0.25),
),
const SizedBox(height: 4),
Text(
'Violation of community guidelines',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
color: cs.onSurface,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Reason',
style: TextStyle(
fontSize: 12,
color: Colors.white.withValues(alpha: 0.6),
),
),
),
],
const SizedBox(height: 4),
const Text(
'Violation of community guidelines',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
],
),
),
),

const SizedBox(height: 32),
const SizedBox(height: 32),

SizedBox(
width: double.infinity,
child: OutlinedButton(
onPressed: () {},
style: OutlinedButton.styleFrom(
side: BorderSide(
color: cs.outline.withValues(alpha: 0.4),
),
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () => _signOut(context, ref),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
foregroundColor: Colors.black87,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
child: const Text(
'Contact support',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
child: const Text(
'Sign out',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.red,
),
),
),
),
),

const SizedBox(height: 12),
const SizedBox(height: 4),

SizedBox(
width: double.infinity,
child: OutlinedButton(
onPressed: () => _signOut(context, ref),
style: OutlinedButton.styleFrom(
side: BorderSide(
color: cs.outline.withValues(alpha: 0.4),
),
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
TextButton(
onPressed: () {},
style: TextButton.styleFrom(
foregroundColor: Colors.white.withValues(alpha: 0.6),
),
child: const Text(
'Sign out',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
'Contact support',
style: TextStyle(fontSize: 14),
),
),
),
],
],
),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public ResponseEntity<?> register(@RequestBody @Valid RegisterRequest request) {
@PostMapping("/logout")
public ResponseEntity<?> logout(@AuthenticationPrincipal CustomUserDetails principal) {
userService.logout(principal.getUser().getId());
userService.revokeDeviceToken(principal.getUser().getId());

return ResponseEntity.ok()
.header(HttpHeaders.SET_COOKIE, CookieUtils.genCookie("access_token", "", 0, "/").toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ public interface UserService extends CrudDtoService<UUID, UserDto> {
void updateImageUrl(UUID id, String imageUrl);
void updateDeviceToken(UUID id, String token);
String getDeviceToken(UUID id);
void revokeDeviceToken(UUID id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,9 @@ public void updateDeviceToken(UUID id, String token) {
public String getDeviceToken(UUID id) {
return userRepository.getDeviceTokenById(id);
}

@Override
public void revokeDeviceToken(UUID id) {
userRepository.updateDeviceToken(id, null);
}
}
Loading