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
@@ -40,7 +40,13 @@ jobs:
40
40
  uses: actions/setup-node@v2
41
41
  with:
42
42
  node-version: ${{ matrix.node-version }}
43
+ - uses: actions/setup-java@v4
44
+ with:
45
+ distribution: "temurin" # See 'Supported distributions' for available options
46
+ java-version: "17"
43
47
  - run: npm install
48
+ - run: npm install -g react-native-cli
49
+ - run: npm i react-native-gradle-plugin
44
50
  - name: Test Integration - Install dependencies
45
51
  working-directory: ./Samples/SimpleMixpanel
46
52
  run: yarn install
@@ -59,7 +65,7 @@ jobs:
59
65
  profile: Nexus 6
60
66
  arch: x86_64
61
67
  working-directory: ./Samples/SimpleMixpanel
62
- script: yarn android
68
+ script: react-native run-android
63
69
 
64
70
  test_ios:
65
71
  runs-on: macos-latest
@@ -75,12 +81,13 @@ jobs:
75
81
  with:
76
82
  node-version: ${{ matrix.node-version }}
77
83
  - run: npm install
84
+ - run: npm install -g react-native-cli
78
85
  - name: Test Integration - Install dependencies
79
86
  working-directory: ./Samples/SimpleMixpanel
80
- run: yarn install
87
+ run: npm install
81
88
  - name: Setup iOS
82
89
  working-directory: ./Samples/SimpleMixpanel/ios
83
90
  run: pod install --repo-update
84
91
  - name: Test iOS
85
92
  working-directory: ./Samples/SimpleMixpanel
86
- run: yarn ios
93
+ run: react-native run-ios
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  #
2
2
 
3
+ ## [v3.0.3](https://github.com/mixpanel/mixpanel-react-native/tree/v3.0.3) (2024-05-10)
4
+
5
+ ### Enhancements
6
+
7
+ - bump iOS to 4.2.7 [\#249](https://github.com/mixpanel/mixpanel-react-native/pull/249)
8
+ - Require only the used subset of `AsnycStorage` as custom storage [\#246](https://github.com/mixpanel/mixpanel-react-native/pull/246)
9
+ - Fix CI issues for both iOS and Android and update the sample app [\#241](https://github.com/mixpanel/mixpanel-react-native/pull/241)
10
+ - Version bump Android SDK to 7.5.2 [\#237](https://github.com/mixpanel/mixpanel-react-native/pull/237)
11
+
12
+ ### Fixes
13
+
14
+ - fix: fix adapter storage jest setup [\#244](https://github.com/mixpanel/mixpanel-react-native/pull/244)
15
+ - fix storage adapter info being logged on every app launch [\#239](https://github.com/mixpanel/mixpanel-react-native/pull/239)
16
+ - Added null check for empty constants object incase of web [\#238](https://github.com/mixpanel/mixpanel-react-native/pull/238)
17
+
18
+ #
19
+
3
20
  ## [v3.0.2](https://github.com/mixpanel/mixpanel-react-native/tree/v3.0.2) (2024-04-16)
4
21
 
5
22
  ### Fixes
@@ -406,3 +423,5 @@ This major release removes all remaining calls to Mixpanel's `/decide` API endpo
406
423
 
407
424
 
408
425
 
426
+
427
+
@@ -19,5 +19,5 @@ Pod::Spec.new do |s|
19
19
  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
20
20
 
21
21
  s.dependency "React-Core"
22
- s.dependency "Mixpanel-swift", '4.2.5'
22
+ s.dependency "Mixpanel-swift", '4.2.7'
23
23
  end
package/README.md CHANGED
@@ -100,12 +100,37 @@ const SampleApp = () => {
100
100
  export default SampleApp;
101
101
 
102
102
  ```
103
- ### Expo and React Native for Web support
104
- 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, `useNative`, set to false(```const mixpanel = new Mixpanel(
103
+ ### Expo and React Native for Web support (3.0.2 and above)
104
+ 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.
105
+ To enable this feature,
106
+ <br>Step 1:
107
+ ```
108
+ npm install @react-native-async-storage/async-storage
109
+ ```
110
+ When JavaScript mode is enabled, Mixpanel utilizes [AsyncStorage](https://react-native-async-storage.github.io/async-storage/) 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: [`MixpanelAsyncStorage`](index.d.ts)) of the same interface as [AsyncStorage](https://react-native-async-storage.github.io/async-storage/) The following example demonstrates how to use a custom storage solution:
111
+
112
+ ```
113
+ // Optional: if you do not want to use the default AsyncStorage
114
+ const MyAsyncStorage = require("@my-org/<library-path>/AsyncStorage");
115
+ const trackAutomaticEvents = false;
116
+ const useNative = false;
117
+ const mixpanel = new Mixpanel('YOUR_TOKEN', trackAutomaticEvents, useNative, MyAsyncStorage);
118
+ mixpanel.init();
119
+ ```
120
+
121
+ <br>Step 2:
122
+ Initialize Mixpanel with an additional parameter, `useNative`, set to false.
123
+ ```
124
+ const trackAutomaticEvents = false;
125
+ const useNative = false;
126
+ const mixpanel = new Mixpanel(
105
127
  "YOUR_MIXPANEL_TOKEN",
106
128
  trackAutomaticEvents,
107
129
  useNative
108
- );```). 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 [v3.0.0-beta.1](https://github.com/mixpanel/mixpanel-react-native/releases/tag/v3.0.0-beta.1).
130
+ );
131
+ ```
132
+ This will activate JavaScript mode.
133
+
109
134
 
110
135
  👋 👋 Tell us about the Mixpanel developer experience! [https://www.mixpanel.com/devnps](https://www.mixpanel.com/devnps) 👍 👎
111
136
 
@@ -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
+ }