3333 subtitle : String ,
3434 operation : Operation ,
3535 rp_id : String ,
36- requesting_app : RequestingApplication ,
36+ app_name : String ,
37+ app_path_or_id : String ,
38+ app_pid : u32 ,
3739
3840 // This includes devices like platform authenticator, USB, hybrid
3941 devices : Vec < Device > ,
@@ -52,13 +54,22 @@ impl<F: FlowController + Send> ViewModel<F> {
5254 rx_event : Receiver < ViewEvent > ,
5355 tx_update : Sender < ViewUpdate > ,
5456 ) -> Self {
57+ let RequestingApplication {
58+ name : app_name,
59+ path_or_app_id : path,
60+ pid,
61+ } = request. requesting_app ;
62+
63+ let app_name: Option < String > = app_name. into ( ) ;
5564 Self {
5665 flow_controller,
5766 rx_event,
5867 tx_update,
5968 operation : request. operation ,
6069 rp_id : request. rp_id ,
61- requesting_app : request. requesting_app ,
70+ app_name : app_name. unwrap_or_else ( || gettext ( "unknown application" ) ) ,
71+ app_path_or_id : path,
72+ app_pid : pid,
6273 title : String :: default ( ) ,
6374 subtitle : String :: default ( ) ,
6475 devices : Vec :: new ( ) ,
@@ -69,11 +80,6 @@ impl<F: FlowController + Send> ViewModel<F> {
6980 }
7081
7182 async fn update_title ( & mut self ) {
72- let mut requesting_app = self . requesting_app . clone ( ) ;
73-
74- if requesting_app. name . is_empty ( ) {
75- requesting_app. name = gettext ( "unknown application" ) ;
76- } ;
7783 let mut title = match self . operation {
7884 Operation :: Create => {
7985 // TRANSLATORS: %s1 is the "relying party" (think: domain name) where the request is coming from
@@ -105,9 +111,9 @@ impl<F: FlowController + Send> ViewModel<F> {
105111 }
106112 . to_string ( ) ;
107113 subtitle = subtitle. replace ( "%s1" , & self . rp_id ) ;
108- subtitle = subtitle. replace ( "%i1" , & format ! ( "{}" , requesting_app . pid ) ) ;
109- subtitle = subtitle. replace ( "%s2" , & requesting_app . name ) ;
110- subtitle = subtitle. replace ( "%s3" , & requesting_app . path ) ;
114+ subtitle = subtitle. replace ( "%i1" , & format ! ( "{}" , self . app_pid ) ) ;
115+ subtitle = subtitle. replace ( "%s2" , & self . app_name ) ;
116+ subtitle = subtitle. replace ( "%s3" , & self . app_path_or_id ) ;
111117 self . title = title;
112118 self . subtitle = subtitle;
113119 self . tx_update
0 commit comments