mixpanel-react-native 3.0.2 → 3.0.4

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 (124) hide show
  1. package/.github/workflows/node.js.yml +10 -3
  2. package/CHANGELOG.md +30 -0
  3. package/MixpanelReactNative.podspec +1 -1
  4. package/README.md +28 -3
  5. package/Samples/MixpanelExpo/package.json +1 -1
  6. package/Samples/MixpanelExpo/yarn.lock +7052 -0
  7. package/Samples/SimpleMixpanel/{App.js → App.tsx} +8 -8
  8. package/Samples/SimpleMixpanel/Gemfile +9 -0
  9. package/Samples/SimpleMixpanel/README.md +79 -0
  10. package/Samples/SimpleMixpanel/__tests__/{App-test.js → App.test.tsx} +3 -0
  11. package/Samples/SimpleMixpanel/android/app/build.gradle +58 -162
  12. package/Samples/SimpleMixpanel/android/app/src/debug/AndroidManifest.xml +1 -5
  13. package/Samples/SimpleMixpanel/android/app/src/main/AndroidManifest.xml +4 -4
  14. package/Samples/SimpleMixpanel/android/app/src/main/java/com/simplemixpanel/MainActivity.kt +22 -0
  15. package/Samples/SimpleMixpanel/android/app/src/main/java/com/simplemixpanel/MainApplication.kt +43 -0
  16. package/Samples/SimpleMixpanel/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  17. package/Samples/SimpleMixpanel/android/app/src/main/res/values/styles.xml +1 -1
  18. package/Samples/SimpleMixpanel/android/build.gradle +11 -28
  19. package/Samples/SimpleMixpanel/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  20. package/Samples/SimpleMixpanel/android/gradle/wrapper/gradle-wrapper.properties +3 -1
  21. package/Samples/SimpleMixpanel/android/gradle.properties +17 -4
  22. package/Samples/SimpleMixpanel/android/gradlew +173 -109
  23. package/Samples/SimpleMixpanel/android/gradlew.bat +92 -89
  24. package/Samples/SimpleMixpanel/android/settings.gradle +1 -0
  25. package/Samples/SimpleMixpanel/app.json +1 -1
  26. package/Samples/SimpleMixpanel/babel.config.js +1 -1
  27. package/Samples/SimpleMixpanel/ios/.xcode.env +11 -0
  28. package/Samples/SimpleMixpanel/ios/Podfile +24 -13
  29. package/Samples/SimpleMixpanel/ios/Podfile.lock +1414 -0
  30. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/AppDelegate.h +2 -4
  31. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/AppDelegate.mm +31 -0
  32. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/Images.xcassets/AppIcon.appiconset/Contents.json +30 -15
  33. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/Info.plist +8 -11
  34. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/PrivacyInfo.xcprivacy +38 -0
  35. package/Samples/SimpleMixpanel/ios/SimpleMixpanel/main.m +2 -1
  36. package/Samples/SimpleMixpanel/ios/SimpleMixpanel.xcodeproj/project.pbxproj +130 -114
  37. package/Samples/SimpleMixpanel/ios/SimpleMixpanelTests/SimpleMixpanelTests.m +14 -13
  38. package/Samples/SimpleMixpanel/jest.config.js +3 -0
  39. package/Samples/SimpleMixpanel/metro.config.js +7 -13
  40. package/Samples/SimpleMixpanel/package.json +23 -15
  41. package/Samples/SimpleMixpanel/tsconfig.json +3 -0
  42. package/Samples/SimpleMixpanel/yarn.lock +6814 -0
  43. package/__tests__/jest_setup.js +3 -3
  44. package/android/build.gradle +1 -1
  45. package/docs/Mixpanel.html +33 -33
  46. package/docs/MixpanelGroup.html +7 -7
  47. package/docs/People.html +12 -12
  48. package/docs/index.html +26 -3
  49. package/docs/index.js.html +8 -18
  50. package/index.d.ts +10 -2
  51. package/index.js +7 -17
  52. package/javascript/mixpanel-main.js +1 -1
  53. package/javascript/mixpanel-network.js +2 -2
  54. package/javascript/mixpanel-persistent.js +0 -2
  55. package/package.json +1 -1
  56. package/Samples/ContextAPIMixpanel/android/.project +0 -28
  57. package/Samples/MixpanelDemo/android/.project +0 -28
  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/android/bin/.gradle/5.5/executionHistory/executionHistory.lock +0 -0
  76. package/android/bin/.gradle/5.5/fileChanges/last-build.bin +0 -0
  77. package/android/bin/.gradle/5.5/fileHashes/fileHashes.bin +0 -0
  78. package/android/bin/.gradle/5.5/fileHashes/fileHashes.lock +0 -0
  79. package/android/bin/.gradle/5.5/gc.properties +0 -0
  80. package/android/bin/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  81. package/android/bin/.gradle/buildOutputCleanup/cache.properties +0 -2
  82. package/android/bin/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  83. package/android/bin/.gradle/vcs-1/gc.properties +0 -0
  84. package/android/bin/.idea/caches/build_file_checksums.ser +0 -0
  85. package/android/bin/.idea/compiler.xml +0 -6
  86. package/android/bin/.idea/gradle.xml +0 -21
  87. package/android/bin/.idea/jarRepositories.xml +0 -30
  88. package/android/bin/.idea/libraries/Gradle__com_android_support_appcompat_v7_23_0_1_aar.xml +0 -16
  89. package/android/bin/.idea/libraries/Gradle__com_android_support_recyclerview_v7_23_0_1_aar.xml +0 -13
  90. package/android/bin/.idea/libraries/Gradle__com_android_support_support_annotations_23_0_1.xml +0 -11
  91. package/android/bin/.idea/libraries/Gradle__com_android_support_support_v4_23_0_1_aar.xml +0 -17
  92. package/android/bin/.idea/libraries/Gradle__com_facebook_fresco_drawee_0_8_1_aar.xml +0 -13
  93. package/android/bin/.idea/libraries/Gradle__com_facebook_fresco_fbcore_0_8_1_aar.xml +0 -13
  94. package/android/bin/.idea/libraries/Gradle__com_facebook_fresco_fresco_0_8_1_aar.xml +0 -13
  95. package/android/bin/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_0_8_1_aar.xml +0 -13
  96. package/android/bin/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp_0_8_1_aar.xml +0 -13
  97. package/android/bin/.idea/libraries/Gradle__com_facebook_react_react_native_0_20_1_aar.xml +0 -17
  98. package/android/bin/.idea/libraries/Gradle__com_facebook_stetho_stetho_1_2_0.xml +0 -11
  99. package/android/bin/.idea/libraries/Gradle__com_facebook_stetho_stetho_okhttp_1_2_0.xml +0 -11
  100. package/android/bin/.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_core_2_2_3.xml +0 -11
  101. package/android/bin/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_0.xml +0 -11
  102. package/android/bin/.idea/libraries/Gradle__com_mixpanel_android_mixpanel_android_6_0_0_beta1_aar.xml +0 -16
  103. package/android/bin/.idea/libraries/Gradle__com_nineoldandroids_library_2_4_0.xml +0 -11
  104. package/android/bin/.idea/libraries/Gradle__com_parse_bolts_bolts_android_1_1_4.xml +0 -11
  105. package/android/bin/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_2_5_0.xml +0 -11
  106. package/android/bin/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_ws_2_5_0.xml +0 -11
  107. package/android/bin/.idea/libraries/Gradle__com_squareup_okio_okio_1_6_0.xml +0 -11
  108. package/android/bin/.idea/libraries/Gradle__commons_cli_commons_cli_1_2.xml +0 -11
  109. package/android/bin/.idea/libraries/Gradle__org_webkit_android_jsc_r174650_aar.xml +0 -11
  110. package/android/bin/.idea/misc.xml +0 -9
  111. package/android/bin/.idea/modules.xml +0 -8
  112. package/android/bin/.idea/vcs.xml +0 -6
  113. package/android/bin/.idea/workspace.xml +0 -57
  114. package/android/bin/.project +0 -34
  115. package/android/bin/.settings/org.eclipse.buildship.core.prefs +0 -13
  116. package/android/bin/build.gradle +0 -45
  117. package/android/bin/gradle/wrapper/gradle-wrapper.jar +0 -0
  118. package/android/bin/gradle/wrapper/gradle-wrapper.properties +0 -6
  119. package/android/bin/gradlew +0 -172
  120. package/android/bin/gradlew.bat +0 -84
  121. package/android/bin/local.properties +0 -8
  122. package/android/bin/src/main/AndroidManifest.xml +0 -2
  123. package/logs/.b11bf985d66a037ca5688a574653f3bf76a28dfa-audit.json +0 -29
  124. package/logs/.c366df74eeb671df60a57a2075ae40a3dae2af25-audit.json +0 -29
@@ -1,9 +1,9 @@
1
- import React, { Component } from 'react';
2
- import { Button, SafeAreaView } from "react-native";
3
- import { Mixpanel } from 'mixpanel-react-native';
1
+ import React from 'react';
2
+ import {Button, SafeAreaView} from 'react-native';
3
+ import {Mixpanel} from 'mixpanel-react-native';
4
4
 
5
5
  const trackAutomaticEvents = true;
6
- const mixpanel = new Mixpanel("Your Project Token", trackAutomaticEvents);
6
+ const mixpanel = new Mixpanel('Your Project Token', trackAutomaticEvents);
7
7
  mixpanel.init();
8
8
 
9
9
  // *************************************
@@ -15,11 +15,11 @@ const SampleApp = () => {
15
15
  <SafeAreaView>
16
16
  <Button
17
17
  title="Select Premium Plan"
18
- onPress={() => mixpanel.track("Plan Selected", {"Plan": "Premium"})}
18
+ onPress={() => mixpanel.track('Plan Selected', {Plan: 'Premium'})}
19
19
  />
20
20
  </SafeAreaView>
21
21
  );
22
- }
22
+ };
23
23
 
24
24
  export default SampleApp;
25
25
 
@@ -36,8 +36,8 @@ export default SampleApp;
36
36
  // onPress={() => mixpanel.track("Plan Selected", {"Plan": "Premium"})}
37
37
  // />
38
38
  // </SafeAreaView>
39
- // );
39
+ // );
40
40
  // }
41
41
  // }
42
42
 
43
- // export default SampleApp;
43
+ // export default SampleApp;
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
+ ruby ">= 2.6.10"
5
+
6
+ # Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7
+ # bound in the template on Cocoapods with next React Native release.
8
+ gem 'cocoapods', '>= 1.13', '< 1.15'
9
+ gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
@@ -0,0 +1,79 @@
1
+ This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
2
+
3
+ # Getting Started
4
+
5
+ >**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
6
+
7
+ ## Step 1: Start the Metro Server
8
+
9
+ First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
10
+
11
+ To start Metro, run the following command from the _root_ of your React Native project:
12
+
13
+ ```bash
14
+ # using npm
15
+ npm start
16
+
17
+ # OR using Yarn
18
+ yarn start
19
+ ```
20
+
21
+ ## Step 2: Start your Application
22
+
23
+ Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
24
+
25
+ ### For Android
26
+
27
+ ```bash
28
+ # using npm
29
+ npm run android
30
+
31
+ # OR using Yarn
32
+ yarn android
33
+ ```
34
+
35
+ ### For iOS
36
+
37
+ ```bash
38
+ # using npm
39
+ npm run ios
40
+
41
+ # OR using Yarn
42
+ yarn ios
43
+ ```
44
+
45
+ If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
46
+
47
+ This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
48
+
49
+ ## Step 3: Modifying your App
50
+
51
+ Now that you have successfully run the app, let's modify it.
52
+
53
+ 1. Open `App.tsx` in your text editor of choice and edit some lines.
54
+ 2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
55
+
56
+ For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
57
+
58
+ ## Congratulations! :tada:
59
+
60
+ You've successfully run and modified your React Native App. :partying_face:
61
+
62
+ ### Now what?
63
+
64
+ - If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
65
+ - If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
66
+
67
+ # Troubleshooting
68
+
69
+ If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
70
+
71
+ # Learn More
72
+
73
+ To learn more about React Native, take a look at the following resources:
74
+
75
+ - [React Native Website](https://reactnative.dev) - learn more about React Native.
76
+ - [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
77
+ - [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
78
+ - [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
79
+ - [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
@@ -6,6 +6,9 @@ import 'react-native';
6
6
  import React from 'react';
7
7
  import App from '../App';
8
8
 
9
+ // Note: import explicitly to use the types shipped with jest.
10
+ import {it} from '@jest/globals';
11
+
9
12
  // Note: test renderer must be required after react-native.
10
13
  import renderer from 'react-test-renderer';
11
14
 
@@ -1,135 +1,80 @@
1
1
  apply plugin: "com.android.application"
2
-
3
- import com.android.build.OutputFile
4
-
5
- /**
6
- * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7
- * and bundleReleaseJsAndAssets).
8
- * These basically call `react-native bundle` with the correct arguments during the Android build
9
- * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10
- * bundle directly from the development server. Below you can see all the possible configurations
11
- * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
- * `apply from: "../../node_modules/react-native/react.gradle"` line.
13
- *
14
- * project.ext.react = [
15
- * // the name of the generated asset file containing your JS bundle
16
- * bundleAssetName: "index.android.bundle",
17
- *
18
- * // the entry file for bundle generation. If none specified and
19
- * // "index.android.js" exists, it will be used. Otherwise "index.js" is
20
- * // default. Can be overridden with ENTRY_FILE environment variable.
21
- * entryFile: "index.android.js",
22
- *
23
- * // https://reactnative.dev/docs/performance#enable-the-ram-format
24
- * bundleCommand: "ram-bundle",
25
- *
26
- * // whether to bundle JS and assets in debug mode
27
- * bundleInDebug: false,
28
- *
29
- * // whether to bundle JS and assets in release mode
30
- * bundleInRelease: true,
31
- *
32
- * // whether to bundle JS and assets in another build variant (if configured).
33
- * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
34
- * // The configuration property can be in the following formats
35
- * // 'bundleIn${productFlavor}${buildType}'
36
- * // 'bundleIn${buildType}'
37
- * // bundleInFreeDebug: true,
38
- * // bundleInPaidRelease: true,
39
- * // bundleInBeta: true,
40
- *
41
- * // whether to disable dev mode in custom build variants (by default only disabled in release)
42
- * // for example: to disable dev mode in the staging build type (if configured)
43
- * devDisabledInStaging: true,
44
- * // The configuration property can be in the following formats
45
- * // 'devDisabledIn${productFlavor}${buildType}'
46
- * // 'devDisabledIn${buildType}'
47
- *
48
- * // the root of your project, i.e. where "package.json" lives
49
- * root: "../../",
50
- *
51
- * // where to put the JS bundle asset in debug mode
52
- * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
53
- *
54
- * // where to put the JS bundle asset in release mode
55
- * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
56
- *
57
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
58
- * // require('./image.png')), in debug mode
59
- * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
60
- *
61
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
62
- * // require('./image.png')), in release mode
63
- * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
64
- *
65
- * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
66
- * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
67
- * // date; if you have any other folders that you want to ignore for performance reasons (gradle
68
- * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
69
- * // for example, you might want to remove it from here.
70
- * inputExcludes: ["android/**", "ios/**"],
71
- *
72
- * // override which node gets called and with what additional arguments
73
- * nodeExecutableAndArgs: ["node"],
74
- *
75
- * // supply additional arguments to the packager
76
- * extraPackagerArgs: []
77
- * ]
78
- */
79
-
80
- project.ext.react = [
81
- enableHermes: false, // clean and rebuild if changing
82
- ]
83
-
84
- apply from: "../../node_modules/react-native/react.gradle"
2
+ apply plugin: "org.jetbrains.kotlin.android"
3
+ apply plugin: "com.facebook.react"
85
4
 
86
5
  /**
87
- * Set this to true to create two separate APKs instead of one:
88
- * - An APK that only works on ARM devices
89
- * - An APK that only works on x86 devices
90
- * The advantage is the size of the APK is reduced by about 4MB.
91
- * Upload all the APKs to the Play Store and people will download
92
- * the correct one based on the CPU architecture of their device.
6
+ * This is the configuration block to customize your React Native Android app.
7
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
93
8
  */
94
- def enableSeparateBuildPerCPUArchitecture = false
9
+ react {
10
+ /* Folders */
11
+ // The root of your project, i.e. where "package.json" lives. Default is '..'
12
+ // root = file("../")
13
+ // The folder where the react-native NPM package is. Default is ../node_modules/react-native
14
+ // reactNativeDir = file("../node_modules/react-native")
15
+ // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
16
+ // codegenDir = file("../node_modules/@react-native/codegen")
17
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
18
+ // cliFile = file("../node_modules/react-native/cli.js")
19
+
20
+ /* Variants */
21
+ // The list of variants to that are debuggable. For those we're going to
22
+ // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
23
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24
+ // debuggableVariants = ["liteDebug", "prodDebug"]
25
+
26
+ /* Bundling */
27
+ // A list containing the node command and its flags. Default is just 'node'.
28
+ // nodeExecutableAndArgs = ["node"]
29
+ //
30
+ // The command to run when bundling. By default is 'bundle'
31
+ // bundleCommand = "ram-bundle"
32
+ //
33
+ // The path to the CLI configuration file. Default is empty.
34
+ // bundleConfig = file(../rn-cli.config.js)
35
+ //
36
+ // The name of the generated asset file containing your JS bundle
37
+ // bundleAssetName = "MyApplication.android.bundle"
38
+ //
39
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40
+ // entryFile = file("../js/MyApplication.android.js")
41
+ //
42
+ // A list of extra flags to pass to the 'bundle' commands.
43
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44
+ // extraPackagerArgs = []
45
+
46
+ /* Hermes Commands */
47
+ // The hermes compiler command to run. By default it is 'hermesc'
48
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49
+ //
50
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51
+ // hermesFlags = ["-O", "-output-source-map"]
52
+ }
95
53
 
96
54
  /**
97
- * Run Proguard to shrink the Java bytecode in release builds.
55
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
98
56
  */
99
57
  def enableProguardInReleaseBuilds = false
100
58
 
101
59
  /**
102
- * The preferred build flavor of JavaScriptCore.
60
+ * The preferred build flavor of JavaScriptCore (JSC)
103
61
  *
104
62
  * For example, to use the international variant, you can use:
105
63
  * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
106
64
  *
107
65
  * The international variant includes ICU i18n library and necessary data
108
66
  * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
109
- * give correct results when using with locales other than en-US. Note that
67
+ * give correct results when using with locales other than en-US. Note that
110
68
  * this variant is about 6MiB larger per architecture than default.
111
69
  */
112
70
  def jscFlavor = 'org.webkit:android-jsc:+'
113
71
 
114
- /**
115
- * Whether to enable the Hermes VM.
116
- *
117
- * This should be set on project.ext.react and mirrored here. If it is not set
118
- * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
119
- * and the benefits of using Hermes will therefore be sharply reduced.
120
- */
121
- def enableHermes = project.ext.react.get("enableHermes", false);
122
-
123
72
  android {
124
73
  ndkVersion rootProject.ext.ndkVersion
74
+ buildToolsVersion rootProject.ext.buildToolsVersion
75
+ compileSdk rootProject.ext.compileSdkVersion
125
76
 
126
- compileSdkVersion rootProject.ext.compileSdkVersion
127
-
128
- compileOptions {
129
- sourceCompatibility JavaVersion.VERSION_1_8
130
- targetCompatibility JavaVersion.VERSION_1_8
131
- }
132
-
77
+ namespace "com.simplemixpanel"
133
78
  defaultConfig {
134
79
  applicationId "com.simplemixpanel"
135
80
  minSdkVersion rootProject.ext.minSdkVersion
@@ -137,14 +82,6 @@ android {
137
82
  versionCode 1
138
83
  versionName "1.0"
139
84
  }
140
- splits {
141
- abi {
142
- reset()
143
- enable enableSeparateBuildPerCPUArchitecture
144
- universalApk false // If true, also generate a universal APK
145
- include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
146
- }
147
- }
148
85
  signingConfigs {
149
86
  debug {
150
87
  storeFile file('debug.keystore')
@@ -165,58 +102,17 @@ android {
165
102
  proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
166
103
  }
167
104
  }
168
-
169
- // applicationVariants are e.g. debug, release
170
- applicationVariants.all { variant ->
171
- variant.outputs.each { output ->
172
- // For each separate APK per architecture, set a unique version code as described here:
173
- // https://developer.android.com/studio/build/configure-apk-splits.html
174
- // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
175
- def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
176
- def abi = output.getFilter(OutputFile.ABI)
177
- if (abi != null) { // null for the universal-debug, universal-release variants
178
- output.versionCodeOverride =
179
- defaultConfig.versionCode * 1000 + versionCodes.get(abi)
180
- }
181
-
182
- }
183
- }
184
105
  }
185
106
 
186
107
  dependencies {
187
- implementation fileTree(dir: "libs", include: ["*.jar"])
188
- //noinspection GradleDynamicVersion
189
- implementation "com.facebook.react:react-native:+" // From node_modules
190
-
191
- implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
108
+ // The version of react-native is set by the React Native Gradle Plugin
109
+ implementation("com.facebook.react:react-android")
192
110
 
193
- debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
194
- exclude group:'com.facebook.fbjni'
195
- }
196
-
197
- debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
198
- exclude group:'com.facebook.flipper'
199
- exclude group:'com.squareup.okhttp3', module:'okhttp'
200
- }
201
-
202
- debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
203
- exclude group:'com.facebook.flipper'
204
- }
205
-
206
- if (enableHermes) {
207
- def hermesPath = "../../node_modules/hermes-engine/android/";
208
- debugImplementation files(hermesPath + "hermes-debug.aar")
209
- releaseImplementation files(hermesPath + "hermes-release.aar")
111
+ if (hermesEnabled.toBoolean()) {
112
+ implementation("com.facebook.react:hermes-android")
210
113
  } else {
211
114
  implementation jscFlavor
212
115
  }
213
116
  }
214
117
 
215
- // Run this once to be able to run the application with BUCK
216
- // puts all compile dependencies into folder libs for BUCK to use
217
- task copyDownloadableDepsToLibs(type: Copy) {
218
- from configurations.compile
219
- into 'libs'
220
- }
221
-
222
118
  apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
@@ -2,12 +2,8 @@
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  xmlns:tools="http://schemas.android.com/tools">
4
4
 
5
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6
-
7
5
  <application
8
6
  android:usesCleartextTraffic="true"
9
7
  tools:targetApi="28"
10
- tools:ignore="GoogleAppIndexingWarning">
11
- <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
12
- </application>
8
+ tools:ignore="GoogleAppIndexingWarning"/>
13
9
  </manifest>
@@ -1,5 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.simplemixpanel">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
 
4
3
  <uses-permission android:name="android.permission.INTERNET" />
5
4
 
@@ -13,9 +12,10 @@
13
12
  <activity
14
13
  android:name=".MainActivity"
15
14
  android:label="@string/app_name"
16
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
15
+ android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
17
16
  android:launchMode="singleTask"
18
- android:windowSoftInputMode="adjustResize">
17
+ android:windowSoftInputMode="adjustResize"
18
+ android:exported="true">
19
19
  <intent-filter>
20
20
  <action android:name="android.intent.action.MAIN" />
21
21
  <category android:name="android.intent.category.LAUNCHER" />
@@ -0,0 +1,22 @@
1
+ package com.simplemixpanel
2
+
3
+ import com.facebook.react.ReactActivity
4
+ import com.facebook.react.ReactActivityDelegate
5
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6
+ import com.facebook.react.defaults.DefaultReactActivityDelegate
7
+
8
+ class MainActivity : ReactActivity() {
9
+
10
+ /**
11
+ * Returns the name of the main component registered from JavaScript. This is used to schedule
12
+ * rendering of the component.
13
+ */
14
+ override fun getMainComponentName(): String = "SimpleMixpanel"
15
+
16
+ /**
17
+ * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18
+ * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19
+ */
20
+ override fun createReactActivityDelegate(): ReactActivityDelegate =
21
+ DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22
+ }
@@ -0,0 +1,43 @@
1
+ package com.simplemixpanel
2
+
3
+ import android.app.Application
4
+ import com.facebook.react.PackageList
5
+ import com.facebook.react.ReactApplication
6
+ import com.facebook.react.ReactHost
7
+ import com.facebook.react.ReactNativeHost
8
+ import com.facebook.react.ReactPackage
9
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
10
+ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11
+ import com.facebook.react.defaults.DefaultReactNativeHost
12
+ import com.facebook.soloader.SoLoader
13
+
14
+ class MainApplication : Application(), ReactApplication {
15
+
16
+ override val reactNativeHost: ReactNativeHost =
17
+ object : DefaultReactNativeHost(this) {
18
+ override fun getPackages(): List<ReactPackage> =
19
+ PackageList(this).packages.apply {
20
+ // Packages that cannot be autolinked yet can be added manually here, for example:
21
+ // add(MyReactNativePackage())
22
+ }
23
+
24
+ override fun getJSMainModuleName(): String = "index"
25
+
26
+ override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
27
+
28
+ override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
29
+ override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
30
+ }
31
+
32
+ override val reactHost: ReactHost
33
+ get() = getDefaultReactHost(applicationContext, reactNativeHost)
34
+
35
+ override fun onCreate() {
36
+ super.onCreate()
37
+ SoLoader.init(this, false)
38
+ if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
39
+ // If you opted-in for the New Architecture, we load the native entry point for this app.
40
+ load()
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Copyright (C) 2014 The Android Open Source Project
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <inset xmlns:android="http://schemas.android.com/apk/res/android"
17
+ android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
18
+ android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
19
+ android:insetTop="@dimen/abc_edit_text_inset_top_material"
20
+ android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
21
+ >
22
+
23
+ <selector>
24
+ <!--
25
+ This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
26
+ The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
27
+ NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
28
+
29
+ <item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
30
+
31
+ For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
32
+ -->
33
+ <item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
34
+ <item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
35
+ </selector>
36
+
37
+ </inset>
@@ -3,7 +3,7 @@
3
3
  <!-- Base application theme. -->
4
4
  <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
5
5
  <!-- Customize your theme here. -->
6
- <item name="android:textColor">#000000</item>
6
+ <item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
7
7
  </style>
8
8
 
9
9
  </resources>
@@ -1,38 +1,21 @@
1
- // Top-level build file where you can add configuration options common to all sub-projects/modules.
2
-
3
1
  buildscript {
4
2
  ext {
5
- buildToolsVersion = "29.0.3"
6
- minSdkVersion = 21
7
- compileSdkVersion = 29
8
- targetSdkVersion = 29
9
- ndkVersion = "20.1.5948944"
3
+ buildToolsVersion = "34.0.0"
4
+ minSdkVersion = 23
5
+ compileSdkVersion = 34
6
+ targetSdkVersion = 34
7
+ ndkVersion = "26.1.10909125"
8
+ kotlinVersion = "1.9.22"
10
9
  }
11
10
  repositories {
12
11
  google()
13
- jcenter()
12
+ mavenCentral()
14
13
  }
15
14
  dependencies {
16
- classpath("com.android.tools.build:gradle:4.1.0")
17
- // NOTE: Do not place your application dependencies here; they belong
18
- // in the individual module build.gradle files
15
+ classpath("com.android.tools.build:gradle")
16
+ classpath("com.facebook.react:react-native-gradle-plugin")
17
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
19
18
  }
20
19
  }
21
20
 
22
- allprojects {
23
- repositories {
24
- mavenLocal()
25
- maven {
26
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
27
- url("$rootDir/../node_modules/react-native/android")
28
- }
29
- maven {
30
- // Android JSC is installed from npm
31
- url("$rootDir/../node_modules/jsc-android/dist")
32
- }
33
-
34
- google()
35
- jcenter()
36
- maven { url 'https://www.jitpack.io' }
37
- }
38
- }
21
+ apply plugin: "com.facebook.react.rootproject"
@@ -1,5 +1,7 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
4
+ networkTimeout=10000
5
+ validateDistributionUrl=true
4
6
  zipStoreBase=GRADLE_USER_HOME
5
7
  zipStorePath=wrapper/dists
@@ -9,8 +9,8 @@
9
9
 
10
10
  # Specifies the JVM arguments used for the daemon process.
11
11
  # The setting is particularly useful for tweaking memory settings.
12
- # Default value: -Xmx10248m -XX:MaxPermSize=256m
13
- # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
12
+ # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13
+ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14
14
 
15
15
  # When configured, Gradle will run in incubating parallel mode.
16
16
  # This option should only be used with decoupled projects. More details, visit
@@ -24,5 +24,18 @@ android.useAndroidX=true
24
24
  # Automatically convert third-party libraries to use AndroidX
25
25
  android.enableJetifier=true
26
26
 
27
- # Version of flipper SDK to use with React Native
28
- FLIPPER_VERSION=0.75.1
27
+ # Use this property to specify which architecture you want to build.
28
+ # You can also override it from the CLI using
29
+ # ./gradlew <task> -PreactNativeArchitectures=x86_64
30
+ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
31
+
32
+ # Use this property to enable support to the new architecture.
33
+ # This will allow you to use TurboModules and the Fabric render in
34
+ # your application. You should enable this flag either if you want
35
+ # to write custom TurboModules/Fabric components OR use libraries that
36
+ # are providing them.
37
+ newArchEnabled=false
38
+
39
+ # Use this property to enable or disable the Hermes JS engine.
40
+ # If set to false, you will be using JSC instead.
41
+ hermesEnabled=true