diff --git a/Podfile b/Podfile index 68f553d50..5343918db 100644 --- a/Podfile +++ b/Podfile @@ -73,6 +73,9 @@ target 'Signal' do pod 'GCDWebServer', '~> 3.0', :inhibit_warnings => true pod 'FeedKit', '~> 8.1', :inhibit_warnings => true pod 'CryptoSwift', '~> 1.0', :inhibit_warnings => true + pod 'FirebaseCore', '~> 6.0', :inhibit_warnings => true # Used for internal testing + pod 'Fabric', '~> 1.10', :inhibit_warnings => true # Used for internal testing + pod 'Crashlytics', '~> 3.13', :inhibit_warnings => true # Used for internal testing pod 'NVActivityIndicatorView', '~> 4.7', :inhibit_warnings => true target 'SignalTests' do diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 0c7768f79..165dac3b5 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -618,6 +618,9 @@ B9EB5ABD1884C002007CBB57 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9EB5ABC1884C002007CBB57 /* MessageUI.framework */; }; BFF3FB9730634F37D25903F4 /* Pods_Signal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D17BB5C25D615AB49813100C /* Pods_Signal.framework */; }; C34C8F7423A7830B00D82669 /* SpaceMono-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C34C8F7323A7830A00D82669 /* SpaceMono-Bold.ttf */; }; + C3B781FF2411C18600C859D8 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3B781FE2411C18600C859D8 /* GoogleService-Info.plist */; }; + C3B782022411C80500C859D8 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3B781FE2411C18600C859D8 /* GoogleService-Info.plist */; }; + C3B782032411C81100C859D8 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = C3B781FE2411C18600C859D8 /* GoogleService-Info.plist */; }; C3DFFAC623E96F0D0058DAF8 /* Sheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3DFFAC523E96F0D0058DAF8 /* Sheet.swift */; }; C3DFFAC823E970080058DAF8 /* OpenGroupSuggestionSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3DFFAC723E970080058DAF8 /* OpenGroupSuggestionSheet.swift */; }; CC875800737563D6891B741D /* Pods_SignalTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 748A5CAEDD7C919FC64C6807 /* Pods_SignalTests.framework */; }; @@ -1466,6 +1469,7 @@ B97940261832BD2400BD66CB /* UIUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIUtil.m; sourceTree = ""; }; B9EB5ABC1884C002007CBB57 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; C34C8F7323A7830A00D82669 /* SpaceMono-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SpaceMono-Bold.ttf"; sourceTree = ""; }; + C3B781FE2411C18600C859D8 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Signal/GoogleService-Info.plist"; sourceTree = SOURCE_ROOT; }; C3DFFAC523E96F0D0058DAF8 /* Sheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sheet.swift; sourceTree = ""; }; C3DFFAC723E970080058DAF8 /* OpenGroupSuggestionSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenGroupSuggestionSheet.swift; sourceTree = ""; }; D17BB5C25D615AB49813100C /* Pods_Signal.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Signal.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -2922,6 +2926,7 @@ B66DBF4919D5BBC8006EA940 /* Images.xcassets */, B67EBF5C19194AC60084CCFD /* Settings.bundle */, B657DDC91911A40500F45B0C /* Signal.entitlements */, + C3B781FE2411C18600C859D8 /* GoogleService-Info.plist */, C34C8F7323A7830A00D82669 /* SpaceMono-Bold.ttf */, 34074F54203D0722004596AE /* Sounds */, 76EB03C118170B33006006FC /* src */, @@ -3091,6 +3096,7 @@ 451DE9EE1DC1546A00810E42 /* [Carthage] Copy Frameworks */, 453518771FC635DD00210559 /* Embed App Extensions */, 4535189F1FC63DBF00210559 /* Embed Frameworks */, + C3B782012411C26000C859D8 /* Set up Crashlytics */, ); buildRules = ( ); @@ -3283,6 +3289,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + C3B782022411C80500C859D8 /* GoogleService-Info.plist in Resources */, 347850321FD7494A007B8332 /* ElegantIcons.ttf in Resources */, 4535186E1FC635DD00210559 /* MainInterface.storyboard in Resources */, 347850551FD749C0007B8332 /* Localizable.strings in Resources */, @@ -3296,6 +3303,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + C3B782032411C81100C859D8 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3303,6 +3311,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + C3B781FF2411C18600C859D8 /* GoogleService-Info.plist in Resources */, 4C63CC00210A620B003AE45C /* SignalTSan.supp in Resources */, 4C6F527C20FFE8400097DEEE /* SignalUBSan.supp in Resources */, 34CF078A203E6B78005C4D61 /* end_call_tone_cept.caf in Resources */, @@ -3632,6 +3641,25 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SignalTests/Pods-SignalTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + C3B782012411C26000C859D8 /* Set up Crashlytics */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)", + ); + name = "Set up Crashlytics"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Fabric/run\"\n"; + }; F4C416F20E3CB0B25DC10C56 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/Signal/GoogleService-Info.plist b/Signal/GoogleService-Info.plist new file mode 100644 index 000000000..f37b4c636 --- /dev/null +++ b/Signal/GoogleService-Info.plist @@ -0,0 +1,36 @@ + + + + + CLIENT_ID + 43512467490-f04dj1ssk2medqq3t33odidvmi9bi9ob.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.43512467490-f04dj1ssk2medqq3t33odidvmi9bi9ob + API_KEY + AIzaSyDgnrhH4AtRrZXuRIeVMLAs7UhqGTTsVdQ + GCM_SENDER_ID + 43512467490 + PLIST_VERSION + 1 + BUNDLE_ID + com.loki-project.loki-messenger + PROJECT_ID + loki-5a81e + STORAGE_BUCKET + loki-5a81e.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:43512467490:ios:d1592446dbc04e6e19ba7b + DATABASE_URL + https://loki-5a81e.firebaseio.com + + diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 9c1f14ca2..a7a084e27 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -5,15 +5,15 @@ BuildDetails CarthageVersion - 0.34.0 + 0.33.0 DateTime - Tue Mar 3 05:11:41 UTC 2020 + Fri Mar 6 00:51:56 UTC 2020 OSXVersion 10.15.3 WebRTCCommit 1445d719bf05280270e9f77576f80f973fd847f8 M73 XCodeVersion - 1100.1120 + 1100.1130 CFBundleDevelopmentRegion en diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 64721d20c..19db0cfee 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -46,6 +46,7 @@ #import #import #import +#import @import WebRTC; @import Intents; @@ -58,6 +59,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; static NSTimeInterval launchStartedAt; +static BOOL isInternalTestVersion = NO; + @interface AppDelegate () @property (nonatomic) BOOL hasInitialRootViewController; @@ -353,7 +356,11 @@ static NSTimeInterval launchStartedAt; // if (!self.lokiP2PServer.isRunning) { // NSLog(@"[Loki] Failed to start P2P server."); // } - + + if (isInternalTestVersion) { + [FIRApp configure]; + } + return YES; } diff --git a/Signal/src/Loki/Components/NewConversationButtonSet.swift b/Signal/src/Loki/Components/NewConversationButtonSet.swift index 8510a2a51..c8611434d 100644 --- a/Signal/src/Loki/Components/NewConversationButtonSet.swift +++ b/Signal/src/Loki/Components/NewConversationButtonSet.swift @@ -42,15 +42,13 @@ final class NewConversationButtonSet : UIView { verticalButtonConstraints[createNewClosedGroupButton] = createNewClosedGroupButton.pin(.bottom, to: .bottom, of: self, withInset: -inset) addSubview(mainButton) mainButton.center(.horizontal, in: self) - mainButton.pin(.bottom, to: .bottom, of: self) - let width = 3 * Values.newConversationButtonExpandedSize + 2 * spacing + mainButton.pin(.bottom, to: .bottom, of: self, withInset: -inset) + let width = 2 * Values.newConversationButtonExpandedSize + 2 * spacing + Values.newConversationButtonCollapsedSize set(.width, to: width) - let height = 2 * Values.newConversationButtonExpandedSize + spacing + let height = Values.newConversationButtonExpandedSize + spacing + Values.newConversationButtonCollapsedSize set(.height, to: height) collapse(withAnimation: false) isUserInteractionEnabled = true - let mainButtonTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleMainButtonTapped)) - mainButton.addGestureRecognizer(mainButtonTapGestureRecognizer) let joinOpenGroupButtonTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleJoinOpenGroupButtonTapped)) joinOpenGroupButton.addGestureRecognizer(joinOpenGroupButtonTapGestureRecognizer) let createNewPrivateChatButtonTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleCreateNewPrivateChatButtonTapped)) @@ -60,7 +58,6 @@ final class NewConversationButtonSet : UIView { } // MARK: Interaction - @objc private func handleMainButtonTapped() { expand(isUserDragging: false) } @objc private func handleJoinOpenGroupButtonTapped() { delegate?.joinOpenGroup() } @objc private func handleCreateNewPrivateChatButtonTapped() { delegate?.createNewPrivateChat() } @objc private func handleCreateNewClosedGroupButtonTapped() { delegate?.createNewClosedGroup() } @@ -161,7 +158,7 @@ final class NewConversationButtonSet : UIView { self.layoutIfNeeded() button.frame = frame button.layer.cornerRadius = size / 2 - button.addGlow(ofSize: size) + button.setGlow(to: size, with: Colors.newConversationButtonShadow) button.backgroundColor = Colors.accent } } @@ -185,7 +182,7 @@ final class NewConversationButtonSet : UIView { self.layoutIfNeeded() button.frame = frame button.layer.cornerRadius = size / 2 - button.removeGlow() + button.setGlow(to: size, with: UIColor.black) button.backgroundColor = Colors.newConversationButtonCollapsedBackground } } @@ -229,9 +226,9 @@ private final class NewConversationButton : UIImageView { private func setUpViewHierarchy() { backgroundColor = isMainButton ? Colors.accent : Colors.newConversationButtonCollapsedBackground - let size = isMainButton ? Values.newConversationButtonExpandedSize : Values.newConversationButtonCollapsedSize + let size = Values.newConversationButtonCollapsedSize layer.cornerRadius = size / 2 - if isMainButton { addGlow(ofSize: size) } + if isMainButton { setGlow(to: size, with: Colors.newConversationButtonShadow) } layer.masksToBounds = false image = icon contentMode = .center @@ -240,21 +237,13 @@ private final class NewConversationButton : UIImageView { } // General - func addGlow(ofSize size: CGFloat) { + func setGlow(to size: CGFloat, with color: UIColor) { layer.shadowPath = UIBezierPath(ovalIn: CGRect(origin: CGPoint(x: 0, y: 0), size: CGSize(width: size, height: size))).cgPath - layer.shadowColor = Colors.newConversationButtonShadow.cgColor + layer.shadowColor = color.cgColor layer.shadowOffset = CGSize(width: 0, height: 0.8) layer.shadowOpacity = 1 layer.shadowRadius = 6 } - - func removeGlow() { - layer.shadowPath = nil - layer.shadowColor = nil - layer.shadowOffset = CGSize.zero - layer.shadowOpacity = 0 - layer.shadowRadius = 0 - } } // MARK: Convenience diff --git a/Signal/src/Loki/Style Guide/Values.swift b/Signal/src/Loki/Style Guide/Values.swift index 257e98d5e..4044456b6 100644 --- a/Signal/src/Loki/Style Guide/Values.swift +++ b/Signal/src/Loki/Style Guide/Values.swift @@ -30,8 +30,8 @@ final class Values : NSObject { @objc static let borderThickness = CGFloat(1) @objc static let conversationCellStatusIndicatorSize = CGFloat(14) @objc static let searchBarHeight = CGFloat(36) - @objc static let newConversationButtonCollapsedSize = CGFloat(48) - @objc static let newConversationButtonExpandedSize = CGFloat(60) + @objc static let newConversationButtonCollapsedSize = CGFloat(60) + @objc static let newConversationButtonExpandedSize = CGFloat(72) @objc static let textFieldHeight = isSmallScreen ? CGFloat(48) : CGFloat(80) @objc static let textFieldCornerRadius = CGFloat(8) @objc static let separatorLabelHeight = CGFloat(24) diff --git a/Signal/src/Loki/View Controllers/DeviceLinkingModal.swift b/Signal/src/Loki/View Controllers/DeviceLinkingModal.swift index a2853b9da..31a33d0ab 100644 --- a/Signal/src/Loki/View Controllers/DeviceLinkingModal.swift +++ b/Signal/src/Loki/View Controllers/DeviceLinkingModal.swift @@ -168,6 +168,9 @@ final class DeviceLinkingModal : Modal, DeviceLinkingSessionDelegate { SSKEnvironment.shared.syncManager.syncAllContacts() SSKEnvironment.shared.syncManager.syncAllGroups() SSKEnvironment.shared.syncManager.syncAllOpenGroups() + let thread = TSContactThread.getOrCreateThread(contactId: deviceLink.slave.hexEncodedPublicKey) + thread.friendRequestStatus = .friends + thread.save() }) { _ in print("[Loki] Failed to send device link authorization message.") } diff --git a/Signal/src/Loki/View Controllers/HomeVC.swift b/Signal/src/Loki/View Controllers/HomeVC.swift index a509a24a0..5b8f262ae 100644 --- a/Signal/src/Loki/View Controllers/HomeVC.swift +++ b/Signal/src/Loki/View Controllers/HomeVC.swift @@ -259,7 +259,13 @@ final class HomeVC : UIViewController, UITableViewDataSource, UITableViewDelegat profilePictureView.set(.height, to: profilePictureSize) let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(openSettings)) profilePictureView.addGestureRecognizer(tapGestureRecognizer) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: profilePictureView) + let profilePictureViewContainer = UIView() + profilePictureViewContainer.addSubview(profilePictureView) + profilePictureView.pin(.leading, to: .leading, of: profilePictureViewContainer, withInset: 4) + profilePictureView.pin(.top, to: .top, of: profilePictureViewContainer) + profilePictureView.pin(.trailing, to: .trailing, of: profilePictureViewContainer) + profilePictureView.pin(.bottom, to: .bottom, of: profilePictureViewContainer) + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: profilePictureViewContainer) } // MARK: Interaction diff --git a/SignalServiceKit/src/Loki/API/LokiAPI.swift b/SignalServiceKit/src/Loki/API/LokiAPI.swift index 656a9fd65..fabf5e6df 100644 --- a/SignalServiceKit/src/Loki/API/LokiAPI.swift +++ b/SignalServiceKit/src/Loki/API/LokiAPI.swift @@ -122,7 +122,7 @@ public final class LokiAPI : NSObject { public static func getDestinations(for hexEncodedPublicKey: String) -> Promise<[Destination]> { var result: Promise<[Destination]>! - storage.dbReadConnection.readWrite { transaction in + storage.dbReadWriteConnection.readWrite { transaction in result = getDestinations(for: hexEncodedPublicKey, in: transaction) } return result diff --git a/SignalServiceKit/src/Messages/OWSMessageHandler.m b/SignalServiceKit/src/Messages/OWSMessageHandler.m index eb0853815..d56e30afc 100644 --- a/SignalServiceKit/src/Messages/OWSMessageHandler.m +++ b/SignalServiceKit/src/Messages/OWSMessageHandler.m @@ -172,6 +172,10 @@ NSString *envelopeAddress(SSKProtoEnvelope *envelope) [description appendString:verifiedString]; } else if (syncMessage.contacts) { [description appendString:@"Contacts"]; + } else if (syncMessage.groups) { + [description appendString:@"ClosedGroups"]; + } else if (syncMessage.openGroups) { + [description appendString:@"OpenGroups"]; } else { [description appendString:@"Unknown"]; } diff --git a/SignalServiceKit/src/Messages/OWSMessageManager.m b/SignalServiceKit/src/Messages/OWSMessageManager.m index bf39441cd..16ea7fd0b 100644 --- a/SignalServiceKit/src/Messages/OWSMessageManager.m +++ b/SignalServiceKit/src/Messages/OWSMessageManager.m @@ -1089,8 +1089,19 @@ NS_ASSUME_NONNULL_BEGIN case LKThreadFriendRequestStatusNone: { OWSMessageSender *messageSender = SSKEnvironment.shared.messageSender; LKFriendRequestMessage *automatedFriendRequestMessage = [messageSender getMultiDeviceFriendRequestMessageForHexEncodedPublicKey:hexEncodedPublicKey transaction:transaction]; - [automatedFriendRequestMessage saveWithTransaction:transaction]; - [self.messageSenderJobQueue addMessage:automatedFriendRequestMessage transaction:transaction]; + thread.isForceHidden = true; + [thread saveWithTransaction:transaction]; + [messageSender sendMessage:automatedFriendRequestMessage + success:^{ + [automatedFriendRequestMessage remove]; + thread.isForceHidden = false; + [thread save]; + } + failure:^(NSError *error) { + [automatedFriendRequestMessage remove]; + thread.isForceHidden = false; + [thread save]; + }]; break; } case LKThreadFriendRequestStatusRequestReceived: { diff --git a/SignalServiceKit/src/Messages/OWSMessageSender.m b/SignalServiceKit/src/Messages/OWSMessageSender.m index 388229e78..6b2e8096d 100644 --- a/SignalServiceKit/src/Messages/OWSMessageSender.m +++ b/SignalServiceKit/src/Messages/OWSMessageSender.m @@ -988,9 +988,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException"; BOOL isGroupMessage = messageSend.thread.isGroupThread; BOOL isPublicChatMessage = isGroupMessage && ((TSGroupThread *)messageSend.thread).isPublicChat; BOOL isDeviceLinkMessage = [message isKindOfClass:LKDeviceLinkMessage.class]; - BOOL isUnlinkDeviceMessage = [message isKindOfClass:LKUnlinkDeviceMessage.class]; - // FIXME: Clean this up - if (isPublicChatMessage || isDeviceLinkMessage || isUnlinkDeviceMessage) { + if (isPublicChatMessage || isDeviceLinkMessage) { [self sendMessage:messageSend]; } else { BOOL isSilentMessage = message.isSilent || [message isKindOfClass:LKEphemeralMessage.class] || [message isKindOfClass:OWSOutgoingSyncMessage.class]; diff --git a/SignalServiceKit/src/Protos/Generated/SignalService.pb.swift b/SignalServiceKit/src/Protos/Generated/SignalService.pb.swift index 44f689eed..0ae7a2464 100644 --- a/SignalServiceKit/src/Protos/Generated/SignalService.pb.swift +++ b/SignalServiceKit/src/Protos/Generated/SignalService.pb.swift @@ -4348,6 +4348,7 @@ extension SignalServiceProtos_SyncMessage: SwiftProtobuf.Message, SwiftProtobuf. 7: .same(proto: "verified"), 9: .same(proto: "configuration"), 8: .same(proto: "padding"), + 100: .same(proto: "openGroups"), ] fileprivate class _StorageClass {