Fix multiple message in app

This commit is contained in:
Thomas Fransolet 2023-11-16 18:02:08 +01:00
parent e63b2a0715
commit 091b89d894
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,5 @@
#Thu Aug 31 16:53:49 CEST 2023 #Fri Sep 01 08:41:57 CEST 2023
VERSION_BUILD=89 VERSION_BUILD=91
VERSION_MAJOR=1 VERSION_MAJOR=1
VERSION_MINOR=0 VERSION_MINOR=0
VERSION_PATCH=0 VERSION_PATCH=0

View File

@ -31,6 +31,8 @@ class MainPage extends StatefulWidget {
} }
class _MainPageState extends State<MainPage> { class _MainPageState extends State<MainPage> {
bool isAlreadyInstantiated = false;
setPage() { setPage() {
setState(() { setState(() {
pageController.jumpToPage(currentIndex); pageController.jumpToPage(currentIndex);
@ -51,8 +53,13 @@ class _MainPageState extends State<MainPage> {
print("MQTT NOT INSTANTIATED"); print("MQTT NOT INSTANTIATED");
MQTTHelper.instance.connect(appContext); MQTTHelper.instance.connect(appContext);
} }
if (!isAlreadyInstantiated)
{
final pushNotificationService = PushNotificationService(); final pushNotificationService = PushNotificationService();
pushNotificationService.initialise(homieAppContext, context); pushNotificationService.initialise(homieAppContext, context);
isAlreadyInstantiated = true;
}
return ChangeNotifierProvider<Index>( return ChangeNotifierProvider<Index>(
create: (_) => Index(0, appContext.getContext()), create: (_) => Index(0, appContext.getContext()),