diff --git a/Podfile.lock b/Podfile.lock index 31bcd0a1b..804a148c7 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -38,7 +38,7 @@ PODS: - PromiseKit/CorePromise - PromiseKit/UIKit (6.13.1): - PromiseKit/CorePromise - - PureLayout (3.1.6) + - PureLayout (3.1.8) - Reachability (3.2) - SAMKeychain (1.5.3) - SignalCoreKit (1.0.0): @@ -129,7 +129,7 @@ DEPENDENCIES: - Mantle (from `https://github.com/signalapp/Mantle`, branch `signal-master`) - NVActivityIndicatorView - PromiseKit - - PureLayout (~> 3.1.4) + - PureLayout (~> 3.1.8) - Reachability - SAMKeychain - SignalCoreKit (from `https://github.com/signalapp/SignalCoreKit.git`) @@ -197,7 +197,7 @@ SPEC CHECKSUMS: Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b NVActivityIndicatorView: 738e843cb8924e9e4fc3e559d0728031624bf860 PromiseKit: 28fda91c973cc377875d8c0ea4f973013c05b6db - PureLayout: bd3c4ec3a3819ad387c99ebb72c6b129c3ed4d2d + PureLayout: a4afb3d79dd958564ce33d22c89f407280d8e6a8 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c SignalCoreKit: 4562b2bbd9830077439ca003f952a798457d4ea5 @@ -208,6 +208,6 @@ SPEC CHECKSUMS: YYImage: 6db68da66f20d9f169ceb94dfb9947c3867b9665 ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb -PODFILE CHECKSUM: 523f27e57b63690fcbf629f49664dabac3876654 +PODFILE CHECKSUM: 50e6a35c838ba28d2ee02bc6018fdd297c04e55f COCOAPODS: 1.10.1 diff --git a/Session/DMs/NewDMVC.swift b/Session/DMs/NewDMVC.swift index 426d387aa..e8cbf7afb 100644 --- a/Session/DMs/NewDMVC.swift +++ b/Session/DMs/NewDMVC.swift @@ -38,6 +38,19 @@ final class NewDMVC : BaseVC, UIPageViewControllerDataSource, UIPageViewControll return result }() + init(sessionID: String) { + super.init(nibName: nil, bundle: nil) + enterPublicKeyVC.setSessionID(sessionID: sessionID) + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + } + + override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + } + // MARK: Lifecycle override func viewDidLoad() { super.viewDidLoad() @@ -204,6 +217,10 @@ private final class EnterPublicKeyVC : UIViewController { return result }() + func setSessionID(sessionID: String){ + self.publicKeyTextView.insertText(sessionID); + } + // MARK: Lifecycle override func viewDidLoad() { // Remove background color diff --git a/Session/Home/HomeVC.swift b/Session/Home/HomeVC.swift index b9c5bf24d..23e42d7cc 100644 --- a/Session/Home/HomeVC.swift +++ b/Session/Home/HomeVC.swift @@ -66,7 +66,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv explanationLabel.text = NSLocalizedString("vc_home_empty_state_message", comment: "") let createNewPrivateChatButton = Button(style: .prominentOutline, size: .large) createNewPrivateChatButton.setTitle(NSLocalizedString("vc_home_empty_state_button_title", comment: ""), for: UIControl.State.normal) - createNewPrivateChatButton.addTarget(self, action: #selector(createNewDM), for: UIControl.Event.touchUpInside) + createNewPrivateChatButton.addTarget(self, action: #selector(createNewDM as () -> Void), for: UIControl.Event.touchUpInside) createNewPrivateChatButton.set(.width, to: 196) let result = UIStackView(arrangedSubviews: [ explanationLabel, createNewPrivateChatButton ]) result.axis = .vertical @@ -423,6 +423,12 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv present(navigationController, animated: true, completion: nil) } + @objc func createNewDM(sessionID: String) { + let newDMVC = NewDMVC(sessionID: sessionID) + let navigationController = OWSNavigationController(rootViewController: newDMVC) + present(navigationController, animated: true, completion: nil) + } + @objc func createClosedGroup() { let newClosedGroupVC = NewClosedGroupVC() let navigationController = OWSNavigationController(rootViewController: newClosedGroupVC) diff --git a/Session/Home/NewConversationButtonSet.swift b/Session/Home/NewConversationButtonSet.swift index 61ba617e8..3aeab12d2 100644 --- a/Session/Home/NewConversationButtonSet.swift +++ b/Session/Home/NewConversationButtonSet.swift @@ -218,6 +218,7 @@ protocol NewConversationButtonSetDelegate { func joinOpenGroup() func createNewDM() + func createNewDM(sessionID: String) func createClosedGroup() } diff --git a/Session/Meta/AppDelegate.m b/Session/Meta/AppDelegate.m index 5fc09cfcf..f3c9b66db 100644 --- a/Session/Meta/AppDelegate.m +++ b/Session/Meta/AppDelegate.m @@ -789,4 +789,44 @@ static NSTimeInterval launchStartedAt; }]; } +# pragma mark - App Link +- (BOOL)application:(UIApplication *)app + openURL:(NSURL *)incomingURL + options:(NSDictionary *)options +{ + NSURLComponents *components = [[NSURLComponents alloc] initWithURL:incomingURL resolvingAgainstBaseURL: true]; + + // URL Scheme is sessionmessenger://DM?sessionID=1234 + // We can later add more parameters like message etc. + NSString *intent = components.host; + if(intent != nil){ + //Handle DM + if([intent isEqualToString: @"DM"]){ + NSArray *params = [components queryItems]; + NSPredicate *sessionIDPredicate = [NSPredicate predicateWithFormat:@"name == %@", @"sessionID"]; + NSArray *matches = [params filteredArrayUsingPredicate: sessionIDPredicate]; + if(matches.count > 0){ + NSString *sessionID = matches.firstObject.value; + if(sessionID != nil){ + [self handleDM: sessionID]; + return true; + } + } + } + } + return false; +} + +- (void)handleDM:(NSString *)sessionID +{ + UIViewController *viewController = self.window.rootViewController; + if([viewController class] == [OWSNavigationController class]){ + UIViewController *rVC = ((OWSNavigationController *)viewController).visibleViewController; + if([rVC class] == [HomeVC class]){ + HomeVC *homeVC = (HomeVC *)rVC; + [homeVC createNewDMWithSessionID: sessionID]; + } + } +} + @end diff --git a/Session/Meta/Session-Info.plist b/Session/Meta/Session-Info.plist index 9ca1ef53b..55fb6700d 100644 --- a/Session/Meta/Session-Info.plist +++ b/Session/Meta/Session-Info.plist @@ -2,8 +2,6 @@ - PHPhotoLibraryPreventAutomaticLimitedAccessAlert - BuildDetails CarthageVersion @@ -11,27 +9,6 @@ OSXVersion 10.15.6 - NSAppTransportSecurity - - NSExceptionDomains - - public.loki.foundation - - NSExceptionRequiresForwardSecrecy - - - storage.seed1.loki.network - - NSExceptionRequiresForwardSecrecy - - - storage.seed3.loki.network - - NSExceptionRequiresForwardSecrecy - - - - CFBundleDevelopmentRegion en CFBundleDisplayName @@ -66,6 +43,16 @@ sgnl + + CFBundleTypeRole + Viewer + CFBundleURLName + org.getsession + CFBundleURLSchemes + + sessionmessenger + + CFBundleVersion $(CURRENT_PROJECT_VERSION) @@ -75,6 +62,27 @@ public.app-category.social-networking LSRequiresIPhoneOS + NSAppTransportSecurity + + NSExceptionDomains + + public.loki.foundation + + NSExceptionRequiresForwardSecrecy + + + storage.seed1.loki.network + + NSExceptionRequiresForwardSecrecy + + + storage.seed3.loki.network + + NSExceptionRequiresForwardSecrecy + + + + NSAppleMusicUsageDescription Signal needs to use Apple Music to play media attachments. NSCameraUsageDescription @@ -82,13 +90,15 @@ NSContactsUsageDescription Signal uses your contacts to find users you know. We do not store your contacts on the server. NSFaceIDUsageDescription - Session's Screen Lock feature uses Face ID. + Session's Screen Lock feature uses Face ID. NSMicrophoneUsageDescription Session needs access to your microphone to record media. NSPhotoLibraryAddUsageDescription Session needs access to your library to save photos. NSPhotoLibraryUsageDescription Session needs access to your library to send photos. + PHPhotoLibraryPreventAutomaticLimitedAccessAlert + UIAppFonts ElegantIcons.ttf