MCPcopy Create free account
hub / github.com/CommE2E/comm / getSelectedProtocolForCompose

Function getSelectedProtocolForCompose

lib/shared/protocol-selection-utils.js:105–124  ·  view source on GitHub ↗
(
  selectedUserInfos: $ReadOnlyArray<SelectedUserInfo>,
  currentUserSupportsFarcasterDCs: boolean,
  selectedProtocol: ?ProtocolName,
)

Source from the content-addressed store, hash-verified

103}
104
105function getSelectedProtocolForCompose(
106 selectedUserInfos: $ReadOnlyArray<SelectedUserInfo>,
107 currentUserSupportsFarcasterDCs: boolean,
108 selectedProtocol: ?ProtocolName,
109): ?ProtocolName {
110 if (selectedUserInfos.length === 0) {
111 return undefined;
112 }
113 const supportedProtocols = getSupportedProtocolsForSearching(
114 selectedUserInfos,
115 currentUserSupportsFarcasterDCs,
116 );
117 if (selectedProtocol && supportedProtocols.includes(selectedProtocol)) {
118 return undefined;
119 }
120 if (supportedProtocols.length === 1) {
121 return supportedProtocols[0];
122 }
123 return null;
124}
125
126export {
127 getSupportedProtocolsForUser,

Callers 2

Calls 1

Tested by

no test coverage detected