mixpanel-react-native 3.0.2 → 3.0.3

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 (76) hide show
  1. package/.github/workflows/node.js.yml +10 -3
  2. package/CHANGELOG.md +19 -0
  3. package/MixpanelReactNative.podspec +1 -1
  4. package/README.md +28 -3
  5. package/Samples/SimpleMixpanel/{App.js → App.tsx} +8 -8
  6. package/Samples/SimpleMixpanel/Gemfile +9 -0
  7. package/Samples/SimpleMixpanel/README.md +79 -0
  8. package/Samples/SimpleMixpanel/__tests__/{App-test.js → App.test.tsx} +3 -0
  9. package/Samples/SimpleMixpanel/android/app/build.gradle +58 -162
  10. package/Samples/SimpleMixpanel/android/app/src/debug/AndroidManifest.xml +1 -5
  11. package/Samples/SimpleMixpanel/android/app/src/main/AndroidManifest.xml +4 -4
  12. package/Samples/SimpleMixpanel/android/app/src/main/java/com/simplemixpanel/MainActivity.kt +22 -0
  13. package/Samples/SimpleMixpanel/android/app/src/main/java/com/simplemixpanel/MainApplication.kt +43 -0
  14. package/Samples/SimpleMixpanel/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  15. package/Samples/SimpleMixpanel/android/app/src/main/res/values/styles.xml +1 -1
  16. package/Samples/SimpleMixpanel/android/build.gradle +11 -28
  17. package/Samples/SimpleMixpanel/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  18. package/Samples/SimpleMixpanel/android/gradle/wrapper/gradle-wrapper.properties +3 -1
  19. package/Samples/SimpleMixpanel/android/gradle.properties +17 -4
  20. package/Samples/SimpleMixpanel/android/gradlew +173 -109
  21. package/Samples/SimpleMixpanel/android/gradlew.bat +92 -89
  22. package/Samples/SimpleMixpanel/android/settings.gradle +1 -0
  23. package/Samples/SimpleMixpanel/app.json +1 -1
  24. package/Samples/SimpleMixpanel/babel.config.js +1 -1
  25. package/Samples/SimpleMixpanel/ios/.xcode.env +11 -0
  26. package/Samples/SimpleMixpanel/ios/Podfile +24 -13
  27. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/AppDelegate.h +2 -4
  28. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/AppDelegate.mm +31 -0
  29. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/Images.xcassets/AppIcon.appiconset/Contents.json +30 -15
  30. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/Info.plist +8 -11
  31. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/PrivacyInfo.xcprivacy +38 -0
  32. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/main.m +2 -1
  33. package/Samples/SimpleMixpanel/ios/SimpleMixpanel.xcodeproj/project.pbxproj +130 -114
  34. package/Samples/SimpleMixpanel/ios/SimpleMixpanelTests/SimpleMixpanelTests.m +14 -13
  35. package/Samples/SimpleMixpanel/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm +1895 -0
  36. package/Samples/SimpleMixpanel/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h +2343 -0
  37. package/Samples/SimpleMixpanel/ios/build/generated/ios/FBReactNativeSpecJSI-generated.cpp +2542 -0
  38. package/Samples/SimpleMixpanel/ios/build/generated/ios/FBReactNativeSpecJSI.h +8693 -0
  39. package/Samples/SimpleMixpanel/ios/build/generated/ios/RCTModulesConformingToProtocolsProvider.h +18 -0
  40. package/Samples/SimpleMixpanel/ios/build/generated/ios/RCTModulesConformingToProtocolsProvider.mm +33 -0
  41. package/Samples/SimpleMixpanel/ios/build/generated/ios/React-Codegen.podspec.json +1 -0
  42. package/Samples/SimpleMixpanel/jest.config.js +3 -0
  43. package/Samples/SimpleMixpanel/metro.config.js +7 -13
  44. package/Samples/SimpleMixpanel/package.json +23 -15
  45. package/Samples/SimpleMixpanel/tsconfig.json +3 -0
  46. package/Samples/SimpleMixpanel/yarn.lock +6814 -0
  47. package/__tests__/jest_setup.js +3 -3
  48. package/android/build.gradle +1 -1
  49. package/docs/Mixpanel.html +1 -1
  50. package/docs/MixpanelGroup.html +1 -1
  51. package/docs/People.html +1 -1
  52. package/docs/index.html +26 -3
  53. package/docs/index.js.html +1 -1
  54. package/index.d.ts +7 -1
  55. package/javascript/mixpanel-main.js +1 -1
  56. package/javascript/mixpanel-persistent.js +0 -2
  57. package/package.json +1 -1
  58. package/Samples/SimpleMixpanel/.buckconfig +0 -6
  59. package/Samples/SimpleMixpanel/.editorconfig +0 -3
  60. package/Samples/SimpleMixpanel/.eslintrc.js +0 -4
  61. package/Samples/SimpleMixpanel/.flowconfig +0 -66
  62. package/Samples/SimpleMixpanel/.gitattributes +0 -3
  63. package/Samples/SimpleMixpanel/.prettierrc.js +0 -7
  64. package/Samples/SimpleMixpanel/.watchmanconfig +0 -1
  65. package/Samples/SimpleMixpanel/android/.project +0 -28
  66. package/Samples/SimpleMixpanel/android/app/BUCK +0 -55
  67. package/Samples/SimpleMixpanel/android/app/build_defs.bzl +0 -19
  68. package/Samples/SimpleMixpanel/android/app/src/debug/java/com/simplemixpanel/ReactNativeFlipper.java +0 -72
  69. package/Samples/SimpleMixpanel/android/app/src/main/java/com/simplemixpanel/MainActivity.java +0 -15
  70. package/Samples/SimpleMixpanel/android/app/src/main/java/com/simplemixpanel/MainApplication.java +0 -80
  71. package/Samples/SimpleMixpanel/ios/File.swift +0 -8
  72. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/AppDelegate.m +0 -62
  73. package/Samples/SimpleMixpanel/ios/SimpleMixpanel-Bridging-Header.h +0 -4
  74. package/Samples/SimpleMixpanel/ios/SimpleMixpanel.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  75. package/logs/.b11bf985d66a037ca5688a574653f3bf76a28dfa-audit.json +0 -29
  76. package/logs/.c366df74eeb671df60a57a2075ae40a3dae2af25-audit.json +0 -29
@@ -3,9 +3,9 @@ import * as ReactNative from "react-native";
3
3
  jest.mock("mixpanel-react-native/javascript/mixpanel-storage", () => {
4
4
  return {
5
5
  AsyncStorageAdapter: jest.fn().mockImplementation(() => ({
6
- getItem: jest.fn(),
7
- setItem: jest.fn(),
8
- removeItem: jest.fn(),
6
+ getItem: jest.fn().mockResolvedValue(null),
7
+ setItem: jest.fn().mockResolvedValue(undefined),
8
+ removeItem: jest.fn().mockResolvedValue(undefined),
9
9
  })),
10
10
  };
11
11
  });
@@ -41,5 +41,5 @@ repositories {
41
41
 
42
42
  dependencies {
43
43
  implementation 'com.facebook.react:react-native:+'
44
- implementation 'com.mixpanel.android:mixpanel-android:7.5.0'
44
+ implementation 'com.mixpanel.android:mixpanel-android:7.5.2'
45
45
  }
@@ -4516,7 +4516,7 @@ To clear all superProperties, use clearSuperProperties()
4516
4516
  <br class="clear">
4517
4517
 
4518
4518
  <footer>
4519
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Apr 15 2024 22:35:54 GMT-0700 (Pacific Daylight Time)
4519
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Fri May 10 2024 11:47:39 GMT-0700 (Pacific Daylight Time)
4520
4520
  </footer>
4521
4521
 
4522
4522
  <script> prettyPrint(); </script>
@@ -957,7 +957,7 @@ If the property exists and is not list-valued, the union will be ignored.
957
957
  <br class="clear">
958
958
 
959
959
  <footer>
960
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Apr 15 2024 22:35:54 GMT-0700 (Pacific Daylight Time)
960
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Fri May 10 2024 11:47:39 GMT-0700 (Pacific Daylight Time)
961
961
  </footer>
962
962
 
963
963
  <script> prettyPrint(); </script>
package/docs/People.html CHANGED
@@ -1625,7 +1625,7 @@ If the property exists and is not list-valued, the union will be ignored.
1625
1625
  <br class="clear">
1626
1626
 
1627
1627
  <footer>
1628
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Apr 15 2024 22:35:54 GMT-0700 (Pacific Daylight Time)
1628
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Fri May 10 2024 11:47:39 GMT-0700 (Pacific Daylight Time)
1629
1629
  </footer>
1630
1630
 
1631
1631
  <script> prettyPrint(); </script>
package/docs/index.html CHANGED
@@ -138,8 +138,31 @@ const SampleApp = () => {
138
138
  export default SampleApp;
139
139
 
140
140
  </code></pre>
141
- <h3>Expo and React Native for Web support</h3>
142
- <p>Starting from version 3.0.0, we have introduced support for Expo, React Native for Web, and other platforms utilizing React Native that do not support iOS and Android directly. To enable this feature, initialize Mixpanel with an additional parameter, <code>useNative</code>, set to false(<code>const mixpanel = new Mixpanel( &quot;YOUR_MIXPANEL_TOKEN&quot;, trackAutomaticEvents, useNative );</code>). This will activate JavaScript mode. Please note that this functionality is currently in beta testing. For further details and installation guidelines, refer to the release notes available at Mixpanel React Native <a href="https://github.com/mixpanel/mixpanel-react-native/releases/tag/v3.0.0-beta.1">v3.0.0-beta.1</a>.</p>
141
+ <h3>Expo and React Native for Web support (3.0.2 and above)</h3>
142
+ <p>Starting from version 3.0.2, we have introduced support for Expo, React Native for Web, and other platforms utilizing React Native that do not support iOS and Android directly.
143
+ To enable this feature,
144
+ <br>Step 1:</p>
145
+ <pre class="prettyprint source"><code>npm install @react-native-async-storage/async-storage
146
+ </code></pre>
147
+ <p>When JavaScript mode is enabled, Mixpanel utilizes <a href="https://react-native-async-storage.github.io/async-storage/">AsyncStorage</a> to persist data. If you prefer not to use it, or if AsyncStorage is unavailable in your target environment, you can import or define a different storage class. However, it must follow a subset (see: <a href="index.d.ts"><code>MixpanelAsyncStorage</code></a>) of the same interface as <a href="https://react-native-async-storage.github.io/async-storage/">AsyncStorage</a> The following example demonstrates how to use a custom storage solution:</p>
148
+ <pre class="prettyprint source"><code>// Optional: if you do not want to use the default AsyncStorage
149
+ const MyAsyncStorage = require(&quot;@my-org/&lt;library-path>/AsyncStorage&quot;);
150
+ const trackAutomaticEvents = false;
151
+ const useNative = false;
152
+ const mixpanel = new Mixpanel('YOUR_TOKEN', trackAutomaticEvents, useNative, MyAsyncStorage);
153
+ mixpanel.init();
154
+ </code></pre>
155
+ <p><br>Step 2:
156
+ Initialize Mixpanel with an additional parameter, <code>useNative</code>, set to false.</p>
157
+ <pre class="prettyprint source"><code>const trackAutomaticEvents = false;
158
+ const useNative = false;
159
+ const mixpanel = new Mixpanel(
160
+ &quot;YOUR_MIXPANEL_TOKEN&quot;,
161
+ trackAutomaticEvents,
162
+ useNative
163
+ );
164
+ </code></pre>
165
+ <p>This will activate JavaScript mode.</p>
143
166
  <p>👋 👋 Tell us about the Mixpanel developer experience! <a href="https://www.mixpanel.com/devnps">https://www.mixpanel.com/devnps</a> 👍 👎</p>
144
167
  <h2>FAQ</h2>
145
168
  <p><strong>I want to stop tracking an event/event property in Mixpanel. Is that possible?</strong><br>
@@ -180,7 +203,7 @@ Please refer to our <a href="https://mixpanel.com/legal/app-store-privacy-detai
180
203
  <br class="clear">
181
204
 
182
205
  <footer>
183
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Apr 15 2024 22:35:54 GMT-0700 (Pacific Daylight Time)
206
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Fri May 10 2024 11:47:39 GMT-0700 (Pacific Daylight Time)
184
207
  </footer>
185
208
 
186
209
  <script> prettyPrint(); </script>
@@ -1048,7 +1048,7 @@ class ObjectHelper {
1048
1048
  <br class="clear">
1049
1049
 
1050
1050
  <footer>
1051
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Apr 15 2024 22:35:54 GMT-0700 (Pacific Daylight Time)
1051
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Fri May 10 2024 11:47:39 GMT-0700 (Pacific Daylight Time)
1052
1052
  </footer>
1053
1053
 
1054
1054
  <script> prettyPrint(); </script>
package/index.d.ts CHANGED
@@ -1,12 +1,18 @@
1
1
  type MixpanelType = any;
2
2
  type MixpanelProperties = {[key: string]: MixpanelType};
3
3
 
4
+ export type MixpanelAsyncStorage = {
5
+ getItem(key: string): Promise<string | null>
6
+ setItem(key: string, value: string): Promise<void>
7
+ removeItem(key: string): Promise<void>
8
+ }
9
+
4
10
  export class Mixpanel {
5
11
  constructor(
6
12
  token: string,
7
13
  trackAutomaticEvents: boolean,
8
14
  useNative?: boolean,
9
- storage?: any
15
+ storage?: MixpanelAsyncStorage
10
16
  );
11
17
  static init(
12
18
  token: string,
@@ -41,7 +41,7 @@ export default class MixpanelMain {
41
41
 
42
42
  getMetaData() {
43
43
  const {OS, Version, constants} = Platform;
44
- const {Brand, Manufacturer, Model} = constants;
44
+ const {Brand, Manufacturer, Model} = constants || {};
45
45
 
46
46
  let metadata = {
47
47
  $os: OS,
@@ -50,8 +50,6 @@ export class MixpanelPersistent {
50
50
  }
51
51
 
52
52
  async loadDeviceId(token) {
53
- console.info("storageAdapter", this.storageAdapter);
54
- console.info("storageAdapter get item", this.storageAdapter.getItem());
55
53
  await this.storageAdapter
56
54
  .getItem(getDeviceIdKey(token))
57
55
  .then((deviceId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixpanel-react-native",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Official React Native Tracking Library for Mixpanel Analytics",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,6 +0,0 @@
1
-
2
- [android]
3
- target = Google Inc.:Google APIs:23
4
-
5
- [maven_repositories]
6
- central = https://repo1.maven.org/maven2
@@ -1,3 +0,0 @@
1
- # Windows files
2
- [*.bat]
3
- end_of_line = crlf
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: '@react-native-community',
4
- };
@@ -1,66 +0,0 @@
1
- [ignore]
2
- ; We fork some components by platform
3
- .*/*[.]android.js
4
-
5
- ; Ignore "BUCK" generated dirs
6
- <PROJECT_ROOT>/\.buckd/
7
-
8
- ; Ignore polyfills
9
- node_modules/react-native/Libraries/polyfills/.*
10
-
11
- ; Flow doesn't support platforms
12
- .*/Libraries/Utilities/LoadingView.js
13
-
14
- [untyped]
15
- .*/node_modules/@react-native-community/cli/.*/.*
16
-
17
- [include]
18
-
19
- [libs]
20
- node_modules/react-native/interface.js
21
- node_modules/react-native/flow/
22
-
23
- [options]
24
- emoji=true
25
-
26
- esproposal.optional_chaining=enable
27
- esproposal.nullish_coalescing=enable
28
-
29
- exact_by_default=true
30
-
31
- module.file_ext=.js
32
- module.file_ext=.json
33
- module.file_ext=.ios.js
34
-
35
- munge_underscores=true
36
-
37
- module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
38
- module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
39
-
40
- suppress_type=$FlowIssue
41
- suppress_type=$FlowFixMe
42
- suppress_type=$FlowFixMeProps
43
- suppress_type=$FlowFixMeState
44
-
45
- [lints]
46
- sketchy-null-number=warn
47
- sketchy-null-mixed=warn
48
- sketchy-number=warn
49
- untyped-type-import=warn
50
- nonstrict-import=warn
51
- deprecated-type=warn
52
- unsafe-getters-setters=warn
53
- unnecessary-invariant=warn
54
- signature-verification-failure=warn
55
-
56
- [strict]
57
- deprecated-type
58
- nonstrict-import
59
- sketchy-null
60
- unclear-type
61
- unsafe-getters-setters
62
- untyped-import
63
- untyped-type-import
64
-
65
- [version]
66
- ^0.137.0
@@ -1,3 +0,0 @@
1
- # Windows files should use crlf line endings
2
- # https://help.github.com/articles/dealing-with-line-endings/
3
- *.bat text eol=crlf
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- bracketSpacing: false,
3
- jsxBracketSameLine: true,
4
- singleQuote: true,
5
- trailingComma: 'all',
6
- arrowParens: 'avoid',
7
- };
@@ -1 +0,0 @@
1
- {}
@@ -1,28 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <projectDescription>
3
- <name>SimpleMixpanel</name>
4
- <comment>Project android created by Buildship.</comment>
5
- <projects>
6
- </projects>
7
- <buildSpec>
8
- <buildCommand>
9
- <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10
- <arguments>
11
- </arguments>
12
- </buildCommand>
13
- </buildSpec>
14
- <natures>
15
- <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16
- </natures>
17
- <filteredResources>
18
- <filter>
19
- <id>1686200212442</id>
20
- <name></name>
21
- <type>30</type>
22
- <matcher>
23
- <id>org.eclipse.core.resources.regexFilterMatcher</id>
24
- <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25
- </matcher>
26
- </filter>
27
- </filteredResources>
28
- </projectDescription>
@@ -1,55 +0,0 @@
1
- # To learn about Buck see [Docs](https://buckbuild.com/).
2
- # To run your application with Buck:
3
- # - install Buck
4
- # - `npm start` - to start the packager
5
- # - `cd android`
6
- # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7
- # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8
- # - `buck install -r android/app` - compile, install and run application
9
- #
10
-
11
- load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12
-
13
- lib_deps = []
14
-
15
- create_aar_targets(glob(["libs/*.aar"]))
16
-
17
- create_jar_targets(glob(["libs/*.jar"]))
18
-
19
- android_library(
20
- name = "all-libs",
21
- exported_deps = lib_deps,
22
- )
23
-
24
- android_library(
25
- name = "app-code",
26
- srcs = glob([
27
- "src/main/java/**/*.java",
28
- ]),
29
- deps = [
30
- ":all-libs",
31
- ":build_config",
32
- ":res",
33
- ],
34
- )
35
-
36
- android_build_config(
37
- name = "build_config",
38
- package = "com.simplemixpanel",
39
- )
40
-
41
- android_resource(
42
- name = "res",
43
- package = "com.simplemixpanel",
44
- res = "src/main/res",
45
- )
46
-
47
- android_binary(
48
- name = "app",
49
- keystore = "//android/keystores:debug",
50
- manifest = "src/main/AndroidManifest.xml",
51
- package_type = "debug",
52
- deps = [
53
- ":app-code",
54
- ],
55
- )
@@ -1,19 +0,0 @@
1
- """Helper definitions to glob .aar and .jar targets"""
2
-
3
- def create_aar_targets(aarfiles):
4
- for aarfile in aarfiles:
5
- name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6
- lib_deps.append(":" + name)
7
- android_prebuilt_aar(
8
- name = name,
9
- aar = aarfile,
10
- )
11
-
12
- def create_jar_targets(jarfiles):
13
- for jarfile in jarfiles:
14
- name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15
- lib_deps.append(":" + name)
16
- prebuilt_jar(
17
- name = name,
18
- binary_jar = jarfile,
19
- )
@@ -1,72 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * <p>This source code is licensed under the MIT license found in the LICENSE file in the root
5
- * directory of this source tree.
6
- */
7
- package com.simplemixpanel;
8
-
9
- import android.content.Context;
10
- import com.facebook.flipper.android.AndroidFlipperClient;
11
- import com.facebook.flipper.android.utils.FlipperUtils;
12
- import com.facebook.flipper.core.FlipperClient;
13
- import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14
- import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15
- import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16
- import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17
- import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18
- import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19
- import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20
- import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
21
- import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
22
- import com.facebook.react.ReactInstanceManager;
23
- import com.facebook.react.bridge.ReactContext;
24
- import com.facebook.react.modules.network.NetworkingModule;
25
- import okhttp3.OkHttpClient;
26
-
27
- public class ReactNativeFlipper {
28
- public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
29
- if (FlipperUtils.shouldEnableFlipper(context)) {
30
- final FlipperClient client = AndroidFlipperClient.getInstance(context);
31
-
32
- client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
33
- client.addPlugin(new ReactFlipperPlugin());
34
- client.addPlugin(new DatabasesFlipperPlugin(context));
35
- client.addPlugin(new SharedPreferencesFlipperPlugin(context));
36
- client.addPlugin(CrashReporterPlugin.getInstance());
37
-
38
- NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
39
- NetworkingModule.setCustomClientBuilder(
40
- new NetworkingModule.CustomClientBuilder() {
41
- @Override
42
- public void apply(OkHttpClient.Builder builder) {
43
- builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
44
- }
45
- });
46
- client.addPlugin(networkFlipperPlugin);
47
- client.start();
48
-
49
- // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
50
- // Hence we run if after all native modules have been initialized
51
- ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
52
- if (reactContext == null) {
53
- reactInstanceManager.addReactInstanceEventListener(
54
- new ReactInstanceManager.ReactInstanceEventListener() {
55
- @Override
56
- public void onReactContextInitialized(ReactContext reactContext) {
57
- reactInstanceManager.removeReactInstanceEventListener(this);
58
- reactContext.runOnNativeModulesQueueThread(
59
- new Runnable() {
60
- @Override
61
- public void run() {
62
- client.addPlugin(new FrescoFlipperPlugin());
63
- }
64
- });
65
- }
66
- });
67
- } else {
68
- client.addPlugin(new FrescoFlipperPlugin());
69
- }
70
- }
71
- }
72
- }
@@ -1,15 +0,0 @@
1
- package com.simplemixpanel;
2
-
3
- import com.facebook.react.ReactActivity;
4
-
5
- public class MainActivity extends ReactActivity {
6
-
7
- /**
8
- * Returns the name of the main component registered from JavaScript. This is used to schedule
9
- * rendering of the component.
10
- */
11
- @Override
12
- protected String getMainComponentName() {
13
- return "SimpleMixpanel";
14
- }
15
- }
@@ -1,80 +0,0 @@
1
- package com.simplemixpanel;
2
-
3
- import android.app.Application;
4
- import android.content.Context;
5
- import com.facebook.react.PackageList;
6
- import com.facebook.react.ReactApplication;
7
- import com.facebook.react.ReactInstanceManager;
8
- import com.facebook.react.ReactNativeHost;
9
- import com.facebook.react.ReactPackage;
10
- import com.facebook.soloader.SoLoader;
11
- import java.lang.reflect.InvocationTargetException;
12
- import java.util.List;
13
-
14
- public class MainApplication extends Application implements ReactApplication {
15
-
16
- private final ReactNativeHost mReactNativeHost =
17
- new ReactNativeHost(this) {
18
- @Override
19
- public boolean getUseDeveloperSupport() {
20
- return BuildConfig.DEBUG;
21
- }
22
-
23
- @Override
24
- protected List<ReactPackage> getPackages() {
25
- @SuppressWarnings("UnnecessaryLocalVariable")
26
- List<ReactPackage> packages = new PackageList(this).getPackages();
27
- // Packages that cannot be autolinked yet can be added manually here, for example:
28
- // packages.add(new MyReactNativePackage());
29
- return packages;
30
- }
31
-
32
- @Override
33
- protected String getJSMainModuleName() {
34
- return "index";
35
- }
36
- };
37
-
38
- @Override
39
- public ReactNativeHost getReactNativeHost() {
40
- return mReactNativeHost;
41
- }
42
-
43
- @Override
44
- public void onCreate() {
45
- super.onCreate();
46
- SoLoader.init(this, /* native exopackage */ false);
47
- initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
48
- }
49
-
50
- /**
51
- * Loads Flipper in React Native templates. Call this in the onCreate method with something like
52
- * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
53
- *
54
- * @param context
55
- * @param reactInstanceManager
56
- */
57
- private static void initializeFlipper(
58
- Context context, ReactInstanceManager reactInstanceManager) {
59
- if (BuildConfig.DEBUG) {
60
- try {
61
- /*
62
- We use reflection here to pick up the class that initializes Flipper,
63
- since Flipper library is not available in release mode
64
- */
65
- Class<?> aClass = Class.forName("com.simplemixpanel.ReactNativeFlipper");
66
- aClass
67
- .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
68
- .invoke(null, context, reactInstanceManager);
69
- } catch (ClassNotFoundException e) {
70
- e.printStackTrace();
71
- } catch (NoSuchMethodException e) {
72
- e.printStackTrace();
73
- } catch (IllegalAccessException e) {
74
- e.printStackTrace();
75
- } catch (InvocationTargetException e) {
76
- e.printStackTrace();
77
- }
78
- }
79
- }
80
- }
@@ -1,8 +0,0 @@
1
- //
2
- // File.swift
3
- // SimpleMixpanel
4
- //
5
- // Created by ZIHE JIA on 7/29/21.
6
- //
7
-
8
- import Foundation
@@ -1,62 +0,0 @@
1
- #import "AppDelegate.h"
2
-
3
- #import <React/RCTBridge.h>
4
- #import <React/RCTBundleURLProvider.h>
5
- #import <React/RCTRootView.h>
6
-
7
- #ifdef FB_SONARKIT_ENABLED
8
- #import <FlipperKit/FlipperClient.h>
9
- #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
10
- #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
11
- #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
12
- #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
13
- #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
14
-
15
- static void InitializeFlipper(UIApplication *application) {
16
- FlipperClient *client = [FlipperClient sharedClient];
17
- SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
18
- [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
19
- [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
20
- [client addPlugin:[FlipperKitReactPlugin new]];
21
- [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
22
- [client start];
23
- }
24
- #endif
25
-
26
- @implementation AppDelegate
27
-
28
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
29
- {
30
- #ifdef FB_SONARKIT_ENABLED
31
- InitializeFlipper(application);
32
- #endif
33
-
34
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
35
- RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
36
- moduleName:@"SimpleMixpanel"
37
- initialProperties:nil];
38
-
39
- if (@available(iOS 13.0, *)) {
40
- rootView.backgroundColor = [UIColor systemBackgroundColor];
41
- } else {
42
- rootView.backgroundColor = [UIColor whiteColor];
43
- }
44
-
45
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
46
- UIViewController *rootViewController = [UIViewController new];
47
- rootViewController.view = rootView;
48
- self.window.rootViewController = rootViewController;
49
- [self.window makeKeyAndVisible];
50
- return YES;
51
- }
52
-
53
- - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
54
- {
55
- #if DEBUG
56
- return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
57
- #else
58
- return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
59
- #endif
60
- }
61
-
62
- @end
@@ -1,4 +0,0 @@
1
- //
2
- // Use this file to import your target's public headers that you would like to expose to Swift.
3
- //
4
-
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>
@@ -1,29 +0,0 @@
1
- {
2
- "keep": {
3
- "days": true,
4
- "amount": 14
5
- },
6
- "auditLog": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/.b11bf985d66a037ca5688a574653f3bf76a28dfa-audit.json",
7
- "files": [
8
- {
9
- "date": 1712642656268,
10
- "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-04-08.log",
11
- "hash": "4a7d6370cb36e50ee6bfb367c333ac6a"
12
- },
13
- {
14
- "date": 1712687544944,
15
- "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-04-09.log",
16
- "hash": "4454643b08fa4b3a09ef5d6539ee436a"
17
- },
18
- {
19
- "date": 1712859288027,
20
- "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-04-11.log",
21
- "hash": "049536ba3b6998b543a89803a4423598"
22
- },
23
- {
24
- "date": 1713206392549,
25
- "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-04-15.log",
26
- "hash": "f07017339bdf31cfa1a98bc3c5876834"
27
- }
28
- ]
29
- }