Skip to content

Commit

Permalink
feat: save yapi tokens in project scope
Browse files Browse the repository at this point in the history
  • Loading branch information
tangcent committed Aug 28, 2021
1 parent 59194bb commit 2eb0b0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class XmlSettingBinder : SettingBinder {
return
}

val projectSettings = projectSettingsComponent?.state ?: ProjectSettings()
t.copyTo(projectSettings)
projectSettingsComponent?.loadState(projectSettings)

val applicationSettings = applicationSettingsComponent.state ?: ApplicationSettings()
t.copyTo(applicationSettings)
applicationSettingsComponent.loadState(applicationSettings)

val projectSettings = projectSettingsComponent?.state ?: ProjectSettings()
t.copyTo(projectSettings)
projectSettingsComponent?.loadState(projectSettings)
}

override fun tryRead(): Settings? {
Expand All @@ -49,8 +49,8 @@ class XmlSettingBinder : SettingBinder {
}

val settings = Settings()
projectSettings?.copyTo(settings)
applicationSettings?.copyTo(settings)
projectSettings?.copyTo(settings)
return settings
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ interface ProjectSettingsSupport {

var postmanWorkspace: String?

var yapiTokens: String?

fun copyTo(newSetting: ProjectSettingsSupport) {
newSetting.postmanWorkspace = this.postmanWorkspace
this.yapiTokens?.let { newSetting.yapiTokens = it }
}
}

class ProjectSettings : ProjectSettingsSupport {

override var postmanWorkspace: String? = null

override var yapiTokens: String? = null

fun copy(): ProjectSettings {
val projectSettings = ProjectSettings()
this.copyTo(projectSettings)
Expand Down

0 comments on commit 2eb0b0d

Please sign in to comment.