-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(Bring back twitter): Optimize string replacement #440
perf(Bring back twitter): Optimize string replacement #440
Conversation
I think this is for testing that we forgot to remove.
Fair points. Now that I look at the code, they really are redundant. One counter point. It may be that the original apk does not provide translations for the user's native language, so they create a custom translation for it. But seeing that no one actually did that, then I think it is safe to remove them after all. |
Should I add logging code for strings which was not found? |
yeah, new implementation is a lot better |
Hey, after I submitted this PR, I found a old code in the git log that replaces all "X" with "Twitter". In conclusion, it was a problem with using setTextContent(). This part was causing the performance issue. for (i in 0 until strings.length) {
val string = strings.item(i) as Element
if (!string.getAttribute("name").contains("api_key")) {
string.textContent = string.textContent.replace("X", "Twitter")
}
} This code calls for (i in 0 until strings.length) {
val string = strings.item(i) as Element
if (!string.getAttribute("name").contains("api_key")) {
val text = string.textContent
if (text.contains("X")) {
string.textContent = text.replace("X", "Twitter")
}
}
} This improved performance incredibly.
This execution time is almost the same as the current process using replacement map. But this is beyond the scope of this PR. |
I pushed the change. However, a new problem with I don't know the difference between normal pt and pt-rBR, but if the strings in the pt_rBR map is taken directly from Twitter 9.98.0 apk, I think I can change values-pt-rBR to values-pt directly. I'll look into it tomorrow or the day after tomorrow. |
It's for Portuguese Region Brazil. It seems I missed this one. We actually need to create the strings for that. |
After researched pt_rBR strings in this patch, I found that the grammar and wording was slightly different from the normal Portuguese (values-pt) contained in the original X APK, and that it was indeed Brazilian Portuguese.
This was real... However, for other languages it is still preferable not to add strings.xml if it does not exist. @r7kings Hello, if I'm correct, you are the one who created the pt_rBR strings in this patch. After that, I will resolve conflicts. @crimera Is this intended? Should I keep these code after merging conflicts? |
Nah, I forgot to remove it. Oops, accidentally closed the issue. My bad, I just woke up and misclicked |
# Conflicts: # src/main/kotlin/crimera/patches/twitter/misc/bringbacktwitter/BringBackTwitterResourcePatch.kt
# Conflicts: # src/main/kotlin/crimera/patches/twitter/misc/bringbacktwitter/BringBackTwitterResourcePatch.kt
When user removed some languages from split apk and SettingsPatch was executed prior to this patch, this log always show warnings because SettingsPatch adds other languages.
Sorry for the late reply. By the way, I removed the missing strings logs at 3448546. It turned out that when user removed some languages from split apk and SettingsPatch was applied prior to this patch, this log always show warnings because SettingsPatch adds other languages files. Therefore, I removed the log. (If you still think the log is needed, please let me know.) |
I forgot to tell you one important thing. When I resolved the conflict on my local repository, I should have rebased the working branch on the dev branch instead of merging the dev branch. 😅 |
## [1.44.1-dev.2](v1.44.1-dev.1...v1.44.1-dev.2) (2024-11-11) ### Perfomance * **Bring back twitter:** Optimize string replacement ([#440](#440)) ([7e61023](7e61023))
## [1.45.0](v1.44.0...v1.45.0) (2024-11-14) ### Bug Fixes * **Twitter:** Share menu button add hook in/from 10.67 ([a640946](a640946)) ### Features * **Twitter:** Added `Customise post font size` patch ([ea608e0](ea608e0)) ### Refactors * **Twitter:** refactor values of list preference ([e0e5c5b](e0e5c5b)) ### Perfomance * **Bring back twitter:** Optimize string replacement ([#440](#440)) ([7e61023](7e61023))
## [1.22.0-dev.1](v1.21.0...v1.22.0-dev.1) (2025-01-20) ### Bug Fixes * add "SettingsStatusLoadFingerprint" to fingerprints of `Hide Community Notes` and `Hide Live Threads` patch ([9c0232a](9c0232a)) * **Bring back twitter:** Change the character "𝕏" into "Twitter". ([crimera#441](https://github.com/okkidwi/piko/issues/441)) ([c20e16f](c20e16f)) * **Bring back twitter:** Change x icon to legacy twitter. ([3006f47](3006f47)) * **Custom download folder:** Restore compatibility with versions prior to 10.64 ([b88b00b](b88b00b)) * **Custom downloader:** Improve fingerprint ([2a2a4a4](2a2a4a4)) * **Feature Flags:** Use ListView instead of RecyclerView for a more reliable list. ([6f16b7f](6f16b7f)) * Fix crash when opening feature flags ([2b1484d](2b1484d)) * Fix oopsie ([2af661f](2af661f)) * Improve getUsername fingerprint ([af617af](af617af)) * Missing `,` ([67675fe](67675fe)) * Not creating `values-night-v31` dir ([e3f3491](e3f3491)) * Opening mod settings with root installation results in crash ([8161644](8161644)) * Opening mod settings with root installation results in crash ([47e7670](47e7670)) * Remove debug prints ([33e4d08](33e4d08)) * Remove duplicate strings ([94c6642](94c6642)) * **Remove Google Ad:** Include ads in the comments ([79d6e35](79d6e35)) * Resource strings getting corrupted, resulting on failure to patch on revanced manager ([crimera#439](https://github.com/okkidwi/piko/issues/439)) ([1763137](1763137)) * switch jp to ja for Japanese translation ([c13cc87](c13cc87)) * tweet highlight color on hold ([crimera#243](https://github.com/okkidwi/piko/issues/243)) ([b22ea42](b22ea42)) * **Twitter:** `Customize Navigation Bar items` in/from `10.53.0-beta.1` ([e8154fb](e8154fb)) * **Twitter:** Add support for version 10.64.0-beta.1 ([c81378d](c81378d)) * **Twitter:** Bookmark in nav bar dix ([03fb96c](03fb96c)) * **Twitter:** Bookmark nav bar fix ([a6e8ab9](a6e8ab9)) * **Twitter:** Change patch name from `Enable app icon settings` -> `Enable app icons` ([5a7ef46](5a7ef46)) * **Twitter:** fix `Control video auto scroll` in 10.57 ([b7ae78c](b7ae78c)) * **Twitter:** Fix `Customize profile tabs` crash after `10.43` ([a38d621](a38d621)) * **Twitter:** fix `Enable app icon settings` patch ([c2b6f79](c2b6f79)) * **Twitter:** Fix `Hide nudge button` patch ([d7572fe](d7572fe)) * **Twitter:** Fix `Hide Promoted Trends` patch ([7052d25](7052d25)) * **Twitter:** Fix `Remove premium upsell` patch ([4df5e32](4df5e32)) * **Twitter:** fix `Remove videos for you` patch ([b19f943](b19f943)) * **Twitter:** Fix aapt breakage due to tag mismatch ([730a51c](730a51c)) * **Twitter:** fix video entity hook in `10.58` ([e8a833d](e8a833d)) * **Twitter:** Missing download option in immersive view ([6b0aa2c](6b0aa2c)) * **Twitter:** Share menu button add hook in/from 10.67 ([a640946](a640946)) * unescaped character on `pl` string values ([a6444be](a6444be)) * Unescaped characters ([8e539df](8e539df)) * URL decode path to JAR containing spaces by osumatrix ([e6671ba](e6671ba)) * Use UrlDecoder API available in older Android versions ([d9e6374](d9e6374)) ### Features * Add toggle for `Open browser chooser on opening links` patch ([6f217f0](6f217f0)) * **all:** Added `Export all activities` patch from ReVanced ([7cc405f](7cc405f)) * **Bring back twitter:** Add Japanese ([4eb08b5](4eb08b5)) * **Customize side bar items:** Allow for hiding of the "Jobs" item ([14ce811](14ce811)) * Enable recent patches by default ([e84f358](e84f358)) * **Hook feature flag:** Added ability to search for supported flags. ([28a2c0a](28a2c0a)) * Quick settings button is now optional ([e9e54e5](e9e54e5)) * Remove throw file ([86bff99](86bff99)) * **Translations:** Add `Turkish` ([bf70b91](bf70b91)) * **Translations:** Add Arabic translations ([c1d797b](c1d797b)) * **Translations:** Add Brazilian Portuguese translations [Bring back Twitter] ([3a831d3](3a831d3)) * **Translations:** Add japanese ([c123d8e](c123d8e)) * **Translations:** Add polish translation ([8102f35](8102f35)) * **Translations:** Add simplified Chinese translation ([7662a34](7662a34)) * **Translations:** Add Simplified Chinese translations and Taiwanese Traditional Chinese translations[Bring back Twitter] ([d44bfd7](d44bfd7)) * **Translations:** Added Traditional Chinese translation ([1c0b10a](1c0b10a)) * **Translations:** Fix Simplified Chinese Translation ([ec0a3dc](ec0a3dc)) * **Translations:** Update `japanese` ([444623f](444623f)) * **Translations:** Update `japanese` ([f5ece19](f5ece19)) * **Translations:** Update Russian translation ([54ba664](54ba664)) * **Translations:** Update Russian translation ([3606c10](3606c10)) * **Translations:** Updated Brazilian Portuguese ([e25ec0e](e25ec0e)) * **Translations:** Updated Brazilian Portuguese ([45aac73](45aac73)) * **Translations:** Updated Traditional Chinese string-zh-rCN.xml ([6cc2373](6cc2373)) * **Translations:** Updated Traditional Chinese string-zh-rTW.xml ([6787c28](6787c28)) * **translation:** Update Simplified Chinese translation ([4f3027a](4f3027a)) * **Translation:** Update Simplified Chinese translation ([b9fe0e8](b9fe0e8)) * **Twitter:** Added `Ability to copy video media link` patch ([14bfdc7](14bfdc7)) * **Twitter:** Added `Control video auto scroll` patch ([7a21924](7a21924)) * **Twitter:** Added `Custom downloader` ([3d5941e](3d5941e)) * **Twitter:** Added `Custom translator` patch ([737fb9e](737fb9e)) * **Twitter:** Added `Customise post font size` patch ([ea608e0](ea608e0)) * **Twitter:** Added `Customize explore tabs` patch ([4be6a7f](4be6a7f)) * **Twitter:** Added `Customize Inline action Bar items` patch ([05b06f9](05b06f9)) * **Twitter:** Added `Customize Navigation Bar items` patch ([9c6f59c](9c6f59c)) * **Twitter:** Added `Customize reply sort filter` patch ([121b8a6](121b8a6)) * **Twitter:** Added `Customize search suggestions` patch ([aaca565](aaca565)) * **Twitter:** Added `Customize search tab items` patch ([9edc97a](9edc97a)) * **Twitter:** Added `Customize side bar items` patch ([ca0d28f](ca0d28f)) * **Twitter:** Added `Customize timeline top bar` patch ([245c5f6](245c5f6)) * **Twitter:** Added `Debug Menu` patch ([7d5ca77](7d5ca77)) * **Twitter:** Added `Delete from database` patch ([d785660](d785660)) * **Twitter:** Added `Disable auto timeline scroll on launch` patch ([b8d431e](b8d431e)) * **Twitter:** Added `Enable app downgrading` patch ([9f581ce](9f581ce)) * **Twitter:** Added `Enable force HD videos` patch ([d316612](d316612)) * **Twitter:** Added `Enable PiP mode automatically` patch ([59d6b67](59d6b67)) * **Twitter:** Added `Hide Buy Premium Banner` patch ([7ba6419](7ba6419)) * **Twitter:** Added `Hide followed by context` patch ([261e1d0](261e1d0)) * **Twitter:** Added `Hide hidden replies` patch ([431acc4](431acc4)) * **Twitter:** Added `Hide nudge button` patch ([ad27484](ad27484)) * **Twitter:** Added `Patch info` section ([7f794c3](7f794c3)) * **Twitter:** Added `Profile tabs customisation` ([db0298b](db0298b)) * **Twitter:** Added `Remove main event` patch ([806598d](806598d)) * **Twitter:** Added `Remove premium upsell` patch ([37525de](37525de)) * **Twitter:** Added `Remove top people in search` patch ([95b5ef9](95b5ef9)) * **Twitter:** Added `Remove videos for you` patch ([25934a2](25934a2)) * **Twitter:** Added `Round off numbers` patch ([b1c1b13](b1c1b13)) * **Twitter:** Added ability to export and import prefs & feature flags ([01cdd6b](01cdd6b)) * **Twitter:** Added ability to export and import prefs & feature flags ([a591133](a591133)) * **Twitter:** Added ability to reset pref and flags ([4aaeb09](4aaeb09)) * **Twitter:** Added Remember filter for `Customize reply sort filter` ([24df398](24df398)) * **Twitter:** Added tab redirects hook (for Bookmark Navbar) ([f01b418](f01b418)) * **Twitter:** Custom deeplinks ([325a281](325a281)) * **ui:** app wide monet theming in light mode ([46f920b](46f920b)) * **ui:** full app wide material theming in dim mode replacing dark blue ([52d7444](52d7444)) * use browser chooser when opening links ([cc165f4](cc165f4)) ### Updates * Add spanish to languages ([e9b8efd](e9b8efd)) * **Bring back twitter:** Create strings file if not found ([9f51a5c](9f51a5c)) * **Custom sharing domain:** require settings patch also turned it on by default. ([6a3777f](6a3777f)) * Enable `Customize profile tabs` patch by default ([a8543bf](a8543bf)) * Enable `Hide Live Threads` patch by default ([b9862b5](b9862b5)) * **Hook feature flag:** Improve flag matching in search. ([d7f0827](d7f0827)) * Improve quick settings appearance ([6dc27b4](6dc27b4)) * Improve the retrieval of the patches version ([ba940da](ba940da)) * Improved the hooking of the recyclerview methods. also fixes the crash when opening feature flags. ([25e5bc4](25e5bc4)) * Russian translation ([42b68e9](42b68e9)) * Translation updates ([509dfbb](509dfbb)) * Translations ([d3ae8ec](d3ae8ec)) * **Translations:** Improved & updates polish translations ([9bbb9f4](9bbb9f4)) * **Translations:** Translation updates ([4bf8a8d](4bf8a8d)) * **Translations:** Update `Indonesian (Bahasa)` ([1442b6c](1442b6c)) * **Translations:** Update `Indonesian (Bahasa)` ([b9488d6](b9488d6)) * **Translations:** Update `japanese` ([9fce4a2](9fce4a2)) * **Translations:** Update `Japanese` ([b326d10](b326d10)) * **Translations:** Update Brazilian Portuguese ([8745f61](8745f61)) * **Translations:** Update Brazilian Portuguese ([7de9493](7de9493)) * **Translations:** Update Japanese ([61ff288](61ff288)) * **Translations:** Update polish ([9d8f4fc](9d8f4fc)) * **Translations:** Update polish translations ([6200d65](6200d65)) * **Translations:** Update Russian translation ([8b1c4c8](8b1c4c8)) * **Translations:** update simplified chinese translation ([3e5a8fd](3e5a8fd)) * **Translations:** update simplified chinese translation ([b24f7cc](b24f7cc)) * **Translations:** Update simplified chinese translation ([147cb29](147cb29)) * **Translations:** Update translations ([9686863](9686863)) * **Translations:** Update Turkish translations ([bab6ae9](bab6ae9)) * **Translation:** Update Hindi translations [Bring back Twitter] ([20ac044](20ac044)) * **Twitter:** Added hide 'Settings and privacy' in `Customize side bar items` ([cb01885](cb01885)) * **Twitter:** Added strings ([fad9b1a](fad9b1a)) * **Twitter:** Change Quick Btn path ([7febdf6](7febdf6)) * **Twitter:** Enable new patches by default ([19f9149](19f9149)) * **Twitter:** Updated `Enable force HD videos` patch description ([86ea041](86ea041)) * **Twitter:** updated string ([60afc68](60afc68)) * **Twitter:** Updated strings ([3cb159e](3cb159e)) ### Refactors * Add `enableSettings` helper function ([7d6ebd5](7d6ebd5)) * Add `SettingsPatch ` dependencies to patches ([6d252f8](6d252f8)) * **Custom Downloader:** Improve getting of tweet method declarations ([5237e49](5237e49)) * Optimize imports ([2f42add](2f42add)) * **Twitter:** `Add ability to copy media link` patch ([e8ef551](e8ef551)) * **Twitter:** Added 'Native features' section ([12d2bda](12d2bda)) * **Twitter:** Added `No shortened URL` as a settings toggle ([ea33a30](ea33a30)) * **Twitter:** Added missing patches names ([b3fda95](b3fda95)) * **Twitter:** Added multiple language support for `Bring back twitter` ([9eacab3](9eacab3)) * **Twitter:** Added Native download filename customization ([99a10b1](99a10b1)) * **Twitter:** Added quick settings button in side drawer ([c0152e3](c0152e3)) * **Twitter:** Added toggle for `Show sensitive media` patch ([cac4fe7](cac4fe7)) * **Twitter:** Change translator icon ([bf5f027](bf5f027)) * **Twitter:** Changed `Top Articles ` string ([b590695](b590695)) * **Twitter:** Combined `customize patch` into single class ([6c04aed](6c04aed)) * **Twitter:** Force enable `Enable app icon settings` patch ([ee605f1](ee605f1)) * **Twitter:** load `Utils.load()` dynamically ([5379276](5379276)) * **Twitter:** Major string changes ([f22fdf0](f22fdf0)) * **Twitter:** More strings refactor ([d5a629f](d5a629f)) * **Twitter:** Rearrange `Bring back twitter` resources ([a476924](a476924)) * **Twitter:** refactor `Custom downloader` patch ([42cc752](42cc752)) * **Twitter:** Refactor `Custom downloader` patch ([1e966f7](1e966f7)) * **Twitter:** Refactor `Enable app icon settings` patch ([e7b3d0e](e7b3d0e)) * **Twitter:** refactor default feature flag hook ([6fd6001](6fd6001)) * **Twitter:** Refactor hooks filename ([2daa292](2daa292)) * **Twitter:** refactor values of list preference ([e0e5c5b](e0e5c5b)) * **Twitter:** renamed 'Share menu button' fingerprints to hooks ([395c221](395c221)) * **Twitter:** Renamed patch `Remove Buy Premium Banner` to `Remove message prompts Banner` ([45dbad8](45dbad8)) * **Twitter:** Separated `App icon` and `Navigation icon` patch ([8a67f12](8a67f12)) * **Twitter:** Seperated/Added `Remove superhero event` patch ([d60ee17](d60ee17)) * **Twitter:** Strings in 'Customization' ([c52c2c0](c52c2c0)) * **Twitter:** Strings in 'Customization' ([a75221b](a75221b)) * **Twitter:** Strings refactor ([2db8866](2db8866)) * **Twitter:** updated profile tab string ([1af7846](1af7846)) ### Perfomance * **Bring back twitter:** Optimize string replacement ([crimera#440](https://github.com/okkidwi/piko/issues/440)) ([7e61023](7e61023))
## [1.31.0](v1.30.2...v1.31.0) (2025-01-26) ### Bug Fixes * **Bring back twitter:** Change the character "𝕏" into "Twitter". ([crimera#441](https://github.com/chemchetchagio/piko/issues/441)) ([c20e16f](c20e16f)) * **Bring back twitter:** Change x icon to legacy twitter. ([3006f47](3006f47)) * **Custom download folder:** Restore compatibility with versions prior to 10.64 ([b88b00b](b88b00b)) * **Custom downloader:** Improve fingerprint ([2a2a4a4](2a2a4a4)) * **Feature Flags:** Use ListView instead of RecyclerView for a more reliable list. ([6f16b7f](6f16b7f)) * Fix crash when opening feature flags ([2b1484d](2b1484d)) * Improve getUsername fingerprint ([af617af](af617af)) * Remove debug prints ([33e4d08](33e4d08)) * Remove duplicate strings ([94c6642](94c6642)) * **Remove Google Ad:** Include ads in the comments ([79d6e35](79d6e35)) * Resource strings getting corrupted, resulting on failure to patch on revanced manager ([crimera#439](https://github.com/chemchetchagio/piko/issues/439)) ([1763137](1763137)) * **Twitter:** `Customize Navigation Bar items` in/from `10.53.0-beta.1` ([e8154fb](e8154fb)) * **Twitter:** Add support for version 10.64.0-beta.1 ([c81378d](c81378d)) * **Twitter:** Change patch name from `Enable app icon settings` -> `Enable app icons` ([5a7ef46](5a7ef46)) * **Twitter:** fix `Control video auto scroll` in 10.57 ([b7ae78c](b7ae78c)) * **Twitter:** fix `Enable app icon settings` patch ([c2b6f79](c2b6f79)) * **Twitter:** Fix `Hide nudge button` patch ([d7572fe](d7572fe)) * **Twitter:** Fix `Remove premium upsell` patch ([4df5e32](4df5e32)) * **Twitter:** fix `Remove videos for you` patch ([b19f943](b19f943)) * **Twitter:** Fix aapt breakage due to tag mismatch ([730a51c](730a51c)) * **Twitter:** fix video entity hook in `10.58` ([e8a833d](e8a833d)) * **Twitter:** Missing download option in immersive view ([6b0aa2c](6b0aa2c)) * **Twitter:** Share menu button add hook in/from 10.67 ([a640946](a640946)) ### Features * **all:** Added `Export all activities` patch from ReVanced ([7cc405f](7cc405f)) * **Bring back twitter:** Add Japanese ([4eb08b5](4eb08b5)) * **Customize side bar items:** Allow for hiding of the "Jobs" item ([14ce811](14ce811)) * Enable recent patches by default ([e84f358](e84f358)) * **Hook feature flag:** Added ability to search for supported flags. ([28a2c0a](28a2c0a)) * Quick settings button is now optional ([e9e54e5](e9e54e5)) * **Translations:** Updated Traditional Chinese string-zh-rCN.xml ([6cc2373](6cc2373)) * **Translations:** Updated Traditional Chinese string-zh-rTW.xml ([6787c28](6787c28)) * **Twitter:** Added `Control video auto scroll` patch ([7a21924](7a21924)) * **Twitter:** Added `Custom downloader` ([3d5941e](3d5941e)) * **Twitter:** Added `Custom translator` patch ([737fb9e](737fb9e)) * **Twitter:** Added `Customise post font size` patch ([ea608e0](ea608e0)) * **Twitter:** Added `Customize explore tabs` patch ([4be6a7f](4be6a7f)) * **Twitter:** Added `Customize reply sort filter` patch ([121b8a6](121b8a6)) * **Twitter:** Added `Customize search suggestions` patch ([aaca565](aaca565)) * **Twitter:** Added `Customize search tab items` patch ([9edc97a](9edc97a)) * **Twitter:** Added `Delete from database` patch ([d785660](d785660)) * **Twitter:** Added `Enable force HD videos` patch ([d316612](d316612)) * **Twitter:** Added `Enable PiP mode automatically` patch ([59d6b67](59d6b67)) * **Twitter:** Added `Hide followed by context` patch ([261e1d0](261e1d0)) * **Twitter:** Added `Hide nudge button` patch ([ad27484](ad27484)) * **Twitter:** Added `Remove main event` patch ([806598d](806598d)) * **Twitter:** Added `Remove premium upsell` patch ([37525de](37525de)) * **Twitter:** Added `Remove top people in search` patch ([95b5ef9](95b5ef9)) * **Twitter:** Added `Remove videos for you` patch ([25934a2](25934a2)) * **Twitter:** Added Remember filter for `Customize reply sort filter` ([24df398](24df398)) * **Twitter:** Added tab redirects hook (for Bookmark Navbar) ([f01b418](f01b418)) * **Twitter:** Custom deeplinks ([325a281](325a281)) ### Updates * Add spanish to languages ([e9b8efd](e9b8efd)) * Enable `Customize profile tabs` patch by default ([a8543bf](a8543bf)) * Enable `Hide Live Threads` patch by default ([b9862b5](b9862b5)) * **Hook feature flag:** Improve flag matching in search. ([d7f0827](d7f0827)) * Improve quick settings appearance ([6dc27b4](6dc27b4)) * Improved the hooking of the recyclerview methods. also fixes the crash when opening feature flags. ([25e5bc4](25e5bc4)) * Russian translation ([42b68e9](42b68e9)) * Translation updates ([509dfbb](509dfbb)) * **Translations:** Translation updates ([4bf8a8d](4bf8a8d)) * **Translations:** Update `Japanese` ([b326d10](b326d10)) * **Translations:** Update translations ([9686863](9686863)) * **Twitter:** Added hide 'Settings and privacy' in `Customize side bar items` ([cb01885](cb01885)) * **Twitter:** Added strings ([fad9b1a](fad9b1a)) * **Twitter:** Change Quick Btn path ([7febdf6](7febdf6)) * **Twitter:** Updated `Enable force HD videos` patch description ([86ea041](86ea041)) * **Twitter:** updated string ([60afc68](60afc68)) * **Twitter:** Updated strings ([3cb159e](3cb159e)) ### Refactors * **Custom Downloader:** Improve getting of tweet method declarations ([5237e49](5237e49)) * **Twitter:** Added 'Native features' section ([12d2bda](12d2bda)) * **Twitter:** Added Native download filename customization ([99a10b1](99a10b1)) * **Twitter:** Added quick settings button in side drawer ([c0152e3](c0152e3)) * **Twitter:** Added toggle for `Show sensitive media` patch ([cac4fe7](cac4fe7)) * **Twitter:** Change translator icon ([bf5f027](bf5f027)) * **Twitter:** Changed `Top Articles ` string ([b590695](b590695)) * **Twitter:** Major string changes ([f22fdf0](f22fdf0)) * **Twitter:** More strings refactor ([d5a629f](d5a629f)) * **Twitter:** refactor `Custom downloader` patch ([42cc752](42cc752)) * **Twitter:** Refactor `Custom downloader` patch ([1e966f7](1e966f7)) * **Twitter:** Refactor hooks filename ([2daa292](2daa292)) * **Twitter:** refactor values of list preference ([e0e5c5b](e0e5c5b)) * **Twitter:** renamed 'Share menu button' fingerprints to hooks ([395c221](395c221)) * **Twitter:** Seperated/Added `Remove superhero event` patch ([d60ee17](d60ee17)) * **Twitter:** Strings in 'Customization' ([c52c2c0](c52c2c0)) * **Twitter:** Strings in 'Customization' ([a75221b](a75221b)) * **Twitter:** Strings refactor ([2db8866](2db8866)) ### Perfomance * **Bring back twitter:** Optimize string replacement ([crimera#440](https://github.com/chemchetchagio/piko/issues/440)) ([7e61023](7e61023))
https://t.me/pikopatches/1/17451
The current implementation has poor performance as it iterates over all string elements for each entry in the stringsMap.
DOM operations using Java XML API are expensive, but on the other hand, Map lookups are fast.
So, the string replacement should be done in a single iteration.
I tested performance on a very low-end phone (Snapdragon 410, 2GB RAM) with ReVanced Manager.
Before PR:
After PR:
[ADDED]
Furthermore, with this change, adding more strings to the map will have little impact on the performance of the patch.
Thus, more "X" can be replaced with "Twiter".
I have a few questions before this PR is ready.
If a string does not exist in the original strings.xml, it was probably deleted from the app.
If so, I think adding it is no point because it will never displayed in the app.
In addition I can remove
mutableStringsMap
.In my opinion, it is not needed to create a new strings.xml even if a specific language string.xml is not found,
When users merged the split APKs, they may have removed unnecessary language splits, in which case this patch does not need to add strings.xml for languages that do not exist.
Also, if a user unintentionally excludes the language split for their language, after applying this patch they will experience a strange situation where only the 60 strings included in this patch are translated.
At the time this patch was created, full APK of X was provided.
However, now that users have to merge the split APKs themselves, I believe that this behavior needs to be reconsidered.
// log which keys were not found or failed
?I can't get what this comment means.
I think logging the missing strings is good idea instead of adding them silently.