-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Bugfix Check Network Connection When File Item Clicked #12093
Bugfix Check Network Connection When File Item Clicked #12093
Conversation
alperozturk96
commented
Oct 25, 2023
•
edited by AndyScherzinger
Loading
edited by AndyScherzinger
- Tests written, or not not needed
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: github-actions <[email protected]>
Signed-off-by: alperozturk <[email protected]>
…tored-message-about-unreachable-server-still-present-9652182' into bugfix/Despite-connection-is-restored-message-about-unreachable-server-still-present-9652182
Signed-off-by: github-actions <[email protected]>
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.
Refactoring is a necessary effort, but it is generally considered good practise to keep pull requests as modular as possible. I would suggest moving all changes, not strictly needed to fix the issue at hand, into a separate pull request.
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: github-actions <[email protected]>
@ZetaTom I agree. Single responsibility in PR is important. I will revert those changes (enhanced switch case, requireActivity, requireContext usages) |
Signed-off-by: alperozturk <[email protected]>
…tored-message-about-unreachable-server-still-present-9652182' into bugfix/Despite-connection-is-restored-message-about-unreachable-server-still-present-9652182
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
import android.net.ConnectivityManager | ||
import android.net.NetworkCapabilities | ||
|
||
object ConnectivityObserver { |
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.
We already have ConnectivityService for this.
Please use/combine those.
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
…age-about-unreachable-server-still-present-9652182
@@ -36,7 +37,7 @@ | |||
import androidx.core.net.ConnectivityManagerCompat; | |||
import kotlin.jvm.functions.Function1; | |||
|
|||
class ConnectivityServiceImpl implements ConnectivityService { | |||
public class ConnectivityServiceImpl implements ConnectivityService { |
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.
This is implemention of an interface.
Please add the new function to its interface.
@@ -240,6 +241,12 @@ protected void onCreate(Bundle savedInstanceState) { | |||
} | |||
} | |||
|
|||
public void checkInternetConnection() { | |||
if (ConnectivityServiceImpl.isConnected(this)) { |
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 it is via interface you can use "connectivityService", which is injected.
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.
Use interface
Signed-off-by: alperozturk <[email protected]>
@tobiasKaminsky Interface used |
Signed-off-by: alperozturk <[email protected]>
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.
During my testing, I've found that there are certain cases where the message disappears even though the server is unavailable. For example, if you open a media preview while the server is stopped.
@ZetaTom When user don't have internet I am always seeing Server not available message. Could you share video? |
@alperozturk96, the message disappears if the device is online but the server isn't. server_availability.webm |
@ZetaTom I assume you expect to still see the message if our backend not available if yes then my question will be our backend providing heartbeat API? So I can check backend health (server availability)? Update: I talked with @tobiasKaminsky within the scope of this PR this implementation sufficient. However we can add that feature in different PR we need to collaborate backend first of course. |
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
/rebase |
Signed-off-by: alperozturk <[email protected]>
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12093.apk |
blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |
/backport to stable-3.27 |