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

Support mobile document uploads #1869

Closed
wants to merge 10 commits into from
Closed

Conversation

rnicholus
Copy link

@rnicholus rnicholus commented Sep 28, 2024

This adds support for mobile document uploads by exposing a file input in the postings section. This allows for easy upload of documents for a specific transaction and account.

I considered adding a file input to the Context dialog, but that proved to be a dead-end since the entry hash changes on file upload. In order to support that, there would either need to be a way to re-calculate the hash after file upload and then reload the context dialog without disturbing unsaved changes, or a way to send the file upload and changes to the transactions in a single atomic PUT request. Those are both possible, but probably not worth the effort.

This alternative implementation has a bit better UX in my opinion, as it allows to easily associate a document with an account simply by clicking the file upload button next to the posting entry.

closes #979

@rnicholus
Copy link
Author

The development doc is either incomplete or out-of-date, so i'll need some assistance getting the build to pass here.

@rnicholus
Copy link
Author

Is fava still maintained? Just wondering if it is best to fork to keep this project alive.

@yagebu
Copy link
Member

yagebu commented Oct 17, 2024

Is fava still maintained?

It is, as might also be evident from the recent commits and release. It's an open-source project, don't expect to daily responses...

@rnicholus
Copy link
Author

Is fava still maintained?

It is, as might also be evident from the recent commits and release. It's an open-source project, don't expect to daily responses...

Thanks for confirming. I have some experience maintaining open source projects, so I don’t expect daily responses, but was concerned after more than 3 weeks without a response.

@yagebu
Copy link
Member

yagebu commented Oct 17, 2024

The development doc is either incomplete or out-of-date, so i'll need some assistance getting the build to pass here.

What exactly doesn't work for you? Use make lint and make test to run the the linters / tests respectively

@rnicholus
Copy link
Author

The development doc is either incomplete or out-of-date, so i'll need some assistance getting the build to pass here.

What exactly doesn't work for you? Use make lint and make test to run the the linters / tests respectively

i'm seeing an error on make lint:

pre-commit run -a
[INFO] Initializing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Initializing environment for local:[email protected],[email protected],[email protected].
[INFO] Initializing environment for local:[email protected],[email protected],[email protected],[email protected].
[INFO] Initializing environment for local.
[INFO] Installing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12', '-mnodeenv', '--prebuilt', '--clean-src', '/Users/ray3/.cache/pre-commit/repoyzy_d7wu/node_env-default')
return code: 1
stdout: (none)
stderr:
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1344, in do_open
        h.request(req.get_method(), req.selector, req.data, headers,
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1336, in request
        self._send_request(method, url, body, headers, encode_chunked)
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1382, in _send_request
        self.endheaders(body, encode_chunked=encode_chunked)
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1331, in endheaders
        self._send_output(message_body, encode_chunked=encode_chunked)
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1091, in _send_output
        self.send(msg)
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1035, in send
        self.connect()
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1477, in connect
        self.sock = self._context.wrap_socket(self.sock,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 455, in wrap_socket
        return self.sslsocket_class._create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1041, in _create
        self.do_handshake()
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ssl.py", line 1319, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nodeenv.py", line 1548, in <module>
        main()
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nodeenv.py", line 1119, in main
        args.node = get_last_stable_node_version()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nodeenv.py", line 1052, in get_last_stable_node_version
        return _get_versions_json()[0]['version'].lstrip('v')
               ^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nodeenv.py", line 1028, in _get_versions_json
        response = urlopen('%s/index.json' % src_base_url)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/nodeenv.py", line 652, in urlopen
        return urllib2.urlopen(req)
               ^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 215, in urlopen
        return opener.open(url, data, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 515, in open
        response = self._open(req, data)
                   ^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 532, in _open
        result = self._call_chain(self.handle_open, protocol, protocol +
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 492, in _call_chain
        result = func(*args)
                 ^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1392, in https_open
        return self.do_open(http.client.HTTPSConnection, req,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/urllib/request.py", line 1347, in do_open
        raise URLError(err)
    urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
Check the log at /Users/ray3/.cache/pre-commit/pre-commit.log
make: *** [lint] Error 3

@rnicholus
Copy link
Author

The above issue was fixed by following the suggestion in the pre-commit issue tracker at pre-commit/pre-commit#1017 (comment).

Build should be passing now.

Copy link
Member

@yagebu yagebu left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I don't really like the way that this looks - I think the icon doesn't match Fava's visuals very well and IMHO it adds quite a bit of noise to the journal. I think on mobile in particular it takes up quite a bit of space (which might be worth removing by something like #1817).

I'd either like to have this in some less prominently visible way (maybe just having some clickable area for it?) - otherwise I think we should indeed do this via something like the context overlay.

@yagebu
Copy link
Member

yagebu commented Oct 23, 2024

I think the transactionality problem regarding the document upload from the context overlay could be addressed as follows: instead of uploading the file with the hash, upload it without and add the metadata inline to the edited slice in the context overlay

@rnicholus rnicholus closed this Nov 14, 2024
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.

Attaching file to transaction on mobile.
2 participants