Commit Graph

71 Commits

Author SHA1 Message Date
kernelkind
d52c50acc2 multi subscriber impl
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-09-18 13:53:34 -04:00
William Casarin
3c79724a81 Merge 'Read android args from config file on device' #298
Ken Sedgwick (1):
      Read android args from config file on device
2024-09-16 15:24:24 -07:00
William Casarin
36c0971fd9 Flexible routing
Another massive refactor to change the way routing works. Now any
column can route anywhere.

Also things are generally just much better and more modular via the
new struct split borrowing technique.

I didn't even try to split this into smaller commits for my sanity.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-09-16 14:50:20 -07:00
kernelkind
ee0029268f add RoutableWidgetState conception
holds the routes for an arbitrary widget

Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-09-11 16:12:57 -07:00
Ken Sedgwick
e7f959b3ea Read android args from config file on device
- allows use of more interesting args w/o risk of checking them in by mistake
- allows use of different args w/o rebuilding the app
- uses compiled in defaults if config file missing or broken

Example android-config.json:
```
{
  "args": [
    "--npub",
    "npub1h50pnxqw9jg7dhr906fvy4mze2yzawf895jhnc3p7qmljdugm6gsrurqev",
    "-c",
    "contacts",
    "-c",
    "notifications"
  ]
}
```

Install/update android-config.json with:
```
adb push android-config.json /sdcard/Android/data/com.damus.app/files/android-config.json
```

Using internal storage would be better but it seems hard to get the config file onto
the device ...
2024-09-10 14:16:10 -07:00
William Casarin
4379466d1d android: launch with initial options
Feel free to change to have a customized android build

Signed-off-by: William Casarin <jb55@jb55.com>
2024-09-09 16:10:33 -07:00
William Casarin
bc8a8d4a74 perf: coordinate unknown id lookups
This is a huge improvement over what it was before. Now all unknown id
lookups are debounced and happen through a central coordinator. This
ensures there is no duplication between timelines.

Fixes: https://github.com/damus-io/notedeck/issues/279
Signed-off-by: William Casarin <jb55@jb55.com>
2024-09-02 17:38:18 -07:00
William Casarin
ad244d48c0 fetch contact lists
If we don't have a contact list, make sure to fetch one

Signed-off-by: William Casarin <jb55@jb55.com>
2024-09-02 16:22:29 -07:00
William Casarin
db49cf3c4b tidy: move ColumnKind to its own file
timeline file is starting to get messy

Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-31 08:08:17 -07:00
William Casarin
2ea6473ae2 refactor: move args to its own file
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-31 05:43:43 -07:00
William Casarin
33e5b6886b threads: add initial thread support
This is a really dumb and broken version of threads, but it will be our
foundation for future changes.

All it currently does is load whatever notes we have locally for a
thread in chronological order. It currently does not open any
subscriptions. It is not clear what is replying to what, but hey, its a
start.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
66c8973edf actionbar: move BarAction and add execute method
We will be executing baractions in multiple places, so factor this
out.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-16 12:54:32 -07:00
William Casarin
61bc9d9919 refactor: rename ui::Note to ui::NoteView
Easier to jump to when using tags.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-10 09:56:16 -07:00
William Casarin
239a2cb701 Switch to egui master to fix wgpu issues
There are some wgpu issues that are fixed in egui-master, so
let's switch to that.

This fixes notedeck so that it runs on both my intel graphics laptop
and amdgpu desktop.

Fixes: https://github.com/damus-io/notedeck/issues/28
Fixes: https://github.com/damus-io/notedeck/issues/42
Fixes: https://github.com/damus-io/notedeck/issues/141
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-02 17:48:18 -07:00
William Casarin
4c490e1436 Merge 'impl linux credential storage' #115
From PR description:

See the test_basic() test in linux_key_storage.rs. I ran it successfully
on my MacOS machine and a linux VM. The BasicFileStorage impl just
stores each Keypair as a SerializableKeypair json object with the file
name as the public key hex in ~/.notedeck_credentials. The
SerializableKeypair uses the nip49 EncryptedSecretKey, but we just use
an empty string as the password for now.

The BasicFileStorage impl works in MacOS, but it only conditionally
compiles to linux for simplicity.

pub enum KeyStorageResponse<R> {
    Waiting,
    ReceivedResult(Result<R, KeyStorageError>),
}

This is used as a response so that it's possible for the storage impl to
be async, since secret_service is async. It seems that secret_service
would allow for a more robust linux key storage impl so I went ahead and
made the API compatible with an async impl.

* kernelkind (1):
      impl linux credential storage
2024-07-01 10:49:15 -07:00
William Casarin
a04df88ff6 initial note posting
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 06:49:12 -07:00
kernelkind
2a47a66bbb impl linux credential storage
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-06-28 15:27:46 -04:00
William Casarin
1228f83e50 refactor: move fixed_window to ui
This is a ui module

Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-24 17:11:01 -07:00
kernelkind
6afb618089 reintroduce account management
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-06-23 20:04:00 -04:00
William Casarin
1458498131 initial post box view
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-17 16:21:46 -07:00
William Casarin
6e69407224 cleanups 2024-05-31 01:08:45 -05:00
William Casarin
31b2b5c950 initial refactor in preparation for routing
Signed-off-by: William Casarin <jb55@jb55.com>
2024-05-28 15:09:01 -07:00
kernelkind
9fad35485a Add MacOS key storage
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-05-21 19:50:05 -04:00
kernelkind
e9c3596067 AccountManagementView
View used to add and remove accounts from the app

Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2024-05-13 10:50:42 -07:00
William Casarin
f9d6161500 move account_login_view to ui submodule
trying to keep all views and widgets in here
2024-05-04 11:32:34 -05:00
William Casarin
893fd582dc profiles: introduce DisplayNames
This is exactly the same as the DisplayName enum in Damus iOS. Due to
the various inconsistencies in `name` and `display_name` between
clients, we have to generalize DisplayName into two variants: one name
or two names.

If we have two names, we treat it in the standard way of display_name is
the real name, and `name` is the username.

If only one is set, then it is considered both the username and "real name".

Signed-off-by: William Casarin <jb55@jb55.com>
2024-04-21 15:55:47 -07:00
William Casarin
2d566cc637 ui: move RelayView into ui module
Trying to keep all UI stuff in there

Signed-off-by: William Casarin <jb55@jb55.com>
2024-04-19 21:53:47 -07:00
kernelkind
c4d9b5cd3c Extract the sample relay to test_data for reuse
Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2024-04-19 17:39:21 -07:00
William Casarin
a71e8206fb introduce View and Previews traits
In this commit we refactor the preview mechanism, and switch to
responsive views by default.

To create a preview, your view now has to implement the Preview trait.
This is very similar to SwiftUI's preview mechanism.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-04-19 14:13:11 -07:00
kernelkind
349e3baa99 Add relay view
Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2024-04-19 14:13:11 -07:00
kernelkind
c76f322a48 Apply cargo fmt
Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2024-04-19 14:13:11 -07:00
kernelkind
c8b1c1cdda Add custom visual themes
Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2024-04-12 19:52:34 -07:00
William Casarin
4e7d168d22 refactor: rename widgets to ui
consolidate ui related things like widgets into our ui module

Signed-off-by: William Casarin <jb55@jb55.com>
2024-04-12 16:16:19 -07:00
kernelkind
4bd01682da Add ui_test_harness binary implementation
Adds ability to run UI components isolated from main app.

`cargo run --bin ui_test_harness -- AccountLoginView`

Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-04-01 10:15:50 -07:00
kernelkind
80b76c5381 Use app_creation for common app setup functions
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-04-01 10:15:45 -07:00
kernelkind
a927c56870 Create account login panel
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-04-01 10:15:42 -07:00
kernelkind
343d3dc569 Add login manager
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-04-01 10:15:38 -07:00
kernelkind
7a113825dd Add login key parsing 2024-03-26 10:04:59 +00:00
William Casarin
c0979d1707 widgets: begin organizing ui components into widgets
egui widgets are nice because there are many helper methods on the
egui::Ui struct for adding widgets to the screen in various ways. For
example, add_sized which designates an area to paint a widget. This is
useful in the note_contents case, as it allows us to reserve
available_space-20.0 pixels of the available area, saving 20.0 pixels
for a side-actionbar popout.

I'm not sure I'll use the side actionbar yet, but I've been
experimenting with that as an option to save vertical space in the
timeline.

I still need to make the side actionbar into a widget as well. It
currently uses the CollapsingHeader widget, which is designed for
expanding elements vertically. We may need to make our own widget for
animating an horizontal expansion if we want to achieve a similar effect
for the side actionbar.
2024-03-13 13:38:02 +00:00
William Casarin
87f385b683 profile picture image cache
coding from a plane so this is helping alot with PFPs
2024-02-27 14:26:02 -08:00
William Casarin
2ce2d4cc70 notecache: add initial in-memory notecache
This is useful for things like relative time strings and other
transient note cache state

Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-15 13:07:01 -08:00
William Casarin
c246b9d92f time: add time_ago function from Damus iOS
Useful relative time formatting

Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-15 13:07:01 -08:00
William Casarin
2f54a05705 timecache: add timecache help for timed caches
Some things we definitely don't want to generate every frame, such as
relative-time formatted strings, as that would create a heap allocation
each frame.

Introduce TimeCached<T> which is responsible for updating some state
after some expiry.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-15 13:07:01 -08:00
William Casarin
5521779f42 android: fix args
Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-15 13:07:01 -08:00
William Casarin
3e96f815b1 apply cargo warning suggested fixes
Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-10 16:19:31 -08:00
William Casarin
3925012ad9 android: pass in internal data path for db
Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-10 13:57:46 -08:00
William Casarin
fd0a14eac2 initial fixes for android build
Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-09 18:55:12 -08:00
William Casarin
f323fe7379 LOCAL RELAY MODEL IS WORKING
Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-09 16:59:49 -08:00
William Casarin
74ce87049d local nostrdb subscriptions working
Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-07 15:18:23 -08:00
William Casarin
0400b94769 add padding to top panel on mobile 2023-07-09 14:21:01 -07:00