SankethBK / local_session_timeout

Redirect user to authentication page if the application doesn't receive any user interaction, or been running in the background for "x" duration.
https://pub.dev/packages/local_session_timeout
BSD 3-Clause "New" or "Revised" License
12 stars 19 forks source link

SessionTimeoutState.userInactivityTimeout event keep calling even when user is interact with the app . #35

Open sritharanMobileDev opened 2 months ago

sritharanMobileDev commented 2 months ago

I'm Also facing the same issue. what you fixed in your code.

Here is my sample code.

After continuously using of 10 minutes, app gets logged out.

final sessionConfig = SessionConfig( invalidateSessionForAppLostFocus: Duration( minutes:10), invalidateSessionForUserInactivity: Duration( minutes: 10);

sessionConfig.stream.listen((SessionTimeoutState timeoutEvent) { if (timeoutEvent == SessionTimeoutState.userInactivityTimeout || timeoutEvent == SessionTimeoutState.appFocusTimeout) { // redirect to login screen } });

return SessionTimeoutManager( userActivityDebounceDuration: const Duration(seconds: 1), sessionConfig: sessionConfig, sessionStateStream: sessionStateStream.stream, child: Scaffold(appBar: _appBar(), body: _body()));

SankethBK commented 2 months ago

Hi, can you check if you can reproduce the same issue in the example app

affan3699 commented 1 month ago

Yes facing same issue.

SankethBK commented 1 month ago

Hi @affan3699 , replied on the issue you posted, let me know if that doesn't solve the bug.