Skip to content

Commit 672b448

Browse files
committed
Ability to mark messages as shown
Signed-off-by: worksofliam <[email protected]>
1 parent 3dad743 commit 672b448

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

src/api/configuration/storage/CodeForIStorage.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const SERVER_SETTINGS_CACHE_PREFIX = `serverSettingsCache_`;
55
const SERVER_SETTINGS_CACHE_KEY = (name: string) => SERVER_SETTINGS_CACHE_PREFIX + name;
66
const PREVIOUS_SEARCH_TERMS_KEY = `prevSearchTerms`;
77
const PREVIOUS_FIND_TERMS_KEY = `prevFindTerms`;
8+
const MESSAGE_SHOWN_KEY = `messageShown`;
89

910
export type PathContent = Record<string, string[]>;
1011
export type DeploymentPath = Record<string, string>;
@@ -137,4 +138,17 @@ export class CodeForIStorage {
137138
async clearPreviousFindTerms(){
138139
await this.internalStorage.set(PREVIOUS_FIND_TERMS_KEY, undefined);
139140
}
141+
142+
hasMessageBeenShown(messageId: string): boolean {
143+
const shownMessages = this.internalStorage.get<string[]>(MESSAGE_SHOWN_KEY) || [];
144+
return shownMessages.includes(messageId);
145+
}
146+
147+
async markMessageAsShown(messageId: string): Promise<void> {
148+
const shownMessages = this.internalStorage.get<string[]>(MESSAGE_SHOWN_KEY) || [];
149+
if (!shownMessages.includes(messageId)) {
150+
shownMessages.push(messageId);
151+
await this.internalStorage.set(MESSAGE_SHOWN_KEY, shownMessages);
152+
}
153+
}
140154
}

src/debug/index.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,23 @@ export async function initialize(context: ExtensionContext) {
323323

324324
} else {
325325
const version = (await getDebugServiceDetails(connection)).semanticVersion();
326-
if (version.major < server.MIN_DEBUG_VERSION) {
327-
vscode.window.showWarningMessage(`Debug service version ${version} is below the minimum required version ${server.MIN_DEBUG_VERSION}. Please update the debug service PTF.`, `Open docs`).then(selected => {
328-
if (selected === `Open docs`) {
329-
env.openExternal(Uri.parse(`https://codefori.github.io/docs/developing/debug/`));
330-
}
331-
});
326+
// if (version.major < server.MIN_DEBUG_VERSION) {
327+
if (true) {
328+
const debugUpdateMessageId = `debugUpdateRequired-${version.major}`;
329+
const showMessage = !IBMi.GlobalStorage.hasMessageBeenShown(debugUpdateMessageId);
330+
331+
if (showMessage) {
332+
vscode.window.showWarningMessage(`Debug service version ${version} is below the minimum required version ${server.MIN_DEBUG_VERSION}. Please update the debug service PTF.`, `Open docs`, `Dismiss`).then(selected => {
333+
switch (selected) {
334+
case `Open docs`:
335+
env.openExternal(Uri.parse(`https://codefori.github.io/docs/developing/debug/`));
336+
break;
337+
case `Dismiss`:
338+
IBMi.GlobalStorage.markMessageAsShown(debugUpdateMessageId);
339+
break;
340+
}
341+
});
342+
}
332343
}
333344
}
334345
}

0 commit comments

Comments
 (0)