diff --git a/pubspec.lock b/pubspec.lock index e4de281..a02f0c1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -322,7 +322,7 @@ packages: name: flutter_quill url: "https://pub.dartlang.org" source: hosted - version: "2.5.1" + version: "3.0.1" flutter_test: dependency: "direct dev" description: flutter @@ -386,7 +386,7 @@ packages: name: i18n_extension url: "https://pub.dartlang.org" source: hosted - version: "4.1.3" + version: "4.2.0" image: dependency: transitive description: @@ -524,7 +524,7 @@ packages: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.11" path_provider_ios: dependency: transitive description: @@ -921,21 +921,21 @@ packages: name: video_player url: "https://pub.dartlang.org" source: hosted - version: "2.2.8" + version: "2.2.10" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "4.2.0" + version: "5.0.0" video_player_web: dependency: transitive description: name: video_player_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.5" vm_service: dependency: transitive description: @@ -970,7 +970,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.3.1" + version: "2.3.3" xdg_directories: dependency: transitive description: diff --git a/src/account.rs b/src/account.rs index 786aaa8..049e8c4 100644 --- a/src/account.rs +++ b/src/account.rs @@ -83,7 +83,7 @@ impl Account { Account { id: 0, - pub_height: 0, + pub_height: 1, own_height: 0, wallet: String::new(), event: EventId::default(), diff --git a/src/apps/group/layer.rs b/src/apps/group/layer.rs index 162acb9..6deca3c 100644 --- a/src/apps/group/layer.rs +++ b/src/apps/group/layer.rs @@ -253,8 +253,10 @@ async fn handle_server_event( // 3. broadcast offline event. broadcast(&LayerEvent::MemberOffline(gcd, fgid), layer, &gcd, results).await?; } - LayerEvent::GroupName(_gcd, name) => { + LayerEvent::GroupName(gcd, name) => { + // 1. update group name let _ = GroupChat::update_name(&db, &id, &name)?; + // 2. UI: update results.rpcs.push(rpc::group_name(ogid, &id, &name)); if let Ok(sid) = Session::update_name_by_id( &session_db(&base, &ogid)?, @@ -264,6 +266,8 @@ async fn handle_server_event( ) { results.rpcs.push(session_update_name(ogid, &sid, &name)); } + // 3. broadcast + broadcast(&LayerEvent::GroupName(gcd, name), layer, &gcd, results).await?; } LayerEvent::Sync(gcd, _, event) => { match event { diff --git a/src/apps/group/rpc.rs b/src/apps/group/rpc.rs index 2bd989a..8580e49 100644 --- a/src/apps/group/rpc.rs +++ b/src/apps/group/rpc.rs @@ -290,16 +290,16 @@ pub(crate) fn new_rpc_handler(handler: &mut RpcHandler) { let g = GroupChat::get(&db, &id)?; let d = bincode::serialize(&LayerEvent::GroupName(g.g_id, name.to_owned()))?; - if let Ok(sid) = Session::update_name_by_id( - &session_db(&base, &gid)?, - &id, - &SessionType::Group, - &name, - ) { - results.rpcs.push(session_update_name(gid, &sid, &name)); - } - if g.local { + if let Ok(sid) = Session::update_name_by_id( + &session_db(&base, &gid)?, + &id, + &SessionType::Group, + &name, + ) { + results.rpcs.push(session_update_name(gid, &sid, &name)); + } + results.rpcs.push(json!([id, name])); // dissolve group. for (mgid, maddr) in state.layer.read().await.running(&g.g_id)?.onlines() {