Merges shell multi-profile support for desktop (FN-3403) — spanning new connection-manager flows, shell onboarding interoperability, mobile connection profiles, desktop IPC/shell-settings plumbing, and tokenized titlebar styles — with a secondary migration of the WhatsApp plugin to the Baileys pairi Fusion-Task-Id: FN-3403
26 lines
941 B
TypeScript
26 lines
941 B
TypeScript
import { useCallback } from "react";
|
|
import { useShellContext } from "../context/ShellContext";
|
|
import {
|
|
createOrUpdateProfile,
|
|
deleteProfile,
|
|
normalizeShellState,
|
|
selectActiveProfile,
|
|
} from "../utils/shell-connection-settings";
|
|
import type { ShellConnectionProfileInput } from "../types/native-shell";
|
|
|
|
export function useShellConnection() {
|
|
const context = useShellContext();
|
|
|
|
const saveProfile = useCallback((profile: ShellConnectionProfileInput) => createOrUpdateProfile(context.shellApi, profile), [context.shellApi]);
|
|
const removeProfile = useCallback((profileId: string) => deleteProfile(context.shellApi, profileId), [context.shellApi]);
|
|
const setActiveProfile = useCallback((profileId: string | null) => selectActiveProfile(context.shellApi, profileId), [context.shellApi]);
|
|
|
|
return {
|
|
...context,
|
|
state: normalizeShellState(context.state),
|
|
saveProfile,
|
|
removeProfile,
|
|
setActiveProfile,
|
|
};
|
|
}
|