Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/badge integration #353

Open
wants to merge 20 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
52db302
feat: added badge_dto and badge entities
andre-tm-hui Jan 26, 2023
7336ddc
test: updated to include badges
andre-tm-hui Jan 26, 2023
df8008f
feat: added badge_dto and badge entities
andre-tm-hui Jan 26, 2023
360f658
test: updated to include badges
andre-tm-hui Jan 26, 2023
b6044df
Merge branch 'feat/badge-integration' of https://github.com/CollActio…
andre-tm-hui Feb 5, 2023
8151d3d
clean: removed unused import
andre-tm-hui Feb 5, 2023
cf9b0b0
fix: add manual logging to auth repo
Xazin Mar 4, 2023
649893f
Merge pull request #371 from CollActionteam/fix/manual-logging-auth-repo
Xazin Mar 4, 2023
023d67e
chore: upgrade gradle build tools and dependencies
Xazin Mar 4, 2023
d7926c1
feat: crowdaction description markdown support
Xazin Mar 17, 2023
ba1c98f
Merge pull request #375 from CollActionteam/feat/markdown-support
Xazin Mar 18, 2023
c39f022
fix: amend minor bugs with navigation
Xazin Mar 18, 2023
c5a9ac1
Merge pull request #376 from CollActionteam/fix/rc1.2.0-1/minor-bugs
Xazin Mar 18, 2023
1c65601
fix: analyzer
Xazin Mar 18, 2023
130fb19
Merge pull request #377 from CollActionteam/fix/rc1.2.0-2/analyzer
Xazin Mar 18, 2023
6f68ecd
chore: update pods
Xazin Mar 18, 2023
2da3bd3
Merge pull request #378 from CollActionteam/chore/pod-update
Xazin Mar 18, 2023
3a083d1
Merge branch 'development' into feat/badge-integration
andre-tm-hui Mar 18, 2023
14d984e
fix: renamed 'Badge' to 'CollActionBadge' to avoid conflict
andre-tm-hui Mar 18, 2023
f7df4ee
Merge branch 'development' into feat/badge-integration
Xazin Apr 1, 2023
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
21 changes: 0 additions & 21 deletions lib/core/utils/ifrebase_crashlytics_extension.dart

This file was deleted.

32 changes: 32 additions & 0 deletions lib/domain/badge/badge.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'badge.freezed.dart';

@freezed
class CollActionBadge with _$CollActionBadge {
const CollActionBadge._();

const factory CollActionBadge({
required BadgeTierEnum tier,
required AwardTypeEnum awardType,
required int minimumCheckIns,
}) = _CollActionBadge;
}

enum BadgeTierEnum {
@JsonValue('BRONZE')
bronze,
@JsonValue('SILVER')
silver,
@JsonValue('GOLD')
gold,
@JsonValue('DIAMOND')
diamond,
}

enum AwardTypeEnum {
@JsonValue('ALL')
all,
@JsonValue('TIER')
tier,
}
2 changes: 2 additions & 0 deletions lib/domain/crowdaction/crowdaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import '../../core/core.dart';
import '../../presentation/core/collaction_icons.dart';
import '../../presentation/core/ionicons_utils.dart';
import '../../presentation/shared_widgets/secondary_chip.dart';
import '../badge/badge.dart';

part 'crowdaction.freezed.dart';

Expand All @@ -26,6 +27,7 @@ class CrowdAction with _$CrowdAction {
required DateTime endAt,
String? password,
String? subcategory,
List<CollActionBadge>? badges,
}) = _CrowdAction;

bool get hasParticipants => participantCount > 0;
Expand Down
3 changes: 3 additions & 0 deletions lib/domain/profile/profile.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:freezed_annotation/freezed_annotation.dart';

import '../badge/badge.dart';

part 'profile.freezed.dart';

@freezed
Expand All @@ -12,6 +14,7 @@ class Profile with _$Profile {
required String lastName,
required String avatar,
String? bio,
List<CollActionBadge>? badges,
}) = _Profile;

String get fullName => '$firstName $lastName';
Expand Down
19 changes: 16 additions & 3 deletions lib/infrastructure/auth/firebase_auth_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:get_it/get_it.dart';
import 'package:injectable/injectable.dart';
import 'package:rxdart/subjects.dart';

import '../../core/utils/ifrebase_crashlytics_extension.dart';
import '../../core/utils/firebase_crashlytics_extension.dart';
import '../../domain/auth/auth_failures.dart';
import '../../domain/auth/auth_success.dart';
import '../../domain/auth/i_auth_repository.dart';
Expand Down Expand Up @@ -53,7 +53,14 @@ class FirebaseAuthRepository implements IAuthRepository, Disposable {

result.add(right(AuthSuccess.codeSent(credential: credential)));
},
verificationFailed: (firebase_auth.FirebaseAuthException error) {
verificationFailed: (firebase_auth.FirebaseAuthException error) async {
await FirebaseCrashlyticsLogger.warn(
error,
error.stackTrace,
message:
'[FirebaseAuthRepository] verifyPhoneNumber().verificationFailed',
);

result.add(left(error.toFailure()));
result.close();
},
Expand Down Expand Up @@ -165,7 +172,13 @@ class FirebaseAuthRepository implements IAuthRepository, Disposable {

result.add(right(AuthSuccess.codeSent(credential: credential)));
},
verificationFailed: (firebase_auth.FirebaseAuthException error) {
verificationFailed: (firebase_auth.FirebaseAuthException error) async {
await FirebaseCrashlyticsLogger.warn(
error,
error.stackTrace,
message: '[FirebaseAuthRepository] resendOTP().verificationFailed',
);

result.add(left(error.toFailure()));
result.close();
},
Expand Down
29 changes: 29 additions & 0 deletions lib/infrastructure/badge/badge_dto.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:freezed_annotation/freezed_annotation.dart';

import '../../domain/badge/badge.dart';

part 'badge_dto.freezed.dart';

part 'badge_dto.g.dart';

@freezed
class CollActionBadgeDto with _$CollActionBadgeDto {
const CollActionBadgeDto._();

factory CollActionBadgeDto({
required BadgeTierEnum tier,
required AwardTypeEnum awardType,
required int minimumCheckIns,
}) = _CollActionBadgeDto;

CollActionBadge toDomain() {
return CollActionBadge(
tier: tier,
awardType: awardType,
minimumCheckIns: minimumCheckIns,
);
}

factory CollActionBadgeDto.fromJson(Map<String, dynamic> json) =>
_$CollActionBadgeDtoFromJson(json);
}
3 changes: 3 additions & 0 deletions lib/infrastructure/crowdaction/crowdaction_dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import 'package:freezed_annotation/freezed_annotation.dart';

import '../../domain/crowdaction/crowdaction.dart';
import '../badge/badge_dto.dart';

part 'crowdaction_dto.freezed.dart';

Expand All @@ -26,6 +27,7 @@ class CrowdActionDto with _$CrowdActionDto {
required String endAt,
String? password,
String? subcategory,
List<CollActionBadgeDto>? badges,
}) = _CrowdActionDto;

CrowdAction toDomain() {
Expand All @@ -43,6 +45,7 @@ class CrowdActionDto with _$CrowdActionDto {
endAt: DateTime.parse(endAt),
password: password,
subcategory: subcategory,
badges: badges?.map((option) => option.toDomain()).toList(),
);
}

Expand Down
3 changes: 3 additions & 0 deletions lib/infrastructure/profile/profile_dto.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:freezed_annotation/freezed_annotation.dart';

import '../../domain/profile/profile.dart';
import '../badge/badge_dto.dart';

part 'profile_dto.freezed.dart';
part 'profile_dto.g.dart';
Expand All @@ -15,6 +16,7 @@ class ProfileDto with _$ProfileDto {
required String lastName,
required String avatar,
String? bio,
List<CollActionBadgeDto>? badges,
}) = _ProfileDto;

Profile toDomain() {
Expand All @@ -24,6 +26,7 @@ class ProfileDto with _$ProfileDto {
lastName: lastName,
avatar: avatar,
bio: bio,
badges: badges?.map((option) => option.toDomain()).toList(),
);
}

Expand Down
Loading