Skip to content

Commit

Permalink
formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
marci1175 committed Aug 3, 2024
1 parent ad2f994 commit 7d7186c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion build_info.matthias_build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.08.03. 23:12
2024.08.03. 23:13
18 changes: 7 additions & 11 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,17 @@ impl eframe::App for backend::Application {
if startup_link.contains(CUSTOM_URL) && self.main.client_mode {
//Get the address the link connects to
let link = &startup_link[CUSTOM_URL.len()..];

let (address, password) = link.split_at(link.find("&").unwrap());

let password = dbg!(&password[1..]);
let password = &password[1..];

//Connect to server
self.connect_to_server(
ctx,
address.to_string(),
Some(password.to_string()),
);
self.connect_to_server(ctx, address.to_string(), Some(password.to_string()));

//Set address so itll be displayed in the ui too
self.client_ui.send_on_ip = address.to_string();

//Set password so itll be displayed in the ui too
self.client_ui.client_password = password.to_string();

Expand All @@ -134,10 +130,10 @@ impl eframe::App for backend::Application {
toast.set_closable(true);

toasts.add(toast);
},
}
Err(_err) => {
dbg!(_err);
},
}
}

//Reset startup args if we have already ran this code
Expand Down Expand Up @@ -439,7 +435,7 @@ impl backend::Application {

ui.add_enabled(
matches!(self.client_connection.state, ConnectionState::Disconnected)
|| matches!(self.client_connection.state, ConnectionState::Error),
|| matches!(self.client_connection.state, ConnectionState::Error),
|ui: &mut egui::Ui| {
ui.add(
TextEdit::singleline(&mut self.client_ui.client_password)
Expand Down
17 changes: 12 additions & 5 deletions src/app/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ use crate::app::backend::{
ClientMessageType::{
FileRequestType, FileUpload, MessageEdit, NormalMessage, Reaction as ClientReaction,
SyncMessage, VoipConnection,
}, ServerFileReply, ServerImageReply,
},
ServerFileReply, ServerImageReply,
};
use tokio::{
io::AsyncWrite,
Expand Down Expand Up @@ -1467,13 +1468,19 @@ impl MessageService {

//Check if we removed the last emoji, if yes remove the whole emoji entry
if was_last_rection {
match reaction_vec[reaction.message_index].message_reactions.clone().get(reaction.message_index) {
match reaction_vec[reaction.message_index]
.message_reactions
.clone()
.get(reaction.message_index)
{
Some(_) => {
reaction_vec[reaction.message_index].message_reactions.remove(reaction.message_index);
},
reaction_vec[reaction.message_index]
.message_reactions
.remove(reaction.message_index);
}
None => {
dbg!("The emoji requested to be removed was not in the emoji list");
},
}
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/app/ui/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,7 @@ impl Application {
if let Some(index) = self
.client_ui
.incoming_messages
.reaction_list
[reaction.message_index]
.reaction_list[reaction.message_index]
.message_reactions
.iter()
.position(|item| {
Expand Down Expand Up @@ -874,8 +873,7 @@ impl Application {
if let Some(index) = self
.client_ui
.incoming_messages
.reaction_list
[reaction.message_index]
.reaction_list[reaction.message_index]
.message_reactions
.iter()
.position(|item| {
Expand Down
10 changes: 5 additions & 5 deletions src/app/ui/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ impl Application {

let pub_ip: Vec<&str> = self.public_ip.rsplit(';').collect();

let formatted_ip = format!(
"[{}]:{}",
pub_ip[0], self.open_on_port
);
let formatted_ip = format!("[{}]:{}", pub_ip[0], self.open_on_port);

ui.horizontal(|ui| {
ui.label("Server address (Public ipv6 address)");
Expand All @@ -155,7 +152,10 @@ impl Application {
ui.horizontal(|ui| {
ui.label(RichText::from("Share").weak().size(self.font_size / 2.));
if ui.button("Copy connection link").clicked() {
ctx.copy_text(format!("matthias://{formatted_ip}&{}", self.server_password));
ctx.copy_text(format!(
"matthias://{formatted_ip}&{}",
self.server_password
));
}
});

Expand Down

0 comments on commit 7d7186c

Please sign in to comment.