Skip to content

Commit

Permalink
Upgrade the nakama sdk to use the latest version of the repository ba…
Browse files Browse the repository at this point in the history
…sed on this issue:

heroiclabs/nakama-dart#115
  • Loading branch information
imaNNeo committed Sep 20, 2024
1 parent 81aa1e3 commit da3b055
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 38 deletions.
2 changes: 1 addition & 1 deletion lib/domain/repositories/game_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GameRepository {
Future<LeaderboardEntity> getLeaderboard() async {
await _initializationCompleter.future;
final recordList = await _nakamaDataSource.getLeaderboard(_mainLeaderboard);
final ids = recordList.records.map((record) => record.ownerId!).toList();
final ids = recordList.records!.map((record) => record.ownerId!).toList();
final users = await _nakamaDataSource.getUsers(ids);
final usersMap = Map.fromEntries(
users.map((user) => MapEntry(user.id, user)),
Expand Down
4 changes: 2 additions & 2 deletions lib/presentation/dialogs/leaderboard_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ class _LeaderBoardDialogState extends State<LeaderBoardDialog> {
itemBuilder: (context, index) {
final (record, name) = state.leaderboardEntity![index];
return LeaderboardRow(
rank: record.rank ?? 9999,
rank: int.parse(record.rank ?? '9999'),
name: name,
score: record.score ?? 0,
score: int.parse(record.score ?? '0'),
isMine: record.ownerId ==
state.currentUserAccount?.user.id,
onMyProfileTap: () => AppDialogs.nicknameDialog(context),
Expand Down
12 changes: 10 additions & 2 deletions lib/presentation/widget/best_score_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,20 @@ class BestScoreOverlay extends StatelessWidget {
Widget build(BuildContext context) {
return BlocBuilder<GameCubit, GameState>(builder: (context, state) {
final record = state.leaderboardEntity?.ownerRecord;
int? rank = int.tryParse(record?.rank ?? '');
int score = int.tryParse(record?.score ?? '') ?? 0;
return BoxOverlay(
onTap: onTap,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
ScoreTrophy(size: 32, rank: record?.rank),
switch (rank) {
null || <= 3 => ScoreTrophy(size: 32, rank: rank),
_ => NormalScore(
size: 38,
rank: rank,
),
},
const SizedBox(width: 18),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand All @@ -37,7 +45,7 @@ class BestScoreOverlay extends StatelessWidget {
),
),
Text(
record?.score.toString() ?? '-',
score.toString(),
style: const TextStyle(
color: AppColors.mainColor,
fontSize: 22,
Expand Down
57 changes: 25 additions & 32 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.0"
chopper:
dependency: transitive
description:
name: chopper
sha256: "1b6280ec22841b844448bec8ef2644d9cbe9ea8dfce13ec9cab9e8d3aac3830d"
url: "https://pub.dev"
source: hosted
version: "7.4.0"
clock:
dependency: transitive
description:
Expand Down Expand Up @@ -113,6 +105,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.0.1"
dio:
dependency: transitive
description:
name: dio
sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260"
url: "https://pub.dev"
source: hosted
version: "5.7.0"
dio_web_adapter:
dependency: transitive
description:
name: dio_web_adapter
sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
equatable:
dependency: "direct main"
description:
Expand Down Expand Up @@ -379,10 +387,11 @@ packages:
nakama:
dependency: "direct main"
description:
name: nakama
sha256: "69baed63158c160e1bd039e751c14de1d443bf86bd11f35f27fe424149fde0c3"
url: "https://pub.dev"
source: hosted
path: nakama
ref: HEAD
resolved-ref: "06c60cb31ebbd34309ee9a19dc0c3c4bcefa6e58"
url: "https://github.com/heroiclabs/nakama-dart.git"
source: git
version: "1.1.0"
nested:
dependency: transitive
Expand Down Expand Up @@ -504,22 +513,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.1.2"
qs_dart:
dependency: transitive
description:
name: qs_dart
sha256: "8dddeaf1d32fe407e253840b2c25c9ab5bf347d2761d82cb4ce010096565c9ff"
url: "https://pub.dev"
source: hosted
version: "1.2.3"
recursive_regex:
retrofit:
dependency: transitive
description:
name: recursive_regex
sha256: f7252e3d3dfd1665e594d9fe035eca6bc54139b1f2fee38256fa427ea41adc60
name: retrofit
sha256: "3c9885ef3dbc5dc4b3fb0a40c972ab52e4dad04d52dac9bba24dfa76cf100451"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
version: "4.4.1"
shared_preferences:
dependency: "direct main"
description:
Expand Down Expand Up @@ -693,14 +694,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "14.2.5"
weak_map:
dependency: transitive
description:
name: weak_map
sha256: "95ca338f0cdf5f0022cc283dfa4d97f6f6b03752f67eca85ebe6d7a679ffe3ed"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
web:
dependency: transitive
description:
Expand Down
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ dependencies:
flutter_animate: ^4.5.0
flutter_soloud: ^2.1.1
get_it: ^7.7.0
nakama: ^1.1.0
nakama:
git:
url: 'https://github.com/heroiclabs/nakama-dart.git'
path: nakama
flutter_svg: ^2.0.10+1
android_id: ^0.4.0
device_info_plus: ^10.1.2
Expand Down

0 comments on commit da3b055

Please sign in to comment.