Closed lepras closed 10 months ago
So I quickly went through the code and I think this is where the script is searching for the next message to unsend:
And you are essentially using the attribute "data-idmu-processed" for knowing which ones are left for processing. Your logic seems to be find elements with "[aria-label=More]" then trying to find unsend button if found, click it?
so essentially in that function the string "[aria-label=More]" will be different on other versions of the web app?
Some selectors I am using are US specific and are not available for the EU version for example.
Take all the selectors that are querying the [role=]
attribute, these are all set to none on the EU version.
Of course there's still some way to find messages, their container and their actions but I would need to implement some kind of conditional strategy system that would run different strategy based on the Instagram location it detected prior to that. What I don't want is mixing up strategies so yeah, we need a strategy system.
Give me some time I am currently in the process of refactoring some parts of the code, when I am done I'll make a develop branch and from that you'll be able to implement the strategies that are specific to your country.
@lepras
Following up my message from earlier, if you have any idea on how to implement an early country detection system I'll gladly listen. The end goal would be to have a UIMessage
per country because in the eye of the UIPI
(which is kind of the middle man between the DOM and IDMU
) it should only go as far as saying I want to make such a menu appear, and click this button etc.. It does not know how it should go about doing it, that's actually the work of the UIMessage
.
@lepras Following up my message from earlier, if you have any idea on how to implement an early country detection system I'll gladly listen. The end goal would be to have a
UIMessage
per country because in the eye of theUIPI
(which is kind of the middle man between the DOM andIDMU
) it should only go as far as saying I want to make such a menu appear, and click this button etc.. It does not know how it should go about doing it, that's actually the work of theUIMessage
.
I am not really familiar with how we do i10n in js but a quick google search suggests to use either a service (I don't like this) or extract the location from timezone natively like this:
Intl.DateTimeFormat().resolvedOptions().timeZone
then using a mapping structure like this codepen.
Can use a lib like moment js (bloat?) to get the map but this blog post reduces the map to something usable.
There is also this minimalist lib.
The best approach seems to be just hard code the map according to me.
Hello,
I've pushed a few changes that enable l10n for ui.UI class.
If you're still interested I invite you to take a look at the getUI module as we can now check for the user location and returns a different Locale UI accordingly.
I will be taking src/ui/default directory as an example and implement code for India in src/ui/in, and make a PR, is that alright?
What is uipi-message and will this be common among different Country specific code? (Its outside the directory)
While reading the code it seems to be marking the element as "done"? So it will be common after all.
It seems I have to import Indian code in this file?
So i have to build the script to test it, Can I test it any other way? (Seems a big dev cycle.)
I will be taking src/ui/default directory as an example and implement code for India in src/ui/in, and make a PR, is that alright?
What is uipi-message and will this be common among different Country specific code? (Its outside the directory)
While reading the code it seems to be marking the element as "done"? So it will be common after all.
It seems I have to import Indian code in this file?
So i have to build the script to test it, Can I test it any other way? (Seems a big dev cycle.)
Exactly, as for the test, they are already written for src/ui/default so you only have to make some minor adjustments to ensure your UI works as intended.
You can run the test suite simply by using : npm test
You can run the test suite simply by using :
npm test
By test, I meant run it on my insta profile in a browser.
You can run the test suite simply by using :
npm test
By test, I meant run it on my insta profile in a browser.
See https://github.com/thoughtsunificator/instagram-dm-unsender#development
Does the latest userscript v0.5.19 support EU version?
So I quickly went through the code and I think this is where the script is searching for the next message to unsend:
https://github.com/thoughtsunificator/instagram-dm-unsender/blob/master/src/ui/strategy/find-messages-strategy.js
And you are essentially using the attribute "data-idmu-processed" for knowing which ones are left for processing. Your logic seems to be find elements with "[aria-label=More]" then trying to find unsend button if found, click it?
so essentially in that function the string "[aria-label=More]" will be different on other versions of the web app?