Improvements to user flow in in-app camera controllers.
• media library picker is now presented modally from in-app camera. • there's no more "Camera" button in media library picker.
This commit is contained in:
parent
f8824905c9
commit
4b876aec2c
@ -1,15 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "media-composer-camera-outline-28.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
@ -1,129 +0,0 @@
|
||||
%PDF-1.7
|
||||
|
||||
1 0 obj
|
||||
<< >>
|
||||
endobj
|
||||
|
||||
2 0 obj
|
||||
<< /Length 3 0 R >>
|
||||
stream
|
||||
/DeviceRGB CS
|
||||
/DeviceRGB cs
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 1.965088 2.899902 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
12.034847 16.100098 m
|
||||
15.034847 16.100098 17.534847 13.600098 17.534847 10.600098 c
|
||||
17.534847 7.600098 15.034847 5.100098 12.034847 5.100098 c
|
||||
9.034847 5.100098 6.534847 7.600098 6.534847 10.600098 c
|
||||
6.534847 13.600098 9.034847 16.100098 12.034847 16.100098 c
|
||||
12.034847 16.100098 l
|
||||
h
|
||||
12.034847 17.600098 m
|
||||
8.134847 17.600098 5.034847 14.500097 5.034847 10.600098 c
|
||||
5.034847 6.700098 8.134847 3.600098 12.034847 3.600098 c
|
||||
15.934847 3.600098 19.034847 6.700098 19.034847 10.600098 c
|
||||
19.034847 14.500097 15.934847 17.600098 12.034847 17.600098 c
|
||||
h
|
||||
14.734847 21.100098 m
|
||||
14.834847 21.100098 15.034846 21.000097 15.134847 20.900097 c
|
||||
17.034847 19.000097 l
|
||||
17.434847 18.600098 l
|
||||
18.934847 18.600098 l
|
||||
20.634848 18.600098 20.934847 18.400097 21.334846 18.200098 c
|
||||
21.734846 18.000097 22.034845 17.700098 22.234846 17.300098 c
|
||||
22.434847 17.000097 22.634848 16.600098 22.634848 14.900098 c
|
||||
22.634848 5.200098 l
|
||||
22.634848 3.500097 22.434847 3.200098 22.234846 2.800098 c
|
||||
22.034845 2.400099 21.734846 2.100098 21.334846 1.900097 c
|
||||
21.034847 1.700096 20.634848 1.500097 18.934847 1.500097 c
|
||||
5.134847 1.500097 l
|
||||
3.434847 1.500097 3.134847 1.700096 2.734847 1.900097 c
|
||||
2.334847 2.100098 2.034847 2.400099 1.834847 2.800098 c
|
||||
1.634847 3.100098 1.434847 3.500097 1.434847 5.200098 c
|
||||
1.434847 14.900098 l
|
||||
1.434847 16.600098 1.634847 17.000097 1.834847 17.300098 c
|
||||
2.034847 17.700098 2.334847 18.000097 2.734847 18.200098 c
|
||||
3.034847 18.400097 3.434847 18.600098 5.134847 18.600098 c
|
||||
6.634847 18.600098 l
|
||||
7.034847 19.000097 l
|
||||
8.834846 20.800098 l
|
||||
9.034847 21.000097 9.334847 21.100098 9.534847 21.100098 c
|
||||
14.734847 21.100098 l
|
||||
14.734847 21.100098 l
|
||||
h
|
||||
14.734847 22.600098 m
|
||||
9.634847 22.600098 l
|
||||
8.934847 22.600098 8.334846 22.300098 7.834847 21.900097 c
|
||||
6.034847 20.100098 l
|
||||
5.134847 20.100098 l
|
||||
4.134847 20.200098 3.034847 20.000097 2.134847 19.600098 c
|
||||
1.434847 19.200098 0.934847 18.700098 0.534847 18.000097 c
|
||||
0.034847 17.000097 -0.065153 16.000097 0.034847 14.900098 c
|
||||
0.034847 5.200098 l
|
||||
-0.065153 4.200098 0.134847 3.100098 0.534847 2.100098 c
|
||||
0.834847 1.500097 1.434847 0.900097 2.034847 0.600098 c
|
||||
3.034847 0.200098 4.034847 0.000097 5.134847 0.100098 c
|
||||
18.834846 0.100098 l
|
||||
19.934847 0.000097 21.034847 0.200098 21.934847 0.600098 c
|
||||
22.534847 0.900097 23.034847 1.400097 23.434847 2.100098 c
|
||||
23.934847 3.100098 24.034847 4.200098 23.934847 5.200098 c
|
||||
23.934847 14.900098 l
|
||||
24.034847 16.000097 23.834846 17.000097 23.434847 18.000097 c
|
||||
23.134848 18.600098 22.634848 19.200098 21.934847 19.500097 c
|
||||
20.934847 20.000097 19.834846 20.100098 18.834846 20.000097 c
|
||||
18.034847 20.000097 l
|
||||
16.134848 21.900097 l
|
||||
15.734848 22.400097 15.234847 22.600098 14.734847 22.600098 c
|
||||
h
|
||||
f*
|
||||
n
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
2785
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 28.000000 28.000000 ]
|
||||
/Resources 1 0 R
|
||||
/Contents 2 0 R
|
||||
/Parent 5 0 R
|
||||
>>
|
||||
endobj
|
||||
|
||||
5 0 obj
|
||||
<< /Kids [ 4 0 R ]
|
||||
/Count 1
|
||||
/Type /Pages
|
||||
>>
|
||||
endobj
|
||||
|
||||
6 0 obj
|
||||
<< /Pages 5 0 R
|
||||
/Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
|
||||
xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000034 00000 n
|
||||
0000002875 00000 n
|
||||
0000002898 00000 n
|
||||
0000003071 00000 n
|
||||
0000003145 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
3204
|
||||
%%EOF
|
||||
@ -8,7 +8,6 @@ import UIKit
|
||||
|
||||
protocol ImagePickerGridControllerDelegate: AnyObject {
|
||||
func imagePickerDidRequestSendMedia(_ imagePicker: ImagePickerGridController)
|
||||
func imagePickerDidRequestPresentCamera(_ imagePicker: ImagePickerGridController)
|
||||
func imagePickerDidCancel(_ imagePicker: ImagePickerGridController)
|
||||
|
||||
func imagePicker(_ imagePicker: ImagePickerGridController, didSelectAsset asset: PHAsset, attachmentPromise: Promise<SignalAttachment>)
|
||||
@ -37,7 +36,6 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
|
||||
private var titleView: TitleView!
|
||||
|
||||
private var bottomBar: UIView!
|
||||
private var cameraButton: CameraOverlayButton!
|
||||
private var doneButton: MediaDoneButton!
|
||||
|
||||
init() {
|
||||
@ -98,15 +96,6 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
|
||||
bottomBar.autoPinBottomToSuperviewMargin(withInset: UIDevice.current.hasIPhoneXNotch ? 0 : 8)
|
||||
bottomBar.autoPinHorizontalEdges(toEdgesOf: view)
|
||||
|
||||
cameraButton = CameraOverlayButton(image: UIImage(named: "media-composer-camera-outline-28"), userInterfaceStyleOverride: .light)
|
||||
cameraButton.addTarget(self, action: #selector(didTapCameraButton), for: .touchUpInside)
|
||||
bottomBar.addSubview(cameraButton)
|
||||
cameraButton.contentInsets = .zero
|
||||
cameraButton.autoSetDimensions(to: .square(40))
|
||||
cameraButton.autoPinLeadingToSuperviewMargin()
|
||||
cameraButton.autoPinTopToSuperviewMargin()
|
||||
cameraButton.autoPinBottomToSuperviewMargin()
|
||||
|
||||
doneButton = MediaDoneButton()
|
||||
doneButton.userInterfaceStyleOverride = .light
|
||||
doneButton.addTarget(self, action: #selector(didTapDoneButton), for: .touchUpInside)
|
||||
@ -337,11 +326,6 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
|
||||
self.delegate?.imagePickerDidCancel(self)
|
||||
}
|
||||
|
||||
@objc
|
||||
private func didTapCameraButton() {
|
||||
delegate?.imagePickerDidRequestPresentCamera(self)
|
||||
}
|
||||
|
||||
@objc
|
||||
private func didTapDoneButton() {
|
||||
delegate?.imagePickerDidRequestSendMedia(self)
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
import Foundation
|
||||
import Photos
|
||||
import SignalUI
|
||||
|
||||
@objc
|
||||
protocol SendMediaNavDelegate: AnyObject {
|
||||
@ -308,7 +309,11 @@ extension SendMediaNavigationController: PhotoCaptureViewControllerDelegate {
|
||||
guard isGranted else { return }
|
||||
|
||||
BenchEventStart(title: "Show-Media-Library", eventId: "Show-Media-Library")
|
||||
self.fadeTo(viewControllers: [self.mediaLibraryViewController], duration: 0.3)
|
||||
let presentedViewController = OWSNavigationController(rootViewController: self.mediaLibraryViewController)
|
||||
if let owsNavBar = presentedViewController.navigationBar as? OWSNavigationBar {
|
||||
owsNavBar.switchToStyle(.alwaysDarkAndClear)
|
||||
}
|
||||
self.presentFullScreen(presentedViewController, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,19 +343,23 @@ extension SendMediaNavigationController: PhotoCaptureViewControllerDataSource {
|
||||
extension SendMediaNavigationController: ImagePickerGridControllerDelegate {
|
||||
|
||||
func imagePickerDidRequestSendMedia(_ imagePicker: ImagePickerGridController) {
|
||||
if let navigationController = presentedViewController as? OWSNavigationController,
|
||||
navigationController.viewControllers.contains(imagePicker) {
|
||||
dismiss(animated: true) {
|
||||
self.showApprovalAfterProcessingAnyMediaLibrarySelections()
|
||||
}
|
||||
return
|
||||
}
|
||||
showApprovalAfterProcessingAnyMediaLibrarySelections()
|
||||
}
|
||||
|
||||
func imagePickerDidRequestPresentCamera(_ imagePicker: ImagePickerGridController) {
|
||||
self.ows_askForCameraPermissions { isGranted in
|
||||
guard isGranted else { return }
|
||||
|
||||
BenchEventStart(title: "Show-Camera", eventId: "Show-Camera")
|
||||
self.fadeTo(viewControllers: [self.captureViewController], duration: 0.3)
|
||||
}
|
||||
}
|
||||
|
||||
func imagePickerDidCancel(_ imagePicker: ImagePickerGridController) {
|
||||
if let navigationController = presentedViewController as? OWSNavigationController,
|
||||
navigationController.viewControllers.contains(imagePicker) {
|
||||
dismiss(animated: true)
|
||||
return
|
||||
}
|
||||
|
||||
let dontAbandonText = NSLocalizedString("SEND_MEDIA_RETURN_TO_MEDIA_LIBRARY", comment: "alert action when the user decides not to cancel the media flow after all.")
|
||||
didRequestExit(dontAbandonText: dontAbandonText)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user