diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a7719d..3fd65da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Leetcode Editor Changelog +[![English Document][badge:en-doc]][gh:en-doc] +[![中文文档][badge:zh-doc]][gh:zh-doc] +[![捐赠][badge:donate]][shuzijun-donate] +[![捐赠][badge:donate-zh]][shuzijun-donate] +[![内推][badge:referrals]][shuzijun-referrals] ## 8.2.0 @@ -34,4 +39,17 @@ ### Deprecated -### Removed \ No newline at end of file +### Removed + +[badge:en-doc]: https://img.shields.io/badge/Docs-English%20Document-blue?logo=docs&style=flat-square +[badge:zh-doc]: https://img.shields.io/badge/Docs-中文文档-blue?logo=docs&style=flat-square +[badge:donate]: https://img.shields.io/badge/Docs-donate-ff69c4?logo=docs&style=flat-square +[badge:donate-zh]: https://img.shields.io/badge/Docs-捐赠-ff69c4?logo=docs&style=flat-square +[badge:referrals]: https://img.shields.io/badge/Docs-内推-ff69c4?logo=docs&style=flat-square + + +[gh:en-doc]: https://github.com/shuzijun/leetcode-editor/blob/master/README.md +[gh:zh-doc]: https://github.com/shuzijun/leetcode-editor/blob/master/README_ZH.md + +[shuzijun-donate]: https://shuzijun.cn/donate.html +[shuzijun-referrals]: https://shuzijun.cn/referrals.html \ No newline at end of file diff --git a/build.gradle b/build.gradle index 80e160d..f5ee6fd 100644 --- a/build.gradle +++ b/build.gradle @@ -50,6 +50,7 @@ intellij { patchPluginXml { sinceBuild = project.pluginSinceBuild untilBuild = project.pluginUntilBuild + pluginDescription = new File(project.pluginDescription).getText('UTF-8') changeNotes.set(provider { changelog.get(project.version+".0").toHTML() }) } diff --git a/doc/description.html b/doc/description.html new file mode 100644 index 0000000..42c034d --- /dev/null +++ b/doc/description.html @@ -0,0 +1,128 @@ +
+

Support for leetcode.com and leetcode.cn, can test and submit questions. + More tutorial please visit: here

+
+
+
+

Introduction

+
+ + +
+
+

Getting Started

+

start

+ +

Local debugging

+

loacl

+ +

Configuration (configuration for first installation)

+

config

+ + +

Window

+

window

+ + +

Menu

+

menu

+ + + +


+ +


+ diff --git a/gradle.properties b/gradle.properties index ff86e6f..b6934d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,6 +4,7 @@ pluginVersion = 8.2 pluginSinceBuild = 202.0 pluginUntilBuild = +pluginDescription = doc/description.html platformType = IU platformVersion = 2022.1 diff --git a/src/main/java/com/shuzijun/leetcode/plugin/listener/RegisterPluginInstallerStateListener.java b/src/main/java/com/shuzijun/leetcode/plugin/listener/RegisterPluginInstallerStateListener.java index d401c4d..2836c4b 100644 --- a/src/main/java/com/shuzijun/leetcode/plugin/listener/RegisterPluginInstallerStateListener.java +++ b/src/main/java/com/shuzijun/leetcode/plugin/listener/RegisterPluginInstallerStateListener.java @@ -1,15 +1,51 @@ package com.shuzijun.leetcode.plugin.listener; +import com.intellij.ide.plugins.PluginManagerCore; +import com.intellij.ide.util.PropertiesComponent; +import com.intellij.openapi.extensions.PluginId; +import com.intellij.openapi.fileEditor.impl.HTMLEditorProvider; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupActivity; +import com.shuzijun.leetcode.plugin.model.Config; +import com.shuzijun.leetcode.plugin.model.PluginConstant; +import com.shuzijun.leetcode.plugin.setting.PersistentConfig; import org.jetbrains.annotations.NotNull; /** * @author shuzijun */ public class RegisterPluginInstallerStateListener implements StartupActivity { + + private final static String ShowNewHTMLEditorKey = PluginConstant.PLUGIN_ID + "ShowNewHTMLEditor"; + + private final static String CHANGELOGURL = "https://github.com/shuzijun/leetcode-editor/blob/master/CHANGELOG.md"; + @Override public void runActivity(@NotNull Project project) { + String newVersion = PluginManagerCore.getPlugin(PluginId.getId(PluginConstant.PLUGIN_ID)).getVersion(); + Config config = PersistentConfig.getInstance().getInitConfig(); + String oldVersion; + if (config == null) { + oldVersion = PropertiesComponent.getInstance().getValue(ShowNewHTMLEditorKey); + PropertiesComponent.getInstance().setValue(ShowNewHTMLEditorKey, newVersion); + } else { + oldVersion = config.getPluginVersion(); + config.setPluginVersion(newVersion); + } + + if (!newVersion.equals(oldVersion)) { + HTMLEditorProvider.openEditor(project, + "What's New in " + PluginConstant.PLUGIN_ID, + CHANGELOGURL, + "'
" + + "
Failed to load!
" + + "'
Open in browser
" + + "
" + ); + } + + /* PluginInstaller.addStateListener(new PluginStateListener() { @Override public void install(@NotNull IdeaPluginDescriptor ideaPluginDescriptor) { diff --git a/src/main/java/com/shuzijun/leetcode/plugin/model/Config.java b/src/main/java/com/shuzijun/leetcode/plugin/model/Config.java index 3d18254..3ad044d 100644 --- a/src/main/java/com/shuzijun/leetcode/plugin/model/Config.java +++ b/src/main/java/com/shuzijun/leetcode/plugin/model/Config.java @@ -17,6 +17,8 @@ public class Config implements Cloneable { private Integer version; + private String pluginVersion; + private String id; /** @@ -419,6 +421,14 @@ public void setShowQuestionEditorSign(boolean showQuestionEditorSign) { this.showQuestionEditorSign = showQuestionEditorSign; } + public String getPluginVersion() { + return pluginVersion; + } + + public void setPluginVersion(String pluginVersion) { + this.pluginVersion = pluginVersion; + } + public boolean isModified(Config config) { if (config == null) { diff --git a/src/main/java/com/shuzijun/leetcode/plugin/window/NavigatorTabsPanel.java b/src/main/java/com/shuzijun/leetcode/plugin/window/NavigatorTabsPanel.java index bf29c68..07d2317 100644 --- a/src/main/java/com/shuzijun/leetcode/plugin/window/NavigatorTabsPanel.java +++ b/src/main/java/com/shuzijun/leetcode/plugin/window/NavigatorTabsPanel.java @@ -224,17 +224,17 @@ public void dispose() { public static synchronized void loadUser(boolean login) { User user = null; if (login) { - for (int i = 0; i < 10; i++) { + for (int i = 0; i <= 50; i++) { user = QuestionManager.getUser(); if (!user.isSignedIn()) { try { - Thread.sleep(500); + Thread.sleep(500 + (i / 10 * 100)); } catch (InterruptedException ignore) { } } else { break; } - if(i == 9){ + if(i == 50){ LogUtils.LOG.warn("User data is not synchronized"); } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 054bc32..118ffd2 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -4,116 +4,7 @@ 8.1 shuzijun - -

Support for leetcode.com and leetcode.cn, can test and submit questions. - More tutorial please visit: here

- -
-

Introduction

-
- - -
-
-

How to use

-
-

- demo -

-
-
-
-

Local debugging

-
-

- demo -

-
-
-
-

Configuration (configuration for first installation)

-
-

- settings -

-
-

Configuration path: File -> settings->tools->leetcode plugin

-
- -
-
-
-
-

Window (Icon in the lower right corner of the main window)

-
-

- window -

-
-

Toolbar:

- -
-

Tree:

- -
-
-
-
-

Menu:

-
-

- menu -

-
-

Menu (right-click on the questions)

- -
- ]]>
+ @@ -131,7 +22,7 @@ - +