|
|
@ -13,18 +13,17 @@ import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Created by plough on 2019/4/8. |
|
|
|
* Created by plough on 2019/4/8. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class DesignerPushUpdateManager { |
|
|
|
public class DesignerPushUpdateManager { |
|
|
|
private static final String SPLIT_CHAR = "-"; |
|
|
|
private static final String SPLIT_CHAR = "-"; |
|
|
|
private static DesignerPushUpdateManager singleton; |
|
|
|
private static DesignerPushUpdateManager singleton; |
|
|
|
|
|
|
|
|
|
|
|
private DesignerUpdateInfo updateInfo; |
|
|
|
private DesignerUpdateInfo updateInfo; |
|
|
|
private DesignerPushUpdateConfigManager config; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
static { |
|
|
|
|
|
|
|
if (DesignerPushUpdateConfigManager.getInstance().isAutoPushUpdateEnabled()) { |
|
|
|
DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { |
|
|
|
DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void designerOpened() { |
|
|
|
public void designerOpened() { |
|
|
@ -32,9 +31,9 @@ public class DesignerPushUpdateManager { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private DesignerPushUpdateManager() { |
|
|
|
private DesignerPushUpdateManager() { |
|
|
|
config = DesignerPushUpdateConfigManager.getInstance(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static DesignerPushUpdateManager getInstance() { |
|
|
|
public static DesignerPushUpdateManager getInstance() { |
|
|
@ -45,7 +44,7 @@ public class DesignerPushUpdateManager { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initUpdateInfo(String currentVersion, String latestVersion) { |
|
|
|
private void initUpdateInfo(String currentVersion, String latestVersion) { |
|
|
|
String lastIgnoredVersion = config.getLastIgnoredVersion(); |
|
|
|
String lastIgnoredVersion = DesignerPushUpdateConfigManager.getInstance().getLastIgnoredVersion(); |
|
|
|
String updatePushInfo = CloudCenter.getInstance().acquireUrlByKind("update.push"); |
|
|
|
String updatePushInfo = CloudCenter.getInstance().acquireUrlByKind("update.push"); |
|
|
|
JSONObject pushData = new JSONObject(updatePushInfo); |
|
|
|
JSONObject pushData = new JSONObject(updatePushInfo); |
|
|
|
|
|
|
|
|
|
|
@ -56,7 +55,7 @@ public class DesignerPushUpdateManager { |
|
|
|
try { |
|
|
|
try { |
|
|
|
String res = HttpToolbox.get(CloudCenter.getInstance().acquireUrlByKind("jar10.update")); |
|
|
|
String res = HttpToolbox.get(CloudCenter.getInstance().acquireUrlByKind("jar10.update")); |
|
|
|
return new JSONObject(res).optString("buildNO"); |
|
|
|
return new JSONObject(res).optString("buildNO"); |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (Throwable e) { |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
return StringUtils.EMPTY; |
|
|
|
return StringUtils.EMPTY; |
|
|
@ -164,6 +163,6 @@ public class DesignerPushUpdateManager { |
|
|
|
if (updateInfo == null) { |
|
|
|
if (updateInfo == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
config.setLastIgnoredVersion(updateInfo.getPushVersion()); |
|
|
|
DesignerPushUpdateConfigManager.getInstance().setLastIgnoredVersion(updateInfo.getPushVersion()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|