session-android/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt

437 lines
17 KiB
Kotlin
Raw Normal View History

2021-07-09 03:14:21 +02:00
package org.thoughtcrime.securesms.preferences
2020-01-06 04:26:52 +01:00
import android.Manifest
2020-01-07 04:51:11 +01:00
import android.app.Activity
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
2020-01-07 04:51:11 +01:00
import android.net.Uri
import android.os.AsyncTask
import android.os.Bundle
import android.os.Handler
import android.os.Looper
New app theming (#913) * feat: start new app theming feature * feat: add some theming colours * refactor: start refactoring themes and colours to use dynamic attributes * feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific * refactor: take a look at ocean light and logo colour * feat: global search colours for light and dark ocean * feat: more styling * feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc * feat: add dynamic accent color * docs: add todo for changing how accent colour is applied * feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts * feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items * refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button * refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes * refactor: add context theme wrapper to bottom sheet dialog that references accent color * fix: input bar bug fix and preference activity themes * refactor: new settings menu options * fix: crash for PNModeActivity.kt refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu * feat: add new appearance settings activity * refactor: title and VM changes * fix: correct override * feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration * fix: compile errors and missing themes from emoji features * refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr * feat: appearance screen wired up, just need to refresh theme * feat: add theme state recreation and fix match system settings option * refactor: add bottom margin * feat: explore custom preference category * feat: add the customized session theme for CorrectedPreferenceFragment * feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment * refactor: change drawable style and remove explicit dividers * refactor: remove divider in CorrectedPreferenceFragment * feat: add theme state check on resume, might be jarring currently * feat: add preference divider elements for settings menu * refactor: settings menu redesigns * refactor: change led preference to integer and refactor TextSecurePreferences.kt * feat: add scroll parcel to save/restore hierarchy on restart with appearance changes * feat: add the conversations blocked contacts and refactor preference order and copy * feat: add blocked contacts activity, basic layout and vm * feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener * feat: add blocked contacts and notif recipient listeners * feat: add recipient db reader * feat: add blocked contact interactions and fix a theming crash for notifications * feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison * feat: add settings menu vectors * fix: preview compile error * refactor: migrating settings menu to new designs * feat: help menu * refactor: simplify link opening * refactor: remove space * feat: refactor preferences and start theming for light mode options * refactor: fixing dark and light modes with dialogs * refactor: popup dialogs use proper themes now * refactor: alert dialogs and media edit fragments use attribute references * refactor: use input bar button attribute instead color control normal in vector tint * refactor: transparency, dialog fixes, notification fix * refactor: attrs and styles for buttons * fix: use prominent button color on the outline button's border * fix: fix the trash * refactor: remove the appearance * refactor: avatar placeholder generation, chips and element border styles * refactor: use colors instead of style references * refactor: theming changes to match designs and feedback * refactor: the titles are bold and the categories are tertiary coloured now * fix: appearance settings match preferences, search bottom bar uses themed attributes * refactor: increase setting button height * Update clear all data dialog * Update seed dialog * refactor: more qa feedback changes * feat: add new TLs and fa-rIR TLs * Update notification content dialog * Fix message requests clear all button text color * feat: re-add screenshot observer * refactor: make send tint accent color * feat: add unread background differences * fix: change unread count indicator * build: upgrade build numbers * Fix message requests popupmenu background color * fix: crash from attr reference in color attribute * build: upgrade build number * fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons * fix: tertiary text for keyboard page search view * fix: emoji overflow colour differences * fix: reaction pill dialog background is now correct colour * Add style to reactions tab layout * fix: appearance activity reverting primary color at correct time * fix: show call privacy warning every time instead of just once * fix: gradient background(?) and audio autoplay disable * fix: crash in all media containing documents * fix: reaction dialog heading fixes * Add style to reactions tab layout * fix: remove gradient backgrounds * fix: adding new reaction normal text attribute to try correct the tab layout * fix: ocean dark unread/read colours * build; update build number * build: update build number Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
import android.os.Parcelable
import android.util.SparseArray
import android.view.ActionMode
import android.view.Menu
import android.view.MenuItem
2020-01-07 02:00:30 +01:00
import android.view.View
import android.view.inputmethod.InputMethodManager
2020-01-06 04:26:52 +01:00
import android.widget.Toast
2023-11-29 15:15:53 +01:00
import androidx.core.view.isGone
import androidx.core.view.isVisible
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
import dagger.hilt.android.AndroidEntryPoint
import network.loki.messenger.BuildConfig
2020-01-06 04:26:52 +01:00
import network.loki.messenger.R
import network.loki.messenger.databinding.ActivitySettingsBinding
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
import network.loki.messenger.libsession_util.util.UserPic
2020-01-07 04:51:11 +01:00
import nl.komponents.kovenant.Promise
import nl.komponents.kovenant.all
import nl.komponents.kovenant.ui.alwaysUi
import nl.komponents.kovenant.ui.successUi
2021-05-18 08:03:47 +02:00
import org.session.libsession.avatars.AvatarHelper
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
import org.session.libsession.messaging.MessagingModuleConfiguration
import org.session.libsession.snode.SnodeAPI
2023-06-05 07:28:56 +02:00
import org.session.libsession.avatars.ProfileContactPhoto
import org.session.libsession.utilities.*
import org.session.libsession.utilities.SSKEnvironment.ProfileManagerProtocol
2023-06-05 07:28:56 +02:00
import org.session.libsession.utilities.recipients.Recipient
2020-01-06 04:26:52 +01:00
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
2020-01-07 04:51:11 +01:00
import org.thoughtcrime.securesms.avatar.AvatarSelection
2023-05-22 07:23:58 +02:00
import org.thoughtcrime.securesms.components.ProfilePictureView
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
import org.thoughtcrime.securesms.dependencies.ConfigFactory
Add a global search (#834) * feat: modifying search functionalities to include contacts * feat: add global search UI input layouts and color attributes * feat: add global search repository and model content * feat: adding diff callbacks and wiring up global search vm to views * feat: adding scroll to message, figuring out new query for recipient thread search * feat: messing with the search and highlighting functionality after wiring up bindings * fix: compile error from merge * fix: gradlew build errors * feat: filtering contacts by existing un-archived threads * refactor: prevent note to self breaking, update queries and logic in search repo to include member->group reverse searches * feat: adding home screen new redesigns for search * feat: replacing designs and adding new group subtitle text * feat: small design improvements and incrementing gradle build number to install on device * feat: add scrollbars for search * feat: replace isVisible for cancel button now that GlobalSearchInputLayout.kt replaces header * refactor: all queries are debounced not just all but 2 char * refactor: remove visibility modifiers for cancel icon * refactor: use simplified non-db and context related models in display, remove db get group members call from binding data * fix: use threadId instead of group's address * refactor: better close on cancel, removing only yourself from group member list in open groups * refactor: seed view back to inflated on create and visibility for empty placeholder and seed view text * refactor: fixing build issues and new designs for message list * refactor: use dynamic limit * refactor: include raw session ID string search for non-empty threads * fix: build lint errors * fix: build issues * feat: add in path to the settings activity * refactor: remove wildcard imports
2022-02-07 07:06:27 +01:00
import org.thoughtcrime.securesms.home.PathActivity
import org.thoughtcrime.securesms.messagerequests.MessageRequestsActivity
2020-01-06 04:26:52 +01:00
import org.thoughtcrime.securesms.mms.GlideApp
import org.thoughtcrime.securesms.mms.GlideRequests
2023-10-19 17:15:33 +02:00
import org.thoughtcrime.securesms.onboarding.recoverypassword.startRecoveryPasswordActivity
import org.thoughtcrime.securesms.permissions.Permissions
New app theming (#913) * feat: start new app theming feature * feat: add some theming colours * refactor: start refactoring themes and colours to use dynamic attributes * feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific * refactor: take a look at ocean light and logo colour * feat: global search colours for light and dark ocean * feat: more styling * feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc * feat: add dynamic accent color * docs: add todo for changing how accent colour is applied * feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts * feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items * refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button * refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes * refactor: add context theme wrapper to bottom sheet dialog that references accent color * fix: input bar bug fix and preference activity themes * refactor: new settings menu options * fix: crash for PNModeActivity.kt refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu * feat: add new appearance settings activity * refactor: title and VM changes * fix: correct override * feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration * fix: compile errors and missing themes from emoji features * refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr * feat: appearance screen wired up, just need to refresh theme * feat: add theme state recreation and fix match system settings option * refactor: add bottom margin * feat: explore custom preference category * feat: add the customized session theme for CorrectedPreferenceFragment * feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment * refactor: change drawable style and remove explicit dividers * refactor: remove divider in CorrectedPreferenceFragment * feat: add theme state check on resume, might be jarring currently * feat: add preference divider elements for settings menu * refactor: settings menu redesigns * refactor: change led preference to integer and refactor TextSecurePreferences.kt * feat: add scroll parcel to save/restore hierarchy on restart with appearance changes * feat: add the conversations blocked contacts and refactor preference order and copy * feat: add blocked contacts activity, basic layout and vm * feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener * feat: add blocked contacts and notif recipient listeners * feat: add recipient db reader * feat: add blocked contact interactions and fix a theming crash for notifications * feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison * feat: add settings menu vectors * fix: preview compile error * refactor: migrating settings menu to new designs * feat: help menu * refactor: simplify link opening * refactor: remove space * feat: refactor preferences and start theming for light mode options * refactor: fixing dark and light modes with dialogs * refactor: popup dialogs use proper themes now * refactor: alert dialogs and media edit fragments use attribute references * refactor: use input bar button attribute instead color control normal in vector tint * refactor: transparency, dialog fixes, notification fix * refactor: attrs and styles for buttons * fix: use prominent button color on the outline button's border * fix: fix the trash * refactor: remove the appearance * refactor: avatar placeholder generation, chips and element border styles * refactor: use colors instead of style references * refactor: theming changes to match designs and feedback * refactor: the titles are bold and the categories are tertiary coloured now * fix: appearance settings match preferences, search bottom bar uses themed attributes * refactor: increase setting button height * Update clear all data dialog * Update seed dialog * refactor: more qa feedback changes * feat: add new TLs and fa-rIR TLs * Update notification content dialog * Fix message requests clear all button text color * feat: re-add screenshot observer * refactor: make send tint accent color * feat: add unread background differences * fix: change unread count indicator * build: upgrade build numbers * Fix message requests popupmenu background color * fix: crash from attr reference in color attribute * build: upgrade build number * fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons * fix: tertiary text for keyboard page search view * fix: emoji overflow colour differences * fix: reaction pill dialog background is now correct colour * Add style to reactions tab layout * fix: appearance activity reverting primary color at correct time * fix: show call privacy warning every time instead of just once * fix: gradient background(?) and audio autoplay disable * fix: crash in all media containing documents * fix: reaction dialog heading fixes * Add style to reactions tab layout * fix: remove gradient backgrounds * fix: adding new reaction normal text attribute to try correct the tab layout * fix: ocean dark unread/read colours * build; update build number * build: update build number Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
import org.thoughtcrime.securesms.preferences.appearance.AppearanceSettingsActivity
2020-01-07 04:51:11 +01:00
import org.thoughtcrime.securesms.profiles.ProfileMediaConstraints
2023-06-02 11:41:58 +02:00
import org.thoughtcrime.securesms.showSessionDialog
import org.thoughtcrime.securesms.util.BitmapDecodingException
import org.thoughtcrime.securesms.util.BitmapUtil
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
Add a global search (#834) * feat: modifying search functionalities to include contacts * feat: add global search UI input layouts and color attributes * feat: add global search repository and model content * feat: adding diff callbacks and wiring up global search vm to views * feat: adding scroll to message, figuring out new query for recipient thread search * feat: messing with the search and highlighting functionality after wiring up bindings * fix: compile error from merge * fix: gradlew build errors * feat: filtering contacts by existing un-archived threads * refactor: prevent note to self breaking, update queries and logic in search repo to include member->group reverse searches * feat: adding home screen new redesigns for search * feat: replacing designs and adding new group subtitle text * feat: small design improvements and incrementing gradle build number to install on device * feat: add scrollbars for search * feat: replace isVisible for cancel button now that GlobalSearchInputLayout.kt replaces header * refactor: all queries are debounced not just all but 2 char * refactor: remove visibility modifiers for cancel icon * refactor: use simplified non-db and context related models in display, remove db get group members call from binding data * fix: use threadId instead of group's address * refactor: better close on cancel, removing only yourself from group member list in open groups * refactor: seed view back to inflated on create and visibility for empty placeholder and seed view text * refactor: fixing build issues and new designs for message list * refactor: use dynamic limit * refactor: include raw session ID string search for non-empty threads * fix: build lint errors * fix: build issues * feat: add in path to the settings activity * refactor: remove wildcard imports
2022-02-07 07:06:27 +01:00
import org.thoughtcrime.securesms.util.disableClipping
import org.thoughtcrime.securesms.util.push
Add a global search (#834) * feat: modifying search functionalities to include contacts * feat: add global search UI input layouts and color attributes * feat: add global search repository and model content * feat: adding diff callbacks and wiring up global search vm to views * feat: adding scroll to message, figuring out new query for recipient thread search * feat: messing with the search and highlighting functionality after wiring up bindings * fix: compile error from merge * fix: gradlew build errors * feat: filtering contacts by existing un-archived threads * refactor: prevent note to self breaking, update queries and logic in search repo to include member->group reverse searches * feat: adding home screen new redesigns for search * feat: replacing designs and adding new group subtitle text * feat: small design improvements and incrementing gradle build number to install on device * feat: add scrollbars for search * feat: replace isVisible for cancel button now that GlobalSearchInputLayout.kt replaces header * refactor: all queries are debounced not just all but 2 char * refactor: remove visibility modifiers for cancel icon * refactor: use simplified non-db and context related models in display, remove db get group members call from binding data * fix: use threadId instead of group's address * refactor: better close on cancel, removing only yourself from group member list in open groups * refactor: seed view back to inflated on create and visibility for empty placeholder and seed view text * refactor: fixing build issues and new designs for message list * refactor: use dynamic limit * refactor: include raw session ID string search for non-empty threads * fix: build lint errors * fix: build issues * feat: add in path to the settings activity * refactor: remove wildcard imports
2022-02-07 07:06:27 +01:00
import org.thoughtcrime.securesms.util.show
2020-01-07 04:51:11 +01:00
import java.io.File
import java.security.SecureRandom
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
import javax.inject.Inject
2020-01-06 04:26:52 +01:00
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
@AndroidEntryPoint
2020-01-06 04:26:52 +01:00
class SettingsActivity : PassphraseRequiredActionBarActivity() {
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
@Inject
lateinit var configFactory: ConfigFactory
2023-11-29 15:15:53 +01:00
@Inject
lateinit var prefs: TextSecurePreferences
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
private lateinit var binding: ActivitySettingsBinding
private var displayNameEditActionMode: ActionMode? = null
set(value) { field = value; handleDisplayNameEditActionModeChanged() }
2020-01-06 04:26:52 +01:00
private lateinit var glide: GlideRequests
2020-01-07 04:51:11 +01:00
private var tempFile: File? = null
2020-01-06 04:26:52 +01:00
private val hexEncodedPublicKey: String
get() {
2021-02-18 05:12:30 +01:00
return TextSecurePreferences.getLocalNumber(this)!!
2020-01-06 04:26:52 +01:00
}
companion object {
const val updatedProfileResultCode = 1234
New app theming (#913) * feat: start new app theming feature * feat: add some theming colours * refactor: start refactoring themes and colours to use dynamic attributes * feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific * refactor: take a look at ocean light and logo colour * feat: global search colours for light and dark ocean * feat: more styling * feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc * feat: add dynamic accent color * docs: add todo for changing how accent colour is applied * feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts * feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items * refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button * refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes * refactor: add context theme wrapper to bottom sheet dialog that references accent color * fix: input bar bug fix and preference activity themes * refactor: new settings menu options * fix: crash for PNModeActivity.kt refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu * feat: add new appearance settings activity * refactor: title and VM changes * fix: correct override * feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration * fix: compile errors and missing themes from emoji features * refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr * feat: appearance screen wired up, just need to refresh theme * feat: add theme state recreation and fix match system settings option * refactor: add bottom margin * feat: explore custom preference category * feat: add the customized session theme for CorrectedPreferenceFragment * feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment * refactor: change drawable style and remove explicit dividers * refactor: remove divider in CorrectedPreferenceFragment * feat: add theme state check on resume, might be jarring currently * feat: add preference divider elements for settings menu * refactor: settings menu redesigns * refactor: change led preference to integer and refactor TextSecurePreferences.kt * feat: add scroll parcel to save/restore hierarchy on restart with appearance changes * feat: add the conversations blocked contacts and refactor preference order and copy * feat: add blocked contacts activity, basic layout and vm * feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener * feat: add blocked contacts and notif recipient listeners * feat: add recipient db reader * feat: add blocked contact interactions and fix a theming crash for notifications * feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison * feat: add settings menu vectors * fix: preview compile error * refactor: migrating settings menu to new designs * feat: help menu * refactor: simplify link opening * refactor: remove space * feat: refactor preferences and start theming for light mode options * refactor: fixing dark and light modes with dialogs * refactor: popup dialogs use proper themes now * refactor: alert dialogs and media edit fragments use attribute references * refactor: use input bar button attribute instead color control normal in vector tint * refactor: transparency, dialog fixes, notification fix * refactor: attrs and styles for buttons * fix: use prominent button color on the outline button's border * fix: fix the trash * refactor: remove the appearance * refactor: avatar placeholder generation, chips and element border styles * refactor: use colors instead of style references * refactor: theming changes to match designs and feedback * refactor: the titles are bold and the categories are tertiary coloured now * fix: appearance settings match preferences, search bottom bar uses themed attributes * refactor: increase setting button height * Update clear all data dialog * Update seed dialog * refactor: more qa feedback changes * feat: add new TLs and fa-rIR TLs * Update notification content dialog * Fix message requests clear all button text color * feat: re-add screenshot observer * refactor: make send tint accent color * feat: add unread background differences * fix: change unread count indicator * build: upgrade build numbers * Fix message requests popupmenu background color * fix: crash from attr reference in color attribute * build: upgrade build number * fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons * fix: tertiary text for keyboard page search view * fix: emoji overflow colour differences * fix: reaction pill dialog background is now correct colour * Add style to reactions tab layout * fix: appearance activity reverting primary color at correct time * fix: show call privacy warning every time instead of just once * fix: gradient background(?) and audio autoplay disable * fix: crash in all media containing documents * fix: reaction dialog heading fixes * Add style to reactions tab layout * fix: remove gradient backgrounds * fix: adding new reaction normal text attribute to try correct the tab layout * fix: ocean dark unread/read colours * build; update build number * build: update build number Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
private const val SCROLL_STATE = "SCROLL_STATE"
}
2020-01-06 04:26:52 +01:00
// region Lifecycle
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
super.onCreate(savedInstanceState, isReady)
binding = ActivitySettingsBinding.inflate(layoutInflater)
setContentView(binding.root)
2020-01-06 04:26:52 +01:00
glide = GlideApp.with(this)
2023-11-29 15:15:53 +01:00
}
override fun onStart() {
super.onStart()
binding.run {
2023-06-30 03:31:57 +02:00
setupProfilePictureView(profilePictureView)
profilePictureView.setOnClickListener { showEditProfilePictureUI() }
ctnGroupNameSection.setOnClickListener { startActionMode(DisplayNameEditActionModeCallback()) }
2023-11-29 15:15:53 +01:00
btnGroupNameDisplay.text = getDisplayName()
publicKeyTextView.text = hexEncodedPublicKey
copyButton.setOnClickListener { copyPublicKey() }
shareButton.setOnClickListener { sharePublicKey() }
Add a global search (#834) * feat: modifying search functionalities to include contacts * feat: add global search UI input layouts and color attributes * feat: add global search repository and model content * feat: adding diff callbacks and wiring up global search vm to views * feat: adding scroll to message, figuring out new query for recipient thread search * feat: messing with the search and highlighting functionality after wiring up bindings * fix: compile error from merge * fix: gradlew build errors * feat: filtering contacts by existing un-archived threads * refactor: prevent note to self breaking, update queries and logic in search repo to include member->group reverse searches * feat: adding home screen new redesigns for search * feat: replacing designs and adding new group subtitle text * feat: small design improvements and incrementing gradle build number to install on device * feat: add scrollbars for search * feat: replace isVisible for cancel button now that GlobalSearchInputLayout.kt replaces header * refactor: all queries are debounced not just all but 2 char * refactor: remove visibility modifiers for cancel icon * refactor: use simplified non-db and context related models in display, remove db get group members call from binding data * fix: use threadId instead of group's address * refactor: better close on cancel, removing only yourself from group member list in open groups * refactor: seed view back to inflated on create and visibility for empty placeholder and seed view text * refactor: fixing build issues and new designs for message list * refactor: use dynamic limit * refactor: include raw session ID string search for non-empty threads * fix: build lint errors * fix: build issues * feat: add in path to the settings activity * refactor: remove wildcard imports
2022-02-07 07:06:27 +01:00
pathButton.setOnClickListener { showPath() }
pathContainer.disableClipping()
privacyButton.setOnClickListener { showPrivacySettings() }
notificationsButton.setOnClickListener { showNotificationSettings() }
messageRequestsButton.setOnClickListener { showMessageRequests() }
chatsButton.setOnClickListener { showChatSettings() }
New app theming (#913) * feat: start new app theming feature * feat: add some theming colours * refactor: start refactoring themes and colours to use dynamic attributes * feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific * refactor: take a look at ocean light and logo colour * feat: global search colours for light and dark ocean * feat: more styling * feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc * feat: add dynamic accent color * docs: add todo for changing how accent colour is applied * feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts * feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items * refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button * refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes * refactor: add context theme wrapper to bottom sheet dialog that references accent color * fix: input bar bug fix and preference activity themes * refactor: new settings menu options * fix: crash for PNModeActivity.kt refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu * feat: add new appearance settings activity * refactor: title and VM changes * fix: correct override * feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration * fix: compile errors and missing themes from emoji features * refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr * feat: appearance screen wired up, just need to refresh theme * feat: add theme state recreation and fix match system settings option * refactor: add bottom margin * feat: explore custom preference category * feat: add the customized session theme for CorrectedPreferenceFragment * feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment * refactor: change drawable style and remove explicit dividers * refactor: remove divider in CorrectedPreferenceFragment * feat: add theme state check on resume, might be jarring currently * feat: add preference divider elements for settings menu * refactor: settings menu redesigns * refactor: change led preference to integer and refactor TextSecurePreferences.kt * feat: add scroll parcel to save/restore hierarchy on restart with appearance changes * feat: add the conversations blocked contacts and refactor preference order and copy * feat: add blocked contacts activity, basic layout and vm * feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener * feat: add blocked contacts and notif recipient listeners * feat: add recipient db reader * feat: add blocked contact interactions and fix a theming crash for notifications * feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison * feat: add settings menu vectors * fix: preview compile error * refactor: migrating settings menu to new designs * feat: help menu * refactor: simplify link opening * refactor: remove space * feat: refactor preferences and start theming for light mode options * refactor: fixing dark and light modes with dialogs * refactor: popup dialogs use proper themes now * refactor: alert dialogs and media edit fragments use attribute references * refactor: use input bar button attribute instead color control normal in vector tint * refactor: transparency, dialog fixes, notification fix * refactor: attrs and styles for buttons * fix: use prominent button color on the outline button's border * fix: fix the trash * refactor: remove the appearance * refactor: avatar placeholder generation, chips and element border styles * refactor: use colors instead of style references * refactor: theming changes to match designs and feedback * refactor: the titles are bold and the categories are tertiary coloured now * fix: appearance settings match preferences, search bottom bar uses themed attributes * refactor: increase setting button height * Update clear all data dialog * Update seed dialog * refactor: more qa feedback changes * feat: add new TLs and fa-rIR TLs * Update notification content dialog * Fix message requests clear all button text color * feat: re-add screenshot observer * refactor: make send tint accent color * feat: add unread background differences * fix: change unread count indicator * build: upgrade build numbers * Fix message requests popupmenu background color * fix: crash from attr reference in color attribute * build: upgrade build number * fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons * fix: tertiary text for keyboard page search view * fix: emoji overflow colour differences * fix: reaction pill dialog background is now correct colour * Add style to reactions tab layout * fix: appearance activity reverting primary color at correct time * fix: show call privacy warning every time instead of just once * fix: gradient background(?) and audio autoplay disable * fix: crash in all media containing documents * fix: reaction dialog heading fixes * Add style to reactions tab layout * fix: remove gradient backgrounds * fix: adding new reaction normal text attribute to try correct the tab layout * fix: ocean dark unread/read colours * build; update build number * build: update build number Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
appearanceButton.setOnClickListener { showAppearanceSettings() }
inviteFriendButton.setOnClickListener { sendInvitation() }
helpButton.setOnClickListener { showHelp() }
2023-11-29 15:17:57 +01:00
passwordDivider.isGone = prefs.getHidePassword()
2023-11-29 15:15:53 +01:00
passwordButton.isGone = prefs.getHidePassword()
passwordButton.setOnClickListener { showPassword() }
clearAllDataButton.setOnClickListener { clearAllData() }
versionTextView.text = String.format(getString(R.string.version_s), "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})")
}
2020-08-19 03:48:16 +02:00
}
private fun getDisplayName(): String =
TextSecurePreferences.getProfileName(this) ?: truncateIdForDisplay(hexEncodedPublicKey)
2023-05-22 07:23:58 +02:00
private fun setupProfilePictureView(view: ProfilePictureView) {
2023-06-05 07:28:56 +02:00
view.apply {
publicKey = hexEncodedPublicKey
displayName = getDisplayName()
isLarge = true
update()
}
2023-05-22 07:23:58 +02:00
}
New app theming (#913) * feat: start new app theming feature * feat: add some theming colours * refactor: start refactoring themes and colours to use dynamic attributes * feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific * refactor: take a look at ocean light and logo colour * feat: global search colours for light and dark ocean * feat: more styling * feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc * feat: add dynamic accent color * docs: add todo for changing how accent colour is applied * feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts * feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items * refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button * refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes * refactor: add context theme wrapper to bottom sheet dialog that references accent color * fix: input bar bug fix and preference activity themes * refactor: new settings menu options * fix: crash for PNModeActivity.kt refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu * feat: add new appearance settings activity * refactor: title and VM changes * fix: correct override * feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration * fix: compile errors and missing themes from emoji features * refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr * feat: appearance screen wired up, just need to refresh theme * feat: add theme state recreation and fix match system settings option * refactor: add bottom margin * feat: explore custom preference category * feat: add the customized session theme for CorrectedPreferenceFragment * feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment * refactor: change drawable style and remove explicit dividers * refactor: remove divider in CorrectedPreferenceFragment * feat: add theme state check on resume, might be jarring currently * feat: add preference divider elements for settings menu * refactor: settings menu redesigns * refactor: change led preference to integer and refactor TextSecurePreferences.kt * feat: add scroll parcel to save/restore hierarchy on restart with appearance changes * feat: add the conversations blocked contacts and refactor preference order and copy * feat: add blocked contacts activity, basic layout and vm * feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener * feat: add blocked contacts and notif recipient listeners * feat: add recipient db reader * feat: add blocked contact interactions and fix a theming crash for notifications * feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison * feat: add settings menu vectors * fix: preview compile error * refactor: migrating settings menu to new designs * feat: help menu * refactor: simplify link opening * refactor: remove space * feat: refactor preferences and start theming for light mode options * refactor: fixing dark and light modes with dialogs * refactor: popup dialogs use proper themes now * refactor: alert dialogs and media edit fragments use attribute references * refactor: use input bar button attribute instead color control normal in vector tint * refactor: transparency, dialog fixes, notification fix * refactor: attrs and styles for buttons * fix: use prominent button color on the outline button's border * fix: fix the trash * refactor: remove the appearance * refactor: avatar placeholder generation, chips and element border styles * refactor: use colors instead of style references * refactor: theming changes to match designs and feedback * refactor: the titles are bold and the categories are tertiary coloured now * fix: appearance settings match preferences, search bottom bar uses themed attributes * refactor: increase setting button height * Update clear all data dialog * Update seed dialog * refactor: more qa feedback changes * feat: add new TLs and fa-rIR TLs * Update notification content dialog * Fix message requests clear all button text color * feat: re-add screenshot observer * refactor: make send tint accent color * feat: add unread background differences * fix: change unread count indicator * build: upgrade build numbers * Fix message requests popupmenu background color * fix: crash from attr reference in color attribute * build: upgrade build number * fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons * fix: tertiary text for keyboard page search view * fix: emoji overflow colour differences * fix: reaction pill dialog background is now correct colour * Add style to reactions tab layout * fix: appearance activity reverting primary color at correct time * fix: show call privacy warning every time instead of just once * fix: gradient background(?) and audio autoplay disable * fix: crash in all media containing documents * fix: reaction dialog heading fixes * Add style to reactions tab layout * fix: remove gradient backgrounds * fix: adding new reaction normal text attribute to try correct the tab layout * fix: ocean dark unread/read colours * build; update build number * build: update build number Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
val scrollBundle = SparseArray<Parcelable>()
binding.scrollView.saveHierarchyState(scrollBundle)
outState.putSparseParcelableArray(SCROLL_STATE, scrollBundle)
}
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
super.onRestoreInstanceState(savedInstanceState)
savedInstanceState.getSparseParcelableArray<Parcelable>(SCROLL_STATE)?.let { scrollBundle ->
binding.scrollView.restoreHierarchyState(scrollBundle)
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.settings_general, menu)
return true
2020-08-19 03:48:16 +02:00
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.action_qr_code -> {
showQRCode()
true
}
else -> super.onOptionsItemSelected(item)
}
2020-01-06 04:26:52 +01:00
}
2020-01-07 04:51:11 +01:00
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
2020-01-07 04:51:11 +01:00
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
AvatarSelection.REQUEST_CODE_AVATAR -> {
if (resultCode != Activity.RESULT_OK) {
return
}
2020-01-07 04:51:11 +01:00
val outputFile = Uri.fromFile(File(cacheDir, "cropped"))
var inputFile: Uri? = data?.data
if (inputFile == null && tempFile != null) {
inputFile = Uri.fromFile(tempFile)
}
AvatarSelection.circularCropImage(this, inputFile, outputFile, R.string.CropImageActivity_profile_avatar)
}
AvatarSelection.REQUEST_CODE_CROP_IMAGE -> {
if (resultCode != Activity.RESULT_OK) {
return
}
2020-01-07 04:51:11 +01:00
AsyncTask.execute {
try {
2023-05-22 07:23:58 +02:00
val profilePictureToBeUploaded = BitmapUtil.createScaledBytes(this@SettingsActivity, AvatarSelection.getResultUri(data), ProfileMediaConstraints()).bitmap
2020-01-07 04:51:11 +01:00
Handler(Looper.getMainLooper()).post {
2023-05-22 07:23:58 +02:00
updateProfile(true, profilePictureToBeUploaded)
2020-01-07 04:51:11 +01:00
}
} catch (e: BitmapDecodingException) {
e.printStackTrace()
}
}
}
}
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
Permissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults)
}
2020-01-07 02:00:30 +01:00
// endregion
2020-01-06 04:26:52 +01:00
2020-01-07 02:00:30 +01:00
// region Updating
private fun handleDisplayNameEditActionModeChanged() {
val isEditingDisplayName = this.displayNameEditActionMode !== null
binding.btnGroupNameDisplay.visibility = if (isEditingDisplayName) View.INVISIBLE else View.VISIBLE
binding.displayNameEditText.visibility = if (isEditingDisplayName) View.VISIBLE else View.INVISIBLE
2020-01-07 02:00:30 +01:00
val inputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
if (isEditingDisplayName) {
binding.displayNameEditText.setText(binding.btnGroupNameDisplay.text)
binding.displayNameEditText.selectAll()
binding.displayNameEditText.requestFocus()
inputMethodManager.showSoftInput(binding.displayNameEditText, 0)
2020-01-07 02:00:30 +01:00
} else {
inputMethodManager.hideSoftInputFromWindow(binding.displayNameEditText.windowToken, 0)
2020-01-07 02:00:30 +01:00
}
}
2023-05-22 07:23:58 +02:00
private fun updateProfile(
isUpdatingProfilePicture: Boolean,
profilePicture: ByteArray? = null,
displayName: String? = null
) {
binding.loader.isVisible = true
2020-01-07 04:51:11 +01:00
val promises = mutableListOf<Promise<*, Exception>>()
if (displayName != null) {
TextSecurePreferences.setProfileName(this, displayName)
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
configFactory.user?.setName(displayName)
2020-01-07 04:51:11 +01:00
}
val encodedProfileKey = ProfileKeyUtil.generateEncodedProfileKey(this)
2023-05-22 07:23:58 +02:00
if (isUpdatingProfilePicture) {
if (profilePicture != null) {
promises.add(ProfilePictureUtilities.upload(profilePicture, encodedProfileKey, this))
} else {
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
MessagingModuleConfiguration.shared.storage.clearUserPic()
2023-05-22 07:23:58 +02:00
}
2020-01-07 04:51:11 +01:00
}
val compoundPromise = all(promises)
compoundPromise.successUi { // Do this on the UI thread so that it happens before the alwaysUi clause below
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
val userConfig = configFactory.user
2023-05-22 07:23:58 +02:00
if (isUpdatingProfilePicture) {
AvatarHelper.setAvatar(this, Address.fromSerialized(TextSecurePreferences.getLocalNumber(this)!!), profilePicture)
2023-05-22 07:23:58 +02:00
TextSecurePreferences.setProfileAvatarId(this, profilePicture?.let { SecureRandom().nextInt() } ?: 0 )
ProfileKeyUtil.setEncodedProfileKey(this, encodedProfileKey)
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
// new config
val url = TextSecurePreferences.getProfilePictureURL(this)
val profileKey = ProfileKeyUtil.getProfileKey(this)
if (profilePicture == null) {
userConfig?.setPic(UserPic.DEFAULT)
} else if (!url.isNullOrEmpty() && profileKey.isNotEmpty()) {
userConfig?.setPic(UserPic(url, profileKey))
}
}
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
if (userConfig != null && userConfig.needsDump()) {
configFactory.persist(userConfig, SnodeAPI.nowWithOffset)
}
Integrate shared libsession-util library (#1096) * feat: add some config db basics and DI for it, make the user profile optional, start looking at integrate building from initial dump * update: get latest util library submodule update * refactor: fix compile for refactored API * refactor: naming consistent with library * feat: add in config storage and injection to common places, managing lifecycle of native instances * refactor: config database changes, new protos, adding in support for config base namespace queries * refactor: config query and store use the same format as other platforms * feat: add batch snode calls and try to poll from all the config namespaces * fix: add optional namespace in signature and params * feat: add raw requests for modifying expiry and getting expiries * feat: add some base config migration logic, start implementing wrappers for conversation and expiry types * chore: update libsession base * feat: start integrating conversation wrapper functions * feat: add basic conversation info volatile types and implementations, start working on tests * feat: more common library wrapper implementation and test * fix: tests and compile issues * fix: fix tests, don't use iterables * feat: add all iterators and tests * feat: add in more config factory for volatile * feat: update request responses and their appropriate processing * feat: add storage with hashes and some basic profile update logic in config factory probably move that somewhere else * feat: adding config sync functionality, refactoring jobs to execute in suspend context to do some nice coroutine execution * refactor: moving some properties around so we have access in libsession * feat: expand on the config sync job, finish basic implementation to test against * feat: add forced config sync * feat: syncs the user profile stuff for now, and errors back to placeholder instead of unknown recipient * feat: add basic message read logic for synchronizing last reads, need to modify the query to use the last seen instead of the unread count in a subquery possibly for thread display record * feat: add broken unreads everywhere * fix: unreads work now for incoming messages, need to sync conv volatile properly still * feat: batching poll responses properly and handling groups properly * fix: replace the mark read receiver (from notifications) to use the new set last seen mark read logic * feat: update to the group list branch * fix: compile errors from updating library to use latest branch, now requires cmake 3.22.1 * fix: fix the contact tests * fix: getters weren't getters properly in the config factory, fixed new onboarding from configs * feat: add the last seen * feat: start adding user groups wrapper objects * refactor: add more else branches for unimplemented types * feat: buffer the last read when in conversation * feat: add basic contact logic for setting local contact state. Need to implement handling properly * refactor: trying to just include blocked status for now in updating contacts * fix: add some more contact syncing: nicknames, approved statuses, blocked statuses * feat: start implementing hashes in shared lib and refactoring * feat: start to implement group list info classes and wrappers and refactor to use library based hashes * feat: incorporate hashes from library, more wrapper for user groups and serialization from c++ * feat: adding more serialization changes for community base info and user groups LGC * feat: adding more serialize deserialize to legacy closed groups * feat: finish serial/deserial helper * feat: just implement deserialize community info * refactor: refactor tests and wrappers to use less pointers, finish implementing user groups API * feat: finish latest wrappers fix tests and continue building default generation functions. refactor defaults to be used if no stored data blob in DB * feat: more usergroup functionality, storage functionality for checking pinned status, adding pinned status for NTS/contacts, move community info parse full url to base community, add StorageProtocol logic for group info * feat: adding user groups to the list of user configs, refactorign some of the config factory to fetch the user configs easier. Add handling for polling user group namespace * feat: implement the default user config list * feat: add user group config handling * chore: extra missed existing group * refactor: use existing lookup for objects in wrappers so they don't overwrite missing values * feat: add contacts expiry serialization/deserialization, more LGC, timestamps to add closed group encryption info (for latest tracking) * refactor: change how expiration timer works for contacts, set the expiration timer for those conversations in handling contact configs * feat: add expiration updates via config for contacts as well * feat: add almost all group editing cases, need to hook into the thread deletion for groups in the user groups * feat: open group joining should work now * feat: add groups to configs for push * fix: handling user group updates bug fix for closed groups instead of all groups * fix: open group sync persistence * feat: add in activity finish if recipient no longer exists (deleted thread) from sync * feat: support avatar removal from shared library * feat: support thread deletion and refactoring a lot of getOrCreateThread references to go via storage or assume they are correctly set to hook into the contact and volatile creation during thread creation * fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library * refactor: make update listener visibility package * refactor: update kotlin * feat: update dependencies and support outdated config messages, refactor config factory to return null configs if new configs not supported * feat: update shared library to use priority only, fix compile errors, fix group member sync problem * fix: compile error * fix: profile avatar fixes for local user now that we aren't setting local user profile key * Revert "fix: profile avatar fixes for local user now that we aren't setting local user profile key" This reverts commit 3f569e34034713ee230581bc118e9127a8d0f434. * refactor: let the local number update recipient details in profile manager * fix: don't recreate thread after leaving * fix: fix up the duplicate thread creation in the message receive handler * fix: fix the placeholder rendering on new messages, add in extra context logging for adding contacts and preventing new thread creation on new messages of various types * feat: add test theme for xml layout previews * feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test * feat: setup android unit tests for verifying storage behaviours and state of shared configs * feat: adding dependencies to try and get android tests working, fixing bug with initial config not syncing properly * fix: remove hilt testing, add spy on app context storage field instead, update libsession-util to fixed sodium cmake branch * refactor: use PR version of libsession-util to test cmake build * fix: new build on normal repo * feat: new libsession util commit * refactor: remove the old custom build libsodium stuff from cmake * feat: update libsession module * fix: add legacy config subscription to the home activity to enable showing banner at any time * fix: pinned status for communities and groups, group last read time being set to snodeapi.now on finish joining * fix: some open group volatile convo fix for last read timer being set. Need to investigate further * fix: prevent blocking local number * fix: adding in more checks for open group inbox recipients before being saved to the shared configs. Prevent sending typing indicator for blocked users * fix: add blocked check for read receipt and updating expiring messages * fix: another contact recipient config library call removed for non-standard IDs * fix: another ID check * fix: don't process thread creation for user is sender && recipient (sync message) for message request responses * refactor: mark as read on open and use less buffer time * fix: finally fix the darn unread count issue by * fix: removing debug logs, adding failure error handling logs for expiry message updater, properly using the message thread ID created for the expiring messages. Process the non-thread messages properly with await in BatchMessageReceiveJob * fix: checking the last read open to message and make sure that scroll behaviour matches expected, fix the config sync job not deleting ALL old hashes only latest * refactor: try to add a retry logic to config sync job in case of snode failure * build: update submodule * fix: remove user notifications for leaving group to prevent synced device issues, don't create thread in messages for new closed groups, includei nactive groups in the deletion queries for merging group configs * feat: use blinded message count for banner also * refactor: remove some logging, don't use blinded conversations in the list * fix: don't set the read flag in update notifications, some roundabout logic for first loads and scrolling to last known positions * refactor: merge changes, re-add the group check in unapproved messages * fix: re-poll on fail in case that was breaking anything * fix: pinning groups and notifying list listeners in threadDb.setPinned * feat: add in TTL extension subrequest and builder, enable extending TTLs for all latest config messages in poll as subrequest * feat: add block to the delete all message requests, only if they're not open group inbox contacts * refactor: disable edit text for non contacts * refactor: let the user display name return "You" for local user * fix: prevent NTS self create thread on user view bind * refactor: remove populate public key cache if needed call which seems unnecessary at that point, maybe UserView refs have changed since 2020 * refactor: use just first visible instead of completely visible, merge message sender changes * fix: prevent block of users in delete all * fix: self sync sync message failures for default values * feat: update libsession-util, adjust docs, update mms and sms to use message sent timestamp instead of -1 for last read in the thread * fix: some compile issues in tests and some TODOs for things to do before merge * fix: handle recyclerview scrolled on scroll to first unread if it's the first load * fix: added more migration code for deleting unnecessary threads and groups, fixed a post-migration last seen issue on last item (current read is now), comment out actual network sync while testing migrations * feat: adding a force new configs flag and logic for timestamp handling / forced configs, fix issue with handling legacy messages * refactor: re-add the sending of configs * fix: don't add contacts if they don't exist in the profile manager * [wip] fix: trying to consolidate prof pic and key properly * feat: add logs and fix compile issue with a themes.xml entry, add removing profile picture into logic for profile manager * fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings * fix: nts threads * fix: open group avatar loop for open groups we have left * feat: add a wrapper hash to track home diff util changes for wrapper contact recipient info, add test for dirty state in double set * feat: add a dump in there as well * refactor: more test code refactor * fix: update last seen if later than current * fix: open group threads and avatar downloads * fix: add max size and maybe fix the non-200 sub requests for batches (for 421s in particular) * fix: open group comparison issues potentially, have to update some more outgoing message open group flags for visibility of details etc * Updated to the latest libSession-util * Updated logic to delete legacy groups when kicked/left * Added the legacy group 'joined_at' value * Replaced incorrect character in JNI * Fixed an issue where the group keyPair was getting encoded incorrectly * Updated the code to ignore outdated legacy group control message changes * Updated the code to ignore messages invalidated by the config * [Review] Updated the poller to process config messages before standard * Cleaned up the outdated message logic * Fixed inverted config dropping flags * Fixed an issue where the joining a community would read all messages Stopped using a reversed RecyclerView in all cases (caused the unread issue) Updated the logic to jump to the newly sent message when sending a message (to be consistent with other platforms) Updated the logic to refresh the DB unread count when the cursor receives an update * Updated the conversation to highlight the first unread message on open * Fixed a couple of bugs with the highlighting * Fixed a bug where the user profile picture wasn't downloading correctly * feat: add all namespaces to delete all messages request and signature verification data * fix: merge namespace hashes for signature returned and * fix: import correct scroll to bottom * build: update version code and name * fix: initial contact generation fix for existing blinded contacts * fix: initial convo generation fix for existing blinded convos (?) * fix: conversation unread not doing a check for standard ID prefix * fix: thread ID not being created for legacy config messages * fix: don't treat 404 as bad snode * fix: don't add retrieve profile job if we have one for that address * build: update build code * fix: reduce attempts for downloading image, invert unreachable type check * fix: attempting to fix preventing message processing if group thread is not active for closed groups and initial contact dump only allows conversations with thread, may need further optimisations though * feat: Added an unread marker and search result focus highlighting * fix: empty set in appropriate places for current closed groups * build: update build version code * fix: fix the notifications and request at appropriate time * refactor: remove debug logging for thread create and delete * build: update build number * fix: new community doesn't break persisting config if the .add request fails * build: trying to track down broken retrieve avatar job * feat: update to latest libsession dev * fix: maybe fix avatar download for new messages * fix: 404s causing snode errors and trying to retrieve avatars that have already 404'd a lot * fix: closed group creation sets thread date to formation timestamp * build: update version code * build: update version code * build: remove debuggable release build * fix: use new permissions for external attachments * build: update version code * chore: remove debug logs * fix: tests and main thread blocking db fetch for path status view * wip: trying to track down failure to mark conversation as read in delayed group add * wip: add more logs for initial last Read sync of communities * wip: maybe the volatile is being updated with 0 on batch message receive? * fix: maybe syncing read statuses are working now * chore: remove debug logs * build: update build number * fix: trying to improve performance * fix: add close to banner * refactor: hide seed reminder in preview * build: update build number * fix: maybe requires update thread no matter what * fix: message request banner shows again * fix: android tests work again and permissions * fix: blocked contacts click handler being overridden by something * Revert "fix: blocked contacts click handler being overridden by something" This reverts commit 608572fc426def0850085727ed0c399623110c37. * build: update build number * refactor: remove unused dependencies and update minor for sqlcipher * fix: actually do insert contact, because otherwise name doesn't get set properly * fix: maybe fix scroll to bottom issue * build: update build number * fix: the message time and jump to message queries are more optimized * fix: maybe fix the last seen issues * build: update build number * fix: pfp broken closed groups why * fix: add admins and members as member list instead of just members * fix: exclude lgc without membership > 1 and inactive explicitly * fix: submodule update * fix: compiles with removal of iterator erase * fix: unread indicator updates properly in ConversationActivityV2 * fix: unread notifications clear and altered if any notifications exist (prevents clearing read notifications in conversation or on home screen) * refactor: profile pictures kinda broken * build: update build number * refactor: remove full hash from log * fix: isPinned threadDB call * refactor: use mutex in all libsession native calls, change timestamp * refactor: add basic support for blinded v2 prefixes --------- Co-authored-by: Morgan Pretty <morgan.t.pretty@gmail.com>
2023-07-14 10:27:13 +02:00
ConfigurationMessageUtilities.forceSyncConfigurationNowIfNeeded(this@SettingsActivity)
}
compoundPromise.alwaysUi {
2020-01-07 04:51:11 +01:00
if (displayName != null) {
binding.btnGroupNameDisplay.text = displayName
2020-01-07 04:51:11 +01:00
}
2023-05-22 07:23:58 +02:00
if (isUpdatingProfilePicture) {
2023-06-30 03:31:57 +02:00
binding.profilePictureView.recycle() // Clear the cached image before updating
binding.profilePictureView.update()
2020-01-07 04:51:11 +01:00
}
binding.loader.isVisible = false
2020-01-07 02:00:30 +01:00
}
2020-01-07 04:51:11 +01:00
}
2020-01-06 04:26:52 +01:00
// endregion
// region Interaction
2020-01-07 02:00:30 +01:00
/**
* @return true if the update was successful.
*/
private fun saveDisplayName(): Boolean {
val displayName = binding.displayNameEditText.text.toString().trim()
2020-01-07 04:51:11 +01:00
if (displayName.isEmpty()) {
Toast.makeText(this, R.string.activity_settings_display_name_missing_error, Toast.LENGTH_SHORT).show()
return false
2020-01-07 04:51:11 +01:00
}
2021-02-22 01:29:22 +01:00
if (displayName.toByteArray().size > ProfileManagerProtocol.Companion.NAME_PADDED_LENGTH) {
Toast.makeText(this, R.string.activity_settings_display_name_too_long_error, Toast.LENGTH_SHORT).show()
return false
2020-01-07 04:51:11 +01:00
}
2023-05-22 07:23:58 +02:00
updateProfile(false, displayName = displayName)
return true
2020-01-06 04:26:52 +01:00
}
private fun showQRCode() {
2020-01-06 06:05:57 +01:00
val intent = Intent(this, QRCodeActivity::class.java)
push(intent)
2020-01-06 04:26:52 +01:00
}
2020-01-07 04:51:11 +01:00
private fun showEditProfilePictureUI() {
2023-06-02 11:41:58 +02:00
showSessionDialog {
2023-05-30 09:19:07 +02:00
title(R.string.activity_settings_set_display_picture)
view(R.layout.dialog_change_avatar)
2023-05-30 14:09:03 +02:00
button(R.string.activity_settings_upload) { startAvatarSelection() }
if (TextSecurePreferences.getProfileAvatarId(context) != 0) {
button(R.string.activity_settings_remove) { removeAvatar() }
2023-05-22 07:23:58 +02:00
}
2023-05-30 14:09:03 +02:00
cancelButton()
2023-05-30 09:19:07 +02:00
}.apply {
2023-06-05 07:28:56 +02:00
val profilePic = findViewById<ProfilePictureView>(R.id.profile_picture_view)
?.also(::setupProfilePictureView)
val pictureIcon = findViewById<View>(R.id.ic_pictures)
val recipient = Recipient.from(context, Address.fromSerialized(hexEncodedPublicKey), false)
val photoSet = (recipient.contactPhoto as ProfileContactPhoto).avatarObject !in setOf("0", "")
profilePic?.isVisible = photoSet
pictureIcon?.isVisible = !photoSet
2023-05-22 07:23:58 +02:00
}
}
private fun removeAvatar() {
updateProfile(true)
}
private fun startAvatarSelection() {
// Ask for an optional camera permission.
Permissions.with(this)
2021-07-14 06:17:40 +02:00
.request(Manifest.permission.CAMERA)
.onAnyResult {
tempFile = AvatarSelection.startAvatarSelection(this, false, true)
}
.execute()
2020-01-07 04:51:11 +01:00
}
2020-01-06 04:26:52 +01:00
private fun copyPublicKey() {
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("Session ID", hexEncodedPublicKey)
clipboard.setPrimaryClip(clip)
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
2020-01-06 04:26:52 +01:00
}
private fun sharePublicKey() {
val intent = Intent()
intent.action = Intent.ACTION_SEND
intent.putExtra(Intent.EXTRA_TEXT, hexEncodedPublicKey)
intent.type = "text/plain"
val chooser = Intent.createChooser(intent, getString(R.string.share))
startActivity(chooser)
2020-01-06 04:26:52 +01:00
}
2020-01-07 05:59:18 +01:00
private fun showPrivacySettings() {
val intent = Intent(this, PrivacySettingsActivity::class.java)
push(intent)
}
private fun showNotificationSettings() {
val intent = Intent(this, NotificationSettingsActivity::class.java)
push(intent)
}
private fun showMessageRequests() {
val intent = Intent(this, MessageRequestsActivity::class.java)
push(intent)
}
private fun showChatSettings() {
val intent = Intent(this, ChatSettingsActivity::class.java)
push(intent)
}
New app theming (#913) * feat: start new app theming feature * feat: add some theming colours * refactor: start refactoring themes and colours to use dynamic attributes * feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific * refactor: take a look at ocean light and logo colour * feat: global search colours for light and dark ocean * feat: more styling * feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc * feat: add dynamic accent color * docs: add todo for changing how accent colour is applied * feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts * feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items * refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button * refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes * refactor: add context theme wrapper to bottom sheet dialog that references accent color * fix: input bar bug fix and preference activity themes * refactor: new settings menu options * fix: crash for PNModeActivity.kt refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu * feat: add new appearance settings activity * refactor: title and VM changes * fix: correct override * feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration * fix: compile errors and missing themes from emoji features * refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr * feat: appearance screen wired up, just need to refresh theme * feat: add theme state recreation and fix match system settings option * refactor: add bottom margin * feat: explore custom preference category * feat: add the customized session theme for CorrectedPreferenceFragment * feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment * refactor: change drawable style and remove explicit dividers * refactor: remove divider in CorrectedPreferenceFragment * feat: add theme state check on resume, might be jarring currently * feat: add preference divider elements for settings menu * refactor: settings menu redesigns * refactor: change led preference to integer and refactor TextSecurePreferences.kt * feat: add scroll parcel to save/restore hierarchy on restart with appearance changes * feat: add the conversations blocked contacts and refactor preference order and copy * feat: add blocked contacts activity, basic layout and vm * feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener * feat: add blocked contacts and notif recipient listeners * feat: add recipient db reader * feat: add blocked contact interactions and fix a theming crash for notifications * feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison * feat: add settings menu vectors * fix: preview compile error * refactor: migrating settings menu to new designs * feat: help menu * refactor: simplify link opening * refactor: remove space * feat: refactor preferences and start theming for light mode options * refactor: fixing dark and light modes with dialogs * refactor: popup dialogs use proper themes now * refactor: alert dialogs and media edit fragments use attribute references * refactor: use input bar button attribute instead color control normal in vector tint * refactor: transparency, dialog fixes, notification fix * refactor: attrs and styles for buttons * fix: use prominent button color on the outline button's border * fix: fix the trash * refactor: remove the appearance * refactor: avatar placeholder generation, chips and element border styles * refactor: use colors instead of style references * refactor: theming changes to match designs and feedback * refactor: the titles are bold and the categories are tertiary coloured now * fix: appearance settings match preferences, search bottom bar uses themed attributes * refactor: increase setting button height * Update clear all data dialog * Update seed dialog * refactor: more qa feedback changes * feat: add new TLs and fa-rIR TLs * Update notification content dialog * Fix message requests clear all button text color * feat: re-add screenshot observer * refactor: make send tint accent color * feat: add unread background differences * fix: change unread count indicator * build: upgrade build numbers * Fix message requests popupmenu background color * fix: crash from attr reference in color attribute * build: upgrade build number * fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons * fix: tertiary text for keyboard page search view * fix: emoji overflow colour differences * fix: reaction pill dialog background is now correct colour * Add style to reactions tab layout * fix: appearance activity reverting primary color at correct time * fix: show call privacy warning every time instead of just once * fix: gradient background(?) and audio autoplay disable * fix: crash in all media containing documents * fix: reaction dialog heading fixes * Add style to reactions tab layout * fix: remove gradient backgrounds * fix: adding new reaction normal text attribute to try correct the tab layout * fix: ocean dark unread/read colours * build; update build number * build: update build number Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
private fun showAppearanceSettings() {
val intent = Intent(this, AppearanceSettingsActivity::class.java)
push(intent)
}
2020-11-02 04:54:10 +01:00
private fun sendInvitation() {
val intent = Intent()
intent.action = Intent.ACTION_SEND
2021-07-14 07:08:59 +02:00
val invitation = "Hey, I've been using Session to chat with complete privacy and security. Come join me! Download it at https://getsession.org/. My Session ID is $hexEncodedPublicKey !"
2020-11-02 04:54:10 +01:00
intent.putExtra(Intent.EXTRA_TEXT, invitation)
intent.type = "text/plain"
val chooser = Intent.createChooser(intent, getString(R.string.activity_settings_invite_button_title))
startActivity(chooser)
2020-11-02 04:54:10 +01:00
}
New app theming (#913) * feat: start new app theming feature * feat: add some theming colours * refactor: start refactoring themes and colours to use dynamic attributes * feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific * refactor: take a look at ocean light and logo colour * feat: global search colours for light and dark ocean * feat: more styling * feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc * feat: add dynamic accent color * docs: add todo for changing how accent colour is applied * feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts * feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items * refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button * refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes * refactor: add context theme wrapper to bottom sheet dialog that references accent color * fix: input bar bug fix and preference activity themes * refactor: new settings menu options * fix: crash for PNModeActivity.kt refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu * feat: add new appearance settings activity * refactor: title and VM changes * fix: correct override * feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration * fix: compile errors and missing themes from emoji features * refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr * feat: appearance screen wired up, just need to refresh theme * feat: add theme state recreation and fix match system settings option * refactor: add bottom margin * feat: explore custom preference category * feat: add the customized session theme for CorrectedPreferenceFragment * feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment * refactor: change drawable style and remove explicit dividers * refactor: remove divider in CorrectedPreferenceFragment * feat: add theme state check on resume, might be jarring currently * feat: add preference divider elements for settings menu * refactor: settings menu redesigns * refactor: change led preference to integer and refactor TextSecurePreferences.kt * feat: add scroll parcel to save/restore hierarchy on restart with appearance changes * feat: add the conversations blocked contacts and refactor preference order and copy * feat: add blocked contacts activity, basic layout and vm * feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener * feat: add blocked contacts and notif recipient listeners * feat: add recipient db reader * feat: add blocked contact interactions and fix a theming crash for notifications * feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison * feat: add settings menu vectors * fix: preview compile error * refactor: migrating settings menu to new designs * feat: help menu * refactor: simplify link opening * refactor: remove space * feat: refactor preferences and start theming for light mode options * refactor: fixing dark and light modes with dialogs * refactor: popup dialogs use proper themes now * refactor: alert dialogs and media edit fragments use attribute references * refactor: use input bar button attribute instead color control normal in vector tint * refactor: transparency, dialog fixes, notification fix * refactor: attrs and styles for buttons * fix: use prominent button color on the outline button's border * fix: fix the trash * refactor: remove the appearance * refactor: avatar placeholder generation, chips and element border styles * refactor: use colors instead of style references * refactor: theming changes to match designs and feedback * refactor: the titles are bold and the categories are tertiary coloured now * fix: appearance settings match preferences, search bottom bar uses themed attributes * refactor: increase setting button height * Update clear all data dialog * Update seed dialog * refactor: more qa feedback changes * feat: add new TLs and fa-rIR TLs * Update notification content dialog * Fix message requests clear all button text color * feat: re-add screenshot observer * refactor: make send tint accent color * feat: add unread background differences * fix: change unread count indicator * build: upgrade build numbers * Fix message requests popupmenu background color * fix: crash from attr reference in color attribute * build: upgrade build number * fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons * fix: tertiary text for keyboard page search view * fix: emoji overflow colour differences * fix: reaction pill dialog background is now correct colour * Add style to reactions tab layout * fix: appearance activity reverting primary color at correct time * fix: show call privacy warning every time instead of just once * fix: gradient background(?) and audio autoplay disable * fix: crash in all media containing documents * fix: reaction dialog heading fixes * Add style to reactions tab layout * fix: remove gradient backgrounds * fix: adding new reaction normal text attribute to try correct the tab layout * fix: ocean dark unread/read colours * build; update build number * build: update build number Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
private fun showHelp() {
val intent = Intent(this, HelpSettingsActivity::class.java)
push(intent)
2021-07-14 06:17:40 +02:00
}
Add a global search (#834) * feat: modifying search functionalities to include contacts * feat: add global search UI input layouts and color attributes * feat: add global search repository and model content * feat: adding diff callbacks and wiring up global search vm to views * feat: adding scroll to message, figuring out new query for recipient thread search * feat: messing with the search and highlighting functionality after wiring up bindings * fix: compile error from merge * fix: gradlew build errors * feat: filtering contacts by existing un-archived threads * refactor: prevent note to self breaking, update queries and logic in search repo to include member->group reverse searches * feat: adding home screen new redesigns for search * feat: replacing designs and adding new group subtitle text * feat: small design improvements and incrementing gradle build number to install on device * feat: add scrollbars for search * feat: replace isVisible for cancel button now that GlobalSearchInputLayout.kt replaces header * refactor: all queries are debounced not just all but 2 char * refactor: remove visibility modifiers for cancel icon * refactor: use simplified non-db and context related models in display, remove db get group members call from binding data * fix: use threadId instead of group's address * refactor: better close on cancel, removing only yourself from group member list in open groups * refactor: seed view back to inflated on create and visibility for empty placeholder and seed view text * refactor: fixing build issues and new designs for message list * refactor: use dynamic limit * refactor: include raw session ID string search for non-empty threads * fix: build lint errors * fix: build issues * feat: add in path to the settings activity * refactor: remove wildcard imports
2022-02-07 07:06:27 +01:00
private fun showPath() {
val intent = Intent(this, PathActivity::class.java)
show(intent)
}
2023-11-29 15:15:53 +01:00
private fun showPassword() {
2023-10-19 13:39:12 +02:00
startRecoveryPasswordActivity()
2020-01-07 05:59:18 +01:00
}
private fun clearAllData() {
ClearAllDataDialog().show(supportFragmentManager, "Clear All Data Dialog")
}
2020-01-06 04:26:52 +01:00
// endregion
private inner class DisplayNameEditActionModeCallback: ActionMode.Callback {
override fun onCreateActionMode(mode: ActionMode, menu: Menu): Boolean {
mode.title = getString(R.string.activity_settings_display_name_edit_text_hint)
mode.menuInflater.inflate(R.menu.menu_apply, menu)
this@SettingsActivity.displayNameEditActionMode = mode
return true
}
override fun onPrepareActionMode(mode: ActionMode, menu: Menu): Boolean {
return false
}
override fun onDestroyActionMode(mode: ActionMode) {
this@SettingsActivity.displayNameEditActionMode = null
}
override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean {
when (item.itemId) {
R.id.applyButton -> {
if (this@SettingsActivity.saveDisplayName()) {
mode.finish()
}
return true
}
}
return false;
}
}
2020-01-06 04:26:52 +01:00
}