Skip to content

Commit

Permalink
Fixes #17 for shared view controller in ios that has non public methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshJuncker committed Jul 18, 2022
1 parent ab5630f commit 700834b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
2 changes: 2 additions & 0 deletions share_handler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 0.0.16
Fix for non public methods in inherited viewcontroller for iOS
# 0.0.15
Updated Readme for custom group id for the runner target
# 0.0.14
Expand Down
4 changes: 2 additions & 2 deletions share_handler/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: share_handler
description: A Flutter plugin to handle incoming shared text/media, as well as add share to suggestions/shortcuts.
repository: https://github.com/AboutShout/share_handler/tree/main/share_handler
version: 0.0.15
version: 0.0.16

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down Expand Up @@ -29,7 +29,7 @@ dependencies:
share_handler_android: ^0.0.6
# share_handler_android:
# path: ../share_handler_android
share_handler_ios: ^0.0.8
share_handler_ios: ^0.0.9
# share_handler_ios:
# path: ../share_handler_ios
# share_handler_linux:
Expand Down
2 changes: 2 additions & 0 deletions share_handler_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 0.0.9
Fix for non public methods in inherited viewcontroller
# 0.0.8
Setup podspecs and dependencies better
# 0.0.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ open class ShareHandlerIosViewController: SLComposeServiceViewController {
return true
}

private func loadIds() {
public func loadIds() {
// loading Share extension App Id
let shareExtensionAppBundleIdentifier = Bundle.main.bundleIdentifier!;

Expand Down Expand Up @@ -101,14 +101,14 @@ open class ShareHandlerIosViewController: SLComposeServiceViewController {
return []
}

private func getNewFileUrl(fileName: String) -> URL {
public func getNewFileUrl(fileName: String) -> URL {
let newFileUrl = FileManager.default
.containerURL(forSecurityApplicationGroupIdentifier: ShareHandlerIosViewController.appGroupId)!
.appendingPathComponent(fileName)
return newFileUrl
}

private func handleText (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
public func handleText (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
let data = try await attachment.loadItem(forTypeIdentifier: textContentType, options: nil)

if let item = data as? String {
Expand All @@ -119,7 +119,7 @@ open class ShareHandlerIosViewController: SLComposeServiceViewController {

}

private func handleUrl (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
public func handleUrl (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
let data = try await attachment.loadItem(forTypeIdentifier: urlContentType, options: nil)

if let item = data as? URL {
Expand All @@ -130,7 +130,7 @@ open class ShareHandlerIosViewController: SLComposeServiceViewController {

}

private func handleImages (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
public func handleImages (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
let data = try await attachment.loadItem(forTypeIdentifier: imageContentType, options: nil)

var fileName: String?
Expand Down Expand Up @@ -179,7 +179,7 @@ open class ShareHandlerIosViewController: SLComposeServiceViewController {

}

private func handleVideos (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
public func handleVideos (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
let data = try await attachment.loadItem(forTypeIdentifier: movieContentType, options: nil)


Expand All @@ -198,7 +198,7 @@ open class ShareHandlerIosViewController: SLComposeServiceViewController {

}

private func handleFiles (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
public func handleFiles (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
let data = try await attachment.loadItem(forTypeIdentifier: fileURLType, options: nil)

if let url = data as? URL {
Expand All @@ -216,7 +216,7 @@ open class ShareHandlerIosViewController: SLComposeServiceViewController {

}

private func handleData (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
public func handleData (content: NSExtensionItem, attachment: NSItemProvider, index: Int) async throws {
let data = try await attachment.loadItem(forTypeIdentifier: dataContentType, options: nil)

if let url = data as? URL {
Expand All @@ -234,7 +234,7 @@ open class ShareHandlerIosViewController: SLComposeServiceViewController {

}

private func dismissWithError() {
public func dismissWithError() {
print("[ERROR] Error loading data!")
let alert = UIAlertController(title: "Error", message: "Error loading data", preferredStyle: .alert)

Expand All @@ -247,7 +247,7 @@ open class ShareHandlerIosViewController: SLComposeServiceViewController {
extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
}

private func redirectToHostApp() {
public func redirectToHostApp() {
// ids may not loaded yet so we need loadIds here too
loadIds();
let url = URL(string: "ShareMedia-\(ShareHandlerIosViewController.hostAppBundleIdentifier)://\(ShareHandlerIosViewController.hostAppBundleIdentifier)?key=\(sharedKey)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'share_handler_ios_models'
s.version = '0.0.8'
s.version = '0.0.9'
s.summary = 'Shared code for share_handler_ios plugin.'
s.description = <<-DESC
Shared code for share_handler_ios plugin so main app and share extension targets can use it.
Expand Down
2 changes: 1 addition & 1 deletion share_handler_ios/ios/share_handler_ios.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'share_handler_ios'
s.version = '0.0.8'
s.version = '0.0.9'
s.summary = 'iOS implementation of the share_handler plugin.'
s.description = <<-DESC
iOS implementation of the share_handler plugin.
Expand Down
2 changes: 1 addition & 1 deletion share_handler_ios/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: share_handler_ios
description: An implementation for the iOS platform of the Flutter share_handler plugin.
repository: https://github.com/AboutShout/share_handler/tree/main/share_handler_ios
version: 0.0.8
version: 0.0.9

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down

0 comments on commit 700834b

Please sign in to comment.