Juby210 / Aliucord-plugins

Plugins for Aliucord.
Open Software License 3.0
166 stars 23 forks source link

MessageLogger - New Features #35

Closed XTREME1738 closed 2 years ago

XTREME1738 commented 2 years ago

Been working on this for a few hours and got it to work like normal except instead of just caching it saves the messages to a SQLite database (using SQLite bc json files like to corrupt)

Juby210 commented 2 years ago

LGTM

XTREME1738 commented 2 years ago

Just added a button in the context menu to remove the edit history / message from the logs aswell but it requires an app restart

XTREME1738 commented 2 years ago

Working on adding whitelisting / blacklisting for guilds and channels and also ability to clear the data

XTREME1738 commented 2 years ago

Update: Added the ability to clear data from settings and if this pr has been merged ill make a new one when i fix whitelisting / blacklisting and if not ill just make a new commit

XTREME1738 commented 2 years ago

Update: added both channel and guild whitelist / blacklist and also clearing whitelists / blacklists from plugin settings

XTREME1738 commented 2 years ago

Update: Added 2 new switches to settings for turning off logging of edited messages and/or deleted messages

XTREME1738 commented 2 years ago

Update: Added 2 new buttons in settings to import or export the database to / from the Aliucord folder

Juby210 commented 2 years ago

Made some changes, what do you think?

XTREME1738 commented 2 years ago

Made some changes, what do you think?

looking good

Vendicated commented 2 years ago

This update introduces memory leaks and crashes because you are not properly closing cursors. You are also calling close on the SQLiteOpenHelper manually instead of using proper try with resources or kotlins .use. In any case, you should not even be creating new instances of SQLiteOpenHelper for every single update you're making. Not only is this bad for thread safety because writes are no longer synchronised, it is also a waste of resources.

1) Properly close all cursors with try with resources/.use 2) Reuse one Sqlite instance across the plugin, do not create new instances each time

rushiiMachine commented 2 years ago

insane juby merged this pr