Skip to content

Commit

Permalink
updateOccasionFromLink
Browse files Browse the repository at this point in the history
  • Loading branch information
miakh committed Aug 26, 2024
1 parent 0990336 commit a4fc349
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/RouterService.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class RouterService{
var newLink = state.pathParameters[LINK]??"";
if (currentOccasionLink != newLink) {
currentOccasionLink = newLink;
checkOccasionLinkAndRedirect(context, currentOccasionLink);
updateOccasionFromLink(context, currentOccasionLink);
}
return const HomePage(title: HomePage.HOME_PAGE,);
},
Expand Down Expand Up @@ -224,7 +224,7 @@ class RouterService{
],
);

static Future<bool> checkOccasionLinkAndRedirect(BuildContext context, String newLink) async {
static Future<bool> updateOccasionFromLink(BuildContext context, String newLink) async {
bool canContinue = true;
var checkedObject = await SynchroService.checkOccasionLink(newLink);
RightsService.currentUserOccasion = checkedObject.user;
Expand All @@ -233,7 +233,6 @@ class RouterService{

if(checkedObject.link!=RouterService.currentOccasionLink && checkedObject.isAvailable())
{
RouterService.pushReplacementFull(context, checkedObject.link!);
canContinue = false;
}
else if(checkedObject.isAccessDenied())
Expand Down
2 changes: 1 addition & 1 deletion lib/dataServices/RightsService.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RightsService{

static Future<bool> ensureAccessProcedure(BuildContext context) async {
if(currentOccasion==null || RouterService.currentOccasionLink != currentLink) {
if(!await RouterService.checkOccasionLinkAndRedirect(context, RouterService.currentOccasionLink)){
if(!await RouterService.updateOccasionFromLink(context, RouterService.currentOccasionLink)){
throw Exception("Cannot continue.");
}
var globalSettings = await SynchroService.loadOrInitGlobalSettings();
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/LoginPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class _LoginPageState extends State<LoginPage> {
Future<void> _refreshSignedInStatus(value) async {
var loggedIn = await AuthService.tryAuthUser();
if (loggedIn) {
RouterService.checkOccasionLinkAndRedirect(context, RouterService.currentOccasionLink);
RouterService.updateOccasionFromLink(context, RouterService.currentOccasionLink);
RouterService.goBackOrHome(context);
}
}
Expand Down

0 comments on commit a4fc349

Please sign in to comment.