├── .gitignore
├── LICENSE
├── README.md
├── android
├── README.md
├── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── ipfs
│ └── gomobilern
│ ├── ExceptionSupplier.java
│ ├── GomobileIpfsModule.java
│ ├── GomobileIpfsPackage.java
│ └── MapHelpers.java
├── index.d.ts
├── index.js
├── ios
├── .gitignore
├── GomobileIpfs.xcodeproj
│ └── project.pbxproj
├── Podfile
└── Sources
│ ├── GomobileIpfs-Bridging-Header.h
│ ├── GomobileIpfs.m
│ ├── GomobileIpfs.swift
│ ├── Pointer.swift
│ └── ReactTry.swift
├── package.json
└── react-native-gomobile-ipfs.podspec
/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # node.js
6 | #
7 | node_modules/
8 | npm-debug.log
9 | yarn-error.log
10 | yarn.lock
11 |
12 | # Xcode
13 | #
14 | build/
15 | *.pbxuser
16 | !default.pbxuser
17 | *.mode1v3
18 | !default.mode1v3
19 | *.mode2v3
20 | !default.mode2v3
21 | *.perspectivev3
22 | !default.perspectivev3
23 | xcuserdata
24 | *.xccheckout
25 | *.moved-aside
26 | DerivedData
27 | *.hmap
28 | *.ipa
29 | *.xcuserstate
30 | project.xcworkspace
31 |
32 | # Android/IntelliJ
33 | #
34 | build/
35 | .idea
36 | .gradle
37 | local.properties
38 | *.iml
39 |
40 | # BUCK
41 | buck-out/
42 | \.buckd/
43 | *.keystore
44 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-native-gomobile-ipfs
2 |
3 | React Native bindings for [ipfs-shipyard/gomobile-ipfs](https://github.com/ipfs-shipyard/gomobile-ipfs)
4 |
5 | ## Getting started
6 |
7 | `$ yarn add react-native-gomobile-ipfs`
8 |
9 | ### Android
10 |
11 | Add gomobile-ipfs maven repository to your `android/build.gradle` repositories section
12 |
13 | ```groovy
14 | maven {
15 | url 'https://dl.bintray.com/berty/gomobile-ipfs-android'
16 | }
17 | ```
18 |
19 | ## Usage
20 | ```javascript
21 | // Import library
22 | import {IPFS} from 'react-native-gomobile-ipfs';
23 |
24 | // Create instance of IPFS. Use one instance per app.
25 | const ipfs = await IPFS.create();
26 |
27 | // Start IPFS instance. It will connect to the network.
28 | await ipfs.start();
29 |
30 | // Create IPFS request. Check IPFS HTTP API docs.
31 | var req = await ipfs.newRequest('cat');
32 |
33 | // Add argument to request
34 | req = await req.withArgument('/ipns/xkcd.hacdias.com/0176/image.png');
35 |
36 | // Send request.
37 | const image = await req.send();
38 |
39 | // Remove request object from memory. Don't forget or you will have memory leak.
40 | // IPFS object also has `free` method.
41 | await req.free();
42 |
43 | // Print binary data of the image
44 | console.log('Image', data);
45 | ```
46 |
--------------------------------------------------------------------------------
/android/README.md:
--------------------------------------------------------------------------------
1 | README
2 | ======
3 |
4 | If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm:
5 |
6 | 1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
7 | 2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
8 | ```
9 | ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
10 | sdk.dir=/Users/{username}/Library/Android/sdk
11 | ```
12 | 3. Delete the `maven` folder
13 | 4. Run `./gradlew installArchives`
14 | 5. Verify that latest set of generated files is in the maven folder with the correct version number
15 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | // android/build.gradle
2 | def DEFAULT_COMPILE_SDK_VERSION = 28
3 | def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
4 | def DEFAULT_MIN_SDK_VERSION = 21
5 | def DEFAULT_TARGET_SDK_VERSION = 28
6 |
7 | def safeExtGet(prop, fallback) {
8 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
9 | }
10 |
11 | apply plugin: 'com.android.library'
12 |
13 | buildscript {
14 | // The Android Gradle plugin is only required when opening the android folder stand-alone.
15 | // This avoids unnecessary downloads and potential conflicts when the library is included as a
16 | // module dependency in an application project.
17 | // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
18 | if (project == rootProject) {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | dependencies {
24 | classpath 'com.android.tools.build:gradle:4.1.0'
25 | }
26 | }
27 | }
28 |
29 | android {
30 | compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
31 | buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
32 | defaultConfig {
33 | minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
34 | targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
35 | versionCode 1
36 | versionName "1.0"
37 | }
38 | lintOptions {
39 | abortOnError false
40 | }
41 | compileOptions {
42 | sourceCompatibility JavaVersion.VERSION_1_8
43 | targetCompatibility JavaVersion.VERSION_1_8
44 | }
45 | }
46 |
47 | repositories {
48 | // ref: https://www.baeldung.com/maven-local-repository
49 | mavenLocal()
50 | maven {
51 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
52 | url "$rootDir/../node_modules/react-native/android"
53 | }
54 | maven {
55 | // Android JSC is installed from npm
56 | url "$rootDir/../node_modules/jsc-android/dist"
57 | }
58 | maven {
59 | // Gomobile Repo
60 | url 'https://dl.bintray.com/berty/gomobile-ipfs-android'
61 | }
62 | google()
63 | jcenter()
64 | }
65 |
66 | dependencies {
67 | implementation 'ipfs.gomobile:bridge:1.2.1'
68 | //noinspection GradleDynamicVersion
69 | implementation 'com.facebook.react:react-native:+' // From node_modules
70 | }
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tesseract-one/react-native-gomobile-ipfs/d566a072cddff1e249b71d24b179338501cd43ba/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Oct 25 00:04:06 EEST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
7 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/android/src/main/java/ipfs/gomobilern/ExceptionSupplier.java:
--------------------------------------------------------------------------------
1 | package ipfs.gomobilern;
2 |
3 | import androidx.core.util.Supplier;
4 |
5 | @FunctionalInterface
6 | public interface ExceptionSupplier {
7 | T get() throws Exception;
8 | }
9 |
--------------------------------------------------------------------------------
/android/src/main/java/ipfs/gomobilern/GomobileIpfsModule.java:
--------------------------------------------------------------------------------
1 | package ipfs.gomobilern;
2 |
3 | import com.facebook.react.bridge.ReactApplicationContext;
4 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
5 | import com.facebook.react.bridge.ReactMethod;
6 | import com.facebook.react.bridge.Promise;
7 | import com.facebook.react.bridge.ReadableMap;
8 | import ipfs.gomobile.android.IPFS;
9 | import ipfs.gomobile.android.RequestBuilder;
10 |
11 | import java.util.ArrayList;
12 | import java.util.HashMap;
13 | import java.util.Map;
14 | import java.util.concurrent.atomic.AtomicLong;
15 | import android.util.Base64;
16 |
17 | import org.json.JSONObject;
18 |
19 | import androidx.annotation.NonNull;
20 |
21 | public class GomobileIpfsModule extends ReactContextBaseJavaModule {
22 |
23 | private final ReactApplicationContext reactContext;
24 | private final Map pointers;
25 | private final AtomicLong pointer;
26 |
27 | GomobileIpfsModule(ReactApplicationContext reactContext) {
28 | super(reactContext);
29 | this.reactContext = reactContext;
30 | this.pointers = new HashMap<>();
31 | this.pointer = new AtomicLong();
32 | }
33 |
34 | @Override @NonNull
35 | public String getName() {
36 | return "GomobileIpfs";
37 | }
38 |
39 | @ReactMethod
40 | public void ipfsCreate(String repoPath, Boolean internalStorage, Promise promise) {
41 | tryReact(promise, () ->
42 | this.getPointer(new IPFS(this.reactContext, repoPath, internalStorage))
43 | );
44 | }
45 |
46 | @ReactMethod
47 | public void ipfsStart(String ptr, Promise promise) {
48 | tryReact(promise, () -> {
49 | IPFS ipfs = this.getUnretainedObject(ptr);
50 | ipfs.start();
51 | return null;
52 | });
53 | }
54 |
55 | @ReactMethod
56 | public void ipfsStop(String ptr, Promise promise) {
57 | tryReact(promise, () -> {
58 | IPFS ipfs = this.getUnretainedObject(ptr);
59 | ipfs.stop();
60 | return null;
61 | });
62 | }
63 |
64 | @ReactMethod
65 | public void ipfsRestart(String ptr, Promise promise) {
66 | tryReact(promise, () -> {
67 | IPFS ipfs = this.getUnretainedObject(ptr);
68 | ipfs.restart();
69 | return null;
70 | });
71 | }
72 |
73 | @ReactMethod
74 | public void ipfsFree(String ptr, Promise promise) {
75 | tryReact(promise, () -> {
76 | this.getRetainedObject(ptr);
77 | return null;
78 | });
79 | }
80 |
81 | @ReactMethod
82 | public void ipfsIsStarted(String ptr, Promise promise) {
83 | tryReact(promise, () -> {
84 | IPFS ipfs = this.getUnretainedObject(ptr);
85 | return ipfs.isStarted();
86 | });
87 | }
88 |
89 | @ReactMethod
90 | public void ipfsGetConfig(String ptr, Promise promise) {
91 | tryReact(promise, () -> {
92 | IPFS ipfs = this.getUnretainedObject(ptr);
93 | return MapHelpers.fromJsonObject(ipfs.getConfig());
94 | });
95 | }
96 |
97 | @ReactMethod
98 | public void ipfsSetConfig(String ptr, ReadableMap config, Promise promise) {
99 | tryReact(promise, () -> {
100 | IPFS ipfs = this.getUnretainedObject(ptr);
101 | ipfs.setConfig(MapHelpers.fromMap(config));
102 | return null;
103 | });
104 | }
105 |
106 | @ReactMethod
107 | public void ipfsGetConfigKey(String ptr, String key, Promise promise) {
108 | tryReact(promise, () -> {
109 | IPFS ipfs = this.getUnretainedObject(ptr);
110 | return MapHelpers.fromJsonObject(ipfs.getConfigKey(key));
111 | });
112 | }
113 |
114 | @ReactMethod
115 | public void ipfsSetConfigKey(String ptr, String key, ReadableMap config, Promise promise) {
116 | tryReact(promise, () -> {
117 | IPFS ipfs = this.getUnretainedObject(ptr);
118 | ipfs.setConfigKey(key, MapHelpers.fromMap(config));
119 | return null;
120 | });
121 | }
122 |
123 | @ReactMethod
124 | public void ipfsEnablePubsubExperiment(String ptr, Promise promise) {
125 | tryReact(promise, () -> {
126 | IPFS ipfs = this.getUnretainedObject(ptr);
127 | ipfs.enablePubsubExperiment();
128 | return null;
129 | });
130 | }
131 |
132 | @ReactMethod
133 | public void ipfsEnableNamesysPubsub(String ptr, Promise promise) {
134 | tryReact(promise, () -> {
135 | IPFS ipfs = this.getUnretainedObject(ptr);
136 | ipfs.enableNamesysPubsub();
137 | return null;
138 | });
139 | }
140 |
141 | @ReactMethod
142 | public void ipfsSetDNSPair(String primary, String secondary, Promise promise) {
143 | tryReact(promise, () -> {
144 | IPFS.setDNSPair(primary, secondary);
145 | return null;
146 | });
147 | }
148 |
149 | @ReactMethod
150 | public void ipfsGetAbsoluteRepoPath(String ptr, Promise promise) {
151 | tryReact(promise, () -> {
152 | IPFS ipfs = this.getUnretainedObject(ptr);
153 | return ipfs.getRepoAbsolutePath();
154 | });
155 | }
156 |
157 | @ReactMethod
158 | public void ipfsNewRequest(String ptr, String command, Promise promise) {
159 | tryReact(promise, () -> {
160 | IPFS ipfs = this.getUnretainedObject(ptr);
161 | RequestBuilder builder = ipfs.newRequest(command);
162 | return this.getPointer(builder);
163 | });
164 | }
165 |
166 | @ReactMethod
167 | public void requestBuilderWithArgument(String ptr, String argument, Promise promise) {
168 | tryReact(promise, () -> {
169 | RequestBuilder builder = this.getRetainedObject(ptr);
170 | return this.getPointer(builder.withArgument(argument));
171 | });
172 | }
173 |
174 | @ReactMethod
175 | public void requestBuilderWithOption(
176 | String ptr, String option, String type, Object value, Promise promise
177 | ) {
178 | tryReact(promise, () -> {
179 | RequestBuilder builder = this.getRetainedObject(ptr);
180 | switch (type) {
181 | case "B":
182 | case "b":
183 | builder = builder.withOption(option, (Boolean) value);
184 | break;
185 | case "S":
186 | case "s":
187 | builder = builder.withOption(option, (String) value);
188 | break;
189 | case "D":
190 | case "d":
191 | byte[] data = Base64.decode((String) value, Base64.DEFAULT);
192 | builder = builder.withOption(option, data);
193 | break;
194 | default: throw new Error("Unknown option type: "+type);
195 | }
196 | return this.getPointer(builder);
197 | });
198 | }
199 |
200 | @ReactMethod
201 | public void requestBuilderWithBody(
202 | String ptr, String type, Object body, Promise promise
203 | ) {
204 | tryReact(promise, () -> {
205 | RequestBuilder builder = this.getRetainedObject(ptr);
206 | switch (type) {
207 | case "S":
208 | case "s":
209 | builder = builder.withBody((String) body);
210 | break;
211 | case "D":
212 | case "d":
213 | byte[] data = Base64.decode((String) body, Base64.DEFAULT);
214 | builder = builder.withBody(data);
215 | break;
216 | default: throw new Error("Unknown option type: "+type);
217 | }
218 | return this.getPointer(builder);
219 | });
220 | }
221 |
222 | @ReactMethod
223 | public void requestBuilderWithHeader(String ptr, String header, String value, Promise promise) {
224 | tryReact(promise, () -> {
225 | RequestBuilder builder = this.getRetainedObject(ptr);
226 | return this.getPointer(builder.withHeader(header, value));
227 | });
228 | }
229 |
230 | @ReactMethod
231 | public void requestBuilderSend(String ptr, Promise promise) {
232 | tryReact(promise, () -> {
233 | RequestBuilder builder = this.getUnretainedObject(ptr);
234 | return Base64.encodeToString(builder.send(), Base64.NO_WRAP);
235 | });
236 | }
237 |
238 | @ReactMethod
239 | public void requestBuilderSendToDict(String ptr, Promise promise) {
240 | tryReact(promise, () -> {
241 | RequestBuilder builder = this.getUnretainedObject(ptr);
242 | ArrayList list = builder.sendToJSONList();
243 | return list.size() > 0 ? MapHelpers.fromJsonObject(list.get(0)) : null;
244 | });
245 | }
246 |
247 | @ReactMethod
248 | public void requestBuilderFree(String ptr, Promise promise) {
249 | tryReact(promise, () -> {
250 | RequestBuilder builder = this.getRetainedObject(ptr);
251 | return null;
252 | });
253 | }
254 |
255 | private String getPointer(Object object) {
256 | long index = pointer.incrementAndGet();
257 | String ptr = Long.toHexString(index);
258 | pointers.put(ptr, object);
259 | return ptr;
260 | }
261 |
262 | private T getRetainedObject(String ptr) throws Error, ClassCastException {
263 | T object = getUnretainedObject(ptr);
264 | pointers.remove(ptr);
265 | return object;
266 | }
267 |
268 | @SuppressWarnings("unchecked")
269 | private T getUnretainedObject(String ptr) throws Error, ClassCastException {
270 | Object obj = pointers.get(ptr);
271 | if (obj == null) {
272 | throw new Error("Object not found: "+ptr);
273 | }
274 | return (T)obj;
275 | }
276 |
277 | private void tryReact(Promise promise, ExceptionSupplier lambda) {
278 | try {
279 | T val = lambda.get();
280 | promise.resolve(val);
281 | } catch (Throwable e) {
282 | promise.reject(e.getClass().getCanonicalName(), e);
283 | }
284 | }
285 | }
286 |
--------------------------------------------------------------------------------
/android/src/main/java/ipfs/gomobilern/GomobileIpfsPackage.java:
--------------------------------------------------------------------------------
1 | package ipfs.gomobilern;
2 |
3 | import java.util.Arrays;
4 | import java.util.Collections;
5 | import java.util.List;
6 |
7 | import com.facebook.react.ReactPackage;
8 | import com.facebook.react.bridge.NativeModule;
9 | import com.facebook.react.bridge.ReactApplicationContext;
10 | import com.facebook.react.uimanager.ViewManager;
11 | import com.facebook.react.bridge.JavaScriptModule;
12 |
13 | public class GomobileIpfsPackage implements ReactPackage {
14 | @Override
15 | public List createNativeModules(ReactApplicationContext reactContext) {
16 | return Arrays.asList(new GomobileIpfsModule(reactContext));
17 | }
18 |
19 | @Override
20 | public List createViewManagers(ReactApplicationContext reactContext) {
21 | return Collections.emptyList();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/android/src/main/java/ipfs/gomobilern/MapHelpers.java:
--------------------------------------------------------------------------------
1 | package ipfs.gomobilern;
2 |
3 | import com.facebook.react.bridge.Arguments;
4 | import com.facebook.react.bridge.ReadableMap;
5 | import com.facebook.react.bridge.ReadableArray;
6 | import com.facebook.react.bridge.ReadableMapKeySetIterator;
7 | import com.facebook.react.bridge.WritableArray;
8 | import com.facebook.react.bridge.WritableMap;
9 |
10 | import org.json.JSONArray;
11 | import org.json.JSONObject;
12 |
13 | import java.util.Iterator;
14 |
15 | class MapHelpers {
16 | private static JSONArray fromArray(ReadableArray array) throws Exception {
17 | JSONArray json = new JSONArray();
18 | for (int i = 0; i < array.size(); i++) {
19 | switch (array.getType(i)) {
20 | case Array:
21 | ReadableArray rarr = array.getArray(i);
22 | json.put(rarr == null ? JSONObject.NULL : fromArray(rarr));
23 | break;
24 | case Map:
25 | ReadableMap rmap = array.getMap(i);
26 | json.put(rmap == null ? JSONObject.NULL : fromMap(rmap));
27 | break;
28 | case Boolean:
29 | json.put(array.getBoolean(i));
30 | break;
31 | case Null:
32 | json.put(JSONObject.NULL);
33 | break;
34 | case Number:
35 | json.put(array.getDouble(i));
36 | break;
37 | case String:
38 | json.put(array.getString(i));
39 | break;
40 | }
41 | }
42 | return json;
43 | }
44 |
45 | static JSONObject fromMap(ReadableMap map) throws Exception {
46 | JSONObject object = new JSONObject();
47 | ReadableMapKeySetIterator iterator = map.keySetIterator();
48 | while (iterator.hasNextKey()) {
49 | String key = iterator.nextKey();
50 | switch (map.getType(key)) {
51 | case Map:
52 | ReadableMap rmap = map.getMap(key);
53 | object.put(key, rmap == null ? JSONObject.NULL : fromMap(rmap));
54 | break;
55 | case Array:
56 | ReadableArray rarr = map.getArray(key);
57 | object.put(key, rarr == null ? JSONObject.NULL : fromArray(rarr));
58 | break;
59 | case Null:
60 | object.put(key, JSONObject.NULL);
61 | break;
62 | case Number:
63 | object.put(key, map.getDouble(key));
64 | break;
65 | case Boolean:
66 | object.put(key, map.getBoolean(key));
67 | break;
68 | case String:
69 | object.put(key, map.getString(key));
70 | break;
71 | }
72 | }
73 | return object;
74 | }
75 |
76 | private static WritableArray fromJsonArray(JSONArray json) throws Exception {
77 | WritableArray array = Arguments.createArray();
78 | for (int i = 0; i < json.length(); i++) {
79 | Object obj = json.get(i);
80 | if (obj == JSONObject.NULL || obj == null) {
81 | array.pushNull();
82 | } else if (obj instanceof Integer) {
83 | array.pushInt((Integer) obj);
84 | } else if (obj instanceof Long) {
85 | array.pushDouble((Long) obj);
86 | } else if (obj instanceof Double) {
87 | array.pushDouble((Double) obj);
88 | } else if (obj instanceof Float) {
89 | array.pushDouble((Float) obj);
90 | } else if (obj instanceof Boolean) {
91 | array.pushBoolean((Boolean) obj);
92 | } else if (obj instanceof String) {
93 | array.pushString((String) obj);
94 | } else if (obj instanceof JSONArray) {
95 | array.pushArray(fromJsonArray((JSONArray) obj));
96 | } else if (obj instanceof JSONObject) {
97 | array.pushMap(fromJsonObject((JSONObject) obj));
98 | }
99 | }
100 | return array;
101 | }
102 |
103 | static WritableMap fromJsonObject(JSONObject json) throws Exception {
104 | WritableMap map = Arguments.createMap();
105 | Iterator iterator = json.keys();
106 | while (iterator.hasNext()) {
107 | String key = iterator.next();
108 | Object obj = json.get(key);
109 | if (obj == JSONObject.NULL || obj == null) {
110 | map.putNull(key);
111 | } else if (obj instanceof Integer) {
112 | map.putInt(key, (Integer) obj);
113 | } else if (obj instanceof Long) {
114 | map.putDouble(key, (Long) obj);
115 | } else if (obj instanceof Double) {
116 | map.putDouble(key, (Double) obj);
117 | } else if (obj instanceof Float) {
118 | map.putDouble(key, (Float) obj);
119 | } else if (obj instanceof Boolean) {
120 | map.putBoolean(key, (Boolean) obj);
121 | } else if (obj instanceof String) {
122 | map.putString(key, (String) obj);
123 | } else if (obj instanceof JSONArray) {
124 | map.putArray(key, fromJsonArray((JSONArray) obj));
125 | } else if (obj instanceof JSONObject) {
126 | map.putMap(key, fromJsonObject((JSONObject) obj));
127 | }
128 | }
129 | return map;
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/index.d.ts:
--------------------------------------------------------------------------------
1 | export enum RequestOption {
2 | Bool = 'b',
3 | String = 's',
4 | Bytes = 'd'
5 | }
6 |
7 | export enum RequestBody {
8 | String = 's',
9 | Bytes = 'd'
10 | }
11 |
12 | export class RequestBuilder {
13 | public withArgument(argument: String): Promise;
14 | public withOption(option: String, type: RequestOption.Bool, value: boolean): Promise;
15 | public withOption(option: String, type: RequestOption.Bytes, value: Uint8Array): Promise;
16 | public withOption(option: String, type: RequestOption.String, value: string): Promise;
17 | public withBody(type: RequestBody.String, value: string): Promise;
18 | public withBody(type: RequestBody.Bytes, value: Uint8Array): Promise;
19 | public withHeader(header: string, value: string): Promise;
20 |
21 | public send(): Promise;
22 | public sendToDict(): Promise>;
23 |
24 | public free(): Promise;
25 | }
26 |
27 | export class IPFS {
28 | public static defaultRepoPath: string;
29 |
30 | public static setDNSPair(primary: string, secondary: string): Promise;
31 |
32 | public static create(repoPath?: string, internalStorage?: boolean): Promise;
33 |
34 | public start(): Promise;
35 | public stop(): Promise;
36 | public restart(): Promise;
37 |
38 | public enablePubsubExperiment(): Promise;
39 | public enableNamesysPubsub(): Promise;
40 |
41 | public isStarted(): Promise;
42 |
43 | public getConfig(): Promise>;
44 | public getConfigKey(key: string): Promise>;
45 | public setConfig(config?: Record): Promise;
46 | public setConfigKey(key: string, value: Record): Promise;
47 |
48 | public getAbsoluteRepoPath(): Promise;
49 |
50 | public newRequest(command: string): Promise;
51 |
52 | public free(): Promise;
53 | }
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import { NativeModules } from 'react-native';
2 | import * as base64 from "base64-js";
3 |
4 | const { GomobileIpfs } = NativeModules;
5 |
6 | export var RequestOption;
7 | (function (RequestOption) {
8 | RequestOption[RequestOption['Bool'] = 'b'] = 'Bool';
9 | RequestOption[RequestOption['String'] = 's'] = 'String';
10 | RequestOption[RequestOption['Bytes'] = 'd'] = 'Bytes';
11 | })(RequestOption || (RequestOption = {}));
12 |
13 |
14 | export var RequestBody;
15 | (function (RequestBody) {
16 | RequestBody[RequestBody['String'] = 's'] = 'String';
17 | RequestBody[RequestBody['Bytes'] = 'd'] = 'Bytes';
18 | })(RequestBody || (RequestBody = {}));
19 |
20 | export class RequestBuilder {
21 | constructor(ptr) {
22 | this._ptr = ptr;
23 | }
24 |
25 | async withArgument(argument) {
26 | const ptr = await GomobileIpfs.requestBuilderWithArgument(this._ptr, argument);
27 | this._ptr = null;
28 | return new RequestBuilder(ptr);
29 | }
30 |
31 | async withOption(option, type, value) {
32 | if (type === RequestOption.Bytes) {
33 | value = base64.fromByteArray(value);
34 | }
35 | const ptr = await GomobileIpfs.requestBuilderWithOption(this._ptr, option, type, value);
36 | this._ptr = null;
37 | return new RequestBuilder(ptr);
38 | }
39 |
40 | async withBody(type, body) {
41 | if (type === RequestBody.Bytes) {
42 | body = base64.fromByteArray(body);
43 | }
44 | const ptr = await GomobileIpfs.requestBuilderWithBody(this._ptr, type, body);
45 | this._ptr = null;
46 | return new RequestBuilder(ptr);
47 | }
48 |
49 | async withHeader(header, value) {
50 | const ptr = await GomobileIpfs.requestBuilderWithHeader(this._ptr, header, value);
51 | this._ptr = null;
52 | return new RequestBuilder(ptr);
53 | }
54 |
55 | async send() {
56 | const res = await GomobileIpfs.requestBuilderSend(this._ptr);
57 | return base64.toByteArray(res);
58 | }
59 |
60 | sendToDict() {
61 | return GomobileIpfs.requestBuilderSendToDict(this._ptr);
62 | }
63 |
64 | async free() {
65 | const res = await GomobileIpfs.requestBuilderFree(this._ptr);
66 | this._ptr = null;
67 | return res;
68 | }
69 | }
70 |
71 | export class IPFS {
72 | constructor(ptr) {
73 | this._ptr = ptr;
74 | }
75 |
76 | static async create(repoPath, internalStorage) {
77 | if (!repoPath) {
78 | repoPath = IPFS.defaultRepoPath;
79 | }
80 | if (typeof internalStorage !== 'boolean') {
81 | internalStorage = true
82 | }
83 | const ptr = await GomobileIpfs.ipfsCreate(repoPath, internalStorage);
84 | return new IPFS(ptr);
85 | }
86 |
87 | static setDNSPair(primary, secondary) {
88 | return GomobileIpfs.ipfsSetDNSPair(primary, secondary);
89 | }
90 |
91 | start() {
92 | return GomobileIpfs.ipfsStart(this._ptr);
93 | }
94 |
95 | stop() {
96 | return GomobileIpfs.ipfsStop(this._ptr);
97 | }
98 |
99 | restart() {
100 | return GomobileIpfs.ipfsRestart(this._ptr);
101 | }
102 |
103 | isStarted() {
104 | return GomobileIpfs.ipfsIsStarted(this._ptr);
105 | }
106 |
107 | getConfig() {
108 | return GomobileIpfs.ipfsGetConfig(this._ptr);
109 | }
110 |
111 | setConfig(config) {
112 | return GomobileIpfs.ipfsSetConfig(this._ptr, config);
113 | }
114 |
115 | getConfigKey(key) {
116 | return GomobileIpfs.ipfsGetConfigKey(this._ptr, key);
117 | }
118 |
119 | setConfigKey(key, value) {
120 | return GomobileIpfs.ipfsSetConfigKey(this._ptr, key, value);
121 | }
122 |
123 | enablePubsubExperiment() {
124 | return GomobileIpfs.ipfsEnablePubsubExperiment(this._ptr);
125 | }
126 |
127 | enableNamesysPubsub() {
128 | return GomobileIpfs.ipfsEnableNamesysPubsub(this._ptr);
129 | }
130 |
131 | getAbsoluteRepoPath() {
132 | return GomobileIpfs.ipfsGetAbsoluteRepoPath(this._ptr);
133 | }
134 |
135 | async newRequest(command) {
136 | const ptr = await GomobileIpfs.ipfsNewRequest(this._ptr, command);
137 | return new RequestBuilder(ptr);
138 | }
139 |
140 | async free() {
141 | const res = await GomobileIpfs.ipfsFree(this._ptr);
142 | this._ptr = null;
143 | return res;
144 | }
145 | }
146 |
147 | IPFS.defaultRepoPath = "ipfs/repo";
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.xcworkspace
2 | Podfile.lock
3 | Pods
4 |
--------------------------------------------------------------------------------
/ios/GomobileIpfs.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 9205F3A025444CAE00CECAE1 /* GomobileIpfs.m in Sources */ = {isa = PBXBuildFile; fileRef = 9205F39F25444CAE00CECAE1 /* GomobileIpfs.m */; };
11 | 9205F3A425444CDD00CECAE1 /* GomobileIpfs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9205F3A325444CDD00CECAE1 /* GomobileIpfs.swift */; };
12 | 9205F3A625444E2D00CECAE1 /* Pointer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9205F3A525444E2D00CECAE1 /* Pointer.swift */; };
13 | 9205F3A82544527900CECAE1 /* ReactTry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9205F3A72544527900CECAE1 /* ReactTry.swift */; };
14 | 99BDB5891EA20D4ECB8E6B9C /* libPods-GomobileIpfs.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AE76FB2D473E090E94EB95A /* libPods-GomobileIpfs.a */; };
15 | /* End PBXBuildFile section */
16 |
17 | /* Begin PBXCopyFilesBuildPhase section */
18 | 58B511D91A9E6C8500147676 /* CopyFiles */ = {
19 | isa = PBXCopyFilesBuildPhase;
20 | buildActionMask = 2147483647;
21 | dstPath = "include/$(PRODUCT_NAME)";
22 | dstSubfolderSpec = 16;
23 | files = (
24 | );
25 | runOnlyForDeploymentPostprocessing = 0;
26 | };
27 | /* End PBXCopyFilesBuildPhase section */
28 |
29 | /* Begin PBXFileReference section */
30 | 134814201AA4EA6300B7C361 /* libGomobileIpfs.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libGomobileIpfs.a; sourceTree = BUILT_PRODUCTS_DIR; };
31 | 5AE76FB2D473E090E94EB95A /* libPods-GomobileIpfs.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-GomobileIpfs.a"; sourceTree = BUILT_PRODUCTS_DIR; };
32 | 5E013FD3F51E623BF816D519 /* Pods-GomobileIpfs.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GomobileIpfs.release.xcconfig"; path = "Target Support Files/Pods-GomobileIpfs/Pods-GomobileIpfs.release.xcconfig"; sourceTree = ""; };
33 | 8A0AFDB8E617D9A4C2A7131D /* Pods-GomobileIpfs.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GomobileIpfs.debug.xcconfig"; path = "Target Support Files/Pods-GomobileIpfs/Pods-GomobileIpfs.debug.xcconfig"; sourceTree = ""; };
34 | 9205F39F25444CAE00CECAE1 /* GomobileIpfs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GomobileIpfs.m; sourceTree = ""; };
35 | 9205F3A125444CB800CECAE1 /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = ""; };
36 | 9205F3A225444CDD00CECAE1 /* GomobileIpfs-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GomobileIpfs-Bridging-Header.h"; sourceTree = ""; };
37 | 9205F3A325444CDD00CECAE1 /* GomobileIpfs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GomobileIpfs.swift; sourceTree = ""; };
38 | 9205F3A525444E2D00CECAE1 /* Pointer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pointer.swift; sourceTree = ""; };
39 | 9205F3A72544527900CECAE1 /* ReactTry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactTry.swift; sourceTree = ""; };
40 | /* End PBXFileReference section */
41 |
42 | /* Begin PBXFrameworksBuildPhase section */
43 | 58B511D81A9E6C8500147676 /* Frameworks */ = {
44 | isa = PBXFrameworksBuildPhase;
45 | buildActionMask = 2147483647;
46 | files = (
47 | 99BDB5891EA20D4ECB8E6B9C /* libPods-GomobileIpfs.a in Frameworks */,
48 | );
49 | runOnlyForDeploymentPostprocessing = 0;
50 | };
51 | /* End PBXFrameworksBuildPhase section */
52 |
53 | /* Begin PBXGroup section */
54 | 134814211AA4EA7D00B7C361 /* Products */ = {
55 | isa = PBXGroup;
56 | children = (
57 | 134814201AA4EA6300B7C361 /* libGomobileIpfs.a */,
58 | );
59 | name = Products;
60 | sourceTree = "";
61 | };
62 | 58B511D21A9E6C8500147676 = {
63 | isa = PBXGroup;
64 | children = (
65 | 9205F3A125444CB800CECAE1 /* Podfile */,
66 | 9205F39D25444CA200CECAE1 /* Sources */,
67 | 134814211AA4EA7D00B7C361 /* Products */,
68 | C8DD8243B3ED3E9B2C760DBC /* Pods */,
69 | B12E5905CDD75ADF6864E401 /* Frameworks */,
70 | );
71 | sourceTree = "";
72 | };
73 | 9205F39D25444CA200CECAE1 /* Sources */ = {
74 | isa = PBXGroup;
75 | children = (
76 | 9205F39F25444CAE00CECAE1 /* GomobileIpfs.m */,
77 | 9205F3A325444CDD00CECAE1 /* GomobileIpfs.swift */,
78 | 9205F3A225444CDD00CECAE1 /* GomobileIpfs-Bridging-Header.h */,
79 | 9205F3A525444E2D00CECAE1 /* Pointer.swift */,
80 | 9205F3A72544527900CECAE1 /* ReactTry.swift */,
81 | );
82 | path = Sources;
83 | sourceTree = "";
84 | };
85 | B12E5905CDD75ADF6864E401 /* Frameworks */ = {
86 | isa = PBXGroup;
87 | children = (
88 | 5AE76FB2D473E090E94EB95A /* libPods-GomobileIpfs.a */,
89 | );
90 | name = Frameworks;
91 | sourceTree = "";
92 | };
93 | C8DD8243B3ED3E9B2C760DBC /* Pods */ = {
94 | isa = PBXGroup;
95 | children = (
96 | 8A0AFDB8E617D9A4C2A7131D /* Pods-GomobileIpfs.debug.xcconfig */,
97 | 5E013FD3F51E623BF816D519 /* Pods-GomobileIpfs.release.xcconfig */,
98 | );
99 | path = Pods;
100 | sourceTree = "";
101 | };
102 | /* End PBXGroup section */
103 |
104 | /* Begin PBXNativeTarget section */
105 | 58B511DA1A9E6C8500147676 /* GomobileIpfs */ = {
106 | isa = PBXNativeTarget;
107 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "GomobileIpfs" */;
108 | buildPhases = (
109 | 450257AFD756F225686878F2 /* [CP] Check Pods Manifest.lock */,
110 | 58B511D71A9E6C8500147676 /* Sources */,
111 | 58B511D81A9E6C8500147676 /* Frameworks */,
112 | 58B511D91A9E6C8500147676 /* CopyFiles */,
113 | );
114 | buildRules = (
115 | );
116 | dependencies = (
117 | );
118 | name = GomobileIpfs;
119 | productName = RCTDataManager;
120 | productReference = 134814201AA4EA6300B7C361 /* libGomobileIpfs.a */;
121 | productType = "com.apple.product-type.library.static";
122 | };
123 | /* End PBXNativeTarget section */
124 |
125 | /* Begin PBXProject section */
126 | 58B511D31A9E6C8500147676 /* Project object */ = {
127 | isa = PBXProject;
128 | attributes = {
129 | LastUpgradeCheck = 0920;
130 | ORGANIZATIONNAME = Facebook;
131 | TargetAttributes = {
132 | 58B511DA1A9E6C8500147676 = {
133 | CreatedOnToolsVersion = 6.1.1;
134 | LastSwiftMigration = 1170;
135 | };
136 | };
137 | };
138 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "GomobileIpfs" */;
139 | compatibilityVersion = "Xcode 3.2";
140 | developmentRegion = en;
141 | hasScannedForEncodings = 0;
142 | knownRegions = (
143 | en,
144 | Base,
145 | );
146 | mainGroup = 58B511D21A9E6C8500147676;
147 | productRefGroup = 58B511D21A9E6C8500147676;
148 | projectDirPath = "";
149 | projectRoot = "";
150 | targets = (
151 | 58B511DA1A9E6C8500147676 /* GomobileIpfs */,
152 | );
153 | };
154 | /* End PBXProject section */
155 |
156 | /* Begin PBXShellScriptBuildPhase section */
157 | 450257AFD756F225686878F2 /* [CP] Check Pods Manifest.lock */ = {
158 | isa = PBXShellScriptBuildPhase;
159 | buildActionMask = 2147483647;
160 | files = (
161 | );
162 | inputFileListPaths = (
163 | );
164 | inputPaths = (
165 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
166 | "${PODS_ROOT}/Manifest.lock",
167 | );
168 | name = "[CP] Check Pods Manifest.lock";
169 | outputFileListPaths = (
170 | );
171 | outputPaths = (
172 | "$(DERIVED_FILE_DIR)/Pods-GomobileIpfs-checkManifestLockResult.txt",
173 | );
174 | runOnlyForDeploymentPostprocessing = 0;
175 | shellPath = /bin/sh;
176 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
177 | showEnvVarsInLog = 0;
178 | };
179 | /* End PBXShellScriptBuildPhase section */
180 |
181 | /* Begin PBXSourcesBuildPhase section */
182 | 58B511D71A9E6C8500147676 /* Sources */ = {
183 | isa = PBXSourcesBuildPhase;
184 | buildActionMask = 2147483647;
185 | files = (
186 | 9205F3A025444CAE00CECAE1 /* GomobileIpfs.m in Sources */,
187 | 9205F3A425444CDD00CECAE1 /* GomobileIpfs.swift in Sources */,
188 | 9205F3A82544527900CECAE1 /* ReactTry.swift in Sources */,
189 | 9205F3A625444E2D00CECAE1 /* Pointer.swift in Sources */,
190 | );
191 | runOnlyForDeploymentPostprocessing = 0;
192 | };
193 | /* End PBXSourcesBuildPhase section */
194 |
195 | /* Begin XCBuildConfiguration section */
196 | 58B511ED1A9E6C8500147676 /* Debug */ = {
197 | isa = XCBuildConfiguration;
198 | buildSettings = {
199 | ALWAYS_SEARCH_USER_PATHS = NO;
200 | CLANG_ANALYZER_NONNULL = YES;
201 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
202 | CLANG_CXX_LIBRARY = "libc++";
203 | CLANG_ENABLE_MODULES = YES;
204 | CLANG_ENABLE_OBJC_ARC = YES;
205 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
206 | CLANG_WARN_BOOL_CONVERSION = YES;
207 | CLANG_WARN_COMMA = YES;
208 | CLANG_WARN_CONSTANT_CONVERSION = YES;
209 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
210 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
211 | CLANG_WARN_EMPTY_BODY = YES;
212 | CLANG_WARN_ENUM_CONVERSION = YES;
213 | CLANG_WARN_INFINITE_RECURSION = YES;
214 | CLANG_WARN_INT_CONVERSION = YES;
215 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
216 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
217 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
218 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
219 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
220 | CLANG_WARN_STRICT_PROTOTYPES = YES;
221 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
222 | CLANG_WARN_UNREACHABLE_CODE = YES;
223 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
224 | COPY_PHASE_STRIP = NO;
225 | ENABLE_STRICT_OBJC_MSGSEND = YES;
226 | ENABLE_TESTABILITY = YES;
227 | GCC_C_LANGUAGE_STANDARD = gnu99;
228 | GCC_DYNAMIC_NO_PIC = NO;
229 | GCC_NO_COMMON_BLOCKS = YES;
230 | GCC_OPTIMIZATION_LEVEL = 0;
231 | GCC_PREPROCESSOR_DEFINITIONS = (
232 | "DEBUG=1",
233 | "$(inherited)",
234 | );
235 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
236 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
237 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
238 | GCC_WARN_UNDECLARED_SELECTOR = YES;
239 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
240 | GCC_WARN_UNUSED_FUNCTION = YES;
241 | GCC_WARN_UNUSED_VARIABLE = YES;
242 | IPHONEOS_DEPLOYMENT_TARGET = 10.0;
243 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
244 | LIBRARY_SEARCH_PATHS = (
245 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
246 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
247 | "\"$(inherited)\"",
248 | );
249 | MTL_ENABLE_DEBUG_INFO = YES;
250 | ONLY_ACTIVE_ARCH = YES;
251 | SDKROOT = iphoneos;
252 | };
253 | name = Debug;
254 | };
255 | 58B511EE1A9E6C8500147676 /* Release */ = {
256 | isa = XCBuildConfiguration;
257 | buildSettings = {
258 | ALWAYS_SEARCH_USER_PATHS = NO;
259 | CLANG_ANALYZER_NONNULL = YES;
260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
261 | CLANG_CXX_LIBRARY = "libc++";
262 | CLANG_ENABLE_MODULES = YES;
263 | CLANG_ENABLE_OBJC_ARC = YES;
264 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
265 | CLANG_WARN_BOOL_CONVERSION = YES;
266 | CLANG_WARN_COMMA = YES;
267 | CLANG_WARN_CONSTANT_CONVERSION = YES;
268 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
269 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
270 | CLANG_WARN_EMPTY_BODY = YES;
271 | CLANG_WARN_ENUM_CONVERSION = YES;
272 | CLANG_WARN_INFINITE_RECURSION = YES;
273 | CLANG_WARN_INT_CONVERSION = YES;
274 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
275 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
276 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
277 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
278 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
279 | CLANG_WARN_STRICT_PROTOTYPES = YES;
280 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
281 | CLANG_WARN_UNREACHABLE_CODE = YES;
282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
283 | COPY_PHASE_STRIP = YES;
284 | ENABLE_NS_ASSERTIONS = NO;
285 | ENABLE_STRICT_OBJC_MSGSEND = YES;
286 | GCC_C_LANGUAGE_STANDARD = gnu99;
287 | GCC_NO_COMMON_BLOCKS = YES;
288 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
289 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
290 | GCC_WARN_UNDECLARED_SELECTOR = YES;
291 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
292 | GCC_WARN_UNUSED_FUNCTION = YES;
293 | GCC_WARN_UNUSED_VARIABLE = YES;
294 | IPHONEOS_DEPLOYMENT_TARGET = 10.0;
295 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
296 | LIBRARY_SEARCH_PATHS = (
297 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
298 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
299 | "\"$(inherited)\"",
300 | );
301 | MTL_ENABLE_DEBUG_INFO = NO;
302 | SDKROOT = iphoneos;
303 | VALIDATE_PRODUCT = YES;
304 | };
305 | name = Release;
306 | };
307 | 58B511F01A9E6C8500147676 /* Debug */ = {
308 | isa = XCBuildConfiguration;
309 | baseConfigurationReference = 8A0AFDB8E617D9A4C2A7131D /* Pods-GomobileIpfs.debug.xcconfig */;
310 | buildSettings = {
311 | CLANG_ENABLE_MODULES = YES;
312 | HEADER_SEARCH_PATHS = (
313 | "$(inherited)",
314 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
315 | "$(SRCROOT)/../../../React/**",
316 | "$(SRCROOT)/../../react-native/React/**",
317 | );
318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
319 | LIBRARY_SEARCH_PATHS = "$(inherited)";
320 | PRODUCT_NAME = GomobileIpfs;
321 | SKIP_INSTALL = YES;
322 | SWIFT_OBJC_BRIDGING_HEADER = "Sources/GomobileIpfs-Bridging-Header.h";
323 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
324 | SWIFT_VERSION = 5.0;
325 | };
326 | name = Debug;
327 | };
328 | 58B511F11A9E6C8500147676 /* Release */ = {
329 | isa = XCBuildConfiguration;
330 | baseConfigurationReference = 5E013FD3F51E623BF816D519 /* Pods-GomobileIpfs.release.xcconfig */;
331 | buildSettings = {
332 | CLANG_ENABLE_MODULES = YES;
333 | HEADER_SEARCH_PATHS = (
334 | "$(inherited)",
335 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
336 | "$(SRCROOT)/../../../React/**",
337 | "$(SRCROOT)/../../react-native/React/**",
338 | );
339 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
340 | LIBRARY_SEARCH_PATHS = "$(inherited)";
341 | PRODUCT_NAME = GomobileIpfs;
342 | SKIP_INSTALL = YES;
343 | SWIFT_OBJC_BRIDGING_HEADER = "Sources/GomobileIpfs-Bridging-Header.h";
344 | SWIFT_VERSION = 5.0;
345 | };
346 | name = Release;
347 | };
348 | /* End XCBuildConfiguration section */
349 |
350 | /* Begin XCConfigurationList section */
351 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "GomobileIpfs" */ = {
352 | isa = XCConfigurationList;
353 | buildConfigurations = (
354 | 58B511ED1A9E6C8500147676 /* Debug */,
355 | 58B511EE1A9E6C8500147676 /* Release */,
356 | );
357 | defaultConfigurationIsVisible = 0;
358 | defaultConfigurationName = Release;
359 | };
360 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "GomobileIpfs" */ = {
361 | isa = XCConfigurationList;
362 | buildConfigurations = (
363 | 58B511F01A9E6C8500147676 /* Debug */,
364 | 58B511F11A9E6C8500147676 /* Release */,
365 | );
366 | defaultConfigurationIsVisible = 0;
367 | defaultConfigurationName = Release;
368 | };
369 | /* End XCConfigurationList section */
370 | };
371 | rootObject = 58B511D31A9E6C8500147676 /* Project object */;
372 | }
373 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | require_relative '../node_modules/react-native/scripts/react_native_pods'
2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3 |
4 | platform :ios, '10.0'
5 |
6 | target 'GomobileIpfs' do
7 |
8 | pod 'Gomobile-IPFS-Bridge', '~> 1.2.0'
9 |
10 | config = use_native_modules!
11 | use_react_native!(:path => config["reactNativePath"])
12 | end
13 |
--------------------------------------------------------------------------------
/ios/Sources/GomobileIpfs-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 | #import
5 |
--------------------------------------------------------------------------------
/ios/Sources/GomobileIpfs.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface RCT_EXTERN_MODULE(GomobileIpfs, NSObject)
4 |
5 | RCT_EXTERN_METHOD(ipfsCreate:(NSString *)repoPath
6 | internalStorage:(BOOL)internalStorage
7 | resolve:(RCTPromiseResolveBlock)resolve
8 | reject:(RCTPromiseRejectBlock)reject)
9 |
10 | RCT_EXTERN_METHOD(ipfsStart:(NSString *)pointer
11 | resolve:(RCTPromiseResolveBlock)resolve
12 | reject:(RCTPromiseRejectBlock)reject)
13 |
14 | RCT_EXTERN_METHOD(ipfsStop:(NSString *)pointer
15 | resolve:(RCTPromiseResolveBlock)resolve
16 | reject:(RCTPromiseRejectBlock)reject)
17 |
18 | RCT_EXTERN_METHOD(ipfsRestart:(NSString *)pointer
19 | resolve:(RCTPromiseResolveBlock)resolve
20 | reject:(RCTPromiseRejectBlock)reject)
21 |
22 | RCT_EXTERN_METHOD(ipfsFree:(NSString *)pointer
23 | resolve:(RCTPromiseResolveBlock)resolve
24 | reject:(RCTPromiseRejectBlock)reject)
25 |
26 | RCT_EXTERN_METHOD(ipfsIsStarted:(NSString *)pointer
27 | resolve:(RCTPromiseResolveBlock)resolve
28 | reject:(RCTPromiseRejectBlock)reject)
29 |
30 | RCT_EXTERN_METHOD(ipfsGetConfig:(NSString *)pointer
31 | resolve:(RCTPromiseResolveBlock)resolve
32 | reject:(RCTPromiseRejectBlock)reject)
33 |
34 | RCT_EXTERN_METHOD(ipfsSetConfig:(NSString *)pointer
35 | config:(NSDictionary *)config
36 | resolve:(RCTPromiseResolveBlock)resolve
37 | reject:(RCTPromiseRejectBlock)reject)
38 |
39 | RCT_EXTERN_METHOD(ipfsGetConfigKey:(NSString *)pointer
40 | key:(NSString*)key
41 | resolve:(RCTPromiseResolveBlock)resolve
42 | reject:(RCTPromiseRejectBlock)reject)
43 |
44 | RCT_EXTERN_METHOD(ipfsSetConfigKey:(NSString *)pointer
45 | key:(NSString*)key
46 | value:(NSDictionary *)value
47 | resolve:(RCTPromiseResolveBlock)resolve
48 | reject:(RCTPromiseRejectBlock)reject)
49 |
50 | RCT_EXTERN_METHOD(ipfsEnablePubsubExperiment:(NSString *)pointer
51 | resolve:(RCTPromiseResolveBlock)resolve
52 | reject:(RCTPromiseRejectBlock)reject)
53 |
54 | RCT_EXTERN_METHOD(ipfsEnableNamesysPubsub:(NSString *)pointer
55 | resolve:(RCTPromiseResolveBlock)resolve
56 | reject:(RCTPromiseRejectBlock)reject)
57 |
58 | RCT_EXTERN_METHOD(ipfsSetDNSPair:(NSString *)primary
59 | secondary:(NSString *)secondary
60 | resolve:(RCTPromiseResolveBlock)resolve
61 | reject:(RCTPromiseRejectBlock)reject)
62 |
63 | RCT_EXTERN_METHOD(ipfsGetAbsoluteRepoPath:(NSString *)pointer
64 | resolve:(RCTPromiseResolveBlock)resolve
65 | reject:(RCTPromiseRejectBlock)reject)
66 |
67 | RCT_EXTERN_METHOD(ipfsNewRequest:(NSString *)pointer
68 | command:(NSString *)command
69 | resolve:(RCTPromiseResolveBlock)resolve
70 | reject:(RCTPromiseRejectBlock)reject)
71 |
72 | RCT_EXTERN_METHOD(requestBuilderWithArgument:(NSString *)pointer
73 | argument:(NSString *)argument
74 | resolve:(RCTPromiseResolveBlock)resolve
75 | reject:(RCTPromiseRejectBlock)reject)
76 |
77 | RCT_EXTERN_METHOD(requestBuilderWithOption:(NSString *)pointer
78 | option:(NSString *)option
79 | type:(NSString *)type
80 | value:(id)value
81 | resolve:(RCTPromiseResolveBlock)resolve
82 | reject:(RCTPromiseRejectBlock)reject)
83 |
84 | RCT_EXTERN_METHOD(requestBuilderWithBody:(NSString *)pointer
85 | type:(NSString *)body
86 | body:(id)body
87 | resolve:(RCTPromiseResolveBlock)resolve
88 | reject:(RCTPromiseRejectBlock)reject)
89 |
90 | RCT_EXTERN_METHOD(requestBuilderWithHeader:(NSString *)pointer
91 | header:(NSString *)header
92 | value:(NSString *)value
93 | resolve:(RCTPromiseResolveBlock)resolve
94 | reject:(RCTPromiseRejectBlock)reject)
95 |
96 | RCT_EXTERN_METHOD(requestBuilderSend:(NSString *)pointer
97 | resolve:(RCTPromiseResolveBlock)resolve
98 | reject:(RCTPromiseRejectBlock)reject)
99 |
100 | RCT_EXTERN_METHOD(requestBuilderSendToDict:(NSString *)pointer
101 | resolve:(RCTPromiseResolveBlock)resolve
102 | reject:(RCTPromiseRejectBlock)reject)
103 |
104 | RCT_EXTERN_METHOD(requestBuilderFree:(NSString *)pointer
105 | resolve:(RCTPromiseResolveBlock)resolve
106 | reject:(RCTPromiseRejectBlock)reject)
107 |
108 | @end
109 |
--------------------------------------------------------------------------------
/ios/Sources/GomobileIpfs.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GomobileIpfs.swift
3 | // GomobileIpfs
4 | //
5 | // Created by Yehor Popovych on 10/24/20.
6 | // Copyright © 2020 Facebook. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import GomobileIPFS
11 |
12 | @objc(GomobileIpfs)
13 | public class GomobileIpfs: NSObject {
14 |
15 | @objc(ipfsCreate:internalStorage:resolve:reject:)
16 | public func ipfsCreate(
17 | repoPath: String,
18 | internalStorage: Bool,
19 | resolve: RCTPromiseResolveBlock,
20 | reject: RCTPromiseRejectBlock
21 | ) {
22 | tryReact(resolve: resolve, reject: reject) {
23 | try IPFS(repoPath).pointer
24 | }
25 | }
26 |
27 | @objc(ipfsStart:resolve:reject:)
28 | public func ipfsStart(
29 | pointer: String,
30 | resolve: RCTPromiseResolveBlock,
31 | reject: RCTPromiseRejectBlock
32 | ) {
33 | tryReact(resolve: resolve, reject: reject) {
34 | try IPFS.unretained(pointer).start()
35 | }
36 | }
37 |
38 | @objc(ipfsStop:resolve:reject:)
39 | public func ipfsStop(
40 | pointer: String,
41 | resolve: RCTPromiseResolveBlock,
42 | reject: RCTPromiseRejectBlock
43 | ) {
44 | tryReact(resolve: resolve, reject: reject) {
45 | try IPFS.unretained(pointer).stop()
46 | }
47 | }
48 |
49 | @objc(ipfsRestart:resolve:reject:)
50 | public func ipfsRestart(
51 | pointer: String,
52 | resolve: RCTPromiseResolveBlock,
53 | reject: RCTPromiseRejectBlock
54 | ) {
55 | tryReact(resolve: resolve, reject: reject) {
56 | try IPFS.unretained(pointer).restart()
57 | }
58 | }
59 |
60 | @objc(ipfsFree:resolve:reject:)
61 | public func ipfsFree(
62 | pointer: String,
63 | resolve: RCTPromiseResolveBlock,
64 | reject: RCTPromiseRejectBlock
65 | ) {
66 | tryReact(resolve: resolve, reject: reject) {
67 | let _ = try IPFS.retained(pointer)
68 | return nil
69 | }
70 | }
71 |
72 | @objc(ipfsIsStarted:resolve:reject:)
73 | public func ipfsIsStarted(
74 | pointer: String,
75 | resolve: RCTPromiseResolveBlock,
76 | reject: RCTPromiseRejectBlock
77 | ) {
78 | tryReact(resolve: resolve, reject: reject) {
79 | try IPFS.unretained(pointer).isStarted()
80 | }
81 | }
82 |
83 | @objc(ipfsGetConfig:resolve:reject:)
84 | public func ipfsGetConfig(
85 | pointer: String,
86 | resolve: RCTPromiseResolveBlock,
87 | reject: RCTPromiseRejectBlock
88 | ) {
89 | tryReact(resolve: resolve, reject: reject) {
90 | try IPFS.unretained(pointer).getConfig()
91 | }
92 | }
93 |
94 | @objc(ipfsSetConfig:config:resolve:reject:)
95 | public func ipfsSetConfig(
96 | pointer: String,
97 | config: [String: Any]?,
98 | resolve: RCTPromiseResolveBlock,
99 | reject: RCTPromiseRejectBlock
100 | ) {
101 | tryReact(resolve: resolve, reject: reject) {
102 | try IPFS.unretained(pointer).setConfig(config)
103 | }
104 | }
105 |
106 | @objc(ipfsGetConfigKey:key:resolve:reject:)
107 | public func ipfsGetConfigKey(
108 | pointer: String,
109 | key: String,
110 | resolve: RCTPromiseResolveBlock,
111 | reject: RCTPromiseRejectBlock
112 | ) {
113 | tryReact(resolve: resolve, reject: reject) {
114 | try IPFS.unretained(pointer).getConfigKey(key)
115 | }
116 | }
117 |
118 | @objc(ipfsSetConfigKey:key:value:resolve:reject:)
119 | public func ipfsSetConfigKey(
120 | pointer: String,
121 | key: String,
122 | value: [String: Any],
123 | resolve: RCTPromiseResolveBlock,
124 | reject: RCTPromiseRejectBlock
125 | ) {
126 | tryReact(resolve: resolve, reject: reject) {
127 | try IPFS.unretained(pointer).setConfigKey(key, value)
128 | }
129 | }
130 |
131 | @objc(ipfsEnablePubsubExperiment:resolve:reject:)
132 | public func ipfsEnablePubsubExperiment(
133 | pointer: String,
134 | resolve: RCTPromiseResolveBlock,
135 | reject: RCTPromiseRejectBlock
136 | ) {
137 | tryReact(resolve: resolve, reject: reject) {
138 | try IPFS.unretained(pointer).enablePubsubExperiment()
139 | }
140 | }
141 |
142 | @objc(ipfsEnableNamesysPubsub:resolve:reject:)
143 | public func ipfsEnableNamesysPubsub(
144 | pointer: String,
145 | resolve: RCTPromiseResolveBlock,
146 | reject: RCTPromiseRejectBlock
147 | ) {
148 | tryReact(resolve: resolve, reject: reject) {
149 | try IPFS.unretained(pointer).enableNamesysPubsub()
150 | }
151 | }
152 |
153 | @objc(ipfsSetDNSPair:secondary:resolve:reject:)
154 | public func ipfsSetDNSPair(
155 | primary: String,
156 | secondary: String,
157 | resolve: RCTPromiseResolveBlock,
158 | reject: RCTPromiseRejectBlock
159 | ) {
160 | tryReact(resolve: resolve, reject: reject) {
161 | IPFS.setDNSPair(primary, secondary)
162 | }
163 | }
164 |
165 | @objc(ipfsGetAbsoluteRepoPath:resolve:reject:)
166 | public func ipfsGetAbsoluteRepoPath(
167 | pointer: String,
168 | resolve: RCTPromiseResolveBlock,
169 | reject: RCTPromiseRejectBlock
170 | ) {
171 | tryReact(resolve: resolve, reject: reject) {
172 | try IPFS.unretained(pointer).getAbsoluteRepoPath()
173 | }
174 | }
175 |
176 | @objc(ipfsNewRequest:command:resolve:reject:)
177 | public func ipfsNewRequest(
178 | pointer: String,
179 | command: String,
180 | resolve: RCTPromiseResolveBlock,
181 | reject: RCTPromiseRejectBlock
182 | ) {
183 | tryReact(resolve: resolve, reject: reject) {
184 | try IPFS.unretained(pointer).newRequest(command).pointer
185 | }
186 | }
187 |
188 | @objc(requestBuilderWithArgument:argument:resolve:reject:)
189 | public func requestBuilderWithArgument(
190 | pointer: String,
191 | argument: String,
192 | resolve: RCTPromiseResolveBlock,
193 | reject: RCTPromiseRejectBlock
194 | ) {
195 | tryReact(resolve: resolve, reject: reject) {
196 | try RequestBuilder.retained(pointer).with(argument: argument).pointer
197 | }
198 | }
199 |
200 | @objc(requestBuilderWithOption:option:type:value:resolve:reject:)
201 | public func requestBuilderWithOption(
202 | pointer: String,
203 | option: String,
204 | type: String,
205 | value: Any,
206 | resolve: RCTPromiseResolveBlock,
207 | reject: RCTPromiseRejectBlock
208 | ) {
209 | tryReact(resolve: resolve, reject: reject) {
210 | var requestOption: RequestOption
211 | switch type {
212 | case "b", "B":
213 | guard let val = value as? Bool else {
214 | throw RequestOptionError.badValue(type, value)
215 | }
216 | requestOption = .bool(val)
217 | case "s", "S":
218 | guard let val = value as? String else {
219 | throw RequestOptionError.badValue(type, value)
220 | }
221 | requestOption = .string(val)
222 | case "d", "D":
223 | guard let val = value as? String else {
224 | throw RequestOptionError.badValue(type, value)
225 | }
226 | guard let data = Data(base64Encoded: val) else {
227 | throw RequestOptionError.badValue(type, val)
228 | }
229 | requestOption = .bytes(data)
230 | default: throw RequestOptionError.badType(type)
231 | }
232 | return try RequestBuilder
233 | .retained(pointer)
234 | .with(option: option, value: requestOption)
235 | .pointer
236 | }
237 | }
238 |
239 | @objc(requestBuilderWithBody:type:body:resolve:reject:)
240 | public func requestBuilderWithBody(
241 | pointer: String,
242 | type: String,
243 | body: Any,
244 | resolve: RCTPromiseResolveBlock,
245 | reject: RCTPromiseRejectBlock
246 | ) {
247 | tryReact(resolve: resolve, reject: reject) {
248 | var requestBody: RequestBody
249 | switch type {
250 | case "s", "S":
251 | guard let val = body as? String else {
252 | throw RequestOptionError.badValue(type, body)
253 | }
254 | requestBody = .string(val)
255 | case "d", "D":
256 | guard let val = body as? String else {
257 | throw RequestOptionError.badValue(type, body)
258 | }
259 | guard let data = Data(base64Encoded: val) else {
260 | throw RequestOptionError.badValue(type, val)
261 | }
262 | requestBody = .bytes(data)
263 | default: throw RequestOptionError.badType(type)
264 | }
265 | return try RequestBuilder
266 | .retained(pointer)
267 | .with(body: requestBody)
268 | .pointer
269 | }
270 | }
271 |
272 | @objc(requestBuilderWithHeader:header:value:resolve:reject:)
273 | public func requestBuilderWithHeader(
274 | pointer: String,
275 | header: String,
276 | value: String,
277 | resolve: RCTPromiseResolveBlock,
278 | reject: RCTPromiseRejectBlock
279 | ) {
280 | tryReact(resolve: resolve, reject: reject) {
281 | try RequestBuilder
282 | .retained(pointer)
283 | .with(header: header, value: value)
284 | .pointer
285 | }
286 | }
287 |
288 | @objc(requestBuilderSend:resolve:reject:)
289 | public func requestBuilderSend(
290 | pointer: String,
291 | resolve: RCTPromiseResolveBlock,
292 | reject: RCTPromiseRejectBlock
293 | ) {
294 | tryReact(resolve: resolve, reject: reject) {
295 | let data = try RequestBuilder.unretained(pointer).send()
296 | return data.base64EncodedString()
297 | }
298 | }
299 |
300 | @objc(requestBuilderSendToDict:resolve:reject:)
301 | public func requestBuilderSendToDict(
302 | pointer: String,
303 | resolve: RCTPromiseResolveBlock,
304 | reject: RCTPromiseRejectBlock
305 | ) {
306 | tryReact(resolve: resolve, reject: reject) {
307 | try RequestBuilder.unretained(pointer).sendToDict()
308 | }
309 | }
310 |
311 | @objc(requestBuilderFree:resolve:reject:)
312 | public func requestBuilderFree(
313 | pointer: String,
314 | resolve: RCTPromiseResolveBlock,
315 | reject: RCTPromiseRejectBlock
316 | ) {
317 | tryReact(resolve: resolve, reject: reject) {
318 | let _ = try RequestBuilder.retained(pointer)
319 | return nil
320 | }
321 | }
322 |
323 | @objc static func requiresMainQueueSetup() -> Bool {
324 | return false
325 | }
326 | }
327 |
--------------------------------------------------------------------------------
/ios/Sources/Pointer.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Pointer.swift
3 | // GomobileIpfs
4 | //
5 | // Created by Yehor Popovych on 10/24/20.
6 | // Copyright © 2020 Facebook. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import GomobileIPFS
11 |
12 | public enum PointeeError: Error {
13 | case badPointerValue(String)
14 | case badIntegerPointer(UInt)
15 | }
16 |
17 | public protocol Pointee: class {
18 | var pointer: String { get }
19 |
20 | static func unretained(_ pointer: String) throws -> Self
21 | static func retained(_ pointer: String) throws -> Self
22 | }
23 |
24 | extension Pointee {
25 | public var pointer: String {
26 | let pointer = Unmanaged.passRetained(self).toOpaque()
27 | let int = UInt(bitPattern: pointer)
28 | return String(int, radix: 16)
29 | }
30 |
31 | public static func unretained(_ pointer: String) throws -> Self {
32 | guard let int = UInt(pointer, radix: 16) else {
33 | throw PointeeError.badPointerValue(pointer)
34 | }
35 | guard let pointer = UnsafeMutableRawPointer(bitPattern: int) else {
36 | throw PointeeError.badIntegerPointer(int)
37 | }
38 | return Unmanaged.fromOpaque(pointer).takeUnretainedValue()
39 | }
40 |
41 | public static func retained(_ pointer: String) throws -> Self {
42 | guard let int = UInt(pointer, radix: 16) else {
43 | throw PointeeError.badPointerValue(pointer)
44 | }
45 | guard let pointer = UnsafeMutableRawPointer(bitPattern: int) else {
46 | throw PointeeError.badIntegerPointer(int)
47 | }
48 | return Unmanaged.fromOpaque(pointer).takeRetainedValue()
49 | }
50 | }
51 |
52 | extension IPFS: Pointee {}
53 | extension RequestBuilder: Pointee {}
54 |
--------------------------------------------------------------------------------
/ios/Sources/ReactTry.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ReactTry.swift
3 | // GomobileIpfs
4 | //
5 | // Created by Yehor Popovych on 10/24/20.
6 | // Copyright © 2020 Facebook. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import GomobileIPFS
11 |
12 | public enum RequestOptionError: Error {
13 | case badType(String)
14 | case badValue(String, Any)
15 | }
16 |
17 | func tryReact(
18 | resolve: RCTPromiseResolveBlock,
19 | reject: RCTPromiseRejectBlock,
20 | cb: @escaping () throws -> Any?
21 | ) {
22 | do {
23 | try resolve(cb())
24 | } catch let e as NSError {
25 | reject("\(e.code)", e.userInfo.description, e)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-gomobile-ipfs",
3 | "title": "React Native gomobile-ipfs bindings",
4 | "version": "0.1.0",
5 | "description": "React Native bindings for gomobile-ipfs",
6 | "main": "index.js",
7 | "types": "index.d.ts",
8 | "files": [
9 | "README.md",
10 | "android",
11 | "index.js",
12 | "ios",
13 | "react-native-gomobile-ipfs.podspec"
14 | ],
15 | "scripts": {
16 | "test": "echo \"Error: no test specified\" && exit 1"
17 | },
18 | "repository": {
19 | "type": "git",
20 | "url": "git+https://github.com/tesseract-one/react-native-gomobile-ipfs.git",
21 | "baseUrl": "https://github.com/tesseract-one/react-native-gomobile-ipfs"
22 | },
23 | "keywords": [
24 | "react-native"
25 | ],
26 | "author": {
27 | "name": "Tesseract Systemc, Inc.",
28 | "email": "info@tesseract.one"
29 | },
30 | "license": "Apache-2.0",
31 | "licenseFilename": "LICENSE",
32 | "readmeFilename": "README.md",
33 | "peerDependencies": {
34 | "react": ">=16.13.0 <17.0.0",
35 | "react-native": ">=0.60.0-rc.0 <1.0.x"
36 | },
37 | "devDependencies": {
38 | "react": "^16.13.0",
39 | "react-native": "^0.63.0"
40 | },
41 | "dependencies": {
42 | "base64-js": "^1.3.0"
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/react-native-gomobile-ipfs.podspec:
--------------------------------------------------------------------------------
1 | require "json"
2 |
3 | package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4 |
5 | Pod::Spec.new do |s|
6 | s.name = "react-native-gomobile-ipfs"
7 | s.version = package["version"]
8 | s.summary = package["description"]
9 | s.homepage = "https://github.com/tesseract-one/react-native-gomobile-ipfs"
10 | s.license = { :type => "Apache-2.0", :file => "LICENSE" }
11 | s.authors = { "Tesseract Systemc, Inc." => "info@tesseract.one" }
12 | s.platforms = { :ios => "10.0" }
13 | s.source = { :git => "https://github.com/tesseract-one/react-native-gomobile-ipfs.git", :tag => "#{s.version}" }
14 |
15 | s.source_files = "ios/Sources/*.{h,c,m,swift}"
16 | s.requires_arc = true
17 |
18 | s.dependency "React"
19 | s.dependency 'Gomobile-IPFS-Bridge', '~> 1.2.0'
20 | end
21 |
22 |
--------------------------------------------------------------------------------