Merge branch 'dev' of github.com:loki-project/session-ios into dev

This commit is contained in:
Niels Andriesse 2020-03-10 10:22:11 +11:00
commit ee38b3f1ae
14 changed files with 119 additions and 33 deletions

View file

@ -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

View file

@ -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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
C3DFFAC723E970080058DAF8 /* OpenGroupSuggestionSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenGroupSuggestionSheet.swift; sourceTree = "<group>"; };
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;

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>43512467490-f04dj1ssk2medqq3t33odidvmi9bi9ob.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.43512467490-f04dj1ssk2medqq3t33odidvmi9bi9ob</string>
<key>API_KEY</key>
<string>AIzaSyDgnrhH4AtRrZXuRIeVMLAs7UhqGTTsVdQ</string>
<key>GCM_SENDER_ID</key>
<string>43512467490</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.loki-project.loki-messenger</string>
<key>PROJECT_ID</key>
<string>loki-5a81e</string>
<key>STORAGE_BUCKET</key>
<string>loki-5a81e.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:43512467490:ios:d1592446dbc04e6e19ba7b</string>
<key>DATABASE_URL</key>
<string>https://loki-5a81e.firebaseio.com</string>
</dict>
</plist>

View file

@ -5,15 +5,15 @@
<key>BuildDetails</key>
<dict>
<key>CarthageVersion</key>
<string>0.34.0</string>
<string>0.33.0</string>
<key>DateTime</key>
<string>Tue Mar 3 05:11:41 UTC 2020</string>
<string>Fri Mar 6 00:51:56 UTC 2020</string>
<key>OSXVersion</key>
<string>10.15.3</string>
<key>WebRTCCommit</key>
<string>1445d719bf05280270e9f77576f80f973fd847f8 M73</string>
<key>XCodeVersion</key>
<string>1100.1120</string>
<string>1100.1130</string>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>

View file

@ -46,6 +46,7 @@
#import <SignalServiceKit/TSSocketManager.h>
#import <YapDatabase/YapDatabaseCryptoUtils.h>
#import <sys/utsname.h>
#import <FirebaseCore/FirebaseCore.h>
@import WebRTC;
@import Intents;
@ -58,6 +59,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
static NSTimeInterval launchStartedAt;
static BOOL isInternalTestVersion = NO;
@interface AppDelegate () <UNUserNotificationCenterDelegate>
@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;
}

View file

@ -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

View file

@ -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)

View file

@ -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.")
}

View file

@ -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

View file

@ -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

View file

@ -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"];
}

View file

@ -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: {

View file

@ -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];

View file

@ -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 {