forked from eatvio/eatvio_app
feat(app): refactoring of sentry using, feat(become_consultant): fixed possible infinite loading, feat(push_notifications): fixed push navigation from paid plan push
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:eatvio_app/features/chat/repositories/chat_repository.dart';
|
||||
import 'package:eatvio_app/features/order_info/cubit/order_info_state.dart';
|
||||
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:eatvio_app/core/error_reporting/report_from.dart';
|
||||
|
||||
class OrderInfoCubit extends Cubit<OrderInfoState> {
|
||||
OrderInfoCubit({required this.chatRepository, required this.profileRepository}) : super(OrderInfoState());
|
||||
@@ -15,22 +16,32 @@ class OrderInfoCubit extends Cubit<OrderInfoState> {
|
||||
if (plan == null) return null;
|
||||
final paymentModel = await chatRepository.getPaymentLink(id: plan.id);
|
||||
return paymentModel.paymentUrl;
|
||||
} catch (e) {
|
||||
} catch (e, st) {
|
||||
await reportFrom(e, st, this);
|
||||
log(e.toString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getChosenPlan({required int id, String? customerSlug}) async {
|
||||
Future<void> getChosenPlan({required int id, String? customerSlug, bool isConsultantView = false}) async {
|
||||
try {
|
||||
emit(state.copyWith(isLoading: true));
|
||||
final chosenPlan = await chatRepository.getChosenPlan(id: id);
|
||||
|
||||
if (customerSlug != null) {
|
||||
final profile = await profileRepository.getProfileBySlug(customerSlug);
|
||||
emit(state.copyWith(customerProfile: profile));
|
||||
emit(state.copyWith(customerProfile: profile, isLoading: false, chosenPlan: chosenPlan));
|
||||
return;
|
||||
}
|
||||
if (isConsultantView) {
|
||||
final chatRoom = await chatRepository.getChatRoom(chosenPlan.chatId);
|
||||
final customerSlug = chatRoom.users.receiver.slug;
|
||||
final profile = await profileRepository.getProfileBySlug(customerSlug);
|
||||
emit(state.copyWith(customerProfile: profile, isLoading: false, chosenPlan: chosenPlan));
|
||||
}
|
||||
emit(state.copyWith(isLoading: false, chosenPlan: chosenPlan));
|
||||
} catch (e) {
|
||||
} catch (e, st) {
|
||||
await reportFrom(e, st, this);
|
||||
log(e.toString());
|
||||
emit(state.copyWith(isLoading: false));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user