Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Commit 06a3886

Browse files
authored
Merge pull request #786 from oxen-io/dev
Release 2.2.7
2 parents a53366d + 2f8ac7d commit 06a3886

7 files changed

Lines changed: 55 additions & 41 deletions

File tree

Session.xcodeproj/project.pbxproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6032,7 +6032,7 @@
60326032
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
60336033
CODE_SIGN_STYLE = Automatic;
60346034
COPY_PHASE_STRIP = NO;
6035-
CURRENT_PROJECT_VERSION = 391;
6035+
CURRENT_PROJECT_VERSION = 392;
60366036
DEBUG_INFORMATION_FORMAT = dwarf;
60376037
DEVELOPMENT_TEAM = SUQ8J2PCT7;
60386038
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@@ -6057,7 +6057,7 @@
60576057
"@executable_path/Frameworks",
60586058
"@executable_path/../../Frameworks",
60596059
);
6060-
MARKETING_VERSION = 2.2.6;
6060+
MARKETING_VERSION = 2.2.7;
60616061
MTL_ENABLE_DEBUG_INFO = YES;
60626062
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
60636063
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -6105,7 +6105,7 @@
61056105
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
61066106
CODE_SIGN_STYLE = Automatic;
61076107
COPY_PHASE_STRIP = NO;
6108-
CURRENT_PROJECT_VERSION = 391;
6108+
CURRENT_PROJECT_VERSION = 392;
61096109
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
61106110
DEVELOPMENT_TEAM = SUQ8J2PCT7;
61116111
ENABLE_NS_ASSERTIONS = NO;
@@ -6135,7 +6135,7 @@
61356135
"@executable_path/Frameworks",
61366136
"@executable_path/../../Frameworks",
61376137
);
6138-
MARKETING_VERSION = 2.2.6;
6138+
MARKETING_VERSION = 2.2.7;
61396139
MTL_ENABLE_DEBUG_INFO = NO;
61406140
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
61416141
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -6171,7 +6171,7 @@
61716171
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
61726172
CODE_SIGN_STYLE = Automatic;
61736173
COPY_PHASE_STRIP = NO;
6174-
CURRENT_PROJECT_VERSION = 391;
6174+
CURRENT_PROJECT_VERSION = 392;
61756175
DEBUG_INFORMATION_FORMAT = dwarf;
61766176
DEVELOPMENT_TEAM = SUQ8J2PCT7;
61776177
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@@ -6194,7 +6194,7 @@
61946194
"@executable_path/Frameworks",
61956195
"@executable_path/../../Frameworks",
61966196
);
6197-
MARKETING_VERSION = 2.2.6;
6197+
MARKETING_VERSION = 2.2.7;
61986198
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
61996199
MTL_FAST_MATH = YES;
62006200
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
@@ -6245,7 +6245,7 @@
62456245
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
62466246
CODE_SIGN_STYLE = Automatic;
62476247
COPY_PHASE_STRIP = NO;
6248-
CURRENT_PROJECT_VERSION = 391;
6248+
CURRENT_PROJECT_VERSION = 392;
62496249
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
62506250
DEVELOPMENT_TEAM = SUQ8J2PCT7;
62516251
ENABLE_NS_ASSERTIONS = NO;
@@ -6273,7 +6273,7 @@
62736273
"@executable_path/Frameworks",
62746274
"@executable_path/../../Frameworks",
62756275
);
6276-
MARKETING_VERSION = 2.2.6;
6276+
MARKETING_VERSION = 2.2.7;
62776277
MTL_ENABLE_DEBUG_INFO = NO;
62786278
MTL_FAST_MATH = YES;
62796279
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
@@ -7173,7 +7173,7 @@
71737173
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
71747174
CODE_SIGN_IDENTITY = "iPhone Developer";
71757175
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
7176-
CURRENT_PROJECT_VERSION = 391;
7176+
CURRENT_PROJECT_VERSION = 392;
71777177
DEVELOPMENT_TEAM = SUQ8J2PCT7;
71787178
FRAMEWORK_SEARCH_PATHS = (
71797179
"$(inherited)",
@@ -7212,7 +7212,7 @@
72127212
"$(SRCROOT)",
72137213
);
72147214
LLVM_LTO = NO;
7215-
MARKETING_VERSION = 2.2.6;
7215+
MARKETING_VERSION = 2.2.7;
72167216
OTHER_LDFLAGS = "$(inherited)";
72177217
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
72187218
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
@@ -7245,7 +7245,7 @@
72457245
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
72467246
CODE_SIGN_IDENTITY = "iPhone Developer";
72477247
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
7248-
CURRENT_PROJECT_VERSION = 391;
7248+
CURRENT_PROJECT_VERSION = 392;
72497249
DEVELOPMENT_TEAM = SUQ8J2PCT7;
72507250
FRAMEWORK_SEARCH_PATHS = (
72517251
"$(inherited)",
@@ -7284,7 +7284,7 @@
72847284
"$(SRCROOT)",
72857285
);
72867286
LLVM_LTO = NO;
7287-
MARKETING_VERSION = 2.2.6;
7287+
MARKETING_VERSION = 2.2.7;
72887288
OTHER_LDFLAGS = "$(inherited)";
72897289
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
72907290
PRODUCT_NAME = Session;

Session/Conversations/Context Menu/ContextMenuVC+Action.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ extension ContextMenuVC {
111111
for cellViewModel: MessageViewModel,
112112
recentEmojis: [EmojiWithSkinTones],
113113
currentUserPublicKey: String,
114+
currentUserBlindedPublicKey: String?,
114115
currentUserIsOpenGroupModerator: Bool,
115116
currentThreadIsMessageRequest: Bool,
116117
delegate: ContextMenuActionDelegate?
@@ -165,6 +166,7 @@ extension ContextMenuVC {
165166
cellViewModel.threadVariant != .openGroup ||
166167
currentUserIsOpenGroupModerator ||
167168
cellViewModel.authorId == currentUserPublicKey ||
169+
cellViewModel.authorId == currentUserBlindedPublicKey ||
168170
cellViewModel.state == .failed
169171
)
170172
let canBan: Bool = (

Session/Conversations/ConversationVC+Interaction.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ extension ConversationVC:
778778
for: cellViewModel,
779779
recentEmojis: (self.viewModel.threadData.recentReactionEmoji ?? []).compactMap { EmojiWithSkinTones(rawValue: $0) },
780780
currentUserPublicKey: self.viewModel.threadData.currentUserPublicKey,
781+
currentUserBlindedPublicKey: self.viewModel.threadData.currentUserBlindedPublicKey,
781782
currentUserIsOpenGroupModerator: OpenGroupManager.isUserModeratorOrAdmin(
782783
self.viewModel.threadData.currentUserPublicKey,
783784
for: self.viewModel.threadData.openGroupRoomToken,

Session/Conversations/ConversationViewModel.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public class ConversationViewModel: OWSAudioPlayerDelegate {
115115
}
116116
)
117117
)
118+
.populatingCurrentUserBlindedKey()
118119

119120
/// This is all the data the screen needs to populate itself, please see the following link for tips to help optimise
120121
/// performance https://github.com/groue/GRDB.swift#valueobservation-performance
@@ -130,7 +131,7 @@ public class ConversationViewModel: OWSAudioPlayerDelegate {
130131

131132
private func setupObservableThreadData(for threadId: String) -> ValueObservation<ValueReducers.RemoveDuplicates<ValueReducers.Fetch<SessionThreadViewModel?>>> {
132133
return ValueObservation
133-
.trackingConstantRegion { db -> SessionThreadViewModel? in
134+
.trackingConstantRegion { [weak self] db -> SessionThreadViewModel? in
134135
let userPublicKey: String = getUserHexEncodedPublicKey(db)
135136
let recentReactionEmoji: [String] = try Emoji.getRecent(db, withDefaultEmoji: true)
136137
let threadViewModel: SessionThreadViewModel? = try SessionThreadViewModel
@@ -139,6 +140,11 @@ public class ConversationViewModel: OWSAudioPlayerDelegate {
139140

140141
return threadViewModel
141142
.map { $0.with(recentReactionEmoji: recentReactionEmoji) }
143+
.map { viewModel -> SessionThreadViewModel in
144+
viewModel.populatingCurrentUserBlindedKey(
145+
currentUserBlindedPublicKeyForThisThread: self?.threadData.currentUserBlindedPublicKey
146+
)
147+
}
142148
}
143149
.removeDuplicates()
144150
}

Session/Notifications/SyncPushTokensJob.swift

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public enum SyncPushTokensJob: JobExecutor {
1111
public static let maxFailureCount: Int = -1
1212
public static let requiresThreadId: Bool = false
1313
public static let requiresInteractionId: Bool = false
14+
private static let maxFrequency: TimeInterval = (12 * 60 * 60)
1415

1516
public static func run(
1617
_ job: Job,
@@ -34,45 +35,44 @@ public enum SyncPushTokensJob: JobExecutor {
3435
return
3536
}
3637

37-
// Push tokens don't normally change while the app is launched, so checking once during launch is
38-
// usually sufficient, but e.g. on iOS11, users who have disabled "Allow Notifications" and disabled
39-
// "Background App Refresh" will not be able to obtain an APN token. Enabling those settings does not
40-
// restart the app, so we check every activation for users who haven't yet registered.
41-
guard job.behaviour != .recurringOnActive || !UIApplication.shared.isRegisteredForRemoteNotifications else {
38+
// Push tokens don't normally change while the app is launched, so you would assume checking once
39+
// during launch is sufficient, but e.g. on iOS11, users who have disabled "Allow Notifications"
40+
// and disabled "Background App Refresh" will not be able to obtain an APN token. Enabling those
41+
// settings does not restart the app, so we check every activation for users who haven't yet
42+
// registered.
43+
//
44+
// It's also possible for a device to successfully register for push notifications but fail to
45+
// register with Session
46+
//
47+
// Due to the above we want to re-register at least once every ~12 hours to ensure users will
48+
// continue to receive push notifications
49+
//
50+
// In addition to this if we are custom running the job (eg. by toggling the push notification
51+
// setting) then we should run regardless of the other settings so users have a mechanism to force
52+
// the registration to run
53+
let lastPushNotificationSync: Date = UserDefaults.standard[.lastPushNotificationSync]
54+
.defaulting(to: Date.distantPast)
55+
56+
guard
57+
job.behaviour == .runOnce ||
58+
!UIApplication.shared.isRegisteredForRemoteNotifications ||
59+
Date().timeIntervalSince(lastPushNotificationSync) >= SyncPushTokensJob.maxFrequency
60+
else {
4261
deferred(job) // Don't need to do anything if push notifications are already registered
4362
return
4463
}
4564

46-
Logger.info("Retrying remote notification registration since user hasn't registered yet.")
47-
48-
// Determine if we want to upload only if stale (Note: This should default to true, and be true if
49-
// 'details' isn't provided)
50-
let uploadOnlyIfStale: Bool = ((try? JSONDecoder().decode(Details.self, from: job.details ?? Data()))?.uploadOnlyIfStale ?? true)
51-
52-
// Get the app version info (used to determine if we want to update the push tokens)
53-
let lastAppVersion: String? = AppVersion.sharedInstance().lastAppVersion
54-
let currentAppVersion: String? = AppVersion.sharedInstance().currentAppVersion
65+
Logger.info("Re-registering for remote notifications.")
5566

67+
// Perform device registration
5668
PushRegistrationManager.shared.requestPushTokens()
5769
.then(on: queue) { (pushToken: String, voipToken: String) -> Promise<Void> in
58-
let lastPushToken: String? = Storage.shared[.lastRecordedPushToken]
59-
let lastVoipToken: String? = Storage.shared[.lastRecordedVoipToken]
60-
let shouldUploadTokens: Bool = (
61-
!uploadOnlyIfStale || (
62-
lastPushToken != pushToken ||
63-
lastVoipToken != voipToken
64-
) ||
65-
lastAppVersion != currentAppVersion
66-
)
67-
68-
guard shouldUploadTokens else { return Promise.value(()) }
69-
7070
let (promise, seal) = Promise<Void>.pending()
7171

7272
SyncPushTokensJob.registerForPushNotifications(
7373
pushToken: pushToken,
7474
voipToken: voipToken,
75-
isForcedUpdate: shouldUploadTokens,
75+
isForcedUpdate: true,
7676
success: { seal.fulfill(()) },
7777
failure: seal.reject
7878
)
@@ -94,6 +94,7 @@ public enum SyncPushTokensJob: JobExecutor {
9494
public static func run(uploadOnlyIfStale: Bool) {
9595
guard let job: Job = Job(
9696
variant: .syncPushTokens,
97+
behaviour: .runOnce,
9798
details: SyncPushTokensJob.Details(
9899
uploadOnlyIfStale: uploadOnlyIfStale
99100
)

SessionMessagingKit/File Server/FileServerAPI.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ public final class FileServerAPI: NSObject {
1414
public static let oldServerPublicKey = "7cb31905b55cd5580c686911debf672577b3fb0bff81df4ce2d5c4cb3a7aaa69"
1515
@objc public static let server = "http://filev2.getsession.org"
1616
public static let serverPublicKey = "da21e1d886c6fbaea313f75298bd64aab03a97ce985b46bb2dad9f2089c8ee59"
17-
public static let maxFileSize = (10 * 1024 * 1024) // 10 MB
17+
18+
/// **Note:** The max file size is 10,000,000 bytes (rather than 10MiB which would be `(10 * 1024 * 1024)`), 10,000,000
19+
/// exactly will be fine but a single byte more will result in an error
20+
public static let maxFileSize = 10_000_000
1821

1922
/// Standard timeout is 10 seconds which is a little too short fir file upload/download with slightly larger files
2023
public static let fileTimeout: TimeInterval = 30

SessionUtilitiesKit/General/SNUserDefaults.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public enum SNUserDefaults {
4444
case lastOpenGroupImageUpdate
4545
case lastOpen
4646
case lastGarbageCollection
47+
case lastPushNotificationSync
4748
}
4849

4950
public enum Double: Swift.String {

0 commit comments

Comments
 (0)