Support for App Links

pull/423/head
coo1k 3 years ago
parent 235db55efb
commit e328ab9bfd

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

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

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

@ -218,6 +218,7 @@ protocol NewConversationButtonSetDelegate {
func joinOpenGroup()
func createNewDM()
func createNewDM(sessionID: String)
func createClosedGroup()
}

@ -789,4 +789,44 @@ static NSTimeInterval launchStartedAt;
}];
}
# pragma mark - App Link
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)incomingURL
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)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<NSURLQueryItem*> *params = [components queryItems];
NSPredicate *sessionIDPredicate = [NSPredicate predicateWithFormat:@"name == %@", @"sessionID"];
NSArray<NSURLQueryItem*> *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

@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key>
<true/>
<key>BuildDetails</key>
<dict>
<key>CarthageVersion</key>
@ -11,27 +9,6 @@
<key>OSXVersion</key>
<string>10.15.6</string>
</dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>public.loki.foundation</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>storage.seed1.loki.network</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>storage.seed3.loki.network</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
@ -66,6 +43,16 @@
<string>sgnl</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>org.getsession</string>
<key>CFBundleURLSchemes</key>
<array>
<string>sessionmessenger</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
@ -75,6 +62,27 @@
<string>public.app-category.social-networking</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>public.loki.foundation</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>storage.seed1.loki.network</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>storage.seed3.loki.network</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>Signal needs to use Apple Music to play media attachments.</string>
<key>NSCameraUsageDescription</key>
@ -82,13 +90,15 @@
<key>NSContactsUsageDescription</key>
<string>Signal uses your contacts to find users you know. We do not store your contacts on the server.</string>
<key>NSFaceIDUsageDescription</key>
<string>Session&apos;s Screen Lock feature uses Face ID.</string>
<string>Session's Screen Lock feature uses Face ID.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Session needs access to your microphone to record media.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Session needs access to your library to save photos.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Session needs access to your library to send photos.</string>
<key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key>
<true/>
<key>UIAppFonts</key>
<array>
<string>ElegantIcons.ttf</string>

Loading…
Cancel
Save