forked from Nexus/nexus
add sharing support
needs more testing
This commit is contained in:
parent
432064e111
commit
78c6b2ef46
15 changed files with 517 additions and 1 deletions
|
|
@ -47,6 +47,12 @@
|
|||
|
||||
<data android:scheme="matrix" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:mimeType="*/*" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
5A4E00000000000000000008 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A4E00000000000000000001 /* ShareViewController.swift */; };
|
||||
5A4E00000000000000000009 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5A4E00000000000000000007 /* MainInterface.storyboard */; };
|
||||
5A4E0000000000000000000A /* ShareExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 5A4E00000000000000000005 /* ShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
5A4E0000000000000000000B /* receive-sharing-intent in Frameworks */ = {isa = PBXBuildFile; productRef = 5A4E00000000000000000015 /* receive-sharing-intent */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
|
@ -26,6 +30,13 @@
|
|||
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
|
||||
remoteInfo = Runner;
|
||||
};
|
||||
5A4E00000000000000000012 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 5A4E0000000000000000000D;
|
||||
remoteInfo = ShareExtension;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
|
|
@ -39,6 +50,17 @@
|
|||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5A4E00000000000000000011 /* Embed App Extensions */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 13;
|
||||
files = (
|
||||
5A4E0000000000000000000A /* ShareExtension.appex in Embed App Extensions */,
|
||||
);
|
||||
name = "Embed App Extensions";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
|
@ -59,6 +81,12 @@
|
|||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
5A4E00000000000000000001 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
|
||||
5A4E00000000000000000002 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
|
||||
5A4E00000000000000000003 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
5A4E00000000000000000004 /* ShareExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ShareExtension.entitlements; sourceTree = "<group>"; };
|
||||
5A4E00000000000000000005 /* ShareExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = ShareExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5A4E00000000000000000006 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
|
@ -77,6 +105,14 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5A4E0000000000000000000F /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5A4E0000000000000000000B /* receive-sharing-intent in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
|
|
@ -107,6 +143,7 @@
|
|||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
331C8082294A63A400263BE5 /* RunnerTests */,
|
||||
5A4E0000000000000000000C /* ShareExtension */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
|
@ -115,6 +152,7 @@
|
|||
children = (
|
||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
|
||||
5A4E00000000000000000005 /* ShareExtension.appex */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -131,10 +169,22 @@
|
|||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
|
||||
7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */,
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
|
||||
5A4E00000000000000000006 /* Runner.entitlements */,
|
||||
);
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5A4E0000000000000000000C /* ShareExtension */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5A4E00000000000000000001 /* ShareViewController.swift */,
|
||||
5A4E00000000000000000007 /* MainInterface.storyboard */,
|
||||
5A4E00000000000000000003 /* Info.plist */,
|
||||
5A4E00000000000000000004 /* ShareExtension.entitlements */,
|
||||
);
|
||||
path = ShareExtension;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
|
|
@ -165,11 +215,13 @@
|
|||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
5A4E00000000000000000011 /* Embed App Extensions */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
5A4E00000000000000000013 /* PBXTargetDependency */,
|
||||
);
|
||||
name = Runner;
|
||||
packageProductDependencies = (
|
||||
|
|
@ -179,6 +231,26 @@
|
|||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
5A4E0000000000000000000D /* ShareExtension */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 5A4E00000000000000000016 /* Build configuration list for PBXNativeTarget "ShareExtension" */;
|
||||
buildPhases = (
|
||||
5A4E0000000000000000000E /* Sources */,
|
||||
5A4E0000000000000000000F /* Frameworks */,
|
||||
5A4E00000000000000000010 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = ShareExtension;
|
||||
packageProductDependencies = (
|
||||
5A4E00000000000000000015 /* receive-sharing-intent */,
|
||||
);
|
||||
productName = ShareExtension;
|
||||
productReference = 5A4E00000000000000000005 /* ShareExtension.appex */;
|
||||
productType = "com.apple.product-type.app-extension";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
|
|
@ -197,6 +269,9 @@
|
|||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1100;
|
||||
};
|
||||
5A4E0000000000000000000D = {
|
||||
CreatedOnToolsVersion = 15.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||
|
|
@ -210,6 +285,7 @@
|
|||
mainGroup = 97C146E51CF9000F007C117D;
|
||||
packageReferences = (
|
||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
|
||||
5A4E00000000000000000014 /* XCLocalSwiftPackageReference "receive_sharing_intent" */,
|
||||
);
|
||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||
projectDirPath = "";
|
||||
|
|
@ -217,6 +293,7 @@
|
|||
targets = (
|
||||
97C146ED1CF9000F007C117D /* Runner */,
|
||||
331C8080294A63A400263BE5 /* RunnerTests */,
|
||||
5A4E0000000000000000000D /* ShareExtension */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
|
@ -240,6 +317,14 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5A4E00000000000000000010 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5A4E00000000000000000009 /* MainInterface.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
|
|
@ -295,6 +380,14 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5A4E0000000000000000000E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5A4E00000000000000000008 /* ShareViewController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
|
|
@ -303,6 +396,11 @@
|
|||
target = 97C146ED1CF9000F007C117D /* Runner */;
|
||||
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
|
||||
};
|
||||
5A4E00000000000000000013 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 5A4E0000000000000000000D /* ShareExtension */;
|
||||
targetProxy = 5A4E00000000000000000012 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
|
|
@ -322,6 +420,14 @@
|
|||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5A4E00000000000000000007 /* MainInterface.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
5A4E00000000000000000002 /* Base */,
|
||||
);
|
||||
name = MainInterface.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
|
|
@ -386,6 +492,7 @@
|
|||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
ENABLE_BITCODE = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
|
@ -566,6 +673,7 @@
|
|||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
ENABLE_BITCODE = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
|
@ -589,6 +697,7 @@
|
|||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
ENABLE_BITCODE = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
|
@ -602,6 +711,87 @@
|
|||
};
|
||||
name = Release;
|
||||
};
|
||||
5A4E00000000000000000017 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = ShareExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.nexus.ShareExtension;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
5A4E00000000000000000018 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = ShareExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.nexus.ShareExtension;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
5A4E00000000000000000019 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = ShareExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.nexus.ShareExtension;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
|
|
@ -635,6 +825,16 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
5A4E00000000000000000016 /* Build configuration list for PBXNativeTarget "ShareExtension" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
5A4E00000000000000000017 /* Debug */,
|
||||
5A4E00000000000000000018 /* Release */,
|
||||
5A4E00000000000000000019 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCLocalSwiftPackageReference section */
|
||||
|
|
@ -642,6 +842,10 @@
|
|||
isa = XCLocalSwiftPackageReference;
|
||||
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
5A4E00000000000000000014 /* XCLocalSwiftPackageReference "receive_sharing_intent" */ = {
|
||||
isa = XCLocalSwiftPackageReference;
|
||||
relativePath = Flutter/ephemeral/Packages/.packages/receive_sharing_intent;
|
||||
};
|
||||
/* End XCLocalSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
|
|
@ -649,6 +853,11 @@
|
|||
isa = XCSwiftPackageProductDependency;
|
||||
productName = FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
5A4E00000000000000000015 /* receive-sharing-intent */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 5A4E00000000000000000014 /* XCLocalSwiftPackageReference "receive_sharing_intent" */;
|
||||
productName = "receive-sharing-intent";
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,15 @@
|
|||
<string>matrix</string>
|
||||
</array>
|
||||
</dict>
|
||||
<!-- Opened by the share extension, see ShareRequestController -->
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>ShareMedia-$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
|
|
|
|||
10
ios/Runner/Runner.entitlements
Normal file
10
ios/Runner/Runner.entitlements
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.nexus.federated.nexus</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
24
ios/ShareExtension/Base.lproj/MainInterface.storyboard
Normal file
24
ios/ShareExtension/Base.lproj/MainInterface.storyboard
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="j1y-V4-xli">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Share View Controller-->
|
||||
<scene sceneID="ceB-am-kn3">
|
||||
<objects>
|
||||
<viewController id="j1y-V4-xli" customClass="ShareViewController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" opaque="NO" contentMode="scaleToFill" id="wbc-yd-nQP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewLayoutGuide key="safeArea" id="1Xd-am-t49"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="CEy-Cv-SGf" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
41
ios/ShareExtension/Info.plist
Normal file
41
ios/ShareExtension/Info.plist
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Nexus</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionAttributes</key>
|
||||
<dict>
|
||||
<key>PHSupportedMediaTypes</key>
|
||||
<array>
|
||||
<string>Video</string>
|
||||
<string>Image</string>
|
||||
</array>
|
||||
<!-- One of each at most, as the composer takes one attachment -->
|
||||
<key>NSExtensionActivationRule</key>
|
||||
<dict>
|
||||
<key>NSExtensionActivationSupportsText</key>
|
||||
<true/>
|
||||
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
<key>NSExtensionActivationSupportsMovieWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
<key>NSExtensionActivationSupportsFileWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>NSExtensionMainStoryboard</key>
|
||||
<string>MainInterface</string>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.share-services</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
10
ios/ShareExtension/ShareExtension.entitlements
Normal file
10
ios/ShareExtension/ShareExtension.entitlements
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.nexus.federated.nexus</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
5
ios/ShareExtension/ShareViewController.swift
Normal file
5
ios/ShareExtension/ShareViewController.swift
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import receive_sharing_intent
|
||||
|
||||
// Saves what was shared to the App Group, then opens Nexus, which asks which
|
||||
// room to send it to. See ShareRequestController.
|
||||
class ShareViewController: RSIShareViewController {}
|
||||
39
lib/controllers/share_request.dart
Normal file
39
lib/controllers/share_request.dart
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import "dart:io";
|
||||
|
||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:receive_sharing_intent/receive_sharing_intent.dart";
|
||||
|
||||
class ShareRequestController extends Notifier<IList<SharedMediaFile>?> {
|
||||
@override
|
||||
IList<SharedMediaFile>? build() {
|
||||
if (!(Platform.isAndroid || Platform.isIOS)) return null;
|
||||
|
||||
void receive(List<SharedMediaFile> files) {
|
||||
final shared = files
|
||||
// Android reports opened Matrix links as URLs too, which
|
||||
// LinkRequestController handles
|
||||
.where((file) => !(Platform.isAndroid && file.type == .url))
|
||||
.toIList();
|
||||
if (shared.isNotEmpty) state = shared;
|
||||
}
|
||||
|
||||
final sharing = ReceiveSharingIntent.instance;
|
||||
final subscription = sharing.getMediaStream().listen(receive);
|
||||
ref.onDispose(subscription.cancel);
|
||||
sharing.getInitialMedia().then(receive).ignore();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
void consume() {
|
||||
state = null;
|
||||
// So the same share isn't received again once the app is reopened
|
||||
ReceiveSharingIntent.instance.reset().ignore();
|
||||
}
|
||||
|
||||
static final provider =
|
||||
NotifierProvider<ShareRequestController, IList<SharedMediaFile>?>(
|
||||
ShareRequestController.new,
|
||||
);
|
||||
}
|
||||
|
|
@ -24,6 +24,10 @@ class const ComposerDraft({
|
|||
final PollStart? poll,
|
||||
final LocationMessageContent? location,
|
||||
|
||||
// Bumped when the text is replaced from outside the composer, so that it
|
||||
// rebuilds its text field from the draft
|
||||
final int textReplacements = 0,
|
||||
|
||||
// The draft from before an edit, restored once it is sent or cancelled
|
||||
final ({ComposerDraft draft, BotCommandDraft? botCommand})? beforeEdit,
|
||||
}) with _$ComposerDraft {
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ class const Composer(
|
|||
:poll,
|
||||
:location,
|
||||
:textCommands,
|
||||
:textReplacements,
|
||||
) = ref.watch(
|
||||
draftProvider.select(
|
||||
(draft) => (
|
||||
|
|
@ -104,6 +105,7 @@ class const Composer(
|
|||
poll: draft.poll,
|
||||
location: draft.location,
|
||||
textCommands: draft.textCommands,
|
||||
textReplacements: draft.textReplacements,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
@ -145,7 +147,7 @@ class const Composer(
|
|||
];
|
||||
},
|
||||
);
|
||||
}, [composer, editingEvent, hasReplacement]);
|
||||
}, [composer, editingEvent, hasReplacement, textReplacements]);
|
||||
useEffect(
|
||||
// After the frame, as FlutterTagger and TextField still use it until then
|
||||
() =>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import "package:hooks_riverpod/hooks_riverpod.dart";
|
|||
import "package:material_adaptive_sheets/material_adaptive_sheets.dart";
|
||||
import "package:nexus/controllers/init_complete.dart";
|
||||
import "package:nexus/controllers/link_request.dart";
|
||||
import "package:nexus/controllers/share_request.dart";
|
||||
import "package:nexus/helpers/extensions/open_link_info.dart";
|
||||
import "package:nexus/main.dart";
|
||||
import "package:nexus/controllers/selected_room.dart";
|
||||
|
|
@ -12,6 +13,7 @@ import "package:nexus/widgets/common/appbar.dart";
|
|||
import "package:nexus/widgets/sidebar/sidebar.dart";
|
||||
import "package:nexus/widgets/common/sync_status_banner.dart";
|
||||
import "package:nexus/widgets/room_chat/room_chat.dart";
|
||||
import "package:nexus/widgets/rooms/share_sheet.dart";
|
||||
import "package:nexus/widgets/common/loading.dart";
|
||||
|
||||
class const ChatPage({super.key}) extends HookConsumerWidget {
|
||||
|
|
@ -53,6 +55,21 @@ class const ChatPage({super.key}) extends HookConsumerWidget {
|
|||
return null;
|
||||
}, [linkRequest, initComplete]);
|
||||
|
||||
final shareRequest = ref.watch(ShareRequestController.provider);
|
||||
|
||||
useEffect(() {
|
||||
if (shareRequest == null || !initComplete) return null;
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
ref.read(ShareRequestController.provider.notifier).consume();
|
||||
navigatorKey.currentState?.popUntil((route) => route.isFirst);
|
||||
scaffoldKey.currentContext?.showAdaptiveSheet(
|
||||
(_) => ShareSheet(shareRequest),
|
||||
);
|
||||
});
|
||||
return null;
|
||||
}, [shareRequest, initComplete]);
|
||||
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final isDesktop = context.isDesktop;
|
||||
|
|
|
|||
131
lib/widgets/rooms/share_sheet.dart
Normal file
131
lib/widgets/rooms/share_sheet.dart
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
import "package:collection/collection.dart";
|
||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:file_selector/file_selector.dart";
|
||||
import "package:flutter_hooks/flutter_hooks.dart";
|
||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||
import "package:material_ui/material_ui.dart";
|
||||
import "package:material_adaptive_sheets/material_adaptive_sheets.dart";
|
||||
import "package:nexus/controllers/attachment.dart";
|
||||
import "package:nexus/controllers/composer_draft.dart";
|
||||
import "package:nexus/controllers/sidebar_page.dart";
|
||||
import "package:nexus/controllers/spaces.dart";
|
||||
import "package:nexus/helpers/extensions/focus_room.dart";
|
||||
import "package:nexus/helpers/extensions/get_all_child_rooms.dart";
|
||||
import "package:nexus/helpers/extensions/weighted_search.dart";
|
||||
import "package:nexus/main.dart";
|
||||
import "package:nexus/models/composer_params.dart";
|
||||
import "package:nexus/widgets/avatars/avatar_or_hash.dart";
|
||||
import "package:receive_sharing_intent/receive_sharing_intent.dart";
|
||||
|
||||
class const ShareSheet(final IList<SharedMediaFile> files, {super.key})
|
||||
extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final controller = useTextEditingController();
|
||||
final query = useValueListenable(controller).text;
|
||||
final spaces = ref.watch(SpacesController.provider).value ?? const .empty();
|
||||
|
||||
final rooms =
|
||||
IMap.fromEntries(
|
||||
spaces
|
||||
.expand((space) => space.allChildRooms)
|
||||
.map((room) => room.metadata)
|
||||
.nonNulls
|
||||
.map((room) => MapEntry(room.id, room)),
|
||||
).values
|
||||
.sortedBy((room) => room.sortingTimestamp)
|
||||
.reversed
|
||||
.search(
|
||||
query,
|
||||
(room) => [(room.name, 2), (room.canonicalAlias, 1)],
|
||||
);
|
||||
|
||||
final text = files
|
||||
.where((file) => file.type == .text || file.type == .url)
|
||||
.map((file) => file.path)
|
||||
.join("\n");
|
||||
final file = files.firstWhereOrNull(
|
||||
(file) => file.type != .text && file.type != .url,
|
||||
);
|
||||
|
||||
Future<void> shareTo(String roomId) async {
|
||||
final container = ProviderScope.containerOf(context);
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
await container.focusRoom(roomId);
|
||||
container.read(SidebarPageController.provider.notifier).set(.rooms);
|
||||
|
||||
final ComposerParams composer = (roomId: roomId, threadRoot: null);
|
||||
final draftProvider = ComposerDraftController.provider(composer);
|
||||
// Shares go in a new message, not an edit
|
||||
if (container.read(draftProvider).isEditing) {
|
||||
container.read(draftProvider.notifier).dismiss();
|
||||
}
|
||||
|
||||
if (text.isNotEmpty) {
|
||||
container
|
||||
.read(draftProvider.notifier)
|
||||
.update(
|
||||
(draft) => draft.copyWith(
|
||||
text: draft.text.isEmpty ? text : "${draft.text}\n$text",
|
||||
textReplacements: draft.textReplacements + 1,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (file != null) {
|
||||
await container
|
||||
.read(
|
||||
AttachmentController.provider((
|
||||
composer: composer,
|
||||
editingRowId: null,
|
||||
)).notifier,
|
||||
)
|
||||
.add(XFile(file.path));
|
||||
}
|
||||
}
|
||||
|
||||
return SheetLayout(
|
||||
title: Text(switch ((file, text.isNotEmpty)) {
|
||||
(_?, _) => "Share File",
|
||||
(null, true) => "Share Text",
|
||||
(null, false) => "Share",
|
||||
}),
|
||||
actions: [
|
||||
TextButton(onPressed: Navigator.of(context).pop, child: Text("Cancel")),
|
||||
],
|
||||
children: [
|
||||
TextField(
|
||||
controller: controller,
|
||||
autofocus: true,
|
||||
decoration: .new(
|
||||
hintText: "Search rooms",
|
||||
prefixIcon: Icon(Icons.search),
|
||||
),
|
||||
),
|
||||
if (rooms.isEmpty)
|
||||
Text("No rooms found")
|
||||
else
|
||||
Column(
|
||||
children: rooms
|
||||
.map(
|
||||
(room) => ListTile(
|
||||
leading: AvatarOrHash(
|
||||
room.avatar,
|
||||
room.name ?? "Unnamed Room",
|
||||
fallback: room.dmUserId == null
|
||||
? Icon(Icons.numbers)
|
||||
: null,
|
||||
),
|
||||
title: Text(
|
||||
room.name ?? "Unnamed Room",
|
||||
overflow: .ellipsis,
|
||||
),
|
||||
onTap: () => shareTo(room.id).onError(showError),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1394,6 +1394,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.2"
|
||||
receive_sharing_intent:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: receive_sharing_intent
|
||||
sha256: "72f229a38f2910029c11d840770c173b27072e348ef3376130b37514bc4556f6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
record_use:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ dependencies:
|
|||
path: packages/location
|
||||
better_player: 1.38.0
|
||||
audioplayers: 6.8.1
|
||||
receive_sharing_intent: 1.9.0
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
|
|
|||
Loading…
Reference in a new issue