Skip to content

Commit ed06555

Browse files
committed
Merge branch 'release/2.5.0' into release/2.5.0-with-master
// FREEBIE
2 parents b59a0e4 + 1979338 commit ed06555

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+196
-24
lines changed

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ source 'https://github.com/CocoaPods/Specs.git'
33

44
target 'Signal' do
55
pod 'SocketRocket', :git => 'https://github.com/facebook/SocketRocket.git'
6-
pod 'SignalServiceKit', :git => 'https://github.com/WhisperSystems/SignalServiceKit.git'
6+
pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git'
77
#pod 'SignalServiceKit', path: '../SignalServiceKit'
88
pod 'OpenSSL', '~> 1.0.208'
99
pod 'PastelogKit', '~> 1.3'

Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ EXTERNAL SOURCES:
130130

131131
CHECKOUT OPTIONS:
132132
SignalServiceKit:
133-
:commit: d802918603158e50987a2a4c74d4174cdc0f72d6
133+
:commit: 9821e0c0d03a01f556680a6ae869b70bf5b93681
134134
:git: https://github.com/WhisperSystems/SignalServiceKit.git
135135
SocketRocket:
136136
:commit: 8096fef47d582bff8ae3758c9ae7af1d55ea53d6
@@ -161,6 +161,6 @@ SPEC CHECKSUMS:
161161
UnionFind: c33be5adb12983981d6e827ea94fc7f9e370f52d
162162
YapDatabase: b1e43555a34a5298e23a045be96817a5ef0da58f
163163

164-
PODFILE CHECKSUM: 547945066e021c3aa0bd6bea018af5e4769a3113
164+
PODFILE CHECKSUM: 5dccee4c1c1ba5d4bf9575a81eeede82d1e89e8b
165165

166166
COCOAPODS: 1.0.1

Signal.xcodeproj/project.pbxproj

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
458E383A1D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 458E38391D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m */; };
2525
459311FC1D75C948008DD4F0 /* OWSDeviceTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 459311FB1D75C948008DD4F0 /* OWSDeviceTableViewCell.m */; };
2626
459C3F0D1C9B3A1B003ACF51 /* TSMessageAdapterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 459C3F0C1C9B3A1B003ACF51 /* TSMessageAdapterTest.m */; };
27+
45BFFFA81D898AF0004A12A7 /* OWSStaleNotificationObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 45BFFFA71D898AF0004A12A7 /* OWSStaleNotificationObserver.m */; };
28+
45BFFFA91D898AF0004A12A7 /* OWSStaleNotificationObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 45BFFFA71D898AF0004A12A7 /* OWSStaleNotificationObserver.m */; };
2729
45C681B71D305A580050903A /* OWSCall.m in Sources */ = {isa = PBXBuildFile; fileRef = 45C681B61D305A580050903A /* OWSCall.m */; };
2830
45C681B81D305A580050903A /* OWSCall.m in Sources */ = {isa = PBXBuildFile; fileRef = 45C681B61D305A580050903A /* OWSCall.m */; };
2931
45C681BC1D305C080050903A /* OWSCallCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 45C681BA1D305C080050903A /* OWSCallCollectionViewCell.m */; };
@@ -537,6 +539,8 @@
537539
4597E94E1D8313C100040CDE /* sq */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sq; path = translations/sq.lproj/Localizable.strings; sourceTree = "<group>"; };
538540
4597E94F1D8313CB00040CDE /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = translations/bg.lproj/Localizable.strings; sourceTree = "<group>"; };
539541
459C3F0C1C9B3A1B003ACF51 /* TSMessageAdapterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSMessageAdapterTest.m; path = "view controllers/Signals/TSMessageAdapters/TSMessageAdapterTest.m"; sourceTree = "<group>"; };
542+
45BFFFA61D898AF0004A12A7 /* OWSStaleNotificationObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OWSStaleNotificationObserver.h; path = Observers/OWSStaleNotificationObserver.h; sourceTree = "<group>"; };
543+
45BFFFA71D898AF0004A12A7 /* OWSStaleNotificationObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OWSStaleNotificationObserver.m; path = Observers/OWSStaleNotificationObserver.m; sourceTree = "<group>"; };
540544
45C681B51D305A580050903A /* OWSCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSCall.h; sourceTree = "<group>"; };
541545
45C681B61D305A580050903A /* OWSCall.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSCall.m; sourceTree = "<group>"; };
542546
45C681B91D305C080050903A /* OWSCallCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSCallCollectionViewCell.h; sourceTree = "<group>"; };
@@ -1167,6 +1171,15 @@
11671171
name = TSMessageAdapters;
11681172
sourceTree = "<group>";
11691173
};
1174+
45BFFFA51D898AB8004A12A7 /* Observers */ = {
1175+
isa = PBXGroup;
1176+
children = (
1177+
45BFFFA61D898AF0004A12A7 /* OWSStaleNotificationObserver.h */,
1178+
45BFFFA71D898AF0004A12A7 /* OWSStaleNotificationObserver.m */,
1179+
);
1180+
name = Observers;
1181+
sourceTree = "<group>";
1182+
};
11701183
70B8009F190C529C0042E3F0 /* Products */ = {
11711184
isa = PBXGroup;
11721185
children = (
@@ -1218,6 +1231,7 @@
12181231
457F3AC01D14A0F700C51351 /* Models */,
12191232
76EB052B18170B33006006FC /* Views */,
12201233
76EB04FE18170B33006006FC /* View Controllers */,
1234+
45BFFFA51D898AB8004A12A7 /* Observers */,
12211235
);
12221236
path = src;
12231237
sourceTree = "<group>";
@@ -2367,6 +2381,7 @@
23672381
ORGANIZATIONNAME = "Open Whisper Systems";
23682382
TargetAttributes = {
23692383
D221A088169C9E5E00537ABF = {
2384+
DevelopmentTeam = U68MSDN6DR;
23702385
SystemCapabilities = {
23712386
com.apple.DataProtection = {
23722387
enabled = 1;
@@ -2377,6 +2392,9 @@
23772392
com.apple.InterAppAudio = {
23782393
enabled = 0;
23792394
};
2395+
com.apple.Push = {
2396+
enabled = 1;
2397+
};
23802398
com.apple.VPNLite = {
23812399
enabled = 0;
23822400
};
@@ -2688,6 +2706,7 @@
26882706
E197B61918BBEC1A00F073E5 /* RemoteIOBufferListWrapper.m in Sources */,
26892707
76EB05A618170B33006006FC /* RtpPacket.m in Sources */,
26902708
76EB064218170B33006006FC /* StringUtil.m in Sources */,
2709+
45BFFFA81D898AF0004A12A7 /* OWSStaleNotificationObserver.m in Sources */,
26912710
A547DD741A70A87800103EC7 /* DJWActionSheet+OWS.m in Sources */,
26922711
45C681B71D305A580050903A /* OWSCall.m in Sources */,
26932712
76EB062618170B33006006FC /* Queue.m in Sources */,
@@ -2882,6 +2901,7 @@
28822901
B660F7311C29988E00687D6E /* IpEndPoint.m in Sources */,
28832902
B660F7321C29988E00687D6E /* PacketHandler.m in Sources */,
28842903
B660F7331C29988E00687D6E /* RtpPacket.m in Sources */,
2904+
45BFFFA91D898AF0004A12A7 /* OWSStaleNotificationObserver.m in Sources */,
28852905
B660F7341C29988E00687D6E /* RtpSocket.m in Sources */,
28862906
B660F7351C29988E00687D6E /* SequenceCounter.m in Sources */,
28872907
B660F7361C29988E00687D6E /* SrtpSocket.m in Sources */,
@@ -3210,7 +3230,10 @@
32103230
buildSettings = {
32113231
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
32123232
CLANG_ENABLE_MODULES = YES;
3233+
CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements;
3234+
CODE_SIGN_IDENTITY = "iPhone Developer";
32133235
CURRENT_PROJECT_VERSION = 1;
3236+
DEVELOPMENT_TEAM = U68MSDN6DR;
32143237
FRAMEWORK_SEARCH_PATHS = (
32153238
"$(inherited)",
32163239
"\"$(SRCROOT)\"",
@@ -3263,7 +3286,10 @@
32633286
buildSettings = {
32643287
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
32653288
CLANG_ENABLE_MODULES = YES;
3289+
CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements;
3290+
CODE_SIGN_IDENTITY = "iPhone Developer";
32663291
CURRENT_PROJECT_VERSION = 1;
3292+
DEVELOPMENT_TEAM = U68MSDN6DR;
32673293
FRAMEWORK_SEARCH_PATHS = (
32683294
"$(inherited)",
32693295
"\"$(SRCROOT)\"",

Signal/Signal-Info.plist

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</dict>
3939
</array>
4040
<key>CFBundleVersion</key>
41-
<string>2.6.0.0</string>
41+
<string>2.5.0.15</string>
4242
<key>ITSAppUsesNonExemptEncryption</key>
4343
<false/>
4444
<key>LOGS_EMAIL</key>
@@ -71,6 +71,8 @@
7171
</dict>
7272
<key>NSAppleMusicUsageDescription</key>
7373
<string>Signal needs to use Apple Music to play media attachments.</string>
74+
<key>NSCameraUsageDescription</key>
75+
<string>Signal will let you take a photo to send to your contacts. You can review it before sending.</string>
7476
<key>NSContactsUsageDescription</key>
7577
<string>Signal uses your contacts to find users you know. We do not store your contacts on the server.</string>
7678
<key>NSMicrophoneUsageDescription</key>

Signal/Signal.entitlements

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
4-
<dict/>
4+
<dict>
5+
<key>aps-environment</key>
6+
<string>development</string>
7+
</dict>
58
</plist>

Signal/src/AppDelegate.m

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#import "TSSocketManager.h"
1616
#import "TextSecureKitEnv.h"
1717
#import "VersionMigrations.h"
18+
#import "OWSStaleNotificationObserver.h"
1819
#import <SignalServiceKit/OWSReadReceiptObserver.h>
1920

2021
static NSString *const kStoryboardName = @"Storyboard";
@@ -26,6 +27,7 @@ @interface AppDelegate ()
2627

2728
@property (nonatomic, retain) UIWindow *screenProtectionWindow;
2829
@property (nonatomic) OWSReadReceiptObserver *readReceiptObserver;
30+
@property (nonatomic) OWSStaleNotificationObserver *staleNotificationObserver;
2931

3032
@end
3133

@@ -119,20 +121,25 @@ - (void)setupTSKitEnv {
119121
[TextSecureKitEnv sharedEnv].contactsManager = [Environment getCurrent].contactsManager;
120122
[[TSStorageManager sharedManager] setupDatabase];
121123
[TextSecureKitEnv sharedEnv].notificationsManager = [[NotificationsManager alloc] init];
122-
self.readReceiptObserver =
123-
[[OWSReadReceiptObserver alloc] initWithMessagesManager:[TSMessagesManager sharedManager]];
124+
self.readReceiptObserver = [OWSReadReceiptObserver new];
124125
[self.readReceiptObserver startObserving];
126+
127+
self.staleNotificationObserver = [OWSStaleNotificationObserver new];
128+
[self.staleNotificationObserver startObserving];
125129
}
126130

127-
- (void)application:(UIApplication *)application
128-
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
131+
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
132+
{
133+
DDLogDebug(@"%@ Successfully registered for remote notifications with token: %@", self.tag, deviceToken);
129134
[PushManager.sharedManager.pushNotificationFutureSource trySetResult:deviceToken];
130135
}
131136

132-
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
137+
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
138+
{
139+
DDLogError(@"%@ Failed to register for remote notifications with error %@", self.tag, error);
133140
#ifdef DEBUG
134-
DDLogWarn(@"We're in debug mode, and registered a fake push identifier");
135-
[PushManager.sharedManager.pushNotificationFutureSource trySetResult:@"aFakePushIdentifier"];
141+
DDLogWarn(@"%@ We're in debug mode. Faking success for remote registration with a fake push identifier", self.tag);
142+
[PushManager.sharedManager.pushNotificationFutureSource trySetResult:[NSData dataWithLength:32]];
136143
#else
137144
[PushManager.sharedManager.pushNotificationFutureSource trySetFailure:error];
138145
#endif
@@ -352,4 +359,14 @@ - (BOOL)applicationIsActive {
352359
return NO;
353360
}
354361

362+
+ (NSString *)tag
363+
{
364+
return [NSString stringWithFormat:@"[%@]", self.class];
365+
}
366+
367+
- (NSString *)tag
368+
{
369+
return self.class.tag;
370+
}
371+
355372
@end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Created by Michael Kirk on 9/14/16.
2+
// Copyright © 2016 Open Whisper Systems. All rights reserved.
3+
4+
NS_ASSUME_NONNULL_BEGIN
5+
6+
@class PushManager;
7+
8+
@interface OWSStaleNotificationObserver : NSObject
9+
10+
- (instancetype)initWithPushManager:(PushManager *)pushManager NS_DESIGNATED_INITIALIZER;
11+
- (void)startObserving;
12+
13+
@end
14+
15+
NS_ASSUME_NONNULL_END
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Created by Michael Kirk on 9/14/16.
2+
// Copyright © 2016 Open Whisper Systems. All rights reserved.
3+
4+
#import "OWSStaleNotificationObserver.h"
5+
#import "PushManager.h"
6+
#import <SignalServiceKit/OWSReadReceiptsProcessor.h>
7+
#import <SignalServiceKit/TSIncomingMessage.h>
8+
9+
NS_ASSUME_NONNULL_BEGIN
10+
11+
@interface OWSStaleNotificationObserver ()
12+
13+
@property (nonatomic, readonly) PushManager *pushManager;
14+
15+
@end
16+
17+
@implementation OWSStaleNotificationObserver
18+
19+
- (void)dealloc
20+
{
21+
[[NSNotificationCenter defaultCenter] removeObserver:self];
22+
}
23+
24+
- (instancetype)init
25+
{
26+
return [self initWithPushManager:[PushManager sharedManager]];
27+
}
28+
29+
- (instancetype)initWithPushManager:(PushManager *)pushManager
30+
{
31+
self = [super init];
32+
if (!self) {
33+
return self;
34+
}
35+
36+
_pushManager = pushManager;
37+
38+
return self;
39+
}
40+
41+
- (void)startObserving
42+
{
43+
[[NSNotificationCenter defaultCenter] addObserver:self
44+
selector:@selector(handleMessageRead:)
45+
name:OWSReadReceiptsProcessorMarkedMessageAsReadNotification
46+
object:nil];
47+
}
48+
49+
- (void)handleMessageRead:(NSNotification *)notification
50+
{
51+
if ([notification.object isKindOfClass:[TSIncomingMessage class]]) {
52+
TSIncomingMessage *message = (TSIncomingMessage *)notification.object;
53+
54+
DDLogDebug(@"%@ canceled notification for message:%@", self.tag, message);
55+
[self.pushManager cancelNotificationsWithThreadId:message.uniqueThreadId];
56+
}
57+
}
58+
59+
+ (NSString *)tag
60+
{
61+
return [NSString stringWithFormat:@"[%@]", self.class];
62+
}
63+
64+
- (NSString *)tag
65+
{
66+
return self.class.tag;
67+
}
68+
69+
@end
70+
71+
NS_ASSUME_NONNULL_END

Signal/src/Storyboard/Storyboard.storyboard

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,27 +1503,28 @@ A0 09 9A FF A8 8A 09 99</string>
15031503
<autoresizingMask key="autoresizingMask"/>
15041504
<subviews>
15051505
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Network Status" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uNq-FV-lwt">
1506-
<rect key="frame" x="15" y="12" width="200" height="20"/>
1506+
<rect key="frame" x="15" y="0.0" width="200" height="44"/>
15071507
<constraints>
1508+
<constraint firstAttribute="height" constant="44" id="nOw-0c-lAd"/>
15081509
<constraint firstAttribute="width" constant="200" id="q6L-Sa-lrA"/>
15091510
</constraints>
1510-
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
1511+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
15111512
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
15121513
<nil key="highlightedColor"/>
15131514
</label>
15141515
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Connected" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsLetterSpacingToFitWidth="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tg3-dQ-odw">
1515-
<rect key="frame" x="105" y="11" width="200" height="21"/>
1516+
<rect key="frame" x="205" y="-1" width="100" height="45"/>
15161517
<constraints>
1517-
<constraint firstAttribute="width" constant="200" id="Lw2-Fv-sOC"/>
1518-
<constraint firstAttribute="height" constant="21" id="uvH-QZ-iUw"/>
1518+
<constraint firstAttribute="width" constant="100" id="Lw2-Fv-sOC"/>
1519+
<constraint firstAttribute="height" constant="44" id="uvH-QZ-iUw"/>
15191520
</constraints>
15201521
<fontDescription key="fontDescription" style="UICTFontTextStyleCallout"/>
15211522
<color key="textColor" red="0.5725490196078431" green="1" blue="0.54117647058823526" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
15221523
<nil key="highlightedColor"/>
15231524
</label>
15241525
</subviews>
15251526
<constraints>
1526-
<constraint firstItem="tg3-dQ-odw" firstAttribute="top" secondItem="hqv-P5-du9" secondAttribute="topMargin" constant="3" id="C7U-ve-FJA"/>
1527+
<constraint firstItem="tg3-dQ-odw" firstAttribute="centerY" secondItem="hqv-P5-du9" secondAttribute="centerY" id="53z-bi-mXN"/>
15271528
<constraint firstItem="uNq-FV-lwt" firstAttribute="leading" secondItem="hqv-P5-du9" secondAttribute="leadingMargin" constant="7" id="ViZ-i6-VOo"/>
15281529
<constraint firstAttribute="centerY" secondItem="uNq-FV-lwt" secondAttribute="centerY" id="d7b-Jy-1gQ"/>
15291530
<constraint firstAttribute="trailingMargin" secondItem="tg3-dQ-odw" secondAttribute="trailing" constant="7" id="xHz-d7-B39"/>

Signal/src/network/PushManager.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#import <CollapsingFutures.h>
10-
#import <Foundation/Foundation.h>
10+
#import <PushKit/PushKit.h>
1111

1212
#define Signal_Thread_UserInfo_Key @"Signal_Thread_Id"
1313
#define Signal_Message_UserInfo_Key @"Signal_Message_Id"
@@ -33,7 +33,7 @@ typedef void (^pushTokensSuccessBlock)(NSString *pushToken, NSString *voipToken)
3333
* The Push Manager is responsible for registering the device for Signal push notifications.
3434
*/
3535

36-
@interface PushManager : NSObject
36+
@interface PushManager : NSObject <PKPushRegistryDelegate>
3737

3838
+ (PushManager *)sharedManager;
3939

@@ -65,6 +65,7 @@ typedef void (^pushTokensSuccessBlock)(NSString *pushToken, NSString *voipToken)
6565
- (BOOL)supportsVOIPPush;
6666
- (UILocalNotification *)closeVOIPBackgroundTask;
6767
- (void)presentNotification:(UILocalNotification *)notification;
68+
- (void)cancelNotificationsWithThreadId:(NSString *)threadId;
6869

6970
#pragma mark Push Notifications Delegate Methods
7071

0 commit comments

Comments
 (0)