-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network Interceptor for noticeboard mobile #35
Network Interceptor for noticeboard mobile #35
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When internet restore ho rha then why not do a notice refetch a the end? Also flutter analyze k issue fix krle, btw nice bgm :)
noticeboard/ios/build/ios/Pods.build/Release-iphonesimulator/Firebase.build/dgph
Outdated
Show resolved
Hide resolved
noticeboard/ios/build/ios/Pods.build/Release-iphonesimulator/FirebaseCore.build/dgph
Outdated
Show resolved
Hide resolved
All changes are as follows: I have updated the web view flutter package to 4.7.0 and upgraded flutter version to 3.19 because reloading the webview requires a webview controller, also added another stream for this purpose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost done, fix the eof and remove the build files from vcs.
Closes #34
Problem
There is notification to the user if their device goes offline, only generic errors were shown
Technicalities of change
I have made a connectivityStatusBloc with a enum for network connection status. In the root of the app , I have passed the context of the material app to the connectivityStatusBloc because it will always be mounted on the widget tree regardless of current widget. My connectivityStatusBloc class is a singleton because there should only be one instantiation of the stream wherever it gets called (We don't want individual network streams for widgets). Hence , it will always be able to render snackbar's succesfully. I have made two functions. One for checking the connectivityStatus using InternetAddress.lookup function of dart:io and have made it a recurring function every 15 seconds until the widget doesn't dispose. I have also made a function to send the required result into the connectivityStatusBloc event sink which manages the snackbars.
For refetch:
There are two types of refetch. One is refetching list of notices, other is reloading the notice detail webview. To reload a web view, we need a webViewController. To do that, I had to upgrade flutter to 3.19.1 and webview_flutter to 4.7.0. I made a NoticeDetailBloc (another stream) which is fed events when user is back online by connectivityStatusBloc based on current position. The reqd widgets listen to the sink of this stream and refetch the required objects.
Note to reviewer
Please squash and merge.
Will fix the GH workflow in another PR. It will fail as I have upgraded flutter version to 3.19.1
Demo
Two videos are attached one for notices list refetch and one for notice detail refetch
2024_02_26_13_46_11.1.mp4
2024_02_26_13_47_29.1.mp4