mirror of
https://github.com/foss42/apidash.git
synced 2025-06-02 07:46:10 +08:00
workspace
This commit is contained in:
@ -14,6 +14,7 @@ class SettingsModel {
|
||||
this.promptBeforeClosing = true,
|
||||
this.activeEnvironmentId,
|
||||
this.historyRetentionPeriod = HistoryRetentionPeriod.oneWeek,
|
||||
this.workspaceFolderPath,
|
||||
});
|
||||
|
||||
final bool isDark;
|
||||
@ -26,6 +27,7 @@ class SettingsModel {
|
||||
final bool promptBeforeClosing;
|
||||
final String? activeEnvironmentId;
|
||||
final HistoryRetentionPeriod historyRetentionPeriod;
|
||||
final String? workspaceFolderPath;
|
||||
|
||||
SettingsModel copyWith({
|
||||
bool? isDark,
|
||||
@ -38,6 +40,7 @@ class SettingsModel {
|
||||
bool? promptBeforeClosing,
|
||||
String? activeEnvironmentId,
|
||||
HistoryRetentionPeriod? historyRetentionPeriod,
|
||||
String? workspaceFolderPath,
|
||||
}) {
|
||||
return SettingsModel(
|
||||
isDark: isDark ?? this.isDark,
|
||||
@ -52,6 +55,7 @@ class SettingsModel {
|
||||
activeEnvironmentId: activeEnvironmentId ?? this.activeEnvironmentId,
|
||||
historyRetentionPeriod:
|
||||
historyRetentionPeriod ?? this.historyRetentionPeriod,
|
||||
workspaceFolderPath: workspaceFolderPath ?? this.workspaceFolderPath,
|
||||
);
|
||||
}
|
||||
|
||||
@ -86,8 +90,7 @@ class SettingsModel {
|
||||
final promptBeforeClosing = data["promptBeforeClosing"] as bool?;
|
||||
final activeEnvironmentId = data["activeEnvironmentId"] as String?;
|
||||
final historyRetentionPeriodStr = data["historyRetentionPeriod"] as String?;
|
||||
HistoryRetentionPeriod historyRetentionPeriod =
|
||||
HistoryRetentionPeriod.oneWeek;
|
||||
HistoryRetentionPeriod? historyRetentionPeriod;
|
||||
if (historyRetentionPeriodStr != null) {
|
||||
try {
|
||||
historyRetentionPeriod =
|
||||
@ -96,6 +99,7 @@ class SettingsModel {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
final workspaceFolderPath = data["workspaceFolderPath"] as String?;
|
||||
|
||||
const sm = SettingsModel();
|
||||
|
||||
@ -109,7 +113,9 @@ class SettingsModel {
|
||||
saveResponses: saveResponses,
|
||||
promptBeforeClosing: promptBeforeClosing,
|
||||
activeEnvironmentId: activeEnvironmentId,
|
||||
historyRetentionPeriod: historyRetentionPeriod,
|
||||
historyRetentionPeriod:
|
||||
historyRetentionPeriod ?? HistoryRetentionPeriod.oneWeek,
|
||||
workspaceFolderPath: workspaceFolderPath,
|
||||
);
|
||||
}
|
||||
|
||||
@ -127,12 +133,13 @@ class SettingsModel {
|
||||
"promptBeforeClosing": promptBeforeClosing,
|
||||
"activeEnvironmentId": activeEnvironmentId,
|
||||
"historyRetentionPeriod": historyRetentionPeriod.name,
|
||||
"workspaceFolderPath": workspaceFolderPath,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toJson().toString();
|
||||
return kJsonEncoder.convert(toJson());
|
||||
}
|
||||
|
||||
@override
|
||||
@ -149,7 +156,8 @@ class SettingsModel {
|
||||
other.saveResponses == saveResponses &&
|
||||
other.promptBeforeClosing == promptBeforeClosing &&
|
||||
other.activeEnvironmentId == activeEnvironmentId &&
|
||||
other.historyRetentionPeriod == historyRetentionPeriod;
|
||||
other.historyRetentionPeriod == historyRetentionPeriod &&
|
||||
other.workspaceFolderPath == workspaceFolderPath;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -166,6 +174,7 @@ class SettingsModel {
|
||||
promptBeforeClosing,
|
||||
activeEnvironmentId,
|
||||
historyRetentionPeriod,
|
||||
workspaceFolderPath,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user