Skip to content

Commit

Permalink
replace update mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
alyssaruth committed Aug 16, 2024
1 parent 2921aa6 commit b8127b3
Show file tree
Hide file tree
Showing 29 changed files with 306 additions and 912 deletions.
2 changes: 2 additions & 0 deletions client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ ktfmt { kotlinLangStyle() }
dependencies {
implementation("com.jgoodies:jgoodies-forms:1.6.0")
implementation("com.miglayout:miglayout-swing:5.2")
implementation("com.konghq:unirest-java:3.14.2")
implementation(project(":core"))
testImplementation(testFixtures(project(":core")))
}

application {
Expand Down
50 changes: 0 additions & 50 deletions client/src/main/java/bean/HyperlinkAdaptor.java

This file was deleted.

9 changes: 0 additions & 9 deletions client/src/main/java/bean/HyperlinkListener.java

This file was deleted.

9 changes: 1 addition & 8 deletions client/src/main/java/online/util/DesktopEntropyClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ public void sendAsyncInSingleThread(MessageSenderParams message)
senderThread.start();
}

/*public void sendAsync(MessageSenderParams message)
{
MessageSender senderRunnable = new MessageSender(this, message);
Thread senderThread = new Thread(senderRunnable, "MessageSender");
senderThread.start();
}*/

@Override
public String sendSyncOnDevice(MessageSender runnable)
{
Expand All @@ -91,6 +84,6 @@ public String sendSyncOnDevice(MessageSender runnable)
@Override
public void checkForUpdates()
{
UpdateChecker.checkForUpdates(FILE_NAME_ENTROPY_JAR, SERVER_PORT_NUMBER_DOWNLOAD);
UpdateManager.INSTANCE.checkForUpdates(OnlineConstants.ENTROPY_VERSION_NUMBER);
}
}
23 changes: 9 additions & 14 deletions client/src/main/java/online/util/ResponseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,28 +265,23 @@ private static void handleConnectFailure(Element root)

if (failureReason.contains("out of date"))
{
promptForUpdate(root);
promptForUpdate();
}
else
{
DialogUtil.showErrorLater(failureReason);
}
}

private static void promptForUpdate(final Element rootElement)
private static void promptForUpdate()
{
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
int answer = DialogUtil.showQuestion("Entropy needs to update in order to connect. \n\nUpdate now?", false);
if (answer == JOptionPane.YES_OPTION)
{
UpdateChecker.startUpdate(rootElement, OnlineConstants.FILE_NAME_ENTROPY_JAR, OnlineConstants.SERVER_PORT_NUMBER_DOWNLOAD);
}
}
});
SwingUtilities.invokeLater(() -> {
int answer = DialogUtil.showQuestion("Entropy needs to update in order to connect. \n\nUpdate now?", false);
if (answer == JOptionPane.YES_OPTION)
{
UpdateManager.INSTANCE.checkForUpdates(OnlineConstants.ENTROPY_VERSION_NUMBER);
}
});
}

private static void handleKickOff(Element root)
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/java/screen/AbstractAboutDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import javax.swing.SwingConstants;

import bean.HyperlinkAdaptor;
import bean.HyperlinkListener;
import bean.IHyperlinkListener;

public abstract class AbstractAboutDialog extends JDialog
implements HyperlinkListener,
implements IHyperlinkListener,
ActionListener
{
public AbstractAboutDialog()
Expand Down
11 changes: 11 additions & 0 deletions client/src/main/java/util/DialogUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import screen.LoadingDialog;

import java.awt.*;

import static utils.InjectedThings.logger;

public class DialogUtil
Expand Down Expand Up @@ -114,4 +116,13 @@ public static void dismissLoadingDialog()
{
loadingDialog.dismissDialog();
}

public static void showCustomMessage(Object message) {
JOptionPane.showMessageDialog(
null,
message,
"Information",
JOptionPane.INFORMATION_MESSAGE
);
}
}
110 changes: 0 additions & 110 deletions client/src/main/java/util/UpdateChecker.java

This file was deleted.

Loading

0 comments on commit b8127b3

Please sign in to comment.