TF-359 Open mailto link outside the Tmail app in mobile/tablet

This commit is contained in:
dab246
2022-04-06 15:34:48 +07:00
committed by Dat H. Pham
parent c456cde7a8
commit 7ab072deab
17 changed files with 618 additions and 32 deletions
+14
View File
@@ -49,6 +49,20 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.SENDTO"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="mailto"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>
</activity>
<provider
+235 -1
View File
@@ -14,8 +14,21 @@
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 */; };
F52F993027FD6EB900346091 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F52F992F27FD6EB900346091 /* ShareViewController.swift */; };
F52F993327FD6EB900346091 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F52F993127FD6EB900346091 /* MainInterface.storyboard */; };
F52F993727FD6EB900346091 /* TeamMailShareExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = F52F992D27FD6EB900346091 /* TeamMailShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
F52F993527FD6EB900346091 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
proxyType = 1;
remoteGlobalIDString = F52F992C27FD6EB900346091;
remoteInfo = TeamMailShareExtension;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
@@ -27,6 +40,17 @@
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
F52F993C27FD6EB900346091 /* Embed App Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
F52F993727FD6EB900346091 /* TeamMailShareExtension.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
@@ -47,6 +71,12 @@
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A33AA12BD904CC248AC23AD3 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
EC917F73F69318C74EE40059 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
F52F992D27FD6EB900346091 /* TeamMailShareExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = TeamMailShareExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
F52F992F27FD6EB900346091 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
F52F993227FD6EB900346091 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
F52F993427FD6EB900346091 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F52F993D27FD733C00346091 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
F52F993E27FD741100346091 /* TeamMailShareExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = TeamMailShareExtension.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -58,6 +88,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F52F992A27FD6EB900346091 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -85,6 +122,7 @@
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
F52F992E27FD6EB900346091 /* TeamMailShareExtension */,
97C146EF1CF9000F007C117D /* Products */,
F62B48DC0DFBD6D5D355E5FE /* Pods */,
66B148CBFC3A1B0ADAE68790 /* Frameworks */,
@@ -95,6 +133,7 @@
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
F52F992D27FD6EB900346091 /* TeamMailShareExtension.appex */,
);
name = Products;
sourceTree = "<group>";
@@ -102,6 +141,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
F52F993D27FD733C00346091 /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
@@ -114,6 +154,17 @@
path = Runner;
sourceTree = "<group>";
};
F52F992E27FD6EB900346091 /* TeamMailShareExtension */ = {
isa = PBXGroup;
children = (
F52F993E27FD741100346091 /* TeamMailShareExtension.entitlements */,
F52F992F27FD6EB900346091 /* ShareViewController.swift */,
F52F993127FD6EB900346091 /* MainInterface.storyboard */,
F52F993427FD6EB900346091 /* Info.plist */,
);
path = TeamMailShareExtension;
sourceTree = "<group>";
};
F62B48DC0DFBD6D5D355E5FE /* Pods */ = {
isa = PBXGroup;
children = (
@@ -139,22 +190,42 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
1F3039EB9D2C1743FF9910D5 /* [CP] Embed Pods Frameworks */,
F52F993C27FD6EB900346091 /* Embed App Extensions */,
);
buildRules = (
);
dependencies = (
F52F993627FD6EB900346091 /* PBXTargetDependency */,
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
F52F992C27FD6EB900346091 /* TeamMailShareExtension */ = {
isa = PBXNativeTarget;
buildConfigurationList = F52F993827FD6EB900346091 /* Build configuration list for PBXNativeTarget "TeamMailShareExtension" */;
buildPhases = (
F52F992927FD6EB900346091 /* Sources */,
F52F992A27FD6EB900346091 /* Frameworks */,
F52F992B27FD6EB900346091 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = TeamMailShareExtension;
productName = TeamMailShareExtension;
productReference = F52F992D27FD6EB900346091 /* TeamMailShareExtension.appex */;
productType = "com.apple.product-type.app-extension";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1320;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
@@ -162,6 +233,9 @@
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
F52F992C27FD6EB900346091 = {
CreatedOnToolsVersion = 13.2.1;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
@@ -178,6 +252,7 @@
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
F52F992C27FD6EB900346091 /* TeamMailShareExtension */,
);
};
/* End PBXProject section */
@@ -194,6 +269,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F52F992B27FD6EB900346091 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F52F993327FD6EB900346091 /* MainInterface.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
@@ -262,7 +345,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
};
/* End PBXShellScriptBuildPhase section */
@@ -276,8 +359,24 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F52F992927FD6EB900346091 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F52F993027FD6EB900346091 /* ShareViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
F52F993627FD6EB900346091 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F52F992C27FD6EB900346091 /* TeamMailShareExtension */;
targetProxy = F52F993527FD6EB900346091 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
@@ -295,6 +394,14 @@
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
F52F993127FD6EB900346091 /* MainInterface.storyboard */ = {
isa = PBXVariantGroup;
children = (
F52F993227FD6EB900346091 /* Base */,
);
name = MainInterface.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
@@ -352,8 +459,10 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = KUT463DS29;
@@ -483,8 +592,10 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = KUT463DS29;
@@ -508,8 +619,10 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = KUT463DS29;
@@ -528,6 +641,117 @@
};
name = Release;
};
F52F993927FD6EB900346091 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = TeamMailShareExtension/TeamMailShareExtension.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = TeamMailShareExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = TeamMailShareExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.linagora.ios.teammail.TeamMailShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
F52F993A27FD6EB900346091 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = TeamMailShareExtension/TeamMailShareExtension.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = TeamMailShareExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = TeamMailShareExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.linagora.ios.teammail.TeamMailShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
F52F993B27FD6EB900346091 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = TeamMailShareExtension/TeamMailShareExtension.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = TeamMailShareExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = TeamMailShareExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.linagora.ios.teammail.TeamMailShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Profile;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -551,6 +775,16 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F52F993827FD6EB900346091 /* Build configuration list for PBXNativeTarget "TeamMailShareExtension" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F52F993927FD6EB900346091 /* Debug */,
F52F993A27FD6EB900346091 /* Release */,
F52F993B27FD6EB900346091 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
+16 -5
View File
@@ -2,11 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
<string>http</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
<string>http</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
@@ -23,6 +23,17 @@
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<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>
<key>LSRequiresIPhoneOS</key>
+10
View 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.com.linagora.ios.teammail</string>
</array>
</dict>
</plist>
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="j1y-V4-xli">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<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" customModule="TeamMailShareExtension" 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="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="1Xd-am-t49"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="CEy-Cv-SGf" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="20" y="84"/>
</scene>
</scenes>
</document>
+41
View 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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>TeamMailShareExtension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsText</key>
<true/>
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
<integer>1</integer>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
</dict>
</dict>
</plist>
@@ -0,0 +1,134 @@
//
// ShareViewController.swift
// TeamMailShareExtension
//
// Created by dab.dev on 06/04/2022.
//
import UIKit
import Social
import MobileCoreServices
class ShareViewController: SLComposeServiceViewController {
let hostAppBundleIdentifier = "com.linagora.ios.teammail"
let sharedKey = "ShareKey"
var sharedText: [String] = []
let textContentType = kUTTypeText as String
let urlContentType = kUTTypeURL as String
override func isContentValid() -> Bool {
return true
}
override func viewDidLoad() {
super.viewDidLoad();
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
if let content = extensionContext!.inputItems[0] as? NSExtensionItem {
if let contents = content.attachments {
for (index, attachment) in (contents).enumerated() {
if attachment.hasItemConformingToTypeIdentifier(textContentType) {
handleText(content: content, attachment: attachment, index: index)
} else if attachment.hasItemConformingToTypeIdentifier(urlContentType) {
handleUrl(content: content, attachment: attachment, index: index)
}
}
}
}
}
override func didSelectPost() {
print("didSelectPost");
}
override func configurationItems() -> [Any]! {
// To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.
return []
}
private func handleText (content: NSExtensionItem, attachment: NSItemProvider, index: Int) {
attachment.loadItem(forTypeIdentifier: textContentType, options: nil) { [weak self] data, error in
if error == nil, let item = data as? String, let this = self {
this.sharedText.append(item)
// If this is the last item, save imagesData in userDefaults and redirect to host app
if index == (content.attachments?.count)! - 1 {
let userDefaults = UserDefaults(suiteName: "group.\(this.hostAppBundleIdentifier)")
userDefaults?.set(this.sharedText, forKey: this.sharedKey)
userDefaults?.synchronize()
this.redirectToHostApp(type: .text)
}
} else {
self?.dismissWithError()
}
}
}
private func handleUrl (content: NSExtensionItem, attachment: NSItemProvider, index: Int) {
attachment.loadItem(forTypeIdentifier: urlContentType, options: nil) { [weak self] data, error in
if error == nil, let item = data as? URL, let this = self {
this.sharedText.append(item.absoluteString)
// If this is the last item, save imagesData in userDefaults and redirect to host app
if index == (content.attachments?.count)! - 1 {
let userDefaults = UserDefaults(suiteName: "group.\(this.hostAppBundleIdentifier)")
userDefaults?.set(this.sharedText, forKey: this.sharedKey)
userDefaults?.synchronize()
this.redirectToHostApp(type: .text)
}
} else {
self?.dismissWithError()
}
}
}
private func dismissWithError() {
print("[ERROR] Error loading data!")
let alert = UIAlertController(title: "Error", message: "Error loading data", preferredStyle: .alert)
let action = UIAlertAction(title: "Error", style: .cancel) { _ in
self.dismiss(animated: true, completion: nil)
}
alert.addAction(action)
present(alert, animated: true, completion: nil)
extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
}
private func redirectToHostApp(type: RedirectType) {
let url = URL(string: "ShareMedia://dataUrl=\(sharedKey)#\(type)")
var responder = self as UIResponder?
let selectorOpenURL = sel_registerName("openURL:")
while (responder != nil) {
if (responder?.responds(to: selectorOpenURL))! {
let _ = responder?.perform(selectorOpenURL, with: url)
}
responder = responder!.next
}
extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
}
enum RedirectType {
case media
case text
case file
}
}
extension Array {
subscript (safe index: UInt) -> Element? {
return Int(index) < count ? self[Int(index)] : nil
}
}
@@ -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.com.linagora.ios.teammail</string>
</array>
</dict>
</plist>
@@ -82,8 +82,7 @@ class EmailController extends BaseController {
);
@override
void onReady() {
super.onReady();
void onInit() {
mailboxDashBoardController.selectedEmail.listen((presentationEmail) {
log('EmailController::onReady(): ${presentationEmail.toString()}');
if (_currentEmailId != presentationEmail?.id) {
@@ -97,6 +96,7 @@ class EmailController extends BaseController {
}
}
});
super.onInit();
}
@override
@@ -10,6 +10,7 @@ import 'package:tmail_ui_user/features/cleanup/domain/usecases/cleanup_email_cac
import 'package:tmail_ui_user/features/home/presentation/home_controller.dart';
import 'package:tmail_ui_user/features/login/domain/usecases/get_credential_interactor.dart';
import 'package:tmail_ui_user/features/thread/data/local/email_cache_manager.dart';
import 'package:tmail_ui_user/main/utils/email_receive_manager.dart';
class HomeBindings extends BaseBindings {
@@ -25,6 +26,7 @@ class HomeBindings extends BaseBindings {
Get.find<DynamicUrlInterceptors>(),
Get.find<AuthorizationInterceptors>(),
Get.find<CleanupEmailCacheInteractor>(),
Get.find<EmailReceiveManager>(),
));
}
@@ -2,32 +2,43 @@ import 'package:core/core.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:get/get.dart';
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
import 'package:tmail_ui_user/features/cleanup/domain/model/cleanup_rule.dart';
import 'package:tmail_ui_user/features/cleanup/domain/usecases/cleanup_email_cache_interactor.dart';
import 'package:tmail_ui_user/features/login/domain/state/get_credential_state.dart';
import 'package:tmail_ui_user/features/login/domain/usecases/get_credential_interactor.dart';
import 'package:tmail_ui_user/main/routes/app_routes.dart';
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
import 'package:tmail_ui_user/main/utils/email_receive_manager.dart';
class HomeController extends GetxController {
final GetCredentialInteractor _getCredentialInteractor;
final DynamicUrlInterceptors _dynamicUrlInterceptors;
final AuthorizationInterceptors _authorizationInterceptors;
final CleanupEmailCacheInteractor _cleanupEmailCacheInteractor;
final EmailReceiveManager _emailReceiveManager;
HomeController(
this._getCredentialInteractor,
this._dynamicUrlInterceptors,
this._authorizationInterceptors,
this._cleanupEmailCacheInteractor,
this._emailReceiveManager,
);
@override
void onInit() {
log('HomeController::onInit(): ');
if (!kIsWeb) {
_initFlutterDownloader();
_registerReceivingSharingIntent();
}
super.onInit();
}
@override
void onReady() {
super.onReady();
if (!kIsWeb) {
_initFlutterDownloader();
}
_cleanupEmailCache();
}
@@ -51,6 +62,16 @@ class HomeController extends GetxController {
(success) => success is GetCredentialViewState ? _goToMailbox(success) : _goToLogin()));
}
void _registerReceivingSharingIntent() {
_emailReceiveManager.receivingSharingStream.listen((uri) {
log('HomeController::onReady(): Received Email: ${uri.toString()}');
if (uri != null) {
log('HomeController::onReady(): Address: ${uri.path}');
_emailReceiveManager.setPendingEmailAddress(EmailAddress(null, uri.path));
}
});
}
void _goToLogin() {
pushAndPop(AppRoutes.LOGIN);
}
@@ -104,15 +104,19 @@ class MailboxController extends BaseMailboxController {
) : super(treeBuilder);
@override
void onReady() {
super.onReady();
void onInit() {
mailboxDashBoardController.accountId.listen((accountId) {
log('MailboxController::onReady(): accountId: $accountId');
if (accountId != null) {
getAllMailboxAction(accountId);
}
});
super.onInit();
}
@override
void onReady() {
super.onReady();
mailboxDashBoardController.viewState.listen((state) {
state.fold(
(failure) {
@@ -44,6 +44,7 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
import 'package:tmail_ui_user/main/routes/app_routes.dart';
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
import 'package:tmail_ui_user/main/routes/router_arguments.dart';
import 'package:tmail_ui_user/main/utils/email_receive_manager.dart';
class MailboxDashBoardController extends ReloadableController {
@@ -55,6 +56,7 @@ class MailboxDashBoardController extends ReloadableController {
final CachingManager _cachingManager = Get.find<CachingManager>();
final Connectivity _connectivity = Get.find<Connectivity>();
final ResponsiveUtils _responsiveUtils = Get.find<ResponsiveUtils>();
final EmailReceiveManager _emailReceiveManager = Get.find<EmailReceiveManager>();
final MoveToTrashInteractor _moveToTrashInteractor;
final MoveToMailboxInteractor _moveToMailboxInteractor;
@@ -79,6 +81,7 @@ class MailboxDashBoardController extends ReloadableController {
FocusNode searchFocus = FocusNode();
RouterArguments? routerArguments;
late StreamSubscription _connectivityStreamSubscription;
late StreamSubscription _emailReceiveManagerStreamSubscription;
MailboxDashBoardController(
this._moveToTrashInteractor,
@@ -88,8 +91,9 @@ class MailboxDashBoardController extends ReloadableController {
@override
void onInit() {
super.onInit();
_registerNetworkConnectivityState();
_registerPendingEmailAddress();
super.onInit();
}
@override
@@ -178,23 +182,36 @@ class MailboxDashBoardController extends ReloadableController {
});
}
void _registerPendingEmailAddress() {
_emailReceiveManagerStreamSubscription =
_emailReceiveManager.pendingEmailAddressInfo.stream.listen((emailAddress) {
log('MailboxDashBoardController::_registerPendingEmailAddress(): ${emailAddress?.email}');
if (emailAddress != null && emailAddress.email?.isNotEmpty == true) {
_emailReceiveManager.clearPendingEmailAddress();
final arguments = ComposerArguments(
emailActionType: EmailActionType.composeFromEmailAddress,
emailAddress: emailAddress,
mailboxRole: selectedMailbox.value?.role);
goToComposer(arguments);
}
});
}
void _getUserProfile() async {
consumeState(_getUserProfileInteractor.execute());
}
void _setSessionCurrent() {
Future.delayed(const Duration(milliseconds: 100), () {
final arguments = Get.arguments;
log('MailboxDashBoardController::_setSessionCurrent(): arguments = $arguments');
if (arguments is Session) {
sessionCurrent = Get.arguments as Session;
accountId.value = sessionCurrent?.accounts.keys.first;
} else {
if (kIsWeb) {
reload();
}
final arguments = Get.arguments;
log('MailboxDashBoardController::_setSessionCurrent(): arguments = $arguments');
if (arguments is Session) {
sessionCurrent = arguments;
accountId.value = sessionCurrent?.accounts.keys.first;
} else {
if (kIsWeb) {
reload();
}
});
}
}
Future<void> _initPackageInfo() async {
@@ -393,6 +410,16 @@ class MailboxDashBoardController extends ReloadableController {
}
}
void goToComposer(ComposerArguments arguments) {
if (kIsWeb) {
if (dashBoardAction != DashBoardAction.compose) {
dispatchDashBoardAction(DashBoardAction.compose, arguments: arguments);
}
} else {
push(AppRoutes.COMPOSER, arguments: arguments);
}
}
void _deleteCredential() async {
await _deleteCredentialInteractor.execute();
}
@@ -409,6 +436,8 @@ class MailboxDashBoardController extends ReloadableController {
@override
void onClose() {
_emailReceiveManager.closeEmailReceiveManagerStream();
_emailReceiveManagerStreamSubscription.cancel();
_connectivityStreamSubscription.cancel();
searchInputController.dispose();
searchFocus.dispose();
@@ -127,12 +127,6 @@ class ThreadController extends BaseController {
@override
void onInit() {
super.onInit();
dispatchState(Right(LoadingState()));
}
@override
void onReady() {
super.onReady();
mailboxDashBoardController.selectedMailbox.listen((selectedMailbox) {
if (_currentMailboxId != selectedMailbox?.id) {
log('ThreadController::onReady(): selectMailbox: ${selectedMailbox?.name?.name}(${selectedMailbox?.id})');
@@ -141,7 +135,13 @@ class ThreadController extends BaseController {
_getAllEmail();
}
});
super.onInit();
dispatchState(Right(LoadingState()));
}
@override
void onReady() {
super.onReady();
mailboxDashBoardController.viewState.listen((state) {
state.map((success) {
log('ThreadController::onReady(): ${success.runtimeType}');
@@ -262,7 +262,6 @@ class ThreadController extends BaseController {
canLoadMore = true;
disableSearch();
cancelSelectEmail();
listEmailController.animateTo(0, duration: Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
mailboxDashBoardController.dispatchRoute(AppRoutes.THREAD);
}
@@ -270,6 +269,9 @@ class ThreadController extends BaseController {
log('ThreadController::_getAllEmailSuccess(): ${success.emailList.length}');
_currentEmailState = success.currentEmailState;
emailList.value = success.emailList;
if (listEmailController.hasClients) {
listEmailController.animateTo(0, duration: Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
}
}
void _refreshChangesAllEmailSuccess(RefreshChangesAllEmailSuccess success) {
@@ -4,6 +4,7 @@ import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tmail_ui_user/features/email/data/local/html_analyzer.dart';
import 'package:tmail_ui_user/main/utils/email_receive_manager.dart';
class CoreBindings extends Bindings {
@@ -16,6 +17,7 @@ class CoreBindings extends Bindings {
_bindingTransformer();
_bindingToast();
_bindingDeviceManager();
_bindingReceivingSharingStream();
}
void _bindingAppImagePaths() {
@@ -47,4 +49,8 @@ class CoreBindings extends Bindings {
Get.put(DeviceInfoPlugin());
Get.put(DeviceManager(Get.find<DeviceInfoPlugin>()));
}
void _bindingReceivingSharingStream() {
Get.put(EmailReceiveManager());
}
}
+40
View File
@@ -0,0 +1,40 @@
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:rxdart/rxdart.dart';
class EmailReceiveManager {
BehaviorSubject<EmailAddress?> _pendingEmailAddressInfo = BehaviorSubject.seeded(null);
BehaviorSubject<EmailAddress?> get pendingEmailAddressInfo => _pendingEmailAddressInfo;
Stream<Uri?> get receivingSharingStream {
return Rx.merge([
Stream.fromFuture(ReceiveSharingIntent.getInitialTextAsUri()),
ReceiveSharingIntent.getTextStreamAsUri()
]);
}
Stream<List<SharedMediaFile>> get receivingSharingStream2 {
return Rx.merge([
Stream.fromFuture(ReceiveSharingIntent.getInitialMedia()),
ReceiveSharingIntent.getMediaStream()
]);
}
void setPendingEmailAddress(EmailAddress emailAddress) async {
clearPendingEmailAddress();
_pendingEmailAddressInfo.add(emailAddress);
}
void clearPendingEmailAddress() {
if(_pendingEmailAddressInfo.isClosed) {
_pendingEmailAddressInfo = BehaviorSubject.seeded(null);
} else {
_pendingEmailAddressInfo.add(null);
}
}
void closeEmailReceiveManagerStream() {
_pendingEmailAddressInfo.close();
}
}
+2
View File
@@ -141,6 +141,8 @@ dependencies:
package_info_plus: 1.4.1
receive_sharing_intent: 1.4.5
dev_dependencies:
flutter_test:
sdk: flutter