try using matrix-widget-toolkit
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 36s
Details
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 36s
Details
This commit is contained in:
parent
c8eb727bed
commit
3983977436
File diff suppressed because it is too large
Load Diff
|
@ -12,6 +12,8 @@
|
|||
"dependencies": {
|
||||
"@helia/dag-json": "^3.0.2",
|
||||
"@libp2p/websockets": "^8.0.16",
|
||||
"@matrix-widget-toolkit/mui": "^1.2.1",
|
||||
"@matrix-widget-toolkit/react": "^1.0.6",
|
||||
"@metamask/eth-sig-util": "^7.0.1",
|
||||
"@metamask/sdk-react": "^0.16.0",
|
||||
"@multiformats/multiaddr": "^12.2.1",
|
||||
|
|
|
@ -10,7 +10,9 @@ import Container from 'react-bootstrap/Container';
|
|||
import Row from 'react-bootstrap/Row';
|
||||
import Col from 'react-bootstrap/Col';
|
||||
import Stack from 'react-bootstrap/Stack';
|
||||
import { WidgetApi } from 'matrix-widget-api';
|
||||
import { EventDirection, WidgetEventCapability } from 'matrix-widget-api';
|
||||
import { MuiCapabilitiesGuard } from '@matrix-widget-toolkit/mui';
|
||||
import { useWidgetApi } from '@matrix-widget-toolkit/react';
|
||||
|
||||
import './App.css';
|
||||
import useList from './utils/List';
|
||||
|
@ -48,7 +50,7 @@ function App() {
|
|||
const [showAddPost, setShowAddPost] = useState(false);
|
||||
const [showViewPost, setShowViewPost] = useState(false);
|
||||
const [viewPost, setViewPost] = useState({});
|
||||
const widgetApi = useRef();
|
||||
const widgetApi = useWidgetApi();
|
||||
const web3ProviderValue = useMemo(() => ({
|
||||
provider,
|
||||
DAO,
|
||||
|
@ -241,15 +243,13 @@ function App() {
|
|||
/* --------------------------- END MAIN INITIALIZION EFFECT ----------------------- */
|
||||
/* -------------------------------------------------------------------------------- */
|
||||
|
||||
useEffect(() => {
|
||||
widgetApi.current = new WidgetApi();
|
||||
const api = widgetApi.current;
|
||||
// api.requestCapability(MatrixCapabilities.)
|
||||
api.on('action:m.message', (ev) => {
|
||||
console.log('action:m.message', ev);
|
||||
});
|
||||
api.start();
|
||||
}, []);
|
||||
// useEffect(() => {
|
||||
// // api.requestCapability(MatrixCapabilities.)
|
||||
// api.on('action:m.message', (ev) => {
|
||||
// console.log('action:m.message', ev);
|
||||
// });
|
||||
// api.start();
|
||||
// }, []);
|
||||
|
||||
/* -------------------------------------------------------------------------------- */
|
||||
/* --------------------------- BEGIN UI ACTIONS ----------------------------------- */
|
||||
|
@ -335,7 +335,13 @@ function App() {
|
|||
|
||||
// TODO: Sign and send a message to the forum-api bot / to a room in matrix
|
||||
const registerMatrixIdentity = async () => {
|
||||
widgetApi.current.transport.send('m.message', 'test message');
|
||||
await widgetApi.requestCapabilities([
|
||||
WidgetEventCapability.forRoomEvent(
|
||||
EventDirection.Send,
|
||||
'm.message',
|
||||
),
|
||||
]);
|
||||
widgetApi.sendRoomEvent('m.message', 'test message');
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------------- */
|
||||
|
@ -389,9 +395,18 @@ function App() {
|
|||
<div>
|
||||
<Button onClick={() => disconnect()}>Disconnect</Button>
|
||||
<Button onClick={() => watchReputationToken()}>Watch REP in MetaMask</Button>
|
||||
<Button onClick={() => registerMatrixIdentity()}>
|
||||
Register Matrix Identity
|
||||
</Button>
|
||||
<MuiCapabilitiesGuard
|
||||
capabilities={[
|
||||
WidgetEventCapability.forRoomEvent(
|
||||
EventDirection.Send,
|
||||
'm.message',
|
||||
),
|
||||
]}
|
||||
>
|
||||
<Button onClick={() => registerMatrixIdentity()}>
|
||||
Register Matrix Identity
|
||||
</Button>
|
||||
</MuiCapabilitiesGuard>
|
||||
</div>
|
||||
</Stack>
|
||||
</Col>
|
||||
|
|
Loading…
Reference in New Issue