bridgefy-react-native 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +145 -0
  3. package/android/build.gradle +105 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +10 -0
  6. package/android/src/main/java/me/bridgefy/plugin/react_native/BridgefyReactNativeModule.kt +323 -0
  7. package/android/src/main/java/me/bridgefy/plugin/react_native/BridgefyReactNativePackage.kt +17 -0
  8. package/bridgefy-react-native.podspec +42 -0
  9. package/ios/BridgefyReactNative-Bridging-Header.h +2 -0
  10. package/ios/BridgefyReactNative.m +42 -0
  11. package/ios/BridgefyReactNative.swift +327 -0
  12. package/ios/BridgefyReactNative.xcodeproj/project.pbxproj +293 -0
  13. package/ios/Frameworks/BridgefySDK.xcframework/Info.plist +44 -0
  14. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/BridgefySDK +0 -0
  15. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Headers/BridgefySDK-Swift.h +296 -0
  16. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Headers/BridgefySDK.h +15 -0
  17. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Info.plist +0 -0
  18. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.abi.json +8744 -0
  19. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.private.swiftinterface +101 -0
  20. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  21. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios.swiftinterface +101 -0
  22. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/Modules/module.modulemap +11 -0
  23. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/BridgefySDK.framework/_CodeSignature/CodeResources +190 -0
  24. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/dSYMs/BridgefySDK.framework.dSYM/Contents/Info.plist +20 -0
  25. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/DWARF/BridgefySDK +0 -0
  26. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/BridgefySDK +0 -0
  27. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Headers/BridgefySDK-Swift.h +588 -0
  28. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Headers/BridgefySDK.h +15 -0
  29. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Info.plist +0 -0
  30. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.abi.json +8744 -0
  31. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +101 -0
  32. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  33. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +101 -0
  34. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +8744 -0
  35. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +101 -0
  36. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  37. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/BridgefySDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +101 -0
  38. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/Modules/module.modulemap +11 -0
  39. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/BridgefySDK.framework/_CodeSignature/CodeResources +245 -0
  40. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/BridgefySDK.framework.dSYM/Contents/Info.plist +20 -0
  41. package/ios/Frameworks/BridgefySDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/BridgefySDK.framework.dSYM/Contents/Resources/DWARF/BridgefySDK +0 -0
  42. package/lib/commonjs/index.js +184 -0
  43. package/lib/commonjs/index.js.map +1 -0
  44. package/lib/module/index.js +176 -0
  45. package/lib/module/index.js.map +1 -0
  46. package/lib/typescript/index.d.ts +214 -0
  47. package/lib/typescript/index.d.ts.map +1 -0
  48. package/package.json +162 -0
  49. package/src/index.tsx +273 -0
@@ -0,0 +1,176 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ const LINKING_ERROR = `The package 'bridgefy-react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
+ ios: "- You have run 'pod install'\n",
4
+ default: ''
5
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
6
+ const BridgefyReactNative = NativeModules.BridgefyReactNative ? NativeModules.BridgefyReactNative : new Proxy({}, {
7
+ get() {
8
+ throw new Error(LINKING_ERROR);
9
+ }
10
+ });
11
+
12
+ /** Profile that defines a series of properties and rules for the propagation of messages. */
13
+ export let BridgefyPropagationProfile = /*#__PURE__*/function (BridgefyPropagationProfile) {
14
+ BridgefyPropagationProfile["standard"] = "standard";
15
+ BridgefyPropagationProfile["highDensityNetwork"] = "highDensityNetwork";
16
+ BridgefyPropagationProfile["sparseNetwork"] = "sparseNetwork";
17
+ BridgefyPropagationProfile["longReach"] = "longReach";
18
+ BridgefyPropagationProfile["shortReach"] = "shortReach";
19
+ return BridgefyPropagationProfile;
20
+ }({});
21
+
22
+ /** The mode used to propagate a message through nearby devices. */
23
+ export let BridgefyTransmissionModeType = /*#__PURE__*/function (BridgefyTransmissionModeType) {
24
+ BridgefyTransmissionModeType["p2p"] = "p2p";
25
+ BridgefyTransmissionModeType["mesh"] = "mesh";
26
+ BridgefyTransmissionModeType["broadcast"] = "broadcast";
27
+ return BridgefyTransmissionModeType;
28
+ }({});
29
+ /** Describes errors in the Bridgefy error domain. */
30
+ export let BridgefyErrorType = /*#__PURE__*/function (BridgefyErrorType) {
31
+ BridgefyErrorType["simulatorIsNotSupported"] = "simulatorIsNotSupported";
32
+ BridgefyErrorType["alreadyStarted"] = "alreadyStarted";
33
+ BridgefyErrorType["invalidAPIKey"] = "invalidAPIKey";
34
+ BridgefyErrorType["expiredLicense"] = "expiredLicense";
35
+ BridgefyErrorType["sessionError"] = "sessionError";
36
+ BridgefyErrorType["notStarted"] = "notStarted";
37
+ BridgefyErrorType["alreadyInstantiated"] = "alreadyInstantiated";
38
+ BridgefyErrorType["startInProgress"] = "startInProgress";
39
+ BridgefyErrorType["serviceNotStarted"] = "serviceNotStarted";
40
+ BridgefyErrorType["missingBundleID"] = "missingBundleID";
41
+ BridgefyErrorType["internetConnectionRequired"] = "internetConnectionRequired";
42
+ BridgefyErrorType["inconsistentDeviceTime"] = "inconsistentDeviceTime";
43
+ BridgefyErrorType["BLEUsageNotGranted"] = "BLEUsageNotGranted";
44
+ BridgefyErrorType["BLEUsageRestricted"] = "BLEUsageRestricted";
45
+ BridgefyErrorType["BLEPoweredOff"] = "BLEPoweredOff";
46
+ BridgefyErrorType["BLEUnsupported"] = "BLEUnsupported";
47
+ BridgefyErrorType["BLEUnknownError"] = "BLEUnknownError";
48
+ BridgefyErrorType["inconsistentConnection"] = "inconsistentConnection";
49
+ BridgefyErrorType["connectionIsAlreadySecure"] = "connectionIsAlreadySecure";
50
+ BridgefyErrorType["cannotCreateSecureConnection"] = "cannotCreateSecureConnection";
51
+ BridgefyErrorType["dataLengthExceeded"] = "dataLengthExceeded";
52
+ BridgefyErrorType["dataValueIsEmpty"] = "dataValueIsEmpty";
53
+ BridgefyErrorType["peerIsNotConnected"] = "peerIsNotConnected";
54
+ BridgefyErrorType["internalError"] = "internalError";
55
+ BridgefyErrorType["licenseError"] = "licenseError";
56
+ BridgefyErrorType["storageError"] = "storageError";
57
+ BridgefyErrorType["encodingError"] = "encodingError";
58
+ BridgefyErrorType["encryptionError"] = "encryptionError";
59
+ BridgefyErrorType["missingApplicationId"] = "missingApplicationId";
60
+ BridgefyErrorType["permissionException"] = "permissionException";
61
+ BridgefyErrorType["registrationException"] = "registrationException";
62
+ BridgefyErrorType["sizeLimitExceeded"] = "sizeLimitExceeded";
63
+ BridgefyErrorType["deviceCapabilities"] = "deviceCapabilities";
64
+ BridgefyErrorType["genericException"] = "genericException";
65
+ BridgefyErrorType["inconsistentDeviceTimeException"] = "inconsistentDeviceTimeException";
66
+ BridgefyErrorType["internetConnectionRequiredException"] = "internetConnectionRequiredException";
67
+ BridgefyErrorType["unknownException"] = "unknownException";
68
+ return BridgefyErrorType;
69
+ }({});
70
+
71
+ /**
72
+ * These events are available via subscriptions to the `NativeEventEmitter` using the
73
+ * `NativeModules.BridgefyReactNative` component. See README for further instructions.
74
+ */
75
+ export let BridgefyEvents = /*#__PURE__*/function (BridgefyEvents) {
76
+ BridgefyEvents["bridgefyDidStart"] = "bridgefyDidStart";
77
+ BridgefyEvents["bridgefyDidFailToStart"] = "bridgefyDidFailToStart";
78
+ BridgefyEvents["bridgefyDidStop"] = "bridgefyDidStop";
79
+ BridgefyEvents["bridgefyDidFailToStop"] = "bridgefyDidFailToStop";
80
+ BridgefyEvents["bridgefyDidDestroySession"] = "bridgefyDidDestroySession";
81
+ BridgefyEvents["bridgefyDidFailToDestroySession"] = "bridgefyDidFailToDestroySession";
82
+ BridgefyEvents["bridgefyDidConnect"] = "bridgefyDidConnect";
83
+ BridgefyEvents["bridgefyDidDisconnect"] = "bridgefyDidDisconnect";
84
+ BridgefyEvents["bridgefyDidEstablishSecureConnection"] = "bridgefyDidEstablishSecureConnection";
85
+ BridgefyEvents["bridgefyDidFailToEstablishSecureConnection"] = "bridgefyDidFailToEstablishSecureConnection";
86
+ BridgefyEvents["bridgefyDidSendMessage"] = "bridgefyDidSendMessage";
87
+ BridgefyEvents["bridgefyDidFailSendingMessage"] = "bridgefyDidFailSendingMessage";
88
+ BridgefyEvents["bridgefyDidReceiveData"] = "bridgefyDidReceiveData";
89
+ BridgefyEvents["bridgefyDidSendDataProgress"] = "bridgefyDidSendDataProgress";
90
+ return BridgefyEvents;
91
+ }({});
92
+
93
+ /**
94
+ * Bridgefy
95
+ */
96
+ export class Bridgefy {
97
+ /**
98
+ * Initialize the SDK
99
+ * @param apiKey API key
100
+ * @param propagationProfile Profile that defines a series of properties and rules for the
101
+ * propagation of messages.
102
+ * @param verboseLogging The log level.
103
+ */
104
+ async initialize(apiKey, propagationProfile) {
105
+ return BridgefyReactNative.initialize(apiKey, propagationProfile);
106
+ }
107
+
108
+ /**
109
+ * Start Bridgefy SDK operations
110
+ */
111
+ async start() {
112
+ return BridgefyReactNative.start();
113
+ }
114
+
115
+ /**
116
+ * Stop Bridgefy SDK operations
117
+ */
118
+ async stop() {
119
+ return BridgefyReactNative.stop();
120
+ }
121
+
122
+ /**
123
+ * Destroy current session
124
+ */
125
+ async destroySession() {
126
+ return BridgefyReactNative.destroySession();
127
+ }
128
+
129
+ /**
130
+ * Function used to send data using a ``TransmissionMode``. This method returns a UUID to identify
131
+ * the message sent.
132
+ * @param data The message data
133
+ * @param transmissionMode The mode used to propagate a message through nearby devices.
134
+ * @returns The id of the message that was sent.
135
+ */
136
+ async send(data, transmissionMode) {
137
+ const result = await BridgefyReactNative.send(data, transmissionMode);
138
+ return result.messageId;
139
+ }
140
+
141
+ /**
142
+ * Establishes a secure connection with the specified user
143
+ * @param userId The UUID of the user with whom a secure connection should be established.
144
+ */
145
+ async establishSecureConnection(userId) {
146
+ return BridgefyReactNative.establishSecureConnection(userId);
147
+ }
148
+
149
+ /**
150
+ * Get current user Id
151
+ * @returns User Id
152
+ */
153
+ async currentUserId() {
154
+ const result = BridgefyReactNative.currentUserId();
155
+ return result.userId;
156
+ }
157
+
158
+ /**
159
+ * Returns connected peers
160
+ * @returns List of connected peers
161
+ */
162
+ async connectedPeers() {
163
+ const result = BridgefyReactNative.connectedPeers();
164
+ return result.connectedPeers;
165
+ }
166
+
167
+ /**
168
+ * Returns license expiration date
169
+ * @returns Expiration date
170
+ */
171
+ async licenseExpirationDate() {
172
+ const result = BridgefyReactNative.licenseExpirationDate();
173
+ return new Date(result.licenseExpirationDate);
174
+ }
175
+ }
176
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","BridgefyReactNative","Proxy","get","Error","BridgefyPropagationProfile","BridgefyTransmissionModeType","BridgefyErrorType","BridgefyEvents","Bridgefy","initialize","apiKey","propagationProfile","start","stop","destroySession","send","data","transmissionMode","result","messageId","establishSecureConnection","userId","currentUserId","connectedPeers","licenseExpirationDate","Date"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GAChB,g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;AACA;AACA;EACE,MAAMC,aAAaA,CAAA,EAAoB;IACrC,MAAMJ,MAAM,GAAGlB,mBAAmB,CAACsB,aAAa,CAAC,CAAC;IAClD,OAAOJ,MAAM,CAACG,MAAM;EACtB;;EAEA;AACF;AACA;AACA;EACE,MAAME,cAAcA,CAAA,EAAsB;IACxC,MAAML,MAAM,GAAGlB,mBAAmB,CAACuB,cAAc,CAAC,CAAC;IACnD,OAAOL,MAAM,CAACK,cAAc;EAC9B;;EAEA;AACF;AACA;AACA;EACE,MAAMC,qBAAqBA,CAAA,EAAkB;IAC3C,MAAMN,MAAM,GAAGlB,mBAAmB,CAACwB,qBAAqB,CAAC,CAAC;IAC1D,OAAO,IAAIC,IAAI,CAACP,MAAM,CAACM,qBAAqB,CAAC;EAC/C;AACF"}
@@ -0,0 +1,214 @@
1
+ /** Profile that defines a series of properties and rules for the propagation of messages. */
2
+ export declare enum BridgefyPropagationProfile {
3
+ standard = "standard",
4
+ highDensityNetwork = "highDensityNetwork",
5
+ sparseNetwork = "sparseNetwork",
6
+ longReach = "longReach",
7
+ shortReach = "shortReach"
8
+ }
9
+ /** The mode used to propagate a message through nearby devices. */
10
+ export declare enum BridgefyTransmissionModeType {
11
+ /** Deliver a message to a specific recipient only if there's an active connection with it. */
12
+ p2p = "p2p",
13
+ /** Deliver a message to a specific recipient using nearby devices to propagate it. */
14
+ mesh = "mesh",
15
+ /** Propagate a message readable by every device that receives it. */
16
+ broadcast = "broadcast"
17
+ }
18
+ export interface BridgefyTransmissionMode {
19
+ type: BridgefyTransmissionModeType;
20
+ uuid: string;
21
+ }
22
+ /** Describes errors in the Bridgefy error domain. */
23
+ export declare enum BridgefyErrorType {
24
+ /** The Bridgefy SDK cannot run in the simulator */
25
+ simulatorIsNotSupported = "simulatorIsNotSupported",
26
+ /** The Bridgefy SDK is already running */
27
+ alreadyStarted = "alreadyStarted",
28
+ /** The provided API key is not valid */
29
+ invalidAPIKey = "invalidAPIKey",
30
+ /** The license is expired */
31
+ expiredLicense = "expiredLicense",
32
+ /** An error occurred while creating the session */
33
+ sessionError = "sessionError",
34
+ /** (iOS) The Bridgefy SDK hasn't been started */
35
+ notStarted = "notStarted",
36
+ /** (iOS) A Bridgefy SDK instance already exists */
37
+ alreadyInstantiated = "alreadyInstantiated",
38
+ /** (iOS) The Bridgefy SDK is performing the start process */
39
+ startInProgress = "startInProgress",
40
+ /** (iOS) The Bridgefy SDK service is not started */
41
+ serviceNotStarted = "serviceNotStarted",
42
+ /** (iOS) Cannot get app's bundle id */
43
+ missingBundleID = "missingBundleID",
44
+ /** (iOS) An internet connection is required to validate the license */
45
+ internetConnectionRequired = "internetConnectionRequired",
46
+ /** (iOS) The device's time has been modified */
47
+ inconsistentDeviceTime = "inconsistentDeviceTime",
48
+ /** (iOS) The user does not allow the use of BLE */
49
+ BLEUsageNotGranted = "BLEUsageNotGranted",
50
+ /** (iOS) The use of BLE in this device is restricted */
51
+ BLEUsageRestricted = "BLEUsageRestricted",
52
+ /** (iOS) The BLE antenna has been turned off */
53
+ BLEPoweredOff = "BLEPoweredOff",
54
+ /** (iOS) The usage of BLE is not supported in the device */
55
+ BLEUnsupported = "BLEUnsupported",
56
+ /** (iOS) BLE usage failed with an unknown error */
57
+ BLEUnknownError = "BLEUnknownError",
58
+ /** (iOS) Inconsistent connection */
59
+ inconsistentConnection = "inconsistentConnection",
60
+ /** (iOS) Connection is already secure */
61
+ connectionIsAlreadySecure = "connectionIsAlreadySecure",
62
+ /** (iOS) Cannot create secure connection */
63
+ cannotCreateSecureConnection = "cannotCreateSecureConnection",
64
+ /** (iOS) The length of the data exceed the maximum limit */
65
+ dataLengthExceeded = "dataLengthExceeded",
66
+ /** (iOS) The data to send is empty */
67
+ dataValueIsEmpty = "dataValueIsEmpty",
68
+ /** (iOS) The requested peer is not connected */
69
+ peerIsNotConnected = "peerIsNotConnected",
70
+ /** (iOS) An internal error occurred */
71
+ internalError = "internalError",
72
+ /** (iOS) An error occurred while validating the license */
73
+ licenseError = "licenseError",
74
+ /** (iOS) An error occurred while storing data */
75
+ storageError = "storageError",
76
+ /** (iOS) An error occurred while encoding the message */
77
+ encodingError = "encodingError",
78
+ /** (iOS) An error occurred while encrypting the message */
79
+ encryptionError = "encryptionError",
80
+ /** (Android) Missing application ID */
81
+ missingApplicationId = "missingApplicationId",
82
+ /** (Android) Permission exception */
83
+ permissionException = "permissionException",
84
+ /** (Android) Registration exception */
85
+ registrationException = "registrationException",
86
+ /** (Android) Size limit exceeded */
87
+ sizeLimitExceeded = "sizeLimitExceeded",
88
+ /** (Android) Device capabilities error */
89
+ deviceCapabilities = "deviceCapabilities",
90
+ /** (Android) Generic exception */
91
+ genericException = "genericException",
92
+ /** (Android) Inconsistent device time */
93
+ inconsistentDeviceTimeException = "inconsistentDeviceTimeException",
94
+ /** (Android) Internet connection required */
95
+ internetConnectionRequiredException = "internetConnectionRequiredException",
96
+ /** (Android) Unknown exception */
97
+ unknownException = "unknownException"
98
+ }
99
+ /**
100
+ * These events are available via subscriptions to the `NativeEventEmitter` using the
101
+ * `NativeModules.BridgefyReactNative` component. See README for further instructions.
102
+ */
103
+ export declare enum BridgefyEvents {
104
+ /**
105
+ * This function is called when the BridgefySDK has been started.
106
+ */
107
+ bridgefyDidStart = "bridgefyDidStart",
108
+ /**
109
+ * This function is called when an error occurred while starting the BridgefySDK.
110
+ */
111
+ bridgefyDidFailToStart = "bridgefyDidFailToStart",
112
+ /**
113
+ * This function is called when the BridgefySDK has been stopped.
114
+ */
115
+ bridgefyDidStop = "bridgefyDidStop",
116
+ /**
117
+ * This function is called when an error occurred while stopping the BridgefySDK.
118
+ */
119
+ bridgefyDidFailToStop = "bridgefyDidFailToStop",
120
+ /**
121
+ * The current session was destroyed
122
+ */
123
+ bridgefyDidDestroySession = "bridgefyDidDestroySession",
124
+ /**
125
+ * An error occurred while destroying the current session
126
+ */
127
+ bridgefyDidFailToDestroySession = "bridgefyDidFailToDestroySession",
128
+ /**
129
+ * This function is called to notify a new connection.
130
+ */
131
+ bridgefyDidConnect = "bridgefyDidConnect",
132
+ /**
133
+ * This function is called to notify a disconnection.
134
+ */
135
+ bridgefyDidDisconnect = "bridgefyDidDisconnect",
136
+ /**
137
+ * This function is called to notify when an on-demand secure connection was established.
138
+ */
139
+ bridgefyDidEstablishSecureConnection = "bridgefyDidEstablishSecureConnection",
140
+ /**
141
+ * This function is called to notify when an on-demand secure connection could not be established.
142
+ */
143
+ bridgefyDidFailToEstablishSecureConnection = "bridgefyDidFailToEstablishSecureConnection",
144
+ /**
145
+ * This function is called when you confirm the sending of the message
146
+ */
147
+ bridgefyDidSendMessage = "bridgefyDidSendMessage",
148
+ /**
149
+ * This function is called when the message could not be sent
150
+ */
151
+ bridgefyDidFailSendingMessage = "bridgefyDidFailSendingMessage",
152
+ /**
153
+ * This function is called when a new message is received
154
+ */
155
+ bridgefyDidReceiveData = "bridgefyDidReceiveData",
156
+ /**
157
+ * (Android) Called when there is progress while transmitting data.
158
+ */
159
+ bridgefyDidSendDataProgress = "bridgefyDidSendDataProgress"
160
+ }
161
+ /**
162
+ * Bridgefy
163
+ */
164
+ export declare class Bridgefy {
165
+ /**
166
+ * Initialize the SDK
167
+ * @param apiKey API key
168
+ * @param propagationProfile Profile that defines a series of properties and rules for the
169
+ * propagation of messages.
170
+ * @param verboseLogging The log level.
171
+ */
172
+ initialize(apiKey: string, propagationProfile: BridgefyPropagationProfile): Promise<void>;
173
+ /**
174
+ * Start Bridgefy SDK operations
175
+ */
176
+ start(): Promise<void>;
177
+ /**
178
+ * Stop Bridgefy SDK operations
179
+ */
180
+ stop(): Promise<void>;
181
+ /**
182
+ * Destroy current session
183
+ */
184
+ destroySession(): Promise<void>;
185
+ /**
186
+ * Function used to send data using a ``TransmissionMode``. This method returns a UUID to identify
187
+ * the message sent.
188
+ * @param data The message data
189
+ * @param transmissionMode The mode used to propagate a message through nearby devices.
190
+ * @returns The id of the message that was sent.
191
+ */
192
+ send(data: string, transmissionMode: BridgefyTransmissionMode): Promise<string>;
193
+ /**
194
+ * Establishes a secure connection with the specified user
195
+ * @param userId The UUID of the user with whom a secure connection should be established.
196
+ */
197
+ establishSecureConnection(userId: string): Promise<void>;
198
+ /**
199
+ * Get current user Id
200
+ * @returns User Id
201
+ */
202
+ currentUserId(): Promise<string>;
203
+ /**
204
+ * Returns connected peers
205
+ * @returns List of connected peers
206
+ */
207
+ connectedPeers(): Promise<string[]>;
208
+ /**
209
+ * Returns license expiration date
210
+ * @returns Expiration date
211
+ */
212
+ licenseExpirationDate(): Promise<Date>;
213
+ }
214
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAmBA,6FAA6F;AAC7F,oBAAY,0BAA0B;IACpC,QAAQ,aAAa;IACrB,kBAAkB,uBAAuB;IACzC,aAAa,kBAAkB;IAC/B,SAAS,cAAc;IACvB,UAAU,eAAe;CAC1B;AAED,mEAAmE;AACnE,oBAAY,4BAA4B;IACtC,8FAA8F;IAC9F,GAAG,QAAQ;IACX,sFAAsF;IACtF,IAAI,SAAS;IACb,qEAAqE;IACrE,SAAS,cAAc;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,4BAA4B,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qDAAqD;AACrD,oBAAY,iBAAiB;IAC3B,mDAAmD;IACnD,uBAAuB,4BAA4B;IACnD,0CAA0C;IAC1C,cAAc,mBAAmB;IACjC,wCAAwC;IACxC,aAAa,kBAAkB;IAC/B,6BAA6B;IAC7B,cAAc,mBAAmB;IACjC,mDAAmD;IACnD,YAAY,iBAAiB;IAC7B,iDAAiD;IACjD,UAAU,eAAe;IACzB,mDAAmD;IACnD,mBAAmB,wBAAwB;IAC3C,6DAA6D;IAC7D,eAAe,oBAAoB;IACnC,oDAAoD;IACpD,iBAAiB,sBAAsB;IACvC,uCAAuC;IACvC,eAAe,oBAAoB;IACnC,uEAAuE;IACvE,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;IACnE;;OAEG;IACH,kBAAkB,uBAAuB;IACzC;;OAEG;IACH,qBAAqB,0BAA0B;IAC/C;;OAEG;IACH,oCAAoC,yCAAyC;IAC7E;;OAEG;IACH,0CAA0C,+CAA+C;IACzF;;OAEG;IACH,sBAAsB,2BAA2B;IACjD;;OAEG;IACH,6BAA6B,kCAAkC;IAC/D;;OAEG;IACH,sBAAsB,2BAA2B;IACjD;;OAEG;IACH,2BAA2B,gCAAgC;CAC5D;AAED;;GAEG;AACH,qBAAa,QAAQ;IACnB;;;;;;OAMG;IACG,UAAU,CACd,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,0BAA0B,GAC7C,OAAO,CAAC,IAAI,CAAC;IAIhB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;;;;;OAMG;IACG,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,wBAAwB,GACzC,OAAO,CAAC,MAAM,CAAC;IAKlB;;;OAGG;IACG,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKtC;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKzC;;;OAGG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7C"}
package/package.json ADDED
@@ -0,0 +1,162 @@
1
+ {
2
+ "name": "bridgefy-react-native",
3
+ "version": "1.0.1",
4
+ "description": "Bridgefy React Native SDK",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "*.podspec",
17
+ "!lib/typescript/example",
18
+ "!ios/build",
19
+ "!android/build",
20
+ "!android/gradle",
21
+ "!android/gradlew",
22
+ "!android/gradlew.bat",
23
+ "!android/local.properties",
24
+ "!**/__tests__",
25
+ "!**/__fixtures__",
26
+ "!**/__mocks__",
27
+ "!**/.*"
28
+ ],
29
+ "scripts": {
30
+ "test": "jest",
31
+ "typecheck": "tsc --noEmit",
32
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
33
+ "prepack": "bob build",
34
+ "release": "release-it",
35
+ "example": "yarn --cwd example",
36
+ "bootstrap": "yarn example && yarn install && yarn example pods",
37
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
38
+ },
39
+ "keywords": [
40
+ "react-native",
41
+ "ios",
42
+ "android",
43
+ "mesh",
44
+ "offline"
45
+ ],
46
+ "repository": "https://github.com/bridgefy/bridgefy-react-native",
47
+ "author": "Bridgefy Inc <contact@bridgefy.me> (https://bridgefy.me)",
48
+ "license": "MIT",
49
+ "bugs": {
50
+ "url": "https://github.com/bridgefy/bridgefy-react-native/issues"
51
+ },
52
+ "homepage": "https://github.com/bridgefy/bridgefy-react-native#readme",
53
+ "publishConfig": {
54
+ "registry": "https://registry.npmjs.org/"
55
+ },
56
+ "devDependencies": {
57
+ "@commitlint/config-conventional": "^17.0.2",
58
+ "@evilmartians/lefthook": "^1.2.2",
59
+ "@react-native-community/eslint-config": "^3.0.2",
60
+ "@release-it/conventional-changelog": "^5.0.0",
61
+ "@types/jest": "^28.1.2",
62
+ "@types/react": "~17.0.21",
63
+ "@types/react-native": "0.70.0",
64
+ "commitlint": "^17.0.2",
65
+ "del-cli": "^5.0.0",
66
+ "eslint": "^8.4.1",
67
+ "eslint-config-prettier": "^8.5.0",
68
+ "eslint-plugin-prettier": "^4.0.0",
69
+ "jest": "^28.1.1",
70
+ "pod-install": "^0.1.0",
71
+ "prettier": "^2.0.5",
72
+ "react": "18.2.0",
73
+ "react-native": "0.72.1",
74
+ "react-native-builder-bob": "^0.21.0",
75
+ "release-it": "^15.0.0",
76
+ "typescript": "^5.0.2"
77
+ },
78
+ "resolutions": {
79
+ "@types/react": "17.0.21"
80
+ },
81
+ "peerDependencies": {
82
+ "react": "*",
83
+ "react-native": "*"
84
+ },
85
+ "engines": {
86
+ "node": ">= 16.0.0"
87
+ },
88
+ "packageManager": "^yarn@1.22.15",
89
+ "jest": {
90
+ "preset": "react-native",
91
+ "modulePathIgnorePatterns": [
92
+ "<rootDir>/example/node_modules",
93
+ "<rootDir>/lib/"
94
+ ]
95
+ },
96
+ "commitlint": {
97
+ "extends": [
98
+ "@commitlint/config-conventional"
99
+ ]
100
+ },
101
+ "release-it": {
102
+ "git": {
103
+ "commitMessage": "chore: release ${version}",
104
+ "tagName": "v${version}"
105
+ },
106
+ "npm": {
107
+ "publish": true
108
+ },
109
+ "github": {
110
+ "release": true
111
+ },
112
+ "plugins": {
113
+ "@release-it/conventional-changelog": {
114
+ "preset": "angular"
115
+ }
116
+ }
117
+ },
118
+ "eslintConfig": {
119
+ "root": true,
120
+ "extends": [
121
+ "@react-native-community",
122
+ "prettier"
123
+ ],
124
+ "rules": {
125
+ "prettier/prettier": [
126
+ "error",
127
+ {
128
+ "quoteProps": "consistent",
129
+ "singleQuote": true,
130
+ "tabWidth": 2,
131
+ "trailingComma": "es5",
132
+ "useTabs": false
133
+ }
134
+ ]
135
+ }
136
+ },
137
+ "eslintIgnore": [
138
+ "node_modules/",
139
+ "lib/"
140
+ ],
141
+ "prettier": {
142
+ "quoteProps": "consistent",
143
+ "singleQuote": true,
144
+ "tabWidth": 2,
145
+ "trailingComma": "es5",
146
+ "useTabs": false
147
+ },
148
+ "react-native-builder-bob": {
149
+ "source": "src",
150
+ "output": "lib",
151
+ "targets": [
152
+ "commonjs",
153
+ "module",
154
+ [
155
+ "typescript",
156
+ {
157
+ "project": "tsconfig.build.json"
158
+ }
159
+ ]
160
+ ]
161
+ }
162
+ }