From 667bb5c307cab6a52703d34c6908a2816f0efe5c Mon Sep 17 00:00:00 2001 From: cameronvoell Date: Tue, 27 Aug 2024 16:51:30 -0700 Subject: [PATCH] fix: sharing files from debug screen fixed so it works on iOS and Android --- components/DebugButton.tsx | 12 +++++++---- ios/Gemfile.lock | 42 ++++++++++++++++++++++---------------- ios/Podfile.lock | 6 ++++++ package.json | 1 + yarn.lock | 5 +++++ 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/components/DebugButton.tsx b/components/DebugButton.tsx index 0e615943a..318d57cfc 100644 --- a/components/DebugButton.tsx +++ b/components/DebugButton.tsx @@ -14,7 +14,8 @@ import Constants from "expo-constants"; import { Image } from "expo-image"; import * as Updates from "expo-updates"; import { forwardRef, useImperativeHandle } from "react"; -import { Platform, Alert, Share } from "react-native"; +import { Platform, Alert } from "react-native"; +import Share from "react-native-share"; import { showActionSheetWithOptions } from "./StateHandlers/ActionSheetStateHandler"; import config from "../config"; @@ -46,16 +47,18 @@ const DebugButton = forwardRef((props, ref) => { showDebugMenu() { const methods: any = { "Share current session logs": async () => { - Share.share({ + Share.open({ title: "Converse Log Session", url: `file://${loggingFilePath}`, + type: "text/plain", }); }, "Share native logs": async () => { const nativeLogFilePath = await getNativeLogFile(); - Share.share({ + Share.open({ title: "LibXMTP Logs", url: `file://${nativeLogFilePath}`, + type: "text/plain", }); }, "Share previous session logs": async () => { @@ -63,9 +66,10 @@ const DebugButton = forwardRef((props, ref) => { if (!previousLoggingFile) { return Alert.alert("No previous session logging file found"); } - Share.share({ + Share.open({ title: "Converse Log Session", url: `file://${previousLoggingFile}`, + type: "text/plain", }); }, "New log session": rotateLoggingFile, diff --git a/ios/Gemfile.lock b/ios/Gemfile.lock index 20a071537..84745130d 100644 --- a/ios/Gemfile.lock +++ b/ios/Gemfile.lock @@ -1,26 +1,29 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.6) + CFPropertyList (3.0.7) + base64 + nkf rexml activesupport (7.0.7.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.5) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) + base64 (0.2.0) claide (1.1.0) - cocoapods (1.12.1) + cocoapods (1.15.2) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.12.1) + cocoapods-core (= 1.15.2) cocoapods-deintegrate (>= 1.0.3, < 2.0) - cocoapods-downloader (>= 1.6.0, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-trunk (>= 1.6.0, < 2.0) @@ -32,8 +35,8 @@ GEM molinillo (~> 0.8.0) nap (~> 1.0) ruby-macho (>= 2.3.0, < 3.0) - xcodeproj (>= 1.21.0, < 2.0) - cocoapods-core (1.12.1) + xcodeproj (>= 1.23.0, < 2.0) + cocoapods-core (1.15.2) activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -44,7 +47,7 @@ GEM public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (1.6.3) + cocoapods-downloader (2.1) cocoapods-plugins (1.0.0) nap cocoapods-pod-linkage (0.0.1) @@ -55,31 +58,34 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.3) escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) - ffi (1.15.5) + ffi (1.17.0-arm64-darwin) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) - i18n (1.14.1) + i18n (1.14.5) concurrent-ruby (~> 1.0) - json (2.6.3) - minitest (5.19.0) + json (2.7.1) + minitest (5.20.0) molinillo (0.8.0) nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) + nkf (0.2.0) public_suffix (4.0.7) - rexml (3.2.6) + rexml (3.2.9) + strscan ruby-macho (2.5.1) - typhoeus (1.4.0) + strscan (1.0.3) + typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - xcodeproj (1.22.0) + xcodeproj (1.24.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -88,7 +94,7 @@ GEM rexml (~> 3.2.4) PLATFORMS - ruby + arm64-darwin-23 DEPENDENCIES activesupport (>= 6.1.7.3, < 7.1.0) @@ -96,4 +102,4 @@ DEPENDENCIES cocoapods-pod-linkage BUNDLED WITH - 2.1.4 + 2.4.10 diff --git a/ios/Podfile.lock b/ios/Podfile.lock index e69e6d0b5..d13bdd500 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1763,6 +1763,8 @@ PODS: - React-Core - React-hermes - Sentry/HybridSDK (= 8.29.1) + - RNShare (10.2.1): + - React-Core - RNSVG (15.2.0): - React-Core - SDWebImage (5.19.7): @@ -1933,6 +1935,7 @@ DEPENDENCIES: - RNReanimated (from `../node_modules/react-native-reanimated`) - RNScreens (from `../node_modules/react-native-screens`) - "RNSentry (from `../node_modules/@sentry/react-native`)" + - RNShare (from `../node_modules/react-native-share`) - RNSVG (from `../node_modules/react-native-svg`) - Sentry/HybridSDK (= 8.29.1) - SQLite.swift @@ -2221,6 +2224,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-screens" RNSentry: :path: "../node_modules/@sentry/react-native" + RNShare: + :path: "../node_modules/react-native-share" RNSVG: :path: "../node_modules/react-native-svg" UMAppLoader: @@ -2372,6 +2377,7 @@ SPEC CHECKSUMS: RNReanimated: d51431fd3597a8f8320319dce8e42cee82a5445f RNScreens: 30249f9331c3b00ae7cb7922e11f58b3ed369c07 RNSentry: e9aa15bb2f3e18c822c002eea13bbd3b222ab493 + RNShare: 0fad69ae2d71de9d1f7b9a43acf876886a6cb99c RNSVG: 43b64ed39c14ce830d840903774154ca0c1f27ec SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3 SDWebImageAVIFCoder: 00310d246aab3232ce77f1d8f0076f8c4b021d90 diff --git a/package.json b/package.json index f719fc192..0f518baec 100644 --- a/package.json +++ b/package.json @@ -163,6 +163,7 @@ "react-native-safe-area-context": "4.10.5", "react-native-screens": "3.31.1", "react-native-sfsymbols": "^1.2.1", + "react-native-share": "^10.2.1", "react-native-shared-group-preferences": "^1.1.23", "react-native-sqlite-storage": "^6.0.1", "react-native-svg": "15.2.0", diff --git a/yarn.lock b/yarn.lock index 99db48c62..750272b4f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21157,6 +21157,11 @@ react-native-sfsymbols@^1.2.1: resolved "https://registry.yarnpkg.com/react-native-sfsymbols/-/react-native-sfsymbols-1.2.1.tgz#53422d432dca1e028cfd95a283d69a590d3e3f84" integrity sha512-G8TLcTJwUsVhDQV/yatoltWF+BWrEyb5Grmrhzdrc0gH9TgXnjfoJ9QxaWwC/3D6QVuaugosnbmlL69EurgM/w== +react-native-share@^10.2.1: + version "10.2.1" + resolved "https://registry.npmjs.org/react-native-share/-/react-native-share-10.2.1.tgz#baf94848c2acee6e52f6b28e05c47fa5fa9402be" + integrity sha512-Z2LWGYWH7raM4H6Oauttv1tEhaB43XSWJAN8iS6oaSG9CnyrUBeYFF4QpU1AH5RgNeylXQdN8CtbizCHHt6coQ== + react-native-shared-group-preferences@^1.1.23: version "1.1.23" resolved "https://registry.npmjs.org/react-native-shared-group-preferences/-/react-native-shared-group-preferences-1.1.23.tgz"