Better share functionality
This commit is contained in:
parent
646550575d
commit
38389e99d4
|
@ -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<ResolveInfo> = 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)
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue