-
Notifications
You must be signed in to change notification settings - Fork 22
Created synchronization from QuickSettingsTileForce #43
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
base: main
Are you sure you want to change the base?
Conversation
|
This isn’t a major refactor compared to #42. I mainly moved some duplicated logic into reusable methods. Regarding the problem:
I could revert the less-clean solution described in point 5, which would leave changes 1–4 and 6 as a cleaner, self-contained improvement. |
|
@normanre thanks for the details and well done writeup, i will check it loading the debug build :-) |
app/src/main/java/com/nutomic/syncthingandroid/service/QuickSettingsTileSchedule.java
Outdated
Show resolved
Hide resolved
|
Could you tell me how I can run the linter locally? Is it just a gradle task? And for this result. I was expecting this could be a problem. This is the not so nice solution for 5. I can revert that but then the button will not always be synced with the force button. Or I could create a service binder to connect the schedule service to the force service. This would mean a bigger refactor which I wanted to avoid. |
|
@normanre |
|
The Force Sync Button never interacted directly with the schedule button before. When you look at the current release version. The force button never changes the schedule button as long as you see the quick settings menu. You have to close it and open it again so that onStartListening() refreshes the state. With #42 the SyncThingService triggers a refresh of the schedule button even when the menu is open. In this way the force button interacts with the schedule button. Here the force button changes the SyncThingService state what in turn changes the schedule button. The problem is I made the schedule button only change between ACTIVE and INACTIVE. Now only the fix in 5. remains which is causing the linter (rightfully) to mark it. |
|
@normanre some thoughts on the duplicate check code in QuickSettingsTileForce and QuickSettingsTileSchedule root cause of the bug is we know if force run or stop is set.. this allow us to derive that syncthing is running or stopped reliably you can take this info from onShouldRunDecisionChanged pls see RunConditionMonitor and SyncthingService for details |
|
@researchxxl Thats what I did. I am not checking not only for the presence of the service. I registered a onServiceStateChanged()-Listener on the schedule tile. This way the tile state is only active when the SyncthingService is actually active. The problem comes only from the interaction with the force tile. Here the only problem is that switching from “Force Stop” to “No Force Stop” while no run condition is met will not change the state of the SynctingService (it stays in state disabled). Therefor the schedule tile does not change its state. Anyways, I think transforming onShouldRunDecisionChanged into a listener is a great idea. I just wanted avoid changing code outside of the tile service classes. If you are fine with that I can implement it in the following days. |
you are welcome to proceed if you like ❤️ |
…ove state synchronization and preference handling
|
I checked the code and changing to a listender would not change anything. The problem is, when the state of the SyncthingService does not change, but the state for the force button changes, the schedule tile has to change. For Example:
Thats the problem because when changing from stopped to stopped neither the syncthing service nor the RunCondtionMonitor fire any events because there is no change. The QS Schedule Tile should in this case change from Adding a listener in the RunCoditionMonitor or SynchtingService would not be good solution because right now only events are triggered when the SycnthingService state changes and I would not want to change it. My solution is now to register an OnSharedPreferenceChangeListener which only checks for this weird interaction with the force button. |
okay let us try that :) |
|
getting back to you soon :) |
|
cleaned up the runconditionmonitor code a little bit to be able to test this better, let me update from main.. hold on. |
Description
The pull request fixes the sync issue with the Force QuickSetting Tile.
mentioned here #42 (comment)