Deploy: 2026-05-25 00:29:42
This commit is contained in:
@@ -30,7 +30,12 @@ class DashboardCubit extends Cubit<DashboardState> {
|
||||
switch (tab) {
|
||||
case DashboardTab.whatsapp:
|
||||
final status = await _repository.getWhatsAppStatus();
|
||||
emit(state.copyWith(whatsappStatus: status, isLoading: false));
|
||||
final meta = await _repository.getMetaSessions();
|
||||
emit(state.copyWith(
|
||||
whatsappStatus: status,
|
||||
metaSessions: meta,
|
||||
isLoading: false,
|
||||
));
|
||||
break;
|
||||
case DashboardTab.billing:
|
||||
final plans = await _repository.getPlans();
|
||||
@@ -123,4 +128,30 @@ class DashboardCubit extends Cubit<DashboardState> {
|
||||
emit(state.copyWith(errorMessage: cleanMsg, isLoading: false));
|
||||
}
|
||||
}
|
||||
|
||||
// English: Connect a Facebook Page or Instagram channel and refresh sessions.
|
||||
Future<void> connectMetaSession(String channelType, String pageId, String pageName, String pageAccessToken) async {
|
||||
emit(state.copyWith(isLoading: true));
|
||||
try {
|
||||
await _repository.connectMetaSession(channelType, pageId, pageName, pageAccessToken);
|
||||
final meta = await _repository.getMetaSessions();
|
||||
emit(state.copyWith(metaSessions: meta, isLoading: false));
|
||||
} catch (e) {
|
||||
final cleanMsg = e.toString().replaceAll('Exception: ', '');
|
||||
emit(state.copyWith(errorMessage: cleanMsg, isLoading: false));
|
||||
}
|
||||
}
|
||||
|
||||
// English: Disconnect a Meta page/profile connection and refresh sessions.
|
||||
Future<void> disconnectMetaSession(int sessionId) async {
|
||||
emit(state.copyWith(isLoading: true));
|
||||
try {
|
||||
await _repository.disconnectMetaSession(sessionId);
|
||||
final meta = await _repository.getMetaSessions();
|
||||
emit(state.copyWith(metaSessions: meta, isLoading: false));
|
||||
} catch (e) {
|
||||
final cleanMsg = e.toString().replaceAll('Exception: ', '');
|
||||
emit(state.copyWith(errorMessage: cleanMsg, isLoading: false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user