-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1525 from ardriveapp/dev
PE-5239: Release v2.28.0
- Loading branch information
Showing
33 changed files
with
1,163 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- Adds browser limit info to Top Up modal | ||
- Removes unneeded upload warning | ||
- Enables sending and redeeming gifted Credits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import 'package:ardrive/authentication/ardrive_auth.dart'; | ||
import 'package:ardrive/turbo/services/payment_service.dart'; | ||
import 'package:ardrive/utils/logger/logger.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
|
||
part 'redeem_gift_event.dart'; | ||
part 'redeem_gift_state.dart'; | ||
|
||
class RedeemGiftBloc extends Bloc<RedeemGiftEvent, RedeemGiftState> { | ||
final PaymentService _paymentService; | ||
final ArDriveAuth _auth; | ||
|
||
RedeemGiftBloc({ | ||
required PaymentService paymentService, | ||
required ArDriveAuth auth, | ||
}) : _auth = auth, | ||
_paymentService = paymentService, | ||
super(RedeemGiftInitial()) { | ||
on<RedeemGiftEvent>((event, emit) async { | ||
if (event is RedeemGiftLoad) { | ||
await _handleRedeemGiftLoad(emit, event); | ||
} | ||
}); | ||
} | ||
|
||
Future<void> _handleRedeemGiftLoad( | ||
Emitter<RedeemGiftState> emit, RedeemGiftLoad event) async { | ||
try { | ||
logger.d('RedeemGiftLoad'); | ||
|
||
emit(RedeemGiftLoading()); | ||
|
||
await _paymentService.redeemGift( | ||
email: event.email, | ||
giftCode: event.giftCode, | ||
destinationAddress: _auth.currentUser.walletAddress, | ||
); | ||
|
||
logger.d('RedeemGiftSuccess'); | ||
|
||
emit(RedeemGiftSuccess()); | ||
} catch (e) { | ||
if (e is GiftAlreadyRedeemed) { | ||
logger.e('RedeemGiftAlreadyRedeemed', e); | ||
emit(RedeemGiftAlreadyRedeemed()); | ||
return; | ||
} | ||
logger.e('RedeemGiftFailure', e); | ||
emit(RedeemGiftFailure()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
part of 'redeem_gift_bloc.dart'; | ||
|
||
sealed class RedeemGiftEvent extends Equatable { | ||
const RedeemGiftEvent(); | ||
|
||
@override | ||
List<Object> get props => []; | ||
} | ||
|
||
class RedeemGiftLoad extends RedeemGiftEvent { | ||
const RedeemGiftLoad({ | ||
required this.giftCode, | ||
required this.email, | ||
}); | ||
|
||
final String giftCode; | ||
final String email; | ||
|
||
@override | ||
List<Object> get props => [giftCode]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
part of 'redeem_gift_bloc.dart'; | ||
|
||
sealed class RedeemGiftState extends Equatable { | ||
const RedeemGiftState(); | ||
|
||
@override | ||
List<Object> get props => []; | ||
} | ||
|
||
final class RedeemGiftInitial extends RedeemGiftState {} | ||
|
||
final class RedeemGiftLoading extends RedeemGiftState {} | ||
|
||
final class RedeemGiftSuccess extends RedeemGiftState {} | ||
|
||
final class RedeemGiftFailure extends RedeemGiftState {} | ||
|
||
final class RedeemGiftAlreadyRedeemed extends RedeemGiftState {} |
Oops, something went wrong.