refactor: share channel setup status helpers

This commit is contained in:
Peter Steinberger
2026-03-23 01:51:38 +00:00
parent 583bea001c
commit 5c8ea0a175
18 changed files with 188 additions and 83 deletions

View File

@@ -1,6 +1,7 @@
import {
createAllowFromSection,
createPromptParsedAllowFromForAccount,
createStandardChannelSetupStatus,
DEFAULT_ACCOUNT_ID,
formatDocsLink,
type ChannelSetupDmPolicy,
@@ -143,20 +144,21 @@ export const blueBubblesSetupWizard: ChannelSetupWizard = {
channel,
stepOrder: "text-first",
status: {
configuredLabel: "configured",
unconfiguredLabel: "needs setup",
configuredHint: "configured",
unconfiguredHint: "iMessage via BlueBubbles app",
configuredScore: 1,
unconfiguredScore: 0,
resolveConfigured: ({ cfg }) =>
listBlueBubblesAccountIds(cfg).some((accountId) => {
const account = resolveBlueBubblesAccount({ cfg, accountId });
return account.configured;
}),
resolveStatusLines: ({ configured }) => [
`BlueBubbles: ${configured ? "configured" : "needs setup"}`,
],
...createStandardChannelSetupStatus({
channelLabel: "BlueBubbles",
configuredLabel: "configured",
unconfiguredLabel: "needs setup",
configuredHint: "configured",
unconfiguredHint: "iMessage via BlueBubbles app",
configuredScore: 1,
unconfiguredScore: 0,
includeStatusLine: true,
resolveConfigured: ({ cfg }) =>
listBlueBubblesAccountIds(cfg).some((accountId) => {
const account = resolveBlueBubblesAccount({ cfg, accountId });
return account.configured;
}),
}),
resolveSelectionHint: ({ configured }) =>
configured ? "configured" : "iMessage via BlueBubbles app",
},