2018-03-17 16:48:08 +01:00
|
|
|
module.exports = (Plugin, Api, Vendor) => {
|
|
|
|
|
2018-03-21 21:48:36 +01:00
|
|
|
const { Logger, ReactComponents, Patcher, monkeyPatch } = Api;
|
2018-03-17 16:48:08 +01:00
|
|
|
|
|
|
|
return class extends Plugin {
|
|
|
|
onStart() {
|
|
|
|
this.patchMessage();
|
|
|
|
return true;
|
|
|
|
}
|
2018-03-21 21:48:36 +01:00
|
|
|
|
2018-03-17 16:48:08 +01:00
|
|
|
async patchMessage() {
|
|
|
|
const Message = await ReactComponents.getComponent('Message');
|
2018-03-21 21:48:36 +01:00
|
|
|
monkeyPatch(Message.component.prototype).after('render', e => {
|
|
|
|
Logger.log('MESSAGE RENDER!', e);
|
2018-03-17 16:48:08 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
onStop() {
|
2018-03-21 21:48:36 +01:00
|
|
|
// The automatic unpatcher is not there yet
|
|
|
|
Patcher.unpatchAll();
|
2018-03-17 16:48:08 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-21 21:48:36 +01:00
|
|
|
};
|