From e5c6e74596b970e910468642419c369097ac0982 Mon Sep 17 00:00:00 2001 From: ericholguin Date: Sat, 28 Oct 2023 20:25:18 -0600 Subject: [PATCH] ui: change post view background to be all black Changelog-Changed: made post view background all black and adjust spacing between image and camera buttons --- .../Base.lproj/MainInterface.storyboard | 24 +++++++++++++++ .../DamusShareExtension.entitlements | 10 +++++++ DamusShareExtension/Info.plist | 18 +++++++++++ DamusShareExtension/ShareViewController.swift | 30 +++++++++++++++++++ damus/Views/PostView.swift | 3 +- damus/Views/TextViewWrapper.swift | 1 + 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 DamusShareExtension/Base.lproj/MainInterface.storyboard create mode 100644 DamusShareExtension/DamusShareExtension.entitlements create mode 100644 DamusShareExtension/Info.plist create mode 100644 DamusShareExtension/ShareViewController.swift diff --git a/DamusShareExtension/Base.lproj/MainInterface.storyboard b/DamusShareExtension/Base.lproj/MainInterface.storyboard new file mode 100644 index 0000000000..286a50894d --- /dev/null +++ b/DamusShareExtension/Base.lproj/MainInterface.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DamusShareExtension/DamusShareExtension.entitlements b/DamusShareExtension/DamusShareExtension.entitlements new file mode 100644 index 0000000000..ee95ab7e58 --- /dev/null +++ b/DamusShareExtension/DamusShareExtension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + + diff --git a/DamusShareExtension/Info.plist b/DamusShareExtension/Info.plist new file mode 100644 index 0000000000..4b1f7e7057 --- /dev/null +++ b/DamusShareExtension/Info.plist @@ -0,0 +1,18 @@ + + + + + NSExtension + + NSExtensionAttributes + + NSExtensionActivationRule + TRUEPREDICATE + + NSExtensionMainStoryboard + MainInterface + NSExtensionPointIdentifier + com.apple.share-services + + + diff --git a/DamusShareExtension/ShareViewController.swift b/DamusShareExtension/ShareViewController.swift new file mode 100644 index 0000000000..4dc3370015 --- /dev/null +++ b/DamusShareExtension/ShareViewController.swift @@ -0,0 +1,30 @@ +// +// ShareViewController.swift +// DamusShareExtension +// +// Created by eric on 10/28/23. +// + +import UIKit +import Social + +class ShareViewController: SLComposeServiceViewController { + + override func isContentValid() -> Bool { + // Do validation of contentText and/or NSExtensionContext attachments here + return true + } + + override func didSelectPost() { + // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments. + + // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context. + self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil) + } + + override func configurationItems() -> [Any]! { + // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here. + return [] + } + +} diff --git a/damus/Views/PostView.swift b/damus/Views/PostView.swift index c276b7cf8a..3557383999 100644 --- a/damus/Views/PostView.swift +++ b/damus/Views/PostView.swift @@ -154,7 +154,7 @@ struct PostView: View { } var AttachmentBar: some View { - HStack(alignment: .center) { + HStack(alignment: .center, spacing: 15) { ImageButton CameraButton } @@ -428,6 +428,7 @@ struct PostView: View { } } } + .background(DamusColors.adaptableWhite.edgesIgnoringSafeArea(.all)) .sheet(isPresented: $attach_media) { ImagePicker(uploader: damus_state.settings.default_media_uploader, sourceType: .photoLibrary, pubkey: damus_state.pubkey, image_upload_confirm: $image_upload_confirm) { img in self.mediaToUpload = .image(img) diff --git a/damus/Views/TextViewWrapper.swift b/damus/Views/TextViewWrapper.swift index 35434d898c..f988974d2f 100644 --- a/damus/Views/TextViewWrapper.swift +++ b/damus/Views/TextViewWrapper.swift @@ -19,6 +19,7 @@ struct TextViewWrapper: UIViewRepresentable { func makeUIView(context: Context) -> UITextView { let textView = UITextView() + textView.backgroundColor = UIColor(DamusColors.adaptableWhite) textView.delegate = context.coordinator // Disable scrolling (this view will expand vertically as needed to fit text)