Skip to content

Commit

Permalink
WIP - protobug for brightness
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-sanderson committed May 17, 2024
1 parent 1d0cb21 commit c406c0f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/connect/src/api/applySettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default class ApplySettings extends AbstractMethod<'applySettings', PROTO
safety_checks: payload.safety_checks,
experimental_features: payload.experimental_features,
_passphrase_source: payload.passphrase_source,
brightness: payload.brightness,
};
}

Expand Down
10 changes: 9 additions & 1 deletion packages/protobuf/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4566,6 +4566,9 @@
},
"Capability_Translations": {
"(bitcoin_only)": true
},
"Capability_Brightness": {
"(bitcoin_only)": true
}
},
"values": {
Expand All @@ -4587,7 +4590,8 @@
"Capability_ShamirGroups": 16,
"Capability_PassphraseEntry": 17,
"Capability_Solana": 18,
"Capability_Translations": 19
"Capability_Translations": 19,
"Capability_Brightness": 20
}
}
}
Expand Down Expand Up @@ -4657,6 +4661,10 @@
"hide_passphrase_from_host": {
"type": "bool",
"id": 11
},
"brightness": {
"type": "uint32",
"id": 12
}
}
},
Expand Down
18 changes: 10 additions & 8 deletions packages/protobuf/src/messages-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2191,6 +2191,7 @@ export enum Enum_Capability {
Capability_PassphraseEntry = 17,
Capability_Solana = 18,
Capability_Translations = 19,
Capability_Brightness = 20,
}

export type EnumEnum_Capability = Static<typeof EnumEnum_Capability>;
Expand Down Expand Up @@ -2283,6 +2284,7 @@ export const ApplySettings = Type.Object(
safety_checks: Type.Optional(SafetyCheckLevel),
experimental_features: Type.Optional(Type.Boolean()),
hide_passphrase_from_host: Type.Optional(Type.Boolean()),
brightness: Type.Optional(Type.Number()),
},
{ $id: 'ApplySettings' },
);
Expand Down Expand Up @@ -2818,12 +2820,6 @@ export const NEMDecryptedMessage = Type.Object(
{ $id: 'NEMDecryptedMessage' },
);

export type experimental_message = Static<typeof experimental_message>;
export const experimental_message = Type.Object({}, { $id: 'experimental_message' });

export type experimental_field = Static<typeof experimental_field>;
export const experimental_field = Type.Object({}, { $id: 'experimental_field' });

export type RippleGetAddress = Static<typeof RippleGetAddress>;
export const RippleGetAddress = Type.Object(
{
Expand Down Expand Up @@ -3398,6 +3394,12 @@ export const TezosSignedTx = Type.Object(
{ $id: 'TezosSignedTx' },
);

export type experimental_message = Static<typeof experimental_message>;
export const experimental_message = Type.Object({}, { $id: 'experimental_message' });

export type experimental_field = Static<typeof experimental_field>;
export const experimental_field = Type.Object({}, { $id: 'experimental_field' });

export type MessageType = Static<typeof MessageType>;
export const MessageType = Type.Object(
{
Expand Down Expand Up @@ -3626,8 +3628,6 @@ export const MessageType = Type.Object(
NEMSignedTx,
NEMDecryptMessage,
NEMDecryptedMessage,
experimental_message,
experimental_field,
RippleGetAddress,
RippleAddress,
RipplePayment,
Expand Down Expand Up @@ -3676,6 +3676,8 @@ export const MessageType = Type.Object(
TezosBallotOp,
TezosSignTx,
TezosSignedTx,
experimental_message,
experimental_field,
},
{ $id: 'MessageType' },
);
Expand Down
2 changes: 2 additions & 0 deletions packages/protobuf/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,7 @@ export enum Enum_Capability {
Capability_PassphraseEntry = 17,
Capability_Solana = 18,
Capability_Translations = 19,
Capability_Brightness = 20,
}

export type Capability = keyof typeof Enum_Capability;
Expand Down Expand Up @@ -1632,6 +1633,7 @@ export type ApplySettings = {
safety_checks?: SafetyCheckLevel;
experimental_features?: boolean;
hide_passphrase_from_host?: boolean;
brightness?: number;
};

// ChangeLanguage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ export const Brightness = ({ isDeviceLocked }: DeviceLabelProps) => {

const showDebugMenu = useSelector(state => state.suite.settings.debug.showDebugMenu);

const isSupportedDevice = true; //device?.features?.capabilities?.includes('Capability_Brightness');
const isSupportedDevice = device?.features?.capabilities?.includes('Capability_Brightness');

if (!showDebugMenu || !isSupportedDevice) {
return null;
}

const brightnessEnabled = true; // device?.features?.brightness ?? false;
const brightnessEnabled = device?.features?.b ?? false;

const handleChange = () => {
dispatch(
applySettings({
// brightness: !brightnessEnabled
brightness: !brightnessEnabled
}),
);
analytics.report({
Expand Down

0 comments on commit c406c0f

Please sign in to comment.