appUpdateFunction function
void
appUpdateFunction({ - required BuildContext context,
- required String googlePlayId,
- required String appStoreId,
- required bool isHomeownerApp,
})
Implementation
void appUpdateFunction({
required BuildContext context,
required String googlePlayId,
required String appStoreId,
required bool isHomeownerApp,
}) async {
final container = ProviderScope.containerOf(context, listen: false);
final appsUpdatePlan = await container.read(
isHomeownerApp
? appUpdatePlanHomeownerApiFamily.future
: appUpdatePlanDealerApiFamily.future,
);
if (appsUpdatePlan.recommendUpgrade == true && context.mounted) {
PlayxVersionUpdate.showUpdateDialog(
context: context,
//show release notes or not
showReleaseNotes: true,
//customize store app id
googlePlayId: googlePlayId,
appStoreId: appStoreId,
//customize dialog layout like title.
title: (info) => appsUpdatePlan.forceUpgrade == true
? context.sharedL10n.anUpdateIsRequired
: context.sharedL10n.newUpdateAvailable,
onCancel: (info) async {
if (appsUpdatePlan.forceUpgrade == true) {
final manager = await container.read(authManagerProvider.future);
manager.logOut();
}
},
);
}
}