Skip to content

Commit

Permalink
Rename hideHeader flag to hideSnapBranding (#2717)
Browse files Browse the repository at this point in the history
We made a conclusion that there are more things we should hide for
preinstalled Snaps, like SnapIcon inside Snap custom footer button or
maybe even something else in the future.
So the decision is made to make this flag name more generic. 

Flag `hideHeader` is renamed to `hideSnapBranding`.

Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
  • Loading branch information
david0xd and Mrtenz authored Sep 12, 2024
1 parent a5d85c3 commit 2c3f26a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions packages/snaps-controllers/src/snaps/SnapController.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5097,7 +5097,7 @@ describe('SnapController', () => {
snapController.destroy();
});

it('supports preinstalled Snaps specifying the hideHeader flag', async () => {
it('supports preinstalled Snaps specifying the hideSnapBranding flag', async () => {
const rootMessenger = getControllerMessenger();
jest.spyOn(rootMessenger, 'call');

Expand All @@ -5111,7 +5111,7 @@ describe('SnapController', () => {
{
snapId: MOCK_SNAP_ID,
manifest: getSnapManifest(),
hideHeader: true,
hideSnapBranding: true,
files: [
{
path: DEFAULT_SOURCE_PATH,
Expand All @@ -5131,7 +5131,7 @@ describe('SnapController', () => {
});
const [snapController] = getSnapControllerWithEES(snapControllerOptions);

expect(snapController.get(MOCK_SNAP_ID)?.hideHeader).toBe(true);
expect(snapController.get(MOCK_SNAP_ID)?.hideSnapBranding).toBe(true);

snapController.destroy();
});
Expand Down
12 changes: 6 additions & 6 deletions packages/snaps-controllers/src/snaps/SnapController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export interface PreinstalledSnap {
files: PreinstalledSnapFile[];
removable?: boolean;
hidden?: boolean;
hideHeader?: boolean;
hideSnapBranding?: boolean;
}

type SnapRpcHandler = (
Expand Down Expand Up @@ -719,7 +719,7 @@ type SetSnapArgs = Omit<AddSnapArgs, 'location' | 'versionRange'> & {
removable?: boolean;
preinstalled?: boolean;
hidden?: boolean;
hideHeader?: boolean;
hideSnapBranding?: boolean;
};

const defaultState: SnapControllerState = {
Expand Down Expand Up @@ -1127,7 +1127,7 @@ export class SnapController extends BaseController<
files,
removable,
hidden,
hideHeader,
hideSnapBranding,
} of preinstalledSnaps) {
const existingSnap = this.get(snapId);
const isAlreadyInstalled = existingSnap !== undefined;
Expand Down Expand Up @@ -1198,7 +1198,7 @@ export class SnapController extends BaseController<
files: filesObject,
removable,
hidden,
hideHeader,
hideSnapBranding,
preinstalled: true,
});

Expand Down Expand Up @@ -2869,7 +2869,7 @@ export class SnapController extends BaseController<
removable,
preinstalled,
hidden,
hideHeader,
hideSnapBranding,
} = args;

const {
Expand Down Expand Up @@ -2926,7 +2926,7 @@ export class SnapController extends BaseController<
removable,
preinstalled,
hidden,
hideHeader,
hideSnapBranding,

id: snapId,
initialConnections: manifest.result.initialConnections,
Expand Down
4 changes: 2 additions & 2 deletions packages/snaps-utils/src/snaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ export type Snap = TruncatedSnap & {
hidden?: boolean;

/**
* Flag to signal whether this snap should hide the header in the UI or not.
* Flag to signal whether this snap should hide the Snap branding like header or avatar in the UI or not.
*/
hideHeader?: boolean;
hideSnapBranding?: boolean;
};

export type TruncatedSnapFields =
Expand Down

0 comments on commit 2c3f26a

Please sign in to comment.