File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1179,6 +1179,12 @@ impl ChatSession {
11791179 }
11801180
11811181 async fn show_changelog_announcement ( & mut self , os : & mut Os ) -> Result < ( ) > {
1182+ let has_used_before = os. database . has_used_chat_before ( ) ?;
1183+ if !has_used_before {
1184+ os. database . mark_chat_as_used ( ) ?;
1185+ return Ok ( ( ) ) ;
1186+ }
1187+
11821188 let current_version = env ! ( "CARGO_PKG_VERSION" ) ;
11831189 let last_version = os. database . get_changelog_last_version ( ) ?;
11841190 let show_count = os. database . get_changelog_show_count ( ) ?. unwrap_or ( 0 ) ;
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ const IDC_REGION_KEY: &str = "auth.idc.region";
6363const CUSTOMIZATION_STATE_KEY : & str = "api.selectedCustomization" ;
6464const PROFILE_MIGRATION_KEY : & str = "profile.Migrated" ;
6565const HEARTBEAT_DATE_KEY : & str = "telemetry.lastHeartbeatDate" ;
66+ const CHAT_USED_BEFORE_KEY : & str = "chat.usedBefore" ;
6667
6768const MIGRATIONS : & [ Migration ] = migrations ! [
6869 "000_migration_table" ,
@@ -507,6 +508,20 @@ impl Database {
507508
508509 Ok ( map)
509510 }
511+
512+ /// Check if chat has been used before
513+ /// Returns true if user has used chat before, false if this is the first time
514+ pub fn has_used_chat_before ( & self ) -> Result < bool , DatabaseError > {
515+ Ok ( self
516+ . get_entry :: < bool > ( Table :: State , CHAT_USED_BEFORE_KEY ) ?
517+ . unwrap_or ( false ) )
518+ }
519+
520+ /// Mark that chat has been used
521+ pub fn mark_chat_as_used ( & self ) -> Result < ( ) , DatabaseError > {
522+ self . set_entry ( Table :: State , CHAT_USED_BEFORE_KEY , true ) ?;
523+ Ok ( ( ) )
524+ }
510525}
511526
512527fn max_migration_version < C : Deref < Target = Connection > > ( conn : & C ) -> Option < i64 > {
You can’t perform that action at this time.
0 commit comments