Skip to content

Commit

Permalink
3.2.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kkkkkkkkkkkkkkeee committed Jan 5, 2020
1 parent 66459ae commit 995d547
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ What I do is generate dart beans based on json, as well as generics parameters a
* If you need generic conversions in your network requests, use the jsonconvert.fromjsonast method directly.
* If you don't want to use the FlutterJsonBeanFactory in your project, you can add flutter-json: enable: false to the pubspec.yaml file
![image](https://github.com/zhangruiyu/FlutterJsonBeanFactory/blob/master/filter_json_config.png)
* [中文移步](https://www.jianshu.com/p/14cbcbaa74b7)
*如果你有任何问题,添加QQGroup(963752388)随时提问 [中文移步](https://www.jianshu.com/p/14cbcbaa74b7)

### Others
* Welcome anyone to raise new issue.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kotlin_version=1.3.61
pluginVersion=3.2.1
pluginVersion=3.2.2
#每次修改这里去打包
ideaVersionPrefix=193
ideaVersion=
46 changes: 29 additions & 17 deletions src/main/java/com/ruiyu/workers/Initializer.kt
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
package com.ruiyu.workers

import com.intellij.json.psi.JsonElementGenerator
import com.intellij.json.psi.JsonFile
import com.intellij.json.psi.JsonProperty
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.command.undo.UndoManager
import com.intellij.openapi.editor.event.DocumentEvent
//import com.jetbrains.lang.dart.psi.*
//import com.jetbrains.lang.dart.util.DartElementGenerator

import com.intellij.openapi.editor.event.DocumentListener
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.StartupActivity
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.openapi.vfs.newvfs.BulkFileListener
import com.intellij.openapi.vfs.newvfs.events.VFileEvent
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiErrorElement
import com.intellij.psi.PsiManager
import com.intellij.psi.search.FilenameIndex
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.util.messages.MessageBusConnection
import com.ruiyu.Log
//import com.jetbrains.lang.dart.psi.*
//import com.jetbrains.lang.dart.util.DartElementGenerator
import com.ruiyu.beanfactory.FlutterBeanFactoryAction
import com.ruiyu.file.FileHelpers
import io.flutter.pub.PubRoot
import java.util.*
import org.jetbrains.annotations.NotNull
import java.util.regex.Pattern
import kotlin.concurrent.scheduleAtFixedRate


/**
* User: zhangruiyu
Expand All @@ -36,6 +29,25 @@ class Initializer : StartupActivity, DocumentListener {

override fun runActivity(project: Project) {
documentManager = PsiDocumentManager.getInstance(project)
val connection: MessageBusConnection = project.messageBus.connect()

connection.subscribe(VirtualFileManager.VFS_CHANGES, object : BulkFileListener {
override fun after(@NotNull events: List<VFileEvent>) {
if (FileHelpers.shouldActivateFor(project)) {
//如果改动文件包括了自动生成的entity.dart
if (events.firstOrNull {
it.path.endsWith("_entity.dart")
} != null) {
//那么此刻就去自动刷新
FlutterBeanFactoryAction.generateAllFile(project)
}
/*for (event in events) {
println("event = $event")
}*/
}

}
})
/*
Timer().scheduleAtFixedRate(0, 1000) {
if (FileHelpers.shouldActivateFor(project)) {
Expand Down
14 changes: 2 additions & 12 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>com.ruiyu.ruiyu</id>
<name>FlutterJsonBeanFactory</name>
<vendor email="[email protected]" url="https://github.com/zhangruiyu/FlutterJsonBeanFactory">ruiyu</vendor>
<vendor email="[email protected]" url="https://github.com/zhangruiyu/FlutterJsonBeanFactory">ruiyu-QQGroup(963752388)</vendor>

<description><![CDATA[
<br>Json to dart beans are provided, and dart files ending in entity are provided to generate dart bean factory for use.</br>
Expand All @@ -10,24 +10,14 @@
<br>If you need generic conversions in your network requests, use the jsonconvert.fromjsonast method directly.</br>
]]></description>
<change-notes><![CDATA[
<br>if you change the fields, the helper and JsonConvert are automatically regenerated</br>
<br>support such as @JSONField(name:"end_time",format: "yyyy/MM/dd hh:mm:ss",deserialize: true,serialize: false)</br>
<br>add format support for datetime</br>
<br>if you don't want to use the FlutterJsonBeanFactory in your project, you can close the plugin by adding flutter-json: enable: false to the pubspec.yaml file</br>
<br>shortcut key is changed to Alt + j</br>
<br>if the first jsonobject in the jsonarray is not perfect, the data will not be complete</br>
<br>rebuild will delete redundant files</br>
<br>version 3.1 has been released,Provide JsonConvert.dart,EntityFactory is deprecated</br>
<br>fixed error occurred when try casting null to List<String></br>
<br>fixed new file bug</br>
<br>fixed an empty collection bug</br>
<br>fixed field naming bug</br>
<br>change null to dynamic to prevent exception resolution</br>
<br>fixed field forEach method when not converted to list</br>
<br>fixed the bug of plural to singular</br>
<br>fixed import bug under Windows</br>
<br>fixed the dart keyword prob <br>support for custom model suffix names</br>
<br>support android studio</br>
<br>Json to dart beans are provided</br>
]]>
</change-notes>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
Expand Down

0 comments on commit 995d547

Please sign in to comment.