Merge pull request #276 from tooot-app/main

Test sharing
This commit is contained in:
xmflsct 2022-05-05 01:33:10 +02:00 committed by GitHub
commit be8fce8185
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 109 additions and 175 deletions

View File

@ -19,7 +19,7 @@
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="portrait">
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="portrait" android:documentLaunchMode="never">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
@ -31,6 +31,13 @@
<data android:scheme="tooot"/>
<data android:scheme="com.xmflsct.app.tooot"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
<data android:mimeType="image/*" />
<!-- Any other mime types you want to support -->
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -4,7 +4,6 @@ import android.os.Bundle;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import expo.modules.ReactActivityDelegateWrapper;
@ -22,17 +21,4 @@ public class MainActivity extends ReactActivity {
protected String getMainComponentName() {
return "main";
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegateWrapper(
this,
new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
}
);
}
}

View File

@ -1,4 +0,0 @@
import { AppRegistry } from 'react-native'
import ShareExtension from './src/ShareExtension'
AppRegistry.registerComponent('ShareMenuModuleComponent', () => ShareExtension)

View File

@ -39,5 +39,4 @@ target 'ShareExtension' do
)
pod 'RNShareMenu', :path => '../node_modules/react-native-share-menu'
pod 'RNFS', :path => '../node_modules/react-native-fs'
end

View File

@ -1,6 +1,8 @@
PODS:
- boost (1.76.0)
- DoubleConversion (1.1.6)
- EXApplication (4.0.2):
- ExpoModulesCore
- EXAV (10.2.1):
- ExpoModulesCore
- ReactCommon/turbomodule/core
@ -21,6 +23,8 @@ PODS:
- EXFirebaseCore (4.1.1):
- ExpoModulesCore
- Firebase/Core (= 7.7.0)
- EXFont (10.0.5):
- ExpoModulesCore
- EXImageLoader (3.1.1):
- ExpoModulesCore
- React-Core
@ -30,6 +34,8 @@ PODS:
- EXImagePicker (12.0.2):
- ExpoModulesCore
- EXJSONUtils (0.2.1)
- EXKeepAwake (10.0.2):
- ExpoModulesCore
- EXManifests (0.2.4):
- EXJSONUtils
- EXNotifications (0.14.1):
@ -454,8 +460,6 @@ PODS:
- React-Core
- SDWebImage (~> 5.12.5)
- SDWebImageWebPCoder (~> 0.8.4)
- RNFS (2.19.0):
- React-Core
- RNGestureHandler (2.4.1):
- React-Core
- RNReanimated (2.8.0):
@ -511,6 +515,7 @@ PODS:
DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- EXApplication (from `../node_modules/expo-application/ios`)
- EXAV (from `../node_modules/expo-av/ios`)
- EXConstants (from `../node_modules/expo-constants/ios`)
- EXCrypto (from `../node_modules/expo-crypto/ios`)
@ -519,10 +524,12 @@ DEPENDENCIES:
- EXFileSystem (from `../node_modules/expo-file-system/ios`)
- EXFirebaseAnalytics (from `../node_modules/expo-firebase-analytics/ios`)
- EXFirebaseCore (from `../node_modules/expo-firebase-core/ios`)
- EXFont (from `../node_modules/expo-font/ios`)
- EXImageLoader (from `../node_modules/expo-image-loader/ios`)
- EXImageManipulator (from `../node_modules/expo-image-manipulator/ios`)
- EXImagePicker (from `../node_modules/expo-image-picker/ios`)
- EXJSONUtils (from `../node_modules/expo-json-utils/ios`)
- EXKeepAwake (from `../node_modules/expo-keep-awake/ios`)
- EXManifests (from `../node_modules/expo-manifests/ios`)
- EXNotifications (from `../node_modules/expo-notifications/ios`)
- Expo (from `../node_modules/expo/ios`)
@ -580,7 +587,6 @@ DEPENDENCIES:
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- RNFastImage (from `../node_modules/react-native-fast-image`)
- RNFS (from `../node_modules/react-native-fs`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
@ -615,6 +621,8 @@ EXTERNAL SOURCES:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
EXApplication:
:path: "../node_modules/expo-application/ios"
EXAV:
:path: "../node_modules/expo-av/ios"
EXConstants:
@ -631,6 +639,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/expo-firebase-analytics/ios"
EXFirebaseCore:
:path: "../node_modules/expo-firebase-core/ios"
EXFont:
:path: "../node_modules/expo-font/ios"
EXImageLoader:
:path: "../node_modules/expo-image-loader/ios"
EXImageManipulator:
@ -639,6 +649,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/expo-image-picker/ios"
EXJSONUtils:
:path: "../node_modules/expo-json-utils/ios"
EXKeepAwake:
:path: "../node_modules/expo-keep-awake/ios"
EXManifests:
:path: "../node_modules/expo-manifests/ios"
EXNotifications:
@ -745,8 +757,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNFastImage:
:path: "../node_modules/react-native-fast-image"
RNFS:
:path: "../node_modules/react-native-fs"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNReanimated:
@ -767,6 +777,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
EXApplication: 54fe5bd6268d697771645e8f1aef8b806a65247a
EXAV: b9ed0c201092244c46aa78f907f5c66176bed236
EXConstants: 88bf79622fbd9b476c96d8ec57fe97ca44fe8e3c
EXCrypto: ab2ba0df3136a5f2407b8c7e70eb498ac20d704f
@ -775,10 +786,12 @@ SPEC CHECKSUMS:
EXFileSystem: 7bcd3c1428698150d5c8ca140c8183f2ee204048
EXFirebaseAnalytics: a7ec2dd1394ad0de5c0c63fac0deee496f798284
EXFirebaseCore: 52151d0b008b99983e6a120cea94466ee760a4e9
EXFont: 2597c10ac85a69d348d44d7873eccf5a7576ef5e
EXImageLoader: 347b72c2ec2df65120ccec40ea65a4c4f24317ff
EXImageManipulator: 60d1bf3f1d7709453b1feb38adf8594b7f58710f
EXImagePicker: bf4d62532cc2bf217edbe4abbb0014e73e079eac
EXJSONUtils: 5ee0d5cf76da70ad86f0be1a41cc70f47d69e06f
EXKeepAwake: bf48d7f740a5cd2befed6cf9a49911d385c6c47d
EXManifests: d3464cd2278f4a19cd80c1aa673231570b534c11
EXNotifications: a7d582fa800d77f4a75bd22d52e84e2fbcee26df
Expo: 534e51e607aba8229293297da5585f4b26f50fa1
@ -846,7 +859,6 @@ SPEC CHECKSUMS:
ReactCommon: 07d0c460b9ba9af3eaf1b8f5abe7daaad28c9c4e
RNCAsyncStorage: 005c0e2f09575360f142d0d1f1f15e4ec575b1af
RNFastImage: 945abf54742505d790d9024d230c69b1e866bc88
RNFS: fc610f78fdf8bfc89a9e5cc2f898519f4dba1002
RNGestureHandler: 4f4986408310a43f1606c391f38f76e0d6e790d5
RNReanimated: 46cdb89ca59ab7181334f4ed05a70e82ddb36751
RNScreens: 40a2cb40a02a609938137a1e0acfbf8fc9eebf19
@ -859,6 +871,6 @@ SPEC CHECKSUMS:
UMTaskManagerInterface: 3184c93ecc290bd422c6e344badc89b601e9c29b
Yoga: d6b6a80659aa3e91aaba01d0012e7edcbedcbecd
PODFILE CHECKSUM: 26ee7ffc1b88088246dc6a04f532230c6d5a5884
PODFILE CHECKSUM: 040599cb42f9766a495935deae4c4908f2041ece
COCOAPODS: 1.11.3

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" 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>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--React Share View Controller-->
<scene sceneID="ceB-am-kn3">
<objects>
<viewController id="j1y-V4-xli" customClass="ReactShareViewController" customModule="ShareExtension" 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="122" y="105"/>
</scene>
</scenes>
</document>

View File

@ -34,8 +34,8 @@
<integer>1</integer>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ShareViewController</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.share-services</string>
</dict>

View File

@ -20,10 +20,8 @@
BB2F792D24A3F905000567C9 /* Expo.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB2F792C24A3F905000567C9 /* Expo.plist */; };
DA8B5B7F0DED488CAC0FF169 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B96B72E5384D44A7B240B27E /* GoogleService-Info.plist */; };
E3BC22F5F8ABE515E14CF199 /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D878F932AF7A9974E06E461 /* ExpoModulesProvider.swift */; };
E633A426281EAEAB000E540F /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E633A424281EAEAB000E540F /* MainInterface.storyboard */; };
E633A42B281EAEAB000E540F /* ShareExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = E633A420281EAEAB000E540F /* ShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
E633A430281EAF38000E540F /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E633A42F281EAF38000E540F /* ShareViewController.swift */; };
E633A437281EB5BC000E540F /* ReactShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E633A436281EB5BC000E540F /* ReactShareViewController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -75,11 +73,9 @@
B96B72E5384D44A7B240B27E /* GoogleService-Info.plist */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "tooot/GoogleService-Info.plist"; sourceTree = "<group>"; };
BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = "<group>"; };
E633A420281EAEAB000E540F /* ShareExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = ShareExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
E633A425281EAEAB000E540F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
E633A427281EAEAB000E540F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E633A42F281EAF38000E540F /* ShareViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ShareViewController.swift; path = "../../node_modules/react-native-share-menu/ios/ShareViewController.swift"; sourceTree = "<group>"; };
E633A431281EB55C000E540F /* ShareExtension-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ShareExtension-Bridging-Header.h"; sourceTree = "<group>"; };
E633A436281EB5BC000E540F /* ReactShareViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ReactShareViewController.swift; path = "../../node_modules/react-native-share-menu/ios/ReactShareViewController.swift"; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
/* End PBXFileReference section */
@ -207,9 +203,7 @@
E633A421281EAEAB000E540F /* ShareExtension */ = {
isa = PBXGroup;
children = (
E633A436281EB5BC000E540F /* ReactShareViewController.swift */,
E633A42F281EAF38000E540F /* ShareViewController.swift */,
E633A424281EAEAB000E540F /* MainInterface.storyboard */,
E633A427281EAEAB000E540F /* Info.plist */,
E633A431281EB55C000E540F /* ShareExtension-Bridging-Header.h */,
);
@ -324,7 +318,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E633A426281EAEAB000E540F /* MainInterface.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -502,7 +495,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E633A437281EB5BC000E540F /* ReactShareViewController.swift in Sources */,
E633A430281EAF38000E540F /* ShareViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -536,14 +528,6 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
E633A424281EAEAB000E540F /* MainInterface.storyboard */ = {
isa = PBXVariantGroup;
children = (
E633A425281EAEAB000E540F /* Base */,
);
name = MainInterface.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */

View File

@ -291,10 +291,10 @@ index 0aa4c58..ad0812c 100644
+ func continueInApp(with items: [NSExtensionItem], and extraData: [String:Any]?)
}
diff --git a/node_modules/react-native-share-menu/ios/ShareViewController.swift b/node_modules/react-native-share-menu/ios/ShareViewController.swift
index 7faf6e4..12d8c92 100644
index 7faf6e4..f02bde5 100644
--- a/node_modules/react-native-share-menu/ios/ShareViewController.swift
+++ b/node_modules/react-native-share-menu/ios/ShareViewController.swift
@@ -6,7 +6,9 @@
@@ -6,15 +6,18 @@
//
// Created by Gustavo Parreira on 26/07/2020.
//
@ -304,38 +304,43 @@ index 7faf6e4..12d8c92 100644
import MobileCoreServices
import UIKit
import Social
@@ -15,6 +17,7 @@ import RNShareMenu
class ShareViewController: SLComposeServiceViewController {
import RNShareMenu
-class ShareViewController: SLComposeServiceViewController {
+class ShareViewController: UIViewController {
var hostAppId: String?
var hostAppUrlScheme: String?
+ var sharedItems: [Any] = []
override func viewDidLoad() {
super.viewDidLoad()
@@ -39,12 +42,12 @@ class ShareViewController: SLComposeServiceViewController {
@@ -30,46 +33,64 @@ class ShareViewController: SLComposeServiceViewController {
} else {
print("Error: \(NO_INFO_PLIST_URL_SCHEME_ERROR)")
}
- }
override func didSelectPost() {
// This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
- override func isContentValid() -> Bool {
- // Do validation of contentText and/or NSExtensionContext attachments here
- return true
+ guard let items = extensionContext?.inputItems as? [NSExtensionItem] else {
+ cancelRequest()
+ return
}
- override func didSelectPost() {
- // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
- guard let item = extensionContext?.inputItems.first as? NSExtensionItem else {
+ guard let items = extensionContext?.inputItems as? [NSExtensionItem] else {
cancelRequest()
return
}
- handlePost(item)
+ handlePost(items)
}
override func configurationItems() -> [Any]! {
@@ -52,24 +55,50 @@ class ShareViewController: SLComposeServiceViewController {
return []
}
- func handlePost(_ item: NSExtensionItem, extraData: [String:Any]? = nil) {
- guard let provider = item.attachments?.first else {
- cancelRequest()
- return
- }
- cancelRequest()
+ handlePost(items)
+ }
+
+ override func viewDidAppear(_ animated: Bool) {
+ super.viewDidAppear(animated)
+
+ completeRequest()
+ }
+
+ func handlePost(_ items: [NSExtensionItem], extraData: [String:Any]? = nil) {
+ DispatchQueue.global().async {
+ guard let hostAppId = self.hostAppId else {
@ -344,13 +349,10 @@ index 7faf6e4..12d8c92 100644
+ }
+ guard let userDefaults = UserDefaults(suiteName: "group.\(hostAppId)") else {
+ self.exit(withError: NO_APP_GROUP_ERROR)
+ return
+ }
return
}
- if let data = extraData {
- storeExtraData(data)
- } else {
- removeExtraData()
- handlePost(item)
- }
+ if let data = extraData {
+ self.storeExtraData(data)
@ -358,21 +360,28 @@ index 7faf6e4..12d8c92 100644
+ self.removeExtraData()
+ }
- if provider.isText {
- storeText(withProvider: provider)
- } else if provider.isURL {
- storeUrl(withProvider: provider)
- } else {
- storeFile(withProvider: provider)
- override func configurationItems() -> [Any]! {
- // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.
- return []
- }
+ let semaphore = DispatchSemaphore(value: 0)
+ var results: [Any] = []
+
- func handlePost(_ item: NSExtensionItem, extraData: [String:Any]? = nil) {
- guard let provider = item.attachments?.first else {
- cancelRequest()
- return
- }
+ for item in items {
+ guard let attachments = item.attachments else {
+ self.cancelRequest()
+ return
+ }
+
- if let data = extraData {
- storeExtraData(data)
- } else {
- removeExtraData()
- }
+ for provider in attachments {
+ if provider.isText {
+ self.storeText(withProvider: provider, semaphore)
@ -381,7 +390,13 @@ index 7faf6e4..12d8c92 100644
+ } else {
+ self.storeFile(withProvider: provider, semaphore)
+ }
+
- if provider.isText {
- storeText(withProvider: provider)
- } else if provider.isURL {
- storeUrl(withProvider: provider)
- } else {
- storeFile(withProvider: provider)
+ semaphore.wait()
+ }
+ }
@ -394,7 +409,7 @@ index 7faf6e4..12d8c92 100644
}
}
@@ -99,7 +128,7 @@ class ShareViewController: SLComposeServiceViewController {
@@ -99,7 +120,7 @@ class ShareViewController: SLComposeServiceViewController {
userDefaults.synchronize()
}
@ -403,7 +418,7 @@ index 7faf6e4..12d8c92 100644
provider.loadItem(forTypeIdentifier: kUTTypeText as String, options: nil) { (data, error) in
guard (error == nil) else {
self.exit(withError: error.debugDescription)
@@ -109,24 +138,13 @@ class ShareViewController: SLComposeServiceViewController {
@@ -109,24 +130,13 @@ class ShareViewController: SLComposeServiceViewController {
self.exit(withError: COULD_NOT_FIND_STRING_ERROR)
return
}
@ -415,11 +430,11 @@ index 7faf6e4..12d8c92 100644
- self.exit(withError: NO_APP_GROUP_ERROR)
- return
- }
-
- userDefaults.set([DATA_KEY: text, MIME_TYPE_KEY: "text/plain"],
- forKey: USER_DEFAULTS_KEY)
- userDefaults.synchronize()
-
- self.openHostApp()
+ self.sharedItems.append([DATA_KEY: text, MIME_TYPE_KEY: "text/plain"])
+ semaphore.signal()
@ -431,7 +446,7 @@ index 7faf6e4..12d8c92 100644
provider.loadItem(forTypeIdentifier: kUTTypeURL as String, options: nil) { (data, error) in
guard (error == nil) else {
self.exit(withError: error.debugDescription)
@@ -136,24 +154,13 @@ class ShareViewController: SLComposeServiceViewController {
@@ -136,24 +146,13 @@ class ShareViewController: SLComposeServiceViewController {
self.exit(withError: COULD_NOT_FIND_URL_ERROR)
return
}
@ -459,7 +474,7 @@ index 7faf6e4..12d8c92 100644
provider.loadItem(forTypeIdentifier: kUTTypeData as String, options: nil) { (data, error) in
guard (error == nil) else {
self.exit(withError: error.debugDescription)
@@ -167,10 +174,6 @@ class ShareViewController: SLComposeServiceViewController {
@@ -167,10 +166,6 @@ class ShareViewController: SLComposeServiceViewController {
self.exit(withError: NO_INFO_PLIST_INDENTIFIER_ERROR)
return
}
@ -470,7 +485,7 @@ index 7faf6e4..12d8c92 100644
guard let groupFileManagerContainer = FileManager.default
.containerURL(forSecurityApplicationGroupIdentifier: "group.\(hostAppId)")
else {
@@ -189,11 +192,8 @@ class ShareViewController: SLComposeServiceViewController {
@@ -189,11 +184,8 @@ class ShareViewController: SLComposeServiceViewController {
return
}

View File

@ -1,43 +0,0 @@
import { useEffect } from 'react'
import { Appearance, Pressable } from 'react-native'
import { Circle } from 'react-native-animated-spinkit'
import { ShareMenuReactView } from 'react-native-share-menu'
// mimeType
// text/plain - text only, website URL, video?!
// image/jpeg - image
// video/mp4 - video
const colors = {
primary: {
light: 'rgb(18, 18, 18)',
dark: 'rgb(180, 180, 180)'
},
background: {
light: 'rgb(250, 250, 250)',
dark: 'rgb(18, 18, 18)'
}
}
const ShareExtension = () => {
useEffect(() => {
ShareMenuReactView.continueInApp()
}, [])
const theme = Appearance.getColorScheme() || 'light'
return (
<Pressable
style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: colors.background[theme]
}}
>
<Circle size={18} color={colors.primary[theme]} />
</Pressable>
)
}
export default ShareExtension

View File

@ -1,7 +1,6 @@
import axios from 'axios'
import chalk from 'chalk'
import Constants from 'expo-constants'
import * as Sentry from 'sentry-expo'
const ctx = new chalk.Instance({ level: 3 })
@ -14,7 +13,6 @@ export type Params = {
}
headers?: { [key: string]: string }
body?: FormData | Object
sentry?: boolean
}
const apiGeneral = async <T = unknown>({
@ -23,8 +21,7 @@ const apiGeneral = async <T = unknown>({
url,
params,
headers,
body,
sentry = true
body
}: Params): Promise<{ body: T }> => {
console.log(
ctx.bgGreen.bold(' API general ') +
@ -45,7 +42,10 @@ const apiGeneral = async <T = unknown>({
url,
params,
headers: {
'Content-Type': 'application/json',
'Content-Type':
body && body instanceof FormData
? 'multipart/form-data'
: 'application/json',
'User-Agent': `tooot/${Constants.manifest?.version}`,
Accept: '*/*',
...headers

View File

@ -3,7 +3,6 @@ import axios, { AxiosRequestConfig } from 'axios'
import chalk from 'chalk'
import Constants from 'expo-constants'
import li from 'li'
import * as Sentry from 'sentry-expo'
const ctx = new chalk.Instance({ level: 3 })
@ -73,7 +72,10 @@ const apiInstance = async <T = unknown>({
url,
params,
headers: {
'Content-Type': 'application/json',
'Content-Type':
body && body instanceof FormData
? 'multipart/form-data'
: 'application/json',
'User-Agent': `tooot/${Constants.manifest?.version}`,
Accept: '*/*',
...headers,

View File

@ -48,7 +48,10 @@ const apiTooot = async <T = unknown>({
url: `${url}`,
params,
headers: {
'Content-Type': 'application/json',
'Content-Type':
body && body instanceof FormData
? 'multipart/form-data'
: 'application/json',
'User-Agent': `tooot/${Constants.manifest?.version}`,
Accept: '*/*',
...headers

View File

@ -3963,9 +3963,9 @@ flow-parser@^0.121.0:
integrity sha512-1gIBiWJNR0tKUNv8gZuk7l9rVX06OuLzY9AoGio7y/JT4V1IZErEMEq2TJS+PFcw/y0RshZ1J/27VfK1UQzYVg==
follow-redirects@^1.14.9:
version "1.14.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==
version "1.15.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.0.tgz#06441868281c86d0dda4ad8bdaead2d02dca89d4"
integrity sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==
fontfaceobserver@^2.1.0:
version "2.1.0"