diff --git a/Icro-Share/ShareViewController.swift b/Icro-Share/ShareViewController.swift
index 65d7902..a14870b 100644
--- a/Icro-Share/ShareViewController.swift
+++ b/Icro-Share/ShareViewController.swift
@@ -56,14 +56,13 @@ import Client
}
private func openCompose(for viewModel: ComposeViewModel) {
- let navigationController = UINavigationController(nibName: nil, bundle: nil)
- let composeView = ComposeView(viewModel: viewModel)
+ var composeView = ComposeView(viewModel: viewModel)
+ composeView.didClose = { [weak self] in
+ self?.extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
+ }
+
let composeViewController = UIHostingController(rootView: composeView)
-// composeViewController.didClose = { [weak self] in
-// self?.extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
-// }
- navigationController.viewControllers = [composeViewController]
- add(navigationController, view: view)
+ add(composeViewController, view: view)
}
}
@@ -82,53 +81,3 @@ import Client
removeFromParent()
}
}
-
-private class EmptyItemNavigator: ItemNavigatorProtocol {
- func showLogin() {
-
- }
-
- func open(url: URL) {
-
- }
-
- func open(author: Author) {
-
- }
-
- func open(authorName: String) {
-
- }
-
- func openFollowing(for user: Author) {
-
- }
-
- func openConversation(item: Item) {
-
- }
-
- func openMedia(media: [Media], index: Int) {
-
- }
-
- func openReply(item: Item) {
-
- }
-
- func share(item: Item, sourceView: UIView?) {
-
- }
-
- func accessibilityPresentLinks(linkList: [(text: String, url: URL)], message: String, sourceView: UIView) {
-
- }
-
- func openMore(item: Item, sourceView: UIView?) {
-
- }
-
- func showDiscoveryCategories(categories: [DiscoveryCategory], sourceView: UIView) {
-
- }
-}
diff --git a/Icro.xcodeproj/project.pbxproj b/Icro.xcodeproj/project.pbxproj
index 90d96be..1090ecd 100644
--- a/Icro.xcodeproj/project.pbxproj
+++ b/Icro.xcodeproj/project.pbxproj
@@ -95,6 +95,7 @@
C5046551274F794A0004B812 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = C5046550274F794A0004B812 /* Kingfisher */; };
C5046553274F795A0004B812 /* Sourceful in Frameworks */ = {isa = PBXBuildFile; productRef = C5046552274F795A0004B812 /* Sourceful */; };
C51F8480267F1FFB002A018E /* Client in Frameworks */ = {isa = PBXBuildFile; productRef = C51F847F267F1FFB002A018E /* Client */; };
+ C527CEAE2770526F0086397A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = BF707E762131C45600506E64 /* Localizable.strings */; };
C5282B932764AC47004F5106 /* ComposeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5282B922764AC47004F5106 /* ComposeView.swift */; };
C5282B942764AC47004F5106 /* ComposeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5282B922764AC47004F5106 /* ComposeView.swift */; };
C5282B972764ADD8004F5106 /* HighlightedTextEditor in Frameworks */ = {isa = PBXBuildFile; productRef = C5282B962764ADD8004F5106 /* HighlightedTextEditor */; };
@@ -1231,6 +1232,7 @@
buildActionMask = 2147483647;
files = (
5BC1384721C639160040353C /* Assets.xcassets in Resources */,
+ C527CEAE2770526F0086397A /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Icro.xcodeproj/xcuserdata/martinhartl.xcuserdatad/xcschemes/xcschememanagement.plist b/Icro.xcodeproj/xcuserdata/martinhartl.xcuserdatad/xcschemes/xcschememanagement.plist
index 59a5781..9daf2f6 100644
--- a/Icro.xcodeproj/xcuserdata/martinhartl.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/Icro.xcodeproj/xcuserdata/martinhartl.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -12,7 +12,7 @@
Icro-Next.xcscheme_^#shared#^_
orderHint
- 4
+ 5
Icro-Share.xcscheme_^#shared#^_
diff --git a/IcroUIKit/ViewController/ComposeView.swift b/IcroUIKit/ViewController/ComposeView.swift
index 22958b8..a7dbc4f 100644
--- a/IcroUIKit/ViewController/ComposeView.swift
+++ b/IcroUIKit/ViewController/ComposeView.swift
@@ -23,6 +23,8 @@ struct ComposeView: View {
@State var insertLinkActive = false
@State var insertImageURLActive = false
+ var didClose: (() -> Void)?
+
init(viewModel: ComposeViewModel) {
self.viewModel = viewModel
}
@@ -85,7 +87,7 @@ struct ComposeView: View {
.navigationBarItems(
leading:
Button(NSLocalizedString("COMPOSEVIEWCONTROLLER_CANCELBUTTON_TITLE", comment: "")) {
- dismiss()
+ dismissView()
}, trailing:
HStack {
if viewModel.uploading {
@@ -99,7 +101,7 @@ struct ComposeView: View {
viewController.showError(error: error, position: .top)
}
} else {
- dismiss()
+ dismissView()
}
})
}
@@ -120,7 +122,7 @@ struct ComposeView: View {
viewController.showError(error: error, position: .top)
}
} else {
- dismiss()
+ dismissView()
}
})
}
@@ -144,6 +146,11 @@ struct ComposeView: View {
return view
}
+ func dismissView() {
+ didClose?()
+ dismiss()
+ }
+
var insertLinkView: InsertLinkView {
InsertLinkView { title, url in
insertLinkActive = false
@@ -171,7 +178,7 @@ private struct ReplyView: View {
var body: some View {
VStack(alignment: .leading) {
ItemView(item: item)
- Text("COMPOSEVIEWCONTROLLER_TABLEVIEW_HEADER_TITLE")
+ Text(NSLocalizedString("COMPOSEVIEWCONTROLLER_TABLEVIEW_HEADER_TITLE", comment: ""))
.font(.headline).bold()
}
.padding()