Skip to content

Commit

Permalink
fixup! feat(suite-native): enable solana via message system
Browse files Browse the repository at this point in the history
  • Loading branch information
vytick committed Dec 10, 2024
1 parent 0c83f3d commit 49a065c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useDispatch, useSelector } from 'react-redux';

import { A, G } from '@mobily/ts-belt';
import { G } from '@mobily/ts-belt';

import { Box, Button, PictogramTitleHeader, VStack } from '@suite-native/atoms';
import { prepareNativeStyle, useNativeStyles } from '@trezor/styles';
import { messageSystemActions } from '@suite-common/message-system';
import { Translation } from '@suite-native/intl';
import { useOpenLink } from '@suite-native/link';

import { selectActiveKillswitchMessages } from '../selectors';
import { selectActiveKillswitchMessage } from '../messageSystemSelectors';

const screenStyle = prepareNativeStyle(utils => ({
flexGrow: 1,
Expand Down Expand Up @@ -39,7 +39,7 @@ export const KillswitchMessageScreen = () => {
const openLink = useOpenLink();
const { applyStyle } = useNativeStyles();

const killswitch = A.head(useSelector(selectActiveKillswitchMessages));
const killswitch = useSelector(selectActiveKillswitchMessage);

if (!killswitch) return null;

Expand Down
2 changes: 1 addition & 1 deletion suite-native/message-system/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './messageSystemMiddleware';
export * from './components/MessageSystemBannerRenderer';
export * from './components/KillswitchMessageScreen';
export * from './selectors';
export * from './messageSystemSelectors';
2 changes: 1 addition & 1 deletion suite-native/message-system/src/messageSystemMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '@suite-native/discovery';
import { FeatureFlag, setFeatureFlag } from '@suite-native/feature-flags';

import { selectIsSolanaFeatureEnabled } from './selectors';
import { selectIsSolanaFeatureEnabled } from './messageSystemSelectors';

const isAnyOfMessageSystemAffectingActions = isAnyOf(
messageSystemActions.fetchSuccessUpdate,
Expand Down
26 changes: 26 additions & 0 deletions suite-native/message-system/src/messageSystemSelectors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { A } from '@mobily/ts-belt';

import {
createMemoizedSelector,
Feature,
MessageSystemRootState,
selectActiveFeatureMessages,
selectIsFeatureEnabled,
} from '@suite-common/message-system';

export const selectActiveKillswitchMessage = createMemoizedSelector(
[selectActiveFeatureMessages],
messages =>
A.head(
messages.filter(m => {
const killswitchFeatures = m.feature?.filter(
item => item.domain === 'killswitch' && item?.flag,
);

return A.isNotEmpty(killswitchFeatures ?? []);
}),
),
);

export const selectIsSolanaFeatureEnabled = (state: MessageSystemRootState) =>
selectIsFeatureEnabled(state, Feature.solanaMobile);
22 changes: 0 additions & 22 deletions suite-native/message-system/src/selectors.ts

This file was deleted.

0 comments on commit 49a065c

Please sign in to comment.