Skip to content

refactor: Convert MPPersistenceController to Obj C#529

Merged
BrandonStalnaker merged 5 commits intoworkstation/9.0-Releasefrom
refactor/SDKE-721/Convert-MPPersistenceController
Feb 2, 2026
Merged

refactor: Convert MPPersistenceController to Obj C#529
BrandonStalnaker merged 5 commits intoworkstation/9.0-Releasefrom
refactor/SDKE-721/Convert-MPPersistenceController

Conversation

@BrandonStalnaker
Copy link
Collaborator

Background

  • The MPPersistenceController was implemented as an Objective-C++ file (.mm) which required the C++ standard library ( and ) for SQL statement handling and collection management
  • Objective-C++ files have slower compilation times and add complexity to the build process
  • The C++ features used were limited to basic string operations and vectors that can be easily replaced with Foundation equivalents (NSString, NSMutableArray)
  • This change is necessary for us to switch to source based distribution for SPM

What Has Changed

  • Converted MPPersistenceController.mm to pure Objective-C (MPPersistenceController.m)
    • Replaced std::string with NSString * and const char * for SQL statements
    • Replaced std::vector with NSMutableArray * for collecting query results
    • Replaced C++ string concatenation with NSMutableString and appendFormat:
    • Replaced std::to_string() with [NSString stringWithFormat:]
    • Replaced range-based for loops with Objective-C for-in enumeration
    • Removed using namespace std; and C++ headers
  • Renamed MPPersistenceControllerTests.mm to MPPersistenceControllerTests.m (no C++ features were used in the test file)
  • Updated project.pbxproj to reference the new .m files with correct lastKnownFileType
  • Added additional unit tests for:
    • Breadcrumb save and pruning operations
    • Session archiving and duplicate detection
    • Database open/close operations
    • App and device info retrieval
    • Delete all sessions except specified session
    • Session update operations
    • Max bytes per event/batch calculations

Checklist

  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have tested this locally.

Reference Issue (For employees only. Ignore if you are an outside contributor)

@BrandonStalnaker BrandonStalnaker self-assigned this Jan 28, 2026
@BrandonStalnaker BrandonStalnaker requested a review from a team as a code owner January 28, 2026 21:09
@github-actions
Copy link

github-actions bot commented Jan 28, 2026

📦 SDK Size Impact Report

Measures how much the SDK adds to an app's size (with-SDK minus without-SDK).

Metric Target Branch This PR Change
App Bundle Impact 1.65 MB 1.61 MB -44 KB
Executable Impact 896 bytes 896 bytes +N/A
XCFramework Size 7.64 MB 7.08 MB -572 KB

➡️ SDK size impact change is minimal.

Raw measurements

Target branch (workstation/9.0-Release):

{"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1772,"with_sdk_executable_size_bytes":76360,"sdk_impact_kb":1688,"sdk_executable_impact_bytes":896,"xcframework_size_kb":7824}

This PR:

{"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1728,"with_sdk_executable_size_bytes":76360,"sdk_impact_kb":1644,"sdk_executable_impact_bytes":896,"xcframework_size_kb":7252}

jamesnrokt
jamesnrokt previously approved these changes Jan 29, 2026
@BrandonStalnaker BrandonStalnaker merged commit 7ad89ed into workstation/9.0-Release Feb 2, 2026
12 of 13 checks passed
@BrandonStalnaker BrandonStalnaker deleted the refactor/SDKE-721/Convert-MPPersistenceController branch February 2, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants