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
7 changes: 7 additions & 0 deletions client/deepdame/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ PODS:
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/darwin`)
Expand All @@ -84,6 +87,7 @@ DEPENDENCIES:
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)

SPEC REPOS:
trunk:
Expand Down Expand Up @@ -112,6 +116,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker_ios/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite_darwin:
:path: ".symlinks/plugins/sqflite_darwin/darwin"

SPEC CHECKSUMS:
audioplayers_darwin: 835ced6edd4c9fc8ebb0a7cc9e294a91d99917d5
Expand All @@ -130,6 +136,7 @@ SPEC CHECKSUMS:
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0

PODFILE CHECKSUM: 1857a7cdb7dfafe45f2b0e9a9af44644190f7506

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:deepdame/features/home/data/models/open_game.dart';
import 'package:deepdame/features/home/presentation/providers/lobby_provider.dart';
import 'package:deepdame/features/home/presentation/widgets/empty_state.dart';
Expand Down Expand Up @@ -210,6 +211,7 @@ class _AvatarStack extends StatelessWidget {

final count = games.length;
final totalWidth = size + (count - 1) * step;
final pixelSize = (size * MediaQuery.of(context).devicePixelRatio).round();

return SizedBox(
width: totalWidth,
Expand All @@ -224,6 +226,7 @@ class _AvatarStack extends StatelessWidget {
size,
borderWidth,
borderColor,
pixelSize,
),
),
],
Expand All @@ -236,6 +239,7 @@ class _AvatarStack extends StatelessWidget {
double size,
double borderWidth,
Color borderColor,
int pixelSize,
) {
final hasImage =
game.host.imageUrl != null && game.host.imageUrl!.isNotEmpty;
Expand All @@ -252,10 +256,14 @@ class _AvatarStack extends StatelessWidget {
),
child: ClipOval(
child: hasImage
? Image.network(
game.host.imageUrl!,
? CachedNetworkImage(
imageUrl: game.host.imageUrl!,
fit: BoxFit.cover,
errorBuilder: (_, _, _) => _InitialsWidget(
fadeInDuration: Duration.zero,
fadeOutDuration: Duration.zero,
memCacheWidth: pixelSize,
memCacheHeight: pixelSize,
errorWidget: (_, _, _) => _InitialsWidget(
initials: initials,
size: size,
),
Expand Down
23 changes: 17 additions & 6 deletions client/deepdame/lib/features/onboarding/onboarding_screen.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import 'dart:async';

import 'package:deepdame/core/routing/app_router.dart';
import 'package:deepdame/core/storage/storage_providers.dart';
import 'package:deepdame/features/shader/swirl_background.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class OnboardingScreen extends StatefulWidget {
class OnboardingScreen extends ConsumerStatefulWidget {
const OnboardingScreen({super.key});

@override
State<OnboardingScreen> createState() => _OnboardingScreenState();
ConsumerState<OnboardingScreen> createState() => _OnboardingScreenState();
}

class _OnboardingScreenState extends State<OnboardingScreen>
class _OnboardingScreenState extends ConsumerState<OnboardingScreen>
with SingleTickerProviderStateMixin {
final PageController _pageController = PageController();
int _currentPage = 0;
Expand Down Expand Up @@ -58,6 +60,13 @@ class _OnboardingScreenState extends State<OnboardingScreen>
});
}

Future<void> _completeOnboarding(String routeName) async {
await ref
.read(sharedPreferencesProvider)
.setBool('has_seen_onboarding', true);
if (mounted) appRouter.goNamed(routeName);
}

void _nextPage() {
if (_currentPage < _slides.length - 1) {
unawaited(
Expand All @@ -67,7 +76,7 @@ class _OnboardingScreenState extends State<OnboardingScreen>
),
);
} else {
appRouter.goNamed('register');
unawaited(_completeOnboarding('register'));
}
}

Expand Down Expand Up @@ -98,7 +107,8 @@ class _OnboardingScreenState extends State<OnboardingScreen>
child: Padding(
padding: const EdgeInsets.only(top: 8, right: 16),
child: TextButton(
onPressed: () => appRouter.goNamed('register'),
onPressed: () =>
unawaited(_completeOnboarding('register')),
child: Text(
'Skip',
style: TextStyle(
Expand Down Expand Up @@ -140,7 +150,8 @@ class _OnboardingScreenState extends State<OnboardingScreen>
const SizedBox(height: 12),
_OutlinedButton(
label: 'I already have an account',
onPressed: () => appRouter.goNamed('login'),
onPressed: () =>
unawaited(_completeOnboarding('login')),
scheme: scheme,
),
],
Expand Down
11 changes: 10 additions & 1 deletion client/deepdame/lib/features/splash/splash_screen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';

import 'package:deepdame/core/network/stomp_service.dart';
import 'package:deepdame/core/storage/storage_providers.dart';
import 'package:deepdame/features/shader/swirl_shader_provider.dart';
import 'package:deepdame/features/user/infrastructure/user_repository.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -40,6 +41,14 @@ class _SplashScreenState extends ConsumerState<SplashScreen>
}

Future<void> _checkAuth() async {
final prefs = ref.read(sharedPreferencesProvider);
final hasSeenOnboarding = prefs.getBool('has_seen_onboarding') ?? false;

if (!hasSeenOnboarding) {
if (mounted) context.goNamed('onboarding');
return;
}

try {
final userFuture = ref.read(userRepositoryProvider).getCurrentUser();
final shaderFuture = ref.read(swirlShaderProvider.future);
Expand All @@ -53,7 +62,7 @@ class _SplashScreenState extends ConsumerState<SplashScreen>
unawaited(ref.read(stompServiceProvider).connect());
context.goNamed('home');
} on Exception catch (_) {
if (mounted) context.goNamed('onboarding');
if (mounted) context.goNamed('login');
}
}

Expand Down
25 changes: 14 additions & 11 deletions client/deepdame/lib/shared/profile_icon.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

class ProfileIcon extends StatelessWidget {
Expand Down Expand Up @@ -43,6 +44,7 @@ class ProfileIcon extends StatelessWidget {
Widget build(BuildContext context) {
final bgColor = _avatarColorFor(username);
final initials = _initialsFor(username);
final pixelSize = (size * MediaQuery.of(context).devicePixelRatio).round();

final initialsWidget = Text(
initials,
Expand All @@ -67,18 +69,19 @@ class ProfileIcon extends StatelessWidget {
child: SizedBox(
width: size,
height: size,
child: Image.network(
imageUrl!,
child: CachedNetworkImage(
imageUrl: imageUrl!,
fit: BoxFit.cover,
loadingBuilder: (context, child, progress) {
if (progress == null) return child;
return CircleAvatar(
radius: size / 2,
backgroundColor: bgColor,
child: initialsWidget,
);
},
errorBuilder: (context, error, stackTrace) {
fadeInDuration: Duration.zero,
fadeOutDuration: Duration.zero,
memCacheWidth: pixelSize,
memCacheHeight: pixelSize,
placeholder: (context, url) => CircleAvatar(
radius: size / 2,
backgroundColor: bgColor,
child: initialsWidget,
),
errorWidget: (context, url, error) {
debugPrint('ProfileIcon: image failed for $username — $error');
return CircleAvatar(
radius: size / 2,
Expand Down
2 changes: 2 additions & 0 deletions client/deepdame/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import firebase_core
import firebase_messaging
import flutter_local_notifications
import shared_preferences_foundation
import sqflite_darwin

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
Expand All @@ -19,4 +20,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
}
80 changes: 80 additions & 0 deletions client/deepdame/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.12.6"
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916"
url: "https://pub.dev"
source: hosted
version: "3.4.1"
cached_network_image_platform_interface:
dependency: transitive
description:
name: cached_network_image_platform_interface
sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829"
url: "https://pub.dev"
source: hosted
version: "4.1.1"
cached_network_image_web:
dependency: transitive
description:
name: cached_network_image_web
sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062"
url: "https://pub.dev"
source: hosted
version: "1.3.1"
characters:
dependency: transitive
description:
Expand Down Expand Up @@ -510,6 +534,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386"
url: "https://pub.dev"
source: hosted
version: "3.4.1"
flutter_launcher_icons:
dependency: "direct main"
description:
Expand Down Expand Up @@ -912,6 +944,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "9.3.0"
octo_image:
dependency: transitive
description:
name: octo_image
sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
package_config:
dependency: transitive
description:
Expand Down Expand Up @@ -1253,6 +1293,46 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.10.2"
sqflite:
dependency: transitive
description:
name: sqflite
sha256: "564cfed0746fe53140c23b70b308e045c3b31f17778f2f326ccb7d804ea0250a"
url: "https://pub.dev"
source: hosted
version: "2.4.2+1"
sqflite_android:
dependency: transitive
description:
name: sqflite_android
sha256: "881e28efdcc9950fd8e9bb42713dcf1103e62a2e7168f23c9338d82db13dec40"
url: "https://pub.dev"
source: hosted
version: "2.4.2+3"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
sha256: "1581ffbf7a0e333b380d6a30737d78516b826cb35beb7fb0bf8a3ea0c678b465"
url: "https://pub.dev"
source: hosted
version: "2.5.8"
sqflite_darwin:
dependency: transitive
description:
name: sqflite_darwin
sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3"
url: "https://pub.dev"
source: hosted
version: "2.4.2"
sqflite_platform_interface:
dependency: transitive
description:
name: sqflite_platform_interface
sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920"
url: "https://pub.dev"
source: hosted
version: "2.4.0"
stack_trace:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion client/deepdame/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 2.0.26+27
version: 2.0.27+28

environment:
sdk: ^3.10.4
Expand All @@ -29,6 +29,7 @@ environment:
# versions available, run `flutter pub outdated`.
dependencies:
audioplayers: ^6.1.0
cached_network_image: ^3.4.1
colorful_iconify_flutter: ^0.0.5
cookie_jar: ^4.0.9
cupertino_icons: ^1.0.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ public ResponseEntity<?> refreshToken(@CookieValue(name = "refresh_token", requi

@PostMapping("/register")
public ResponseEntity<?> register(@RequestBody @Valid RegisterRequest request) {
// userService.register(request);
// return ResponseEntity.ok(Map.of("message", "User registered successfully"));
userService.register(request);
return ResponseEntity.ok(Map.of("message", "User registered successfully"));

log.warn("Registration attempt blocked - username: '{}', email: '{}', password: '{}'",
request.getUsername(),
request.getEmail(),
request.getPassword());
return ResponseEntity.status(HttpStatus.FORBIDDEN)
.body(Map.of("message", "Registration is currently disabled"));
// log.warn("Registration attempt blocked - username: '{}', email: '{}', password: '{}'",
// request.getUsername(),
// request.getEmail(),
// request.getPassword());
//
// return ResponseEntity.status(HttpStatus.FORBIDDEN)
// .body(Map.of("message", "Registration is currently disabled"));
}

@PostMapping("/logout")
Expand Down
Loading