From a54b6ce6ef452d46ddca61be503c76bd6b62682e Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 26 Apr 2019 12:27:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-16461=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E4=B8=AD=E5=85=B3=E9=97=AD=E8=87=AA=E5=8A=A8=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../push/DesignerPushUpdateManager.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java index 7ac254c93c..f867d6cfd7 100644 --- a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java +++ b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java @@ -13,28 +13,29 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import java.io.IOException; - /** * Created by plough on 2019/4/8. */ public class DesignerPushUpdateManager { private static final String SPLIT_CHAR = "-"; private static DesignerPushUpdateManager singleton; + private static DesignerPushUpdateConfigManager config; + private DesignerUpdateInfo updateInfo; - private DesignerPushUpdateConfigManager config; static { - DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { - @Override - public void designerOpened() { - getInstance().checkAndPop(); - } - }); + config = DesignerPushUpdateConfigManager.getInstance(); + if (config.isAutoPushUpdateEnabled()) { + DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { + @Override + public void designerOpened() { + getInstance().checkAndPop(); + } + }); + } } private DesignerPushUpdateManager() { - config = DesignerPushUpdateConfigManager.getInstance(); } public static DesignerPushUpdateManager getInstance() { @@ -56,7 +57,7 @@ public class DesignerPushUpdateManager { try { String res = HttpToolbox.get(CloudCenter.getInstance().acquireUrlByKind("jar10.update")); return new JSONObject(res).optString("buildNO"); - } catch (IOException e) { + } catch (Throwable e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return StringUtils.EMPTY; From 71025a0b7485681ee778dfb69c41fae4cc964c18 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 26 Apr 2019 13:39:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-16461=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E4=B8=AD=E5=85=B3=E9=97=AD=E8=87=AA=E5=8A=A8=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=A0=E6=95=88=3D>=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/update/push/DesignerPushUpdateManager.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java index f867d6cfd7..dcb5d45fd2 100644 --- a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java +++ b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java @@ -19,13 +19,11 @@ import com.fr.workspace.WorkContext; public class DesignerPushUpdateManager { private static final String SPLIT_CHAR = "-"; private static DesignerPushUpdateManager singleton; - private static DesignerPushUpdateConfigManager config; private DesignerUpdateInfo updateInfo; static { - config = DesignerPushUpdateConfigManager.getInstance(); - if (config.isAutoPushUpdateEnabled()) { + if (DesignerPushUpdateConfigManager.getInstance().isAutoPushUpdateEnabled()) { DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { @Override public void designerOpened() { @@ -46,7 +44,7 @@ public class DesignerPushUpdateManager { } private void initUpdateInfo(String currentVersion, String latestVersion) { - String lastIgnoredVersion = config.getLastIgnoredVersion(); + String lastIgnoredVersion = DesignerPushUpdateConfigManager.getInstance().getLastIgnoredVersion(); String updatePushInfo = CloudCenter.getInstance().acquireUrlByKind("update.push"); JSONObject pushData = new JSONObject(updatePushInfo); @@ -165,6 +163,6 @@ public class DesignerPushUpdateManager { if (updateInfo == null) { return; } - config.setLastIgnoredVersion(updateInfo.getPushVersion()); + DesignerPushUpdateConfigManager.getInstance().setLastIgnoredVersion(updateInfo.getPushVersion()); } }