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

Show latest version if newer version exists #194

Open
kyu08 opened this issue Jan 7, 2024 · 0 comments
Open

Show latest version if newer version exists #194

kyu08 opened this issue Jan 7, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@kyu08
Copy link
Owner

kyu08 commented Jan 7, 2024

Functionality

  • Notify latest version if newer version exists in either pane.
  • Cache for certain period of time(maybe 12 ~ 24 hours?)
    • Save the unix-time checked latest version and the version to file like ~/fzf-make/last-version-checked-at.toml
  • It might be better how many users exist for my motivation.
    • Run some web server which has these functionality.
      • fzf-make send only how many commands were executed in the period.
      • fzf-make does not send the command names, content of the command.
      • Return whether the newer version exists than the user uses.
      • Store how many requests sent by users. It shows active unique user for the period.

How to implement

  • Write a web server.
    • Implementation cost is high, but we will be able to know user activity.
  • Use mgrachev/update-informer.
    • Implementation cost is low, so we can release version notification faster.

At first, we are going to release the version using mgrachev/update-informer, and then take time to implement the web server.

[Web server] How to store the data

  • Write to DB like SQLite, Firestore
  • Output log and collect and parse them once per day (or week).

[Web server] How to handle request data as unique user

  • Ask to the server to create userId and store it to the file under fzf-make's directory.
  • When fzf-make requests the server, pass the userId with the params.
  • Then the server checks the userId is existing or not.

Ref

Implementation memo

fn run<B: Backend>(terminal: &mut Terminal<B>, mut model: Model) -> Result<Option<String>> {

    // TODO: Check whether there is newer version via http asynchronously

    loop {

        // TODO: Get a value using try_recv. When a value has been got,
        // invoke update function like `update(&mut model, Message::GotNewerVersion(version))`.

        if let Err(e) = terminal.draw(|f| ui(f, &mut model.clone())) {
            return Err(anyhow!(e));
        }
        match handle_event(&model) {
            Ok(message) => {
                update(&mut model, message);
                if model.should_quit() || model.is_target_selected() {
                    break;
                }
            }
            Err(_) => break,
        }
    }
    Ok(model.target_to_execute())
}

About try_recv, see https://doc.rust-jp.rs/book-ja/ch16-02-message-passing.html.

@kyu08 kyu08 added the enhancement New feature or request label Jan 7, 2024
@kyu08 kyu08 self-assigned this Jan 8, 2024
@kyu08 kyu08 added this to the Next release milestone Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant