Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
223 commits
Select commit Hold shift + click to select a range
bc6b084
wip: dev settings to treat all users a session pro
Aug 13, 2025
2d7554d
Merge branch 'user-profile-modal' into session-pro-badge
Aug 13, 2025
3250738
pro badge in conversation screen
Aug 14, 2025
84ec23f
pro badges in conversation list
Aug 14, 2025
eb178ef
fix the cancel button position in quote draft view
Aug 14, 2025
1340733
feat: label with pro badge and refactor
Aug 15, 2025
3c6e04e
feat: pro badge on App title
Aug 18, 2025
122a1a7
feat: badges in Message info screen
Aug 19, 2025
695dcb6
Merge branch 'dev' into session-pro-badge
Aug 20, 2025
c595c54
feat: contact list with pro badge
Aug 20, 2025
4b5c1f0
wip: pro badges in settings screen
Aug 20, 2025
6696c84
feat: pro badges in settings screen
Aug 20, 2025
f7a720b
wip: conversation setting screen with pro badge
Aug 21, 2025
69cdf8f
feat: profile picture and qrcode in ucs
Aug 22, 2025
86b6eb4
wip: Pro CTA Modal for group activated
Aug 22, 2025
c135636
[Automated] Update translations from Crowdin
Bilb Aug 25, 2025
de7c0b0
feat: group activated pro modal
Aug 25, 2025
4be55d3
Merge branch 'feature/update-crowdin-translations' of https://github.…
Aug 25, 2025
1f979a7
feat: user profile modal in message info screen
Aug 25, 2025
e8d867a
feat: open lightbox for qrcode in ucs
Aug 25, 2025
18920ae
fix: read more for message bubble cells with link preview and other m…
Aug 25, 2025
b6c3a36
[Automated] Update translations from Crowdin
ThomasSession Aug 25, 2025
40aacf4
clean up
Aug 25, 2025
90c07d3
Merge branch 'feature/update-crowdin-translations' of https://github.…
Aug 26, 2025
96175cb
fix unit test
Aug 26, 2025
457f4f9
fix message bubble in message info screen
Aug 26, 2025
97fe404
clean
Aug 26, 2025
fb25784
Merge branch 'dev' into session-pro-badge
Aug 26, 2025
12bdef7
Merge branch 'user-profile-modal' into session-pro-badge
Aug 27, 2025
c3654e0
Merge branch 'user-profile-modal' into session-pro-badge
Sep 8, 2025
3fedbfa
Merge branch 'user-profile-modal' into session-pro-badge
Sep 11, 2025
16bf625
Merge branch 'user-profile-modal' into session-pro-badge
Sep 12, 2025
345ab9b
fix merge
Sep 12, 2025
3bf67ed
Updated notification content to group message request type notifications
mikoldin123 Sep 17, 2025
ee2295c
Updated notification grouping cases
mikoldin123 Sep 18, 2025
2a3f88b
Updated input disabled field and use better string for communities
mikoldin123 Sep 18, 2025
2801419
Fix delete emoji icon too large
mikoldin123 Sep 18, 2025
20cd5ac
Merge branch 'dev' into fix/SES-4471/delete_emoji_reaction_too_big
mikoldin123 Sep 19, 2025
3d9ab32
Merge branch 'dev' into feat/SES-3848/show_disabled_input_for_communi…
mikoldin123 Sep 19, 2025
315d60a
Merge branch 'user-profile-modal' into session-pro-badge
mpretty-cyro Sep 19, 2025
5c12f47
Fixed some merge issues
mpretty-cyro Sep 19, 2025
a64fbc4
Fixed an issue with the dev setting not updating the UI
mpretty-cyro Sep 19, 2025
bafe40e
Show empty video inset as soon as any video starts
mikoldin123 Sep 19, 2025
87f2016
Merge branch 'user-profile-modal' into session-pro-badge
mpretty-cyro Sep 19, 2025
2d8c5f9
Updated variable flag definition to constant
mikoldin123 Sep 22, 2025
03f1862
Add handling of enter key from external keyboard
mikoldin123 Sep 23, 2025
b11d8bc
Started working on new reupload logic for user display pics
mpretty-cyro Sep 24, 2025
2955d9a
Merge branch 'user-profile-modal' into session-pro-badge
Sep 25, 2025
1c17b97
Fix to only show approved contacts on global search
mikoldin123 Sep 25, 2025
ebb0c63
Fix valid ip address labeled as unknown country path on some locale
mikoldin123 Sep 25, 2025
f6ed270
Fix log file fails to upload to google drive when shared
mikoldin123 Sep 26, 2025
c52905a
Moved file modification handling to `Attachmentmanager`
mikoldin123 Sep 29, 2025
8178020
Updated `numColumnsBeforeProfiles` count for the new column
mikoldin123 Sep 29, 2025
675910e
Updated disabled conversation input buttons colors
mikoldin123 Sep 29, 2025
b1257b2
Centered play button for audio type attachment
mikoldin123 Sep 29, 2025
76bc2f5
Fixes inputAccessoryView disappears when dismissing emoji search modal
mikoldin123 Sep 29, 2025
50aee06
Added whitespace removal on other file name creation
mikoldin123 Sep 30, 2025
4672b4a
Added missing accessibility identifier for Missed call dialogs
mikoldin123 Sep 30, 2025
0ece34c
Merge pull request #597 from session-foundation/dev
mpretty-cyro Sep 30, 2025
7dc430e
Merge pull request #598 from session-foundation/dev
mpretty-cyro Sep 30, 2025
00b5df0
Removed generic cancel button identifier
mikoldin123 Oct 1, 2025
741c5b2
Merge branch 'user-profile-modal' into session-pro-badge
Oct 1, 2025
959867d
Merge branch 'user-profile-modal' into session-pro-badge
Oct 1, 2025
1f2829a
Merge branch 'user-profile-modal' into session-pro-badge
Oct 1, 2025
57e779c
fix some minor ui issues
Oct 1, 2025
270a5dd
fix: improve `isAnimated`
Oct 1, 2025
169438e
Removed unused attachment caption functionality
mpretty-cyro Oct 2, 2025
1ed3dc8
Added iOS support deprecation banner on home screen
mikoldin123 Oct 1, 2025
c616c10
Fixed layout bugs with contact list items and blocked contacts button
mpretty-cyro Oct 2, 2025
34b979c
Fixed profile cell layout, fixed Community 'next' button on iPhone SE
mpretty-cyro Oct 2, 2025
35fb351
Fix wrong condition check in hiding support banner
mikoldin123 Oct 3, 2025
09deb0d
feat: add cache for pro badge images and use image for @YOU
Oct 3, 2025
0937356
fix message info screen
Oct 3, 2025
eb45a02
clean up
Oct 3, 2025
a15f94e
WIP Updated attachment processing refactoring
mpretty-cyro Oct 3, 2025
b08bef0
Added option to select a minimum version for depecation warning banner
mikoldin123 Oct 3, 2025
7eda203
refactor on session pro badge image cache
Oct 6, 2025
1cc029d
feat: cache for @You image rendering
Oct 6, 2025
5f720af
New deterministic encryption/decryption, upload/download refactoring
mpretty-cyro Oct 6, 2025
07c75d8
fix pro badge or mention in attributed string won't change the color …
Oct 6, 2025
25f99ea
Added code to filter out Giphy results which won't be rendered
mpretty-cyro Oct 6, 2025
da0ad25
[Automated] Update translations from Crowdin
mpretty-cyro Oct 7, 2025
b6c4d9a
Fixed a number of issues found during testing, cleaned up code
mpretty-cyro Oct 7, 2025
323cdc2
Merge pull request #599 from session-foundation/feature/update-crowdi…
mpretty-cyro Oct 7, 2025
83dc62f
[Automated] Update translations from Crowdin
mpretty-cyro Oct 8, 2025
9852348
Merge pull request #604 from session-foundation/feature/update-crowdi…
mpretty-cyro Oct 8, 2025
1b6071a
Removed camera permission request on call start
mikoldin123 Sep 16, 2025
fc7f6c8
Clean up permission and preview handling
mikoldin123 Sep 16, 2025
9dc19d2
Additional camera permission instructions and behavior
mikoldin123 Oct 8, 2025
6d33617
Added missing localized string and cleaned up code
mikoldin123 Oct 8, 2025
592eb34
Fixed a number of bugs, some code cleanup, resolved some TODOs
mpretty-cyro Oct 8, 2025
a1db1c0
Fixed a few bugs which were noticed while testing
mpretty-cyro Oct 8, 2025
284b1aa
Fix end call camera instruction not showing
mikoldin123 Oct 10, 2025
99ea4ad
Added missing emoji in welcome to session copy
mikoldin123 Oct 10, 2025
7e2a8e6
[Automated] Update translations from Crowdin
mpretty-cyro Oct 10, 2025
c2db476
Merge pull request #490 from RyanRory/animated-profile-picture
mpretty-cyro Oct 10, 2025
971ac79
Merge pull request #495 from RyanRory/user-profile-modal
mpretty-cyro Oct 10, 2025
4b58291
Merge pull request #568 from mikoldin123/feat/SES-4293/message_reques…
mpretty-cyro Oct 10, 2025
8be06ff
Merge pull request #576 from mikoldin123/feat/SES-3848/show_disabled_…
mpretty-cyro Oct 10, 2025
f3f0685
Merge pull request #577 from mikoldin123/fix/SES-4471/delete_emoji_re…
mpretty-cyro Oct 10, 2025
266fd66
Merge pull request #580 from mikoldin123/feat/SES-2357/show_empty_vid…
mpretty-cyro Oct 10, 2025
c40e0e8
Merge pull request #584 from mikoldin123/feat/SES-495/external_keyboa…
mpretty-cyro Oct 10, 2025
68e54cc
Merge pull request #589 from mikoldin123/fix/SES-4578/show_only_appro…
mpretty-cyro Oct 10, 2025
16815b4
Merge pull request #590 from mikoldin123/fix/SES-2855/path_shows_unkn…
mpretty-cyro Oct 10, 2025
78148ac
Merge pull request #591 from mikoldin123/fix/SES-3228/google_drive_up…
mpretty-cyro Oct 10, 2025
e4e7dc7
Merge pull request #592 from mikoldin123/fix/SES-3850/update_disabled…
mpretty-cyro Oct 10, 2025
2c8f56e
Merge pull request #593 from mikoldin123/fix/SES-3428/input_accessory…
mpretty-cyro Oct 10, 2025
450a7d4
Merge pull request #595 from mikoldin123/fix/SES-4192/missed_call_dia…
mpretty-cyro Oct 10, 2025
cc552a5
Merge pull request #601 from mpretty-cyro/fix/layout-bugs
mpretty-cyro Oct 10, 2025
27d052a
Merge pull request #607 from session-foundation/feature/update-crowdi…
mpretty-cyro Oct 10, 2025
81c6d9d
Cleaned up and finalised code changes
mpretty-cyro Oct 10, 2025
a6de09d
Added a dev setting to trigger a refund for a transaction
mpretty-cyro Oct 10, 2025
b4b300f
Merge branch 'dev' into fix/SES-4373/allow_calls_without_camera_permi…
mpretty-cyro Oct 10, 2025
94fddd3
Alternate approach for `shouldShowCameraPermissionInstructions`
mpretty-cyro Oct 10, 2025
a5a643a
Added some logs around notification and UserMetadata loading
mpretty-cyro Oct 10, 2025
63640b9
Merge pull request #608 from mpretty-cyro/feature/request-refund-dev-…
mpretty-cyro Oct 10, 2025
c46d3ce
Merge remote-tracking branch 'upstream/dev' into fix/SES-4373/allow_c…
mpretty-cyro Oct 10, 2025
c4e8fcd
Tweaked the modal buttons to have some padding and wrap
mpretty-cyro Oct 10, 2025
69c1cda
Working on fixing unit tests
mpretty-cyro Oct 10, 2025
8fb9050
Bug and unit test fixing
mpretty-cyro Oct 12, 2025
6ca079b
Fixed issues found during QA
mpretty-cyro Oct 12, 2025
b9d9e03
Some minor tweaks to ensure consistent profile update behaviour
mpretty-cyro Oct 12, 2025
d17be79
Bumped build number
mpretty-cyro Oct 12, 2025
38d2ed2
Fixed a layout issue picked up by the regression tests
mpretty-cyro Oct 13, 2025
81e824e
[Automated] Update translations from Crowdin
mpretty-cyro Oct 13, 2025
3060090
Added NL recognizer and start end markers to check string directions
mikoldin123 Oct 13, 2025
46ab808
Fixed a couple of bugs found during testing
mpretty-cyro Oct 13, 2025
963bc33
Merge pull request #611 from session-foundation/feature/update-crowdi…
mpretty-cyro Oct 13, 2025
36e8d5a
Merge pull request #565 from mikoldin123/fix/SES-4373/allow_calls_wit…
mpretty-cyro Oct 13, 2025
60a9717
Merge pull request #612 from session-foundation/dev
mpretty-cyro Oct 13, 2025
eed02ca
Merge branch 'dev' into feature/profile-pic-reupload-changes
mpretty-cyro Oct 13, 2025
baea669
Tweaks due to changes from merge
mpretty-cyro Oct 13, 2025
d63d04f
Updated icons state for camera and mute buttons
mikoldin123 Oct 14, 2025
7540a85
Cleaned up a bunch of issues found during testing
mpretty-cyro Oct 14, 2025
365d604
Fixed remaining known issues
mpretty-cyro Oct 14, 2025
6959568
Fixed unit tests, mocked out media decoding to silence errors
mpretty-cyro Oct 15, 2025
b2c5f88
Merge remote-tracking branch 'upstream/dev' into session-pro-badge
mpretty-cyro Oct 15, 2025
6e593ed
Few very minor tweaks
mpretty-cyro Oct 15, 2025
2e189a7
Revert a lib session path change
mpretty-cyro Oct 15, 2025
135c528
Format issue
mpretty-cyro Oct 15, 2025
91e2855
More CI-specific build errors -_-
mpretty-cyro Oct 15, 2025
315a89f
More CI complaints...
mpretty-cyro Oct 15, 2025
5730dbc
Fix non matching highlighted states
mikoldin123 Oct 15, 2025
a52ba37
Another tweak for the CI
mpretty-cyro Oct 15, 2025
c26ab50
Fixing CI complaints
mpretty-cyro Oct 15, 2025
3ae101f
Fixed an IP2Country crash on launch
mpretty-cyro Oct 15, 2025
2298c34
Removed duplicate import
mpretty-cyro Oct 16, 2025
1c72f31
fix: plus icon when display picture is null
Oct 16, 2025
5e827ca
fix: update icons to lucide in message info screens
Oct 16, 2025
35898b9
fix: remove pro badge in note-to-self thread settings screen
Oct 16, 2025
002799c
fix: missing pro badge at the end of strings in pro cta modal
Oct 17, 2025
6e82a5b
fix: user profile modal doesn't show "You"
Oct 17, 2025
6fbbe0e
fix: session pro badge for pro settings cell in light mode in setting…
Oct 17, 2025
ca6c352
fix: contact name bottom padding in conversation settings screen
Oct 17, 2025
7abde5a
fix: group avatar was not expandable
Oct 17, 2025
c084157
fix: close button alignment issue on quote view
Oct 17, 2025
c271431
fix: group control messages deformatted
Oct 19, 2025
5dbc58f
fix: confirmation modal save button should be disabled if there is an…
Oct 19, 2025
ec7cf93
fix: pro badge not showing in share extension
Oct 19, 2025
97b63a8
fix: Session Pro wordmark in the app heading should not be flipped in…
Oct 19, 2025
a0e1c14
fix: incorrectly showing long message pro feature in message info screen
Oct 20, 2025
5872478
fix: incorrect pro badge position for community members
Oct 20, 2025
0940dd2
fix: pro badge in quote view
Oct 20, 2025
f16107f
fix: message author UI in message info screen
Oct 20, 2025
9082120
fix: message info screen failed to send status overlaps with message …
Oct 20, 2025
edbc7b1
fix: blinded id incorrectly shown in quote view
Oct 20, 2025
364aefb
fix: qr code generation
Oct 20, 2025
29a4748
fix: light box qr code color
Oct 20, 2025
be6f840
Fixed a number of issues found during QA testing
mpretty-cyro Oct 20, 2025
c25071f
Fixed more QA issues
mpretty-cyro Oct 21, 2025
6d3b261
Fixed CI build issue and unit tests
mpretty-cyro Oct 21, 2025
827a8f3
fix: pro cta ui issues
Oct 21, 2025
531e6f5
Fixed an issue where sending videos was erroring
mpretty-cyro Oct 21, 2025
560d83e
fix: Pro badge is cut off screen with a long name
Oct 21, 2025
12dd293
fix: pro badge alignment with inline text
Oct 21, 2025
ed61e7f
feat: dev settings for pro message features
Oct 21, 2025
5457ff3
Added a `with(userProfile:)` function to handle the libSession profile
mpretty-cyro Oct 22, 2025
2c01af5
Fixed a number of QA issues
mpretty-cyro Oct 22, 2025
95b0759
fix: message status padding to message bubble in message info screen
Oct 22, 2025
4f2e990
fix: minor QA issues
Oct 24, 2025
8d8caa8
[Automated] Update translations from Crowdin
mpretty-cyro Oct 27, 2025
6896499
Replicating the current user profile into the database again
mpretty-cyro Oct 27, 2025
faae6a4
Fixed PN registration so a single group missing auth block all PNs
mpretty-cyro Oct 27, 2025
9b71171
Debugging CI errors
mpretty-cyro Oct 27, 2025
d487f09
Attempted fix for CI error
mpretty-cyro Oct 27, 2025
b1ca35c
Added a dev setting to show the group pubkey in conversation settings
mpretty-cyro Oct 27, 2025
95a44d2
Fixed a couple of issues found during testing
mpretty-cyro Oct 28, 2025
13e0bf9
Merge pull request #615 from session-foundation/feature/update-crowdi…
mpretty-cyro Oct 28, 2025
66d6b38
Merge pull request #618 from mpretty-cyro/fix/ip2country-deadlock
mpretty-cyro Oct 28, 2025
5e68ab9
Merge pull request #606 from mikoldin123/fix/SES-4662/welcome_copy_mi…
mpretty-cyro Oct 28, 2025
943eb77
Merge pull request #600 from mikoldin123/feat/SES-4509/ios_support_de…
mpretty-cyro Oct 28, 2025
8f72275
Merge pull request #614 from mikoldin123/feat/SES-4672/mute_and_camer…
mpretty-cyro Oct 28, 2025
3b2ba73
Merge pull request #621 from mpretty-cyro/fix/broken-group-breaking-a…
mpretty-cyro Oct 28, 2025
47a6cd6
Merge pull request #622 from mpretty-cyro/feature/dev-setting-to-show…
mpretty-cyro Oct 28, 2025
400fe7f
Merge remote-tracking branch 'upstream/dev' into feature/profile-pic-…
mpretty-cyro Oct 28, 2025
30eb7f2
Bumped build number
mpretty-cyro Oct 28, 2025
40fc1a3
Merge remote-tracking branch 'upstream/master' into dev
mpretty-cyro Oct 28, 2025
11efd75
Merge branch 'dev' into feature/profile-pic-reupload-changes
mpretty-cyro Oct 28, 2025
f2cc186
[Automated] Update translations from Crowdin
ThomasSession Oct 28, 2025
b0cea5d
Fixed a bug where you couldn't upload the same file multiple times
mpretty-cyro Oct 28, 2025
4755045
Merge pull request #623 from session-foundation/feature/update-crowdi…
mpretty-cyro Oct 28, 2025
4ca7a1a
Bumped build number
mpretty-cyro Oct 28, 2025
52bd474
Merge pull request #588 from mpretty-cyro/feature/profile-pic-reuploa…
mpretty-cyro Oct 28, 2025
90d13cb
Fixed a number of issues found when debugging image orientation bug
mpretty-cyro Oct 29, 2025
14bd381
Fixed more image orientation issues
mpretty-cyro Oct 30, 2025
59e4c59
Merge pull request #625 from mpretty-cyro/fix/image-orientation-issue…
mpretty-cyro Oct 30, 2025
c3c96b9
[Automated] Update translations from Crowdin
mpretty-cyro Nov 3, 2025
e5695f4
Fixed a string which has a new variable
mpretty-cyro Nov 3, 2025
6c54a54
Testing CI tweaks to reduce flaky builds
mpretty-cyro Nov 3, 2025
c4e15e6
Further CI tweaks
mpretty-cyro Nov 3, 2025
635badb
More CI tweaks
mpretty-cyro Nov 3, 2025
20e5594
Merge branch 'dev' into session-pro-badge
Nov 3, 2025
2572ed1
fix: UCS UI & Pro badge tapping issue
Nov 3, 2025
edae077
fix: message info screen tweak
Nov 3, 2025
f1fc05a
Merge branch 'fix/update-string' of https://github.com/mpretty-cyro/s…
Nov 3, 2025
d827e1d
Merge pull request #630 from mpretty-cyro/fix/update-string
mpretty-cyro Nov 4, 2025
7cb734b
fix: style tags shouldn't show in home screen message cells
Nov 6, 2025
4f85beb
Merge branch 'dev' into session-pro-badge
Nov 6, 2025
c1ebd36
fix: UPM in Message Info Screen
Nov 6, 2025
f3a4a66
clean
Nov 6, 2025
56117d0
fix: Pro badges in Session heading did not respond to dev settings ch…
Nov 6, 2025
c5942a2
fix: remove copy account id action in message info screen
Nov 6, 2025
9f3bebb
fix: Context Menu Screen for RTL
Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Scripts/build_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ if [[ "$MODE" == "test" ]]; then
xcresultparser --output-format cli --no-test-result --coverage ./build/artifacts/testResults.xcresult
parser_output=$(xcresultparser --output-format cli --no-test-result ./build/artifacts/testResults.xcresult)

build_errors_count=$(echo "$parser_output" | grep "Number of errors" | awk '{print $NF}')
failed_tests_count=$(echo "$parser_output" | grep "Number of failed tests" | awk '{print $NF}')
build_errors_count=$(echo "$parser_output" | grep "Number of errors" | awk '{print $NF}' | grep -o '[0-9]*' || echo "0")
failed_tests_count=$(echo "$parser_output" | grep "Number of failed tests" | awk '{print $NF}' | grep -o '[0-9]*' || echo "0")

if [ "${build_errors_count:-0}" -gt 0 ] || [ "${failed_tests_count:-0}" -gt 0 ]; then
echo ""
Expand Down
224 changes: 123 additions & 101 deletions Scripts/build_libSession_util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,63 @@ COMPILE_DIR="${TARGET_BUILD_DIR}/LibSessionUtil"
INDEX_DIR="${DERIVED_DATA_PATH}/Index.noindex/Build/Products/Debug-${PLATFORM_NAME}"
LAST_SUCCESSFUL_HASH_FILE="${TARGET_BUILD_DIR}/last_successful_source_tree.hash.log"
LAST_BUILT_FRAMEWORK_SLICE_DIR_FILE="${TARGET_BUILD_DIR}/last_built_framework_slice_dir.log"
BUILT_LIB_FINAL_TIMESTAMP_FILE="${TARGET_BUILD_DIR}/libsession_util_built.timestamp"

# Save original stdout and set trap for cleanup
exec 3>&1
function finish {
# Restore stdout
exec 1>&3 3>&-
# Modify the platform detection to handle archive builds
if [ "${ACTION}" = "install" ] || [ "${CONFIGURATION}" = "Release" ]; then
# Archive builds typically use 'install' action
if [ -z "$PLATFORM_NAME" ]; then
# During archive, PLATFORM_NAME might not be set correctly
# Default to device build for archives
PLATFORM_NAME="iphoneos"
echo "Missing 'PLATFORM_NAME' value, manually set to ${PLATFORM_NAME}"
fi
fi

sync_headers() {
local source_dir="$1"
echo "- Syncing headers from ${source_dir}"

local destinations=(
"${TARGET_BUILD_DIR}/include"
"${INDEX_DIR}/include"
"${BUILT_PRODUCTS_DIR}/include"
"${CONFIGURATION_BUILD_DIR}/include"
)

# For archive builds, add the archive-specific path
if [ "${ACTION}" = "install" ]; then
local ARCHIVE_PRODUCTS_PATH="${BUILD_DIR}/../../BuildProductsPath/${CONFIGURATION}-${PLATFORM_NAME}/include"
destinations+=("${ARCHIVE_PRODUCTS_PATH}")
fi

for dest in "${destinations[@]}"; do
if [ -n "$dest" ]; then
local temp_dest="${dest}.tmp-$(uuidgen)"
rm -rf "$temp_dest"
mkdir -p "$temp_dest"

rsync -rtc --delete --exclude='.DS_Store' "${source_dir}/" "$temp_dest/"

# Atomically move the old directory out of the way
local old_dest="${dest}.old-$(uuidgen)"
if [ -d "$dest" ]; then
mv "$dest" "$old_dest"
fi

# Atomically move the new, correct directory into place
mv "$temp_dest" "$dest"

# Clean up the old directory
if [ -d "$old_dest" ]; then
# Clear any immutable flags (work around Xcode's indexer file locking)
chflags -R nouchg "${dir_to_remove}" &>/dev/null || true
rm -rf "$old_dest"
fi

echo " Synced to: $dest"
fi
done
}
trap finish EXIT ERR SIGINT SIGTERM

# Determine whether we want to build from source
TARGET_ARCH_DIR=""
Expand All @@ -35,11 +83,21 @@ else
fi

if [ "${COMPILE_LIB_SESSION}" != "YES" ]; then
echo "Restoring original headers to Xcode Indexer cache from backup..."
rm -rf "${INDEX_DIR}/include"
rsync -rt --exclude='.DS_Store' "${PRE_BUILT_FRAMEWORK_DIR}/${FRAMEWORK_DIR}/${TARGET_ARCH_DIR}/Headers/" "${INDEX_DIR}/include"

echo "Using pre-packaged SessionUtil"

if [ "$CI" = "true" ] || [ "$DRONE" = "true" ]; then
# In CI, Xcode's SPM integration is reliable. Skip manual header sync
# to avoid the 'redefinition of module' error.
echo "- CI environment detected, skipping manual header sync to rely on SPM"
else
echo "- Local build detected, syncing headers to assist Xcode indexer"
sync_headers "${PRE_BUILT_FRAMEWORK_DIR}/${FRAMEWORK_DIR}/${TARGET_ARCH_DIR}/Headers/"
fi

# Create the placeholder in the FINAL products directory to satisfy dependency
touch "${BUILT_PRODUCTS_DIR}/libsession-util.a"

echo "- Revert to SPM complete."
exit 0
fi

Expand Down Expand Up @@ -83,20 +141,22 @@ fi
echo "- Checking if libSession changed..."
REQUIRES_BUILD=0

# Generate a hash to determine whether any source files have changed
SOURCE_HASH=$(find "${LIB_SESSION_SOURCE_DIR}/src" -type f -not -name '.DS_Store' -exec md5 {} + | awk '{print $NF}' | sort | md5 | awk '{print $NF}')
HEADER_HASH=$(find "${LIB_SESSION_SOURCE_DIR}/include" -type f -not -name '.DS_Store' -exec md5 {} + | awk '{print $NF}' | sort | md5 | awk '{print $NF}')
EXTERNAL_HASH=$(find "${LIB_SESSION_SOURCE_DIR}/external" -type f -not -name '.DS_Store' -exec md5 {} + | awk '{print $NF}' | sort | md5 | awk '{print $NF}')
MAKE_LISTS_HASH=$(md5 -q "${LIB_SESSION_SOURCE_DIR}/CMakeLists.txt")
STATIC_BUNDLE_HASH=$(md5 -q "${LIB_SESSION_SOURCE_DIR}/utils/static-bundle.sh")

CURRENT_SOURCE_TREE_HASH=$( (
echo "${SOURCE_HASH}"
echo "${HEADER_HASH}"
echo "${EXTERNAL_HASH}"
echo "${MAKE_LISTS_HASH}"
echo "${STATIC_BUNDLE_HASH}"
) | sort | md5 -q)
# Generate a hash to determine whether any source files have changed (by using git we automatically
# respect .gitignore)
CURRENT_SOURCE_TREE_HASH=$( \
( \
cd "${LIB_SESSION_SOURCE_DIR}" && git ls-files --recurse-submodules \
) \
| grep -vE '/(tests?|docs?|examples?)/|\.md$|/(\.DS_Store|\.gitignore)$' \
| sort \
| tr '\n' '\0' \
| ( \
cd "${LIB_SESSION_SOURCE_DIR}" && xargs -0 md5 -r \
) \
| awk '{print $1}' \
| sort \
| md5 -q \
)

PREVIOUS_BUILT_FRAMEWORK_SLICE_DIR=""
if [ -f "$LAST_BUILT_FRAMEWORK_SLICE_DIR_FILE" ]; then
Expand Down Expand Up @@ -131,10 +191,6 @@ if [ "${REQUIRES_BUILD}" == 1 ]; then
VALID_SIM_ARCH_PLATFORMS=(SIMULATORARM64 SIMULATOR64)
VALID_DEVICE_ARCH_PLATFORMS=(OS64)

OUTPUT_DIR="${TARGET_BUILD_DIR}"
IPHONEOS_DEPLOYMENT_TARGET=${IPHONEOS_DEPLOYMENT_TARGET}
ENABLE_BITCODE=${ENABLE_BITCODE}

# Generate the target architectures we want to build for
TARGET_ARCHS=()
TARGET_PLATFORMS=()
Expand Down Expand Up @@ -204,69 +260,31 @@ if [ "${REQUIRES_BUILD}" == 1 ]; then
log_file="${COMPILE_DIR}/libsession_util_output.log"
echo "- Building ${TARGET_ARCHS[$i]} for $platform in $build"

# Redirect the build output to a log file and only include the progress lines in the XCode output
exec > >(tee "$log_file" | grep --line-buffered '^\[.*%\]') 2>&1

cd "${LIB_SESSION_SOURCE_DIR}"
env -i PATH="$PATH" SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" \
./utils/static-bundle.sh "$build" "" \
-DCMAKE_TOOLCHAIN_FILE="${LIB_SESSION_SOURCE_DIR}/external/ios-cmake/ios.toolchain.cmake" \
-DPLATFORM=$platform \
-DDEPLOYMENT_TARGET=$IPHONEOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DBUILD_TESTS=OFF \
-DBUILD_STATIC_DEPS=ON \
-DENABLE_VISIBILITY=ON \
-DSUBMODULE_CHECK=$submodule_check \
-DCMAKE_BUILD_TYPE=$build_type \
-DLOCAL_MIRROR=https://oxen.rocks/deps
{
env -i PATH="$PATH" SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" \
./utils/static-bundle.sh "$build" "" \
-DCMAKE_TOOLCHAIN_FILE="${LIB_SESSION_SOURCE_DIR}/external/ios-cmake/ios.toolchain.cmake" \
-DPLATFORM=$platform \
-DDEPLOYMENT_TARGET=$IPHONEOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DBUILD_TESTS=OFF \
-DBUILD_STATIC_DEPS=ON \
-DENABLE_VISIBILITY=ON \
-DSUBMODULE_CHECK=$submodule_check \
-DCMAKE_BUILD_TYPE=$build_type \
-DLOCAL_MIRROR=https://oxen.rocks/deps
} 2>&1 | tee "$log_file" | grep --line-buffered -E '^\[.*%\]|:[0-9]+:[0-9]+: error:|^make.*\*\*\*|^error:|^CMake Error'

# Capture the exit status of the ./utils/static-bundle.sh command
EXIT_STATUS=$?

# Flush the tee buffer (ensure any errors have been properly written to the log before continuing) and
# restore stdout
echo ""
exec 1>&3

# Retrieve and log any submodule errors/warnings
ALL_CMAKE_ERROR_LINES=($(grep -nE "CMake Error" "$log_file" | cut -d ":" -f 1))
ALL_SUBMODULE_ISSUE_LINES=($(grep -nE "\s*Submodule '([^']+)' is not up-to-date" "$log_file" | cut -d ":" -f 1))
ALL_CMAKE_ERROR_LINES_STR=" ${ALL_CMAKE_ERROR_LINES[*]} "
ALL_SUBMODULE_ISSUE_LINES_STR=" ${ALL_SUBMODULE_ISSUE_LINES[*]} "

for i in "${!ALL_SUBMODULE_ISSUE_LINES[@]}"; do
line="${ALL_SUBMODULE_ISSUE_LINES[$i]}"
prev_line=$((line - 1))
value=$(sed "${line}q;d" "$log_file" | sed -E "s/.*Submodule '([^']+)'.*/Submodule '\1' is not up-to-date./")

if [[ "$ALL_CMAKE_ERROR_LINES_STR" == *" $prev_line "* ]]; then
echo "error: $value"
else
echo "warning: $value"
fi
done

EXIT_STATUS=${PIPESTATUS[0]}

if [ $EXIT_STATUS -ne 0 ]; then
ALL_ERROR_LINES=($(grep -n "error:" "$log_file" | cut -d ":" -f 1))

# Log any other errors
for e in "${!ALL_ERROR_LINES[@]}"; do
error_line="${ALL_ERROR_LINES[$e]}"
error=$(sed "${error_line}q;d" "$log_file")

# If it was a CMake Error then the actual error will be on the next line so we want to append that info
if [[ $error == *'CMake Error'* ]]; then
actual_error_line=$((error_line + 1))
error="${error}$(sed "${actual_error_line}q;d" "$log_file")"
fi

# Exclude the 'ALL_ERROR_LINES' line and the 'grep' line
if [[ ! $error == *'grep -n "error'* ]] && [[ ! $error == *'grep -n error'* ]]; then
echo "error: $error"
fi
# Extract and display CMake/make errors from the log in Xcode error format
grep -E '^CMake Error' "$log_file" | sort -u | while IFS= read -r line; do
echo "error: $line"
done

# If the build failed we still want to copy files across because it'll help errors appear correctly
echo "- Replacing build dir files"

Expand All @@ -276,9 +294,14 @@ if [ "${REQUIRES_BUILD}" == 1 ]; then
rm -rf "${INDEX_DIR}/include"

# Rsync the compiled ones (maintaining timestamps)
rsync -rt "${COMPILE_DIR}/libsession-util.a" "${TARGET_BUILD_DIR}/libsession-util.a"
rsync -rt --exclude='.DS_Store' "${COMPILE_DIR}/Headers/" "${TARGET_BUILD_DIR}/include"
rsync -rt --exclude='.DS_Store' "${COMPILE_DIR}/Headers/" "${INDEX_DIR}/include"
if [ -f "${COMPILE_DIR}/libsession-util.a" ]; then
rsync -rt "${COMPILE_DIR}/libsession-util.a" "${TARGET_BUILD_DIR}/libsession-util.a"
fi

if [ -d "${COMPILE_DIR}/Headers" ]; then
sync_headers "${COMPILE_DIR}/Headers/"
fi

exit 1
fi
done
Expand Down Expand Up @@ -309,24 +332,23 @@ if [ "${REQUIRES_BUILD}" == 1 ]; then
echo "${TARGET_ARCH_DIR}" > "${LAST_BUILT_FRAMEWORK_SLICE_DIR_FILE}"
echo "${CURRENT_SOURCE_TREE_HASH}" > "${LAST_SUCCESSFUL_HASH_FILE}"

echo "- Touching timestamp file to signal update to Xcode"
touch "${BUILT_LIB_FINAL_TIMESTAMP_FILE}"
cp "${BUILT_LIB_FINAL_TIMESTAMP_FILE}" "${SPM_TIMESTAMP_FILE}"

echo "- Build complete"
fi

echo "- Replacing build dir files"

# Remove the current files (might be "newer")
rm -rf "${TARGET_BUILD_DIR}/libsession-util.a"
rm -rf "${TARGET_BUILD_DIR}/include"
rm -rf "${INDEX_DIR}/include"

# Rsync the compiled ones (maintaining timestamps)
rm -rf "${TARGET_BUILD_DIR}/libsession-util.a"
rsync -rt "${COMPILE_DIR}/libsession-util.a" "${TARGET_BUILD_DIR}/libsession-util.a"
rsync -rt --exclude='.DS_Store' "${COMPILE_DIR}/Headers/" "${TARGET_BUILD_DIR}/include"
rsync -rt --exclude='.DS_Store' "${COMPILE_DIR}/Headers/" "${INDEX_DIR}/include"

if [ "${TARGET_BUILD_DIR}" != "${BUILT_PRODUCTS_DIR}" ]; then
echo "- TARGET_BUILD_DIR and BUILT_PRODUCTS_DIR are different. Copying library."
rm -f "${BUILT_PRODUCTS_DIR}/libsession-util.a"
rsync -rt "${COMPILE_DIR}/libsession-util.a" "${BUILT_PRODUCTS_DIR}/libsession-util.a"
fi

sync_headers "${COMPILE_DIR}/Headers/"
echo "- Sync complete."

# Output to XCode just so the output is good
echo "LibSession is Ready"
Loading