Skip to content

Commit

Permalink
Merge pull request #123 from CodeDead/feature/refactoring
Browse files Browse the repository at this point in the history
feat: code refactoring
  • Loading branch information
CodeDead authored Jul 12, 2024
2 parents 00bbc06 + 6cf3593 commit 066bdbd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 105 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,6 @@ This library is maintained by CodeDead. You can find more about us using the fol
* [Twitter](https://twitter.com/C0DEDEAD)
* [Facebook](https://facebook.com/deadlinecodedead)
* [Reddit](https://reddit.com/r/CodeDead)
* [ X ](https://x.com/C0DEDEAD)

Copyright © 2024 CodeDead
20 changes: 16 additions & 4 deletions src/main/java/com/codedead/opal/controller/TrayIconController.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ public void showTrayIcon() throws IOException {
logger.info("Displaying tray icon");
if (trayIcon == null) {
createTrayIcon();
if (trayIcon == null) {
logger.warn("TrayIcon cannot be null!");
if (!validTrayIcon()) {
return;
}
}
Expand All @@ -119,8 +118,8 @@ public void showTrayIcon() throws IOException {
*/
public void hideTrayIcon() {
logger.info("Hiding tray icon");
if (trayIcon == null) {
logger.warn("TrayIcon cannot be null!");

if (!validTrayIcon()) {
return;
}

Expand All @@ -129,4 +128,17 @@ public void hideTrayIcon() {

trayIcon = null;
}

/**
* Check if the tray icon is valid
*
* @return True if the tray icon is valid, false otherwise
*/
private boolean validTrayIcon() {
if (trayIcon == null) {
logger.warn("TrayIcon cannot be null!");
return false;
}
return true;
}
}
101 changes: 0 additions & 101 deletions src/main/resources/translations/OpalApplication_en_US.properties

This file was deleted.

0 comments on commit 066bdbd

Please sign in to comment.