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

SMBSync3 Fixes #4

Open
wants to merge 141 commits into
base: main
Choose a base branch
from
Open

SMBSync3 Fixes #4

wants to merge 141 commits into from

Conversation

PhilZ-cwm6
Copy link

@PhilZ-cwm6 PhilZ-cwm6 commented Jun 30, 2022

Open bugs:

  • Filters need review and some changes
  • Add timeout support to jcifs 1 globally
  • Custom timeout during scan
  • Complete Fix compiler errors and bug/crash warnings
  • Deprecate PreferenceManager
  • SMB scanner not using port setting

Fixed bugs and added features:
check commit messages

Move settings directory from /data/data to internal storage
An optional setting should select /data/data, internal storage  or app specific directory /storage/emulated/0/android/data/app_tag
After app reinstall or a new request to storage permissions, previous messages were not properly loaded and could be overwritten
Some labels had a wrong description
jcifs 1.3 library is recompiled with jcifs13 class and we keep the upstream jcifs-ng class to jcifs.
This makes it possible to directly update the jcifs lib to the latest release by just swapping the library instead of recompiling jcifs-ng with a custom class

JcifsFile2 is upgraded to support the new jcifs libs

Utilities3 is upgraded to use updated wrapperForSlf4j that supports latest logging formats by slf4j and that are needed by jcifs-ng and any future external lib relying on slf4j logger
- fix SMB sync was broken when a custom port was set in destination
- fix SMB sync error message displaying url:port:port error instead of url:port
- When editing an SMB server with a user/password set, the user/pass were empty and editing the server details caused the user/pass to be lost
Allow copy/paste in unhidden password field when importing an encrypted app settings file
…tings

allow password confirmation field toggle and copy/paste when exporting settings with password
- Zip password: fix confirmation password view always disabled and a zip password could not be set
- Zip password: enable password show/hide icon with confirmation password field toggle
- Zip password: preserve password visibility view state on screen rotation
Properly toggle SMB password TextInputLayout view on use password check/uncheck (no functional changes, but for code clarity)
When option "Edit SMB Server Parameters" is unchecked, mask the SMB server password
On screen rotation, ensure SMB password cannot be shown if Edit SMB Server parameters option is unchecked
Not needed because the check is also done later in setSyncFolderSmbListener: if the Edit SMB Server parameters option is unchecked, the ll_sync_folder_pswd_view is disabled and password is automatically masked
After screen rotation in SMB and ZIP, properly enable/disable Save button on view changes
- fix bug where the following spinners were disabled after screen rotation:
  + Sync Task Type spinner
  + Sync Wifi option spinner
  + DST offset spinner
- remove orphan code
…aved

In SMB server, if the option "Use account name and password" is unchecked, do not discard the current user/pass on screen rotation until user clicks "Save" button in SMB edit view
If settingSecurityReinitSmbAccountPasswordValue is set, the option Use SMB account/password could be wrongly checked
@PhilZ-cwm6 PhilZ-cwm6 mentioned this pull request Jun 30, 2022
Deprecate Activity.startActivityForResult(), onActivityResult(), requestPermissions() and onRequestPermissionsResult() in favor of ActivityResultLauncher, registerForActivityResult, ActivityResultContracts
- Enable the Storage permissions access in menu. This menu will be later migrated to a menu showing access to all app permissions
- When requesting storage permissions from menu, do not exit app if permission was already granted and user cancels the permission request
Deprecate startActivityForResult to request  access to external removable storage (external SD) on App start and in Task Editor
EditSynTask views are properly saved and reloaded on configuration changes (screen rotation) and use of deprecated setRetainInstance() is not needed
Fixes warning : Do not place Android context classes in static fields (static reference to `NotifyEvent` which has field `context` pointing to `Context`); this is a memory leak
On returning from Settings (back button), setting were not reloaded
Deprecate PreferenceActivity and migrate to AppCompatActivity with PreferenceFragmentCompat as it was deprecated since Android 3.0 (API 11)
Dual pane view is not supported in androidx Preference library
We need a custom fragment layout for this
For now, disable the dual pane view in preferences
- apply option immediately
- apply option also in Create/Edit password option
- Add menu to open app system permissions
- Fix string resource in xml
To know if the app main activity is starting for the first time or is being recreated after being killed/restarted by Android system (system app permission change, low memory, system developer's option "Don't keep activities") we use Bundle savedInstanceState from onCreate() instead of relying on onRestoreInstanceState() method call

This change is only for convenience as it is uncommon to use it in onRestoreInstanceState()
When system app permissions are changed, Android system recreates the activity effectively calling onCreate()
This was causing an NPE crash if, while in app preferences (settings activity), the user moved to system app permissions and removed an app permission like storage access. The NPE occurred when returning to main app.
In upstream source, this scenario would cause a false app prompt to restart if some settings (theme, text size, app directory...) are set to other than default values.

This patch fixes the NPE crash and any useless prompt for app restart in such scenarios where onCreate() is called when back to main activity
Only code cleanup, no change in function
On Android versions before SDK 30, only enable storage is possible from this new option. Storage access can still be revoked inside app using "All app system permissions" menu
This menu is now useless since we have storage permission option in Settings / Advanced
- Restore original upstream custom list preference for non compressed file types
- Deprecate legacy Preference Dialog implementation and migrate to androidx
- Fix screen rotation did not properly preserve Ok button state
- Add missing resources for edit compress file type dialogs
- Fix compression file types list sorting was only applied in adapter and not persisted in saved preferences
- Fix when editing file type entries in list, they were not sorted when back to the list view
- Deprecate getFragmentManager()
- Notice about deprecated setTargetFragment():
Deprecated setTargetFragment() must be implemented because source file PreferenceDialogFragmentCompat.java implements @SuppressWarnings("deprecation") in onCreate() for deprecated getTargetFragment() method.
Else, we get JavaExcption error "Target fragment must implement TargetFragment interface"
Until PreferenceDialogFragmentCompat.java adds an alternative, we're stuck to using setTargetFragment() deprecated method here
                    https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-preference-release/preference/preference/src/main/java/androidx/preference/PreferenceDialogFragmentCompat.java#78
For custom list preference (non compressed file types selection):
- add option to undo delete entry
- when list is modified, Ok button will only be enabled if the final resulting list is different from the original one
- on screen rotation and activity killed, properly preserve all the custom preference list dialogs state
- Upgrade all tools and plugins to latest releases
- Target SDK 33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant