mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge pull request #424 from oxen-io/deep-linking
Support Basic Deep Linking
This commit is contained in:
commit
c375dee5e3
|
@ -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(to: sessionID)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
}
|
||||
|
||||
override init(nibName: String?, bundle: Bundle?) {
|
||||
super.init(nibName: nibName, bundle: bundle)
|
||||
}
|
||||
|
||||
// MARK: Lifecycle
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
@ -260,6 +273,10 @@ private final class EnterPublicKeyVC : UIViewController {
|
|||
}
|
||||
|
||||
// MARK: General
|
||||
func setSessionID(to sessionID: String){
|
||||
publicKeyTextView.text = sessionID
|
||||
}
|
||||
|
||||
func constrainHeight(to height: CGFloat) {
|
||||
view.set(.height, to: height)
|
||||
}
|
||||
|
|
|
@ -385,11 +385,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv
|
|||
} else if let thread = thread as? TSGroupThread, thread.isClosedGroup == true {
|
||||
let groupID = thread.groupModel.groupId
|
||||
let groupPublicKey = LKGroupUtilities.getDecodedGroupID(groupID)
|
||||
do {
|
||||
try MessageSender.leave(groupPublicKey, using: transaction)
|
||||
} catch {
|
||||
// TODO: Handle
|
||||
}
|
||||
MessageSender.leave(groupPublicKey, using: transaction).retainUntilComplete()
|
||||
thread.removeAllThreadInteractions(with: transaction)
|
||||
thread.remove(with: transaction)
|
||||
} else {
|
||||
|
@ -423,6 +419,13 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv
|
|||
present(navigationController, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
@objc(createNewDMFromDeepLink:)
|
||||
func createNewDMFromDeepLink(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)
|
||||
|
|
|
@ -789,4 +789,38 @@ static NSTimeInterval launchStartedAt;
|
|||
}];
|
||||
}
|
||||
|
||||
# pragma mark - App Link
|
||||
|
||||
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
|
||||
{
|
||||
NSURLComponents *components = [[NSURLComponents alloc] initWithURL:url 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 && [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;
|
||||
[self createNewDMFromDeepLink:sessionID];
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)createNewDMFromDeepLink:(NSString *)sessionID
|
||||
{
|
||||
UIViewController *viewController = self.window.rootViewController;
|
||||
if ([viewController class] == [OWSNavigationController class]) {
|
||||
UIViewController *visibleVC = ((OWSNavigationController *)viewController).visibleViewController;
|
||||
if ([visibleVC isKindOfClass:HomeVC.class]) {
|
||||
HomeVC *homeVC = (HomeVC *)visibleVC;
|
||||
[homeVC createNewDMFromDeepLink: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'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…
Reference in a new issue