Skip to content

Commit d1739b2

Browse files
committed
Apply ReadContext
1 parent 3fe60a3 commit d1739b2

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

AxolotlKit/Classes/SessionCipher.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ NS_ASSUME_NONNULL_BEGIN
3636
protocolContext:(nullable id<SPKProtocolWriteContext>)protocolContext
3737
error:(NSError **)outError;
3838

39-
- (int)throws_remoteRegistrationId:(nullable id<SPKProtocolWriteContext>)protocolContext NS_SWIFT_UNAVAILABLE("throws objc exceptions");
39+
- (int)throws_remoteRegistrationId:(nullable id<SPKProtocolReadContext>)protocolContext
40+
NS_SWIFT_UNAVAILABLE("throws objc exceptions");
4041

41-
- (int)throws_sessionVersion:(nullable id<SPKProtocolWriteContext>)protocolContext NS_SWIFT_UNAVAILABLE("throws objc exceptions");
42+
- (int)throws_sessionVersion:(nullable id<SPKProtocolReadContext>)protocolContext
43+
NS_SWIFT_UNAVAILABLE("throws objc exceptions");
4244

4345
@end
4446

AxolotlKit/Classes/SessionCipher.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ + (NSData*)currentProtocolVersion{
484484
return versionByte;
485485
}
486486

487-
- (int)throws_remoteRegistrationId:(nullable id<SPKProtocolWriteContext>)protocolContext
487+
- (int)throws_remoteRegistrationId:(nullable id<SPKProtocolReadContext>)protocolContext
488488
{
489489
SessionRecord *_Nullable record =
490490
[self.sessionStore loadSession:self.recipientId deviceId:_deviceId protocolContext:protocolContext];
@@ -496,7 +496,7 @@ - (int)throws_remoteRegistrationId:(nullable id<SPKProtocolWriteContext>)protoco
496496
return record.sessionState.remoteRegistrationId;
497497
}
498498

499-
- (int)throws_sessionVersion:(nullable id<SPKProtocolWriteContext>)protocolContext
499+
- (int)throws_sessionVersion:(nullable id<SPKProtocolReadContext>)protocolContext
500500
{
501501
SessionRecord *_Nullable record =
502502
[self.sessionStore loadSession:self.recipientId deviceId:_deviceId protocolContext:protocolContext];

AxolotlKit/Classes/State/IdentityKeyStore.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ typedef NS_ENUM(NSInteger, TSMessageDirection) {
4747
- (BOOL)isTrustedIdentityKey:(NSData *)identityKey
4848
recipientId:(NSString *)recipientId
4949
direction:(TSMessageDirection)direction
50-
protocolContext:(nullable id<SPKProtocolWriteContext>)protocolContext;
50+
protocolContext:(nullable id<SPKProtocolReadContext>)protocolContext;
5151

5252
- (nullable NSData *)identityKeyForRecipientId:(NSString *)recipientId;
5353

54-
- (nullable NSData *)identityKeyForRecipientId:(NSString *)recipientId protocolContext:(nullable id<SPKProtocolWriteContext>)protocolContext;
54+
- (nullable NSData *)identityKeyForRecipientId:(NSString *)recipientId
55+
protocolContext:(nullable id<SPKProtocolReadContext>)protocolContext;
5556

5657
@end
5758

AxolotlKit/Classes/State/SessionStore.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
2121
*/
2222
- (SessionRecord *)loadSession:(NSString *)contactIdentifier
2323
deviceId:(int)deviceId
24-
protocolContext:(nullable id<SPKProtocolWriteContext>)protocolContext;
24+
protocolContext:(nullable id<SPKProtocolReadContext>)protocolContext;
2525

2626
- (NSArray *)subDevicesSessions:(NSString *)contactIdentifier protocolContext:(nullable id<SPKProtocolWriteContext>)protocolContext __attribute__((deprecated));
2727

@@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
3232

3333
- (BOOL)containsSession:(NSString *)contactIdentifier
3434
deviceId:(int)deviceId
35-
protocolContext:(nullable id<SPKProtocolWriteContext>)protocolContext;
35+
protocolContext:(nullable id<SPKProtocolReadContext>)protocolContext;
3636

3737
- (void)deleteSessionForContact:(NSString *)contactIdentifier
3838
deviceId:(int)deviceId

AxolotlKit/Classes/TestUtils/SPKMockProtocolStore.m

+5-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ - (nullable NSData *)identityKeyForRecipientId:(NSString *)recipientId
179179
return [self identityKeyForRecipientId:recipientId protocolContext:nil];
180180
}
181181

182-
- (nullable NSData *)identityKeyForRecipientId:(NSString *)recipientId protocolContext:(nullable id<SPKProtocolWriteContext>)protocolContext
182+
- (nullable NSData *)identityKeyForRecipientId:(NSString *)recipientId
183+
protocolContext:(nullable id<SPKProtocolReadContext>)protocolContext
183184
{
184185
NSData *_Nullable data = [self.trustedKeys objectForKey:recipientId];
185186
return data;
@@ -201,10 +202,13 @@ - (SessionRecord *)loadSession:(NSString *)contactIdentifier
201202
return sessionRecord;
202203
}
203204

205+
#pragma clang diagnostic push
206+
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
204207
- (NSArray *)subDevicesSessions:(NSString *)contactIdentifier protocolContext:(nullable id<SPKProtocolWriteContext>)protocolContext
205208
{
206209
return [[self deviceSessionRecordsForContactIdentifier:contactIdentifier] allKeys];
207210
}
211+
#pragma clang diagnostic pop
208212

209213
- (NSMutableDictionary *)deviceSessionRecordsForContactIdentifier:(NSString *)contactIdentifier
210214
{

AxolotlKit/Classes/Utility/SPKProtocolContext.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66

77
NS_ASSUME_NONNULL_BEGIN
88

9-
@protocol SPKProtocolWriteContext <NSObject>
9+
@protocol SPKProtocolReadContext <NSObject>
10+
11+
@end
12+
13+
@protocol SPKProtocolWriteContext <SPKProtocolReadContext>
1014

1115
@end
1216

0 commit comments

Comments
 (0)