diff --git a/android/app/src/main/kotlin/net/defined/mobile_nebula/Share.kt b/android/app/src/main/kotlin/net/defined/mobile_nebula/Share.kt index 079fe4a..b3d1af7 100644 --- a/android/app/src/main/kotlin/net/defined/mobile_nebula/Share.kt +++ b/android/app/src/main/kotlin/net/defined/mobile_nebula/Share.kt @@ -85,7 +85,7 @@ class Share { intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK intent.action = Intent.ACTION_SEND - intent.type = "*/*" + intent.type = "text/plain" intent.putExtra(Intent.EXTRA_SUBJECT, title) intent.putExtra(Intent.EXTRA_STREAM, fileUri) @@ -97,7 +97,6 @@ class Share { val resInfoList: List = context.packageManager.queryIntentActivities(chooserIntent, PackageManager.MATCH_DEFAULT_ONLY) for (resolveInfo in resInfoList) { - print(fileUri) val packageName: String = resolveInfo.activityInfo.packageName context.grantUriPermission(packageName, fileUri, Intent.FLAG_GRANT_READ_URI_PERMISSION) } diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e3f1121..271a039 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -533,7 +533,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 0.0.33; + MARKETING_VERSION = 0.0.35; PRODUCT_BUNDLE_IDENTIFIER = net.defined.mobileNebula; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -563,7 +563,7 @@ INFOPLIST_FILE = NebulaNetworkExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 0.0.33; + MARKETING_VERSION = 0.0.35; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; @@ -598,7 +598,7 @@ INFOPLIST_FILE = NebulaNetworkExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 0.0.33; + MARKETING_VERSION = 0.0.35; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = net.defined.mobileNebula.NebulaNetworkExtension; @@ -630,7 +630,7 @@ INFOPLIST_FILE = NebulaNetworkExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 0.0.33; + MARKETING_VERSION = 0.0.35; MTL_FAST_MATH = YES; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = net.defined.mobileNebula.NebulaNetworkExtension; @@ -772,7 +772,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 0.0.33; + MARKETING_VERSION = 0.0.35; PRODUCT_BUNDLE_IDENTIFIER = net.defined.mobileNebula; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -805,7 +805,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 0.0.33; + MARKETING_VERSION = 0.0.35; PRODUCT_BUNDLE_IDENTIFIER = net.defined.mobileNebula; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/ios/Runner/Share.swift b/ios/Runner/Share.swift index 89691b6..730f69d 100644 --- a/ios/Runner/Share.swift +++ b/ios/Runner/Share.swift @@ -77,7 +77,7 @@ public class Share { return completion(false) } - let activityViewController = UIActivityViewController(activityItems: [file], applicationActivities: nil) + let activityViewController = UIActivityViewController(activityItems: [ShareCopy(file: file)], applicationActivities: nil) activityViewController.completionWithItemsHandler = {(activityType: UIActivity.ActivityType?, completed: Bool, returnedItems: [Any]?, error: Error?) in completion(true) @@ -117,3 +117,34 @@ extension UIApplication { return controller } } + +class ShareCopy: UIActivityItemProvider { + private let file: URL + private let content: String + + init(file: URL) { + self.file = file + do { + self.content = try String.init(contentsOf: file) + } catch { + self.content = "Error" + } + + // the type of the placeholder item is used to + // display correct activity types by UIActivityControler + super.init(placeholderItem: self.content) + } + + override var item: Any { + get { + guard let activityType = activityType else { + return file + } + + switch activityType { + case .copyToPasteboard: return content + default: return file + } + } + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 1f3dec6..f7f0320 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Mobile Nebula Client # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.0.32+4 +version: 0.0.35+35 environment: sdk: ">=2.1.0 <3.0.0"