Skip to content
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

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Oct 25, 2023

  • Tests written, or not not needed

alperozturk96 and others added 5 commits October 25, 2023 14:16
Signed-off-by: alperozturk <[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
Copy link
Collaborator

@ZetaTom ZetaTom left a 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.

@alperozturk96
Copy link
Collaborator Author

@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]>
import android.net.ConnectivityManager
import android.net.NetworkCapabilities

object ConnectivityObserver {
Copy link
Member

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]>
alperozturk96 and others added 3 commits November 9, 2023 12:00
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 {
Copy link
Member

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)) {
Copy link
Member

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.

Copy link
Member

@tobiasKaminsky tobiasKaminsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use interface

@alperozturk96
Copy link
Collaborator Author

@tobiasKaminsky Interface used

Copy link
Collaborator

@ZetaTom ZetaTom left a 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.

@alperozturk96
Copy link
Collaborator Author

@ZetaTom When user don't have internet I am always seeing Server not available message. Could you share video?

@ZetaTom
Copy link
Collaborator

ZetaTom commented Nov 21, 2023

@alperozturk96, the message disappears if the device is online but the server isn't.

server_availability.webm

@alperozturk96
Copy link
Collaborator Author

alperozturk96 commented Nov 21, 2023

@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.

@tobiasKaminsky
Copy link
Member

/rebase

Signed-off-by: alperozturk <[email protected]>
Copy link

github-actions bot commented Dec 5, 2023

Codacy

Lint

TypemasterPR
Warnings7474
Errors00

SpotBugs

CategoryBaseNew
Bad practice2626
Correctness7070
Dodgy code359359
Experimental22
Internationalization99
Malicious code vulnerability22
Multithreaded correctness99
Performance5858
Security1818
Total553553

Copy link

github-actions bot commented Dec 5, 2023

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12093.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

Copy link

github-actions bot commented Dec 5, 2023

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

@alperozturk96
Copy link
Collaborator Author

/backport to stable-3.27

@tobiasKaminsky tobiasKaminsky merged commit 0e27b34 into master Dec 11, 2023
20 of 21 checks passed
@delete-merged-branch delete-merged-branch bot deleted the bugfix/Despite-connection-is-restored-message-about-unreachable-server-still-present-9652182 branch December 11, 2023 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants