chore: clean up codebase (#186)
* refactor app state * clean up * clean up * .
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
use anyhow::anyhow;
|
||||
use app_state::constants::SETTINGS_IDENTIFIER;
|
||||
use app_state::nostr_client;
|
||||
use gpui::{App, AppContext, Context, Entity, Global, Subscription, Task};
|
||||
use nostr_sdk::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use states::app_state;
|
||||
use states::constants::SETTINGS_IDENTIFIER;
|
||||
|
||||
pub fn init(cx: &mut App) {
|
||||
let state = cx.new(AppSettings::new);
|
||||
@@ -121,7 +121,7 @@ impl AppSettings {
|
||||
|
||||
pub fn load_settings(&self, cx: &mut Context<Self>) {
|
||||
let task: Task<Result<Settings, anyhow::Error>> = cx.background_spawn(async move {
|
||||
let client = nostr_client();
|
||||
let client = app_state().client();
|
||||
let signer = client.signer().await?;
|
||||
let public_key = signer.get_public_key().await?;
|
||||
|
||||
@@ -153,7 +153,7 @@ impl AppSettings {
|
||||
pub fn set_settings(&self, cx: &mut Context<Self>) {
|
||||
if let Ok(content) = serde_json::to_string(&self.setting_values) {
|
||||
let task: Task<Result<(), anyhow::Error>> = cx.background_spawn(async move {
|
||||
let client = nostr_client();
|
||||
let client = app_state().client();
|
||||
let signer = client.signer().await?;
|
||||
let public_key = signer.get_public_key().await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user