Skip to content

Remove database usage from push notification extension #452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 87 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
80eb4fe
Cached seckey, cleaned up crypto usage
mpretty-cyro Apr 30, 2025
dccc734
Merge pull request #442 from mpretty-cyro/feature/dbr1-cache-seckey
mpretty-cyro May 13, 2025
e42dda7
Refactored the message deduplication logic
mpretty-cyro May 2, 2025
b7672a3
Added unit tests for the logic in MessageDeduplication
mpretty-cyro May 4, 2025
e246b5c
Fixed build issue
mpretty-cyro May 13, 2025
19f2d43
Merge pull request #443 from mpretty-cyro/feature/dbr2-clean-message-…
mpretty-cyro May 14, 2025
f6d6f13
Cached seckey, cleaned up crypto usage
mpretty-cyro Apr 30, 2025
08f40c4
Updated logic to handle VisibleMessage and CallMessage without db
mpretty-cyro May 7, 2025
9464e82
Fixed a build issue
mpretty-cyro May 7, 2025
cade236
Fixed a db query issue and added some todos
mpretty-cyro May 8, 2025
56ae735
Fixed broken unit tests, moved some functions around for mocking
mpretty-cyro May 8, 2025
53c7471
Added additional unit tests
mpretty-cyro May 8, 2025
1e45389
Fixed some rebase issues
mpretty-cyro May 14, 2025
f555ad9
Merge pull request #446 from mpretty-cyro/feature/dbr3-handlevisible-…
mpretty-cyro May 18, 2025
cab862e
Refactored the message deduplication logic
mpretty-cyro May 2, 2025
6774cd0
Updated logic to handle VisibleMessage and CallMessage without db
mpretty-cyro May 7, 2025
e2d7f9a
Fixed broken unit tests, moved some functions around for mocking
mpretty-cyro May 8, 2025
908a447
Write message data to disk
mpretty-cyro May 9, 2025
4ae4726
Fixed a bug where we could be incorrectly stripping numbers from mess…
mpretty-cyro May 11, 2025
0daffb1
Finished off work for this batch of changes
mpretty-cyro May 12, 2025
ce0b65c
Fixed a rebase issue
mpretty-cyro May 19, 2025
ebfc7d1
Merge pull request #450 from mpretty-cyro/feature/dbr4-configs-and-sa…
mpretty-cyro May 29, 2025
d67a58e
Merge branch 'session-network-page' into feature/database-relocation
mpretty-cyro May 30, 2025
a93365f
Fixed build issues from the merge
mpretty-cyro May 30, 2025
665fce1
Cached seckey, cleaned up crypto usage
mpretty-cyro Apr 30, 2025
caf9de8
Refactored the message deduplication logic
mpretty-cyro May 2, 2025
f6b093e
Updated logic to handle VisibleMessage and CallMessage without db
mpretty-cyro May 7, 2025
6ad0193
Added config message PN handling, fixed a bug with groups
mpretty-cyro May 12, 2025
a7a32ba
Handle config and group control message PNs, start sending pipeline t…
mpretty-cyro May 13, 2025
70d297b
Fixed issues from rebasing
mpretty-cyro May 30, 2025
641bb39
Merge pull request #451 from mpretty-cyro/feature/dbr5-config-message…
mpretty-cyro Jun 2, 2025
e47fbd6
Cached seckey, cleaned up crypto usage
mpretty-cyro Apr 30, 2025
b0ce202
Refactored the message deduplication logic
mpretty-cyro May 2, 2025
45ba3b3
Updated logic to handle VisibleMessage and CallMessage without db
mpretty-cyro May 7, 2025
e2328c6
Removed negative namespace PN workaround, fixed a BencodeDecoder bug
mpretty-cyro May 14, 2025
bb57df7
Fixed broken onboarding
mpretty-cyro May 15, 2025
388d46f
Fixed call deduping and unread counts
mpretty-cyro May 15, 2025
eddffae
Refactored a number of processes to no longer require database access
mpretty-cyro May 19, 2025
63f8c06
Added unit tests for new call dedupe logic
mpretty-cyro May 19, 2025
b4cde8e
Fixed a few issues from the rebase and minor SessionNetworkAPI tweaks
mpretty-cyro Jun 2, 2025
d10f0df
Merge pull request #455 from mpretty-cyro/feature/dbr6-handle-call-busy
mpretty-cyro Jun 10, 2025
18a35f1
Refactored the message deduplication logic
mpretty-cyro May 2, 2025
9cf5054
Added config message PN handling, fixed a bug with groups
mpretty-cyro May 12, 2025
307c688
Handle config and group control message PNs, start sending pipeline t…
mpretty-cyro May 13, 2025
5863beb
Updated code to use libSession for storing app settings
mpretty-cyro May 22, 2025
2edc0f0
Fixed a few bugs found during testing
mpretty-cyro May 23, 2025
ce2c298
Updated code to use new local config, fixed unit tests, general testing
mpretty-cyro May 28, 2025
35816ad
Started adding unit tests for the NotificationsManagerType
mpretty-cyro May 28, 2025
37dd05d
Finished adding unit tests for the NotificationsManagerType
mpretty-cyro May 29, 2025
c5f5aca
Replaced dev setting to copy db path with Documents and AppGroup paths
mpretty-cyro May 29, 2025
bec0487
Update libSession ios sound functions
mpretty-cyro Jun 10, 2025
171bffe
Fixed issues from rebase
mpretty-cyro Jun 11, 2025
736feb6
Fixed up tests and a TODO
mpretty-cyro Jun 11, 2025
63a8f8e
Updated to libSession 1.5.0
mpretty-cyro Jun 11, 2025
d858b9b
Fixed a couple of issues found during testing
mpretty-cyro Jun 11, 2025
71feefa
Made a couple of tweaks to Voip call handling
mpretty-cyro Jun 11, 2025
b556c8e
Merge remote-tracking branch 'upstream/dev' into feature/dbr7-libsess…
mpretty-cyro Jun 11, 2025
78c3283
Fixed some broken tests
mpretty-cyro Jun 12, 2025
98e2ecd
Merge remote-tracking branch 'upstream/dev' into feature/database-rel…
mpretty-cyro Jun 12, 2025
38dd115
Merge branch 'feature/database-relocation' into feature/dbr7-libsessi…
mpretty-cyro Jun 12, 2025
a6e4eb3
Fixes for build errors/warnings
mpretty-cyro Jun 12, 2025
e36dbca
Tweak to help compiler ambiguity issue on the CI
mpretty-cyro Jun 12, 2025
49d7e7d
Remove more tuple labels due to CI issues
mpretty-cyro Jun 12, 2025
93f15a8
Merge pull request #464 from mpretty-cyro/feature/dbr7-libsession-set…
mpretty-cyro Jun 13, 2025
2d31d86
Merge remote-tracking branch 'upstream/dev' into feature/database-rel…
mpretty-cyro Jun 13, 2025
8862282
Updated build & version numbers, fixed a build script issue
mpretty-cyro Jun 17, 2025
8c64afd
Clear GRDB memory and checkpoint on suspend
mpretty-cyro Jun 19, 2025
b432753
Changed some synchronous db queries, minor UI fixes
mpretty-cyro Jun 19, 2025
e386004
Added a new "ObservableDatabase" to track observable changes and use …
mpretty-cyro Jun 20, 2025
1af2f75
Refactored attachment handling and small bug fixes
mpretty-cyro Jun 23, 2025
948f797
Fixed an issue where sync messages weren't getting sent
mpretty-cyro Jun 23, 2025
5111758
Removed logic to clean up old config hashes outside of config pushes
mpretty-cyro Jun 23, 2025
2c47f27
Fixed an issue where the typing indicator animation could appear on o…
mpretty-cyro Jun 23, 2025
b4d85b0
Fixed a number of issues found when testing
mpretty-cyro Jun 25, 2025
619370e
Attempt to fix a crash accessing the nav stack too early
mpretty-cyro Jun 25, 2025
c273cfe
Fixed unit tests, tweaks to Task usage
mpretty-cyro Jun 26, 2025
9a15d7d
Fixed a couple of theming issues with group & community creation
mpretty-cyro Jun 26, 2025
30f3948
Fixed a number of deadlock and observation bugs
mpretty-cyro Jun 26, 2025
0190480
Merge remote-tracking branch 'RyanFork/updated-convo-settings' into f…
mpretty-cyro Jun 26, 2025
98f00db
Merge remote-tracking branch 'RyanFork/updated-convo-settings' into f…
mpretty-cyro Jun 26, 2025
9a60d53
Minor tweaks to remove synchronous database calls
mpretty-cyro Jun 26, 2025
20351bc
Fixed a silly typo
mpretty-cyro Jun 26, 2025
db36dce
Updated code to support synced notification settings
mpretty-cyro Jun 27, 2025
8e1695c
Finalised approach for notification settings
mpretty-cyro Jun 27, 2025
57511b5
Merge remote-tracking branch 'upstream/dev' into feature/database-rel…
mpretty-cyro Jun 27, 2025
6b91497
Updated build and version numbers
mpretty-cyro Jun 27, 2025
0ec5f97
Fixed issues found during QA
mpretty-cyro Jul 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
278 changes: 117 additions & 161 deletions Scripts/build_libSession_util.sh

Large diffs are not rendered by default.

497 changes: 245 additions & 252 deletions Session.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Session/Calls/Call Management/SessionCall.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public final class SessionCall: CurrentCallProtocol, WebRTCSessionDelegate {

// MARK: - Actions

public func startSessionCall(_ db: Database) {
public func startSessionCall(_ db: ObservingDatabase) {
let sessionId: String = self.sessionId
let messageInfo: CallMessage.MessageInfo = CallMessage.MessageInfo(state: .outgoing)

Expand Down Expand Up @@ -245,10 +245,10 @@ public final class SessionCall: CurrentCallProtocol, WebRTCSessionDelegate {

try? webRTCSession
.sendPreOffer(
db,
message: message,
threadId: thread.id,
interactionId: interaction?.id,
in: thread
authMethod: try Authentication.with(db, swarmPublicKey: thread.id, using: dependencies)
)
.retry(5)
// Start the timeout timer for the call
Expand Down
6 changes: 3 additions & 3 deletions Session/Calls/CallVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,10 @@ final class CallVC: UIViewController, VideoPreviewDelegate, AVRoutePickerViewDel
try Profile.fetchOne(db, id: call.sessionId)
}

switch profile?.profilePictureFileName {
case .some(let fileName): profilePictureView.loadImage(from: fileName)
switch profile?.displayPictureUrl.map({ try? dependencies[singleton: .displayPictureManager].path(for: $0) }) {
case .some(let filePath): profilePictureView.loadImage(from: filePath)
case .none:
profilePictureView.image = PlaceholderIcon.generate(
profilePictureView.loadPlaceholder(
seed: call.sessionId,
text: call.contactName,
size: 300
Expand Down
2 changes: 1 addition & 1 deletion Session/Calls/Views & Modals/IncomingCallBanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ final class IncomingCallBanner: UIView, UIGestureRecognizerDelegate {
profilePictureView.update(
publicKey: call.sessionId,
threadVariant: .contact,
displayPictureFilename: nil,
displayPictureUrl: nil,
profile: dependencies[singleton: .storage].read { [sessionId = call.sessionId] db in
Profile.fetchOrCreate(db, id: sessionId)
},
Expand Down
2 changes: 1 addition & 1 deletion Session/Calls/WebRTC/WebRTCSession+MessageHandling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension WebRTCSession {
}

public func handleRemoteSDP(_ sdp: RTCSessionDescription, from sessionId: String) {
Log.info(.calls, "Received remote SDP: \(sdp.sdp).")
Log.debug(.calls, "Received remote SDP: \(sdp.sdp).")

peerConnection?.setRemoteDescription(sdp, completionHandler: { [weak self] error in
if let error = error {
Expand Down
224 changes: 115 additions & 109 deletions Session/Calls/WebRTC/WebRTCSession.swift

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions Session/Closed Groups/EditGroupViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,18 @@ class EditGroupViewModel: SessionTableViewModel, NavigatableStateHolder, Editabl

var profileFront: Profile?
var profileBack: Profile?
let hasDownloadedDisplayPicture: Bool = {
guard
let displayPictureUrl: String = group.displayPictureUrl,
let path: String = try? dependencies[singleton: .displayPictureManager]
.path(for: displayPictureUrl),
dependencies[singleton: .fileManager].fileExists(atPath: path)
else { return false }

return true
}()

if group.displayPictureFilename == nil {
if !hasDownloadedDisplayPicture {
let frontProfileId: String? = try GroupMember
.filter(GroupMember.Columns.groupId == threadId)
.filter(GroupMember.Columns.role == GroupMember.Role.standard)
Expand Down Expand Up @@ -192,7 +202,7 @@ class EditGroupViewModel: SessionTableViewModel, NavigatableStateHolder, Editabl
id: threadId,
size: .hero,
threadVariant: (isUpdatedGroup ? .group : .legacyGroup),
displayPictureFilename: state.group.displayPictureFilename,
displayPictureUrl: state.group.displayPictureUrl,
profile: state.profile,
profileIcon: .none,
additionalProfile: state.additionalProfile,
Expand Down
12 changes: 6 additions & 6 deletions Session/Closed Groups/NewClosedGroupVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ final class NewClosedGroupVC: BaseVC, UITableViewDataSource, UITableViewDelegate
private lazy var fadeView: GradientView = {
let result: GradientView = GradientView()
result.themeBackgroundGradient = [
.value(.newConversation_background, alpha: 0), // Want this to take up 20% (~25pt)
.newConversation_background,
.newConversation_background,
.newConversation_background,
.newConversation_background
.value(.backgroundSecondary, alpha: 0), // Want this to take up 20% (~25pt)
.backgroundSecondary,
.backgroundSecondary,
.backgroundSecondary,
.backgroundSecondary
]
result.set(.height, to: Values.footerGradientHeight(window: UIApplication.shared.keyWindow))

Expand All @@ -202,7 +202,7 @@ final class NewClosedGroupVC: BaseVC, UITableViewDataSource, UITableViewDelegate
override func viewDidLoad() {
super.viewDidLoad()

view.themeBackgroundColor = .newConversation_background
view.themeBackgroundColor = .backgroundSecondary

let customTitleFontSize = Values.largeFontSize
setNavBarTitle("groupCreate".localized(), customFontSize: customTitleFontSize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ extension ContextMenuVC {
dependencies[singleton: .openGroupManager].isUserModeratorOrAdmin(
publicKey: threadViewModel.currentUserSessionId,
for: threadViewModel.openGroupRoomToken,
on: threadViewModel.openGroupServer
on: threadViewModel.openGroupServer,
currentUserSessionIds: (threadViewModel.currentUserSessionIds ?? [])
)
)
let shouldShowEmojiActions: Bool = {
Expand Down
Loading