Changeset View
Changeset View
Standalone View
Standalone View
native/types/message-types-validator.js
- This file was added.
// @flow | |||||
import { Alert } from 'react-native'; | |||||
import { messageSpecs } from 'lib/shared/messages/message-specs.js'; | |||||
import { messageTypes } from 'lib/types/message-types-enum.js'; | |||||
import { commConstants } from '../native-modules.js'; | |||||
if (__DEV__) { | |||||
const messageTypesCpp = new Set(commConstants.NATIVE_MESSAGE_TYPES); | |||||
const missingMessageTypesCpp = []; | |||||
for (const messageName in messageTypes) { | |||||
const messageType = messageTypes[messageName]; | |||||
if ( | |||||
messageSpecs[messageType]?.generatesNotifs && | |||||
!messageTypesCpp.has(messageType) | |||||
) { | |||||
missingMessageTypesCpp.push(messageName); | |||||
} | |||||
} | |||||
if (missingMessageTypesCpp.length !== 0) { | |||||
Alert.alert( | |||||
'C++ MessageSpecs missing', | |||||
'C++ MessageSpec implementation missing for message types: ' + | |||||
missingMessageTypesCpp.join(', '), | |||||
); | |||||
} | |||||
} |