Tn tracker android (#2289)
* change(android): added android support * change(git): Remove .yarn from version control * change(git): Remove .yarn from version control * change(rn-tracker): android view fixes * change(tracker): yarn * fix rn: fix ios config for react native * ios source changes * change(lib): tracker manager * change(lib): layout fixes * change(lib): layout fixes * fix default api endp --------- Co-authored-by: Shekar Siri <sshekarsiri@gmail.com>
This commit is contained in:
parent
7b6c02a955
commit
50c63a23e8
759 changed files with 4881 additions and 1542 deletions
35
lefthook.yml
Normal file
35
lefthook.yml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# EXAMPLE USAGE:
|
||||
#
|
||||
# Refer for explanation to following link:
|
||||
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
|
||||
#
|
||||
# pre-push:
|
||||
# commands:
|
||||
# packages-audit:
|
||||
# tags: frontend security
|
||||
# run: yarn audit
|
||||
# gems-audit:
|
||||
# tags: backend security
|
||||
# run: bundle audit
|
||||
#
|
||||
# pre-commit:
|
||||
# parallel: true
|
||||
# commands:
|
||||
# eslint:
|
||||
# glob: "*.{js,ts,jsx,tsx}"
|
||||
# run: yarn eslint {staged_files}
|
||||
# rubocop:
|
||||
# tags: backend style
|
||||
# glob: "*.rb"
|
||||
# exclude: '(^|/)(application|routes)\.rb$'
|
||||
# run: bundle exec rubocop --force-exclusion {all_files}
|
||||
# govet:
|
||||
# tags: backend style
|
||||
# files: git ls-files -m
|
||||
# glob: "*.go"
|
||||
# run: go vet {files}
|
||||
# scripts:
|
||||
# "hello.js":
|
||||
# runner: node
|
||||
# "any.go":
|
||||
# runner: go run
|
||||
59
tracker/.husky/prepare-commit-msg
Executable file
59
tracker/.husky/prepare-commit-msg
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
if [ "$LEFTHOOK" = "0" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
call_lefthook()
|
||||
{
|
||||
if test -n "$LEFTHOOK_BIN"
|
||||
then
|
||||
"$LEFTHOOK_BIN" "$@"
|
||||
elif lefthook -h >/dev/null 2>&1
|
||||
then
|
||||
lefthook "$@"
|
||||
else
|
||||
dir="$(git rev-parse --show-toplevel)"
|
||||
if test -f "$dir/node_modules/lefthook/bin/index.js"
|
||||
then
|
||||
"$dir/node_modules/lefthook/bin/index.js" "$@"
|
||||
else
|
||||
osArch=$(uname | tr '[:upper:]' '[:lower:]')
|
||||
cpuArch=$(uname -m | sed 's/aarch64/arm64/')
|
||||
if test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook"
|
||||
then
|
||||
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook_${osArch}_${cpuArch}/lefthook" "$@"
|
||||
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch}_${cpuArch}/lefthook"
|
||||
then
|
||||
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook_${osArch}_${cpuArch}/lefthook" "$@"
|
||||
|
||||
elif bundle exec lefthook -h >/dev/null 2>&1
|
||||
then
|
||||
bundle exec lefthook "$@"
|
||||
elif yarn lefthook -h >/dev/null 2>&1
|
||||
then
|
||||
yarn lefthook "$@"
|
||||
elif pnpm lefthook -h >/dev/null 2>&1
|
||||
then
|
||||
pnpm lefthook "$@"
|
||||
elif swift package plugin lefthook >/dev/null 2>&1
|
||||
then
|
||||
swift package --disable-sandbox plugin lefthook "$@"
|
||||
elif command -v mint >/dev/null 2>&1
|
||||
then
|
||||
mint run csjones/lefthook-plugin "$@"
|
||||
elif command -v npx >/dev/null 2>&1
|
||||
then
|
||||
npx lefthook "$@"
|
||||
else
|
||||
echo "Can't find lefthook in PATH"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
call_lefthook run "prepare-commit-msg" "$@"
|
||||
8
tracker/tracker-reactnative/.gitignore
vendored
8
tracker/tracker-reactnative/.gitignore
vendored
|
|
@ -61,6 +61,14 @@ buck-out/
|
|||
android/app/libs
|
||||
android/keystores/debug.keystore
|
||||
|
||||
# Yarn
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
||||
# Expo
|
||||
.expo/
|
||||
|
||||
|
|
|
|||
541
tracker/tracker-reactnative/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
Normal file
541
tracker/tracker-reactnative/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
Normal file
File diff suppressed because one or more lines are too long
28
tracker/tracker-reactnative/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
vendored
Normal file
28
tracker/tracker-reactnative/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
vendored
Normal file
File diff suppressed because one or more lines are too long
874
tracker/tracker-reactnative/.yarn/releases/yarn-3.6.1.cjs
vendored
Executable file
874
tracker/tracker-reactnative/.yarn/releases/yarn-3.6.1.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
10
tracker/tracker-reactnative/.yarnrc.yml
Normal file
10
tracker/tracker-reactnative/.yarnrc.yml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
nodeLinker: node-modules
|
||||
nmHoistingLimits: workspaces
|
||||
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
||||
spec: "@yarnpkg/plugin-workspace-tools"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.6.1.cjs
|
||||
133
tracker/tracker-reactnative/CODE_OF_CONDUCT.md
Normal file
133
tracker/tracker-reactnative/CODE_OF_CONDUCT.md
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
[INSERT CONTACT METHOD].
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
122
tracker/tracker-reactnative/CONTRIBUTING.md
Normal file
122
tracker/tracker-reactnative/CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
# Contributing
|
||||
|
||||
Contributions are always welcome, no matter how large or small!
|
||||
|
||||
We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md).
|
||||
|
||||
## Development workflow
|
||||
|
||||
This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:
|
||||
|
||||
- The library package in the root directory.
|
||||
- An example app in the `example/` directory.
|
||||
|
||||
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
|
||||
|
||||
```sh
|
||||
yarn
|
||||
```
|
||||
|
||||
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
|
||||
|
||||
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
|
||||
|
||||
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.
|
||||
|
||||
If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/ReactNativeExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > @openreplay/react-native`.
|
||||
|
||||
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `openreplay-react-native` under `Android`.
|
||||
|
||||
You can use various commands from the root directory to work with the project.
|
||||
|
||||
To start the packager:
|
||||
|
||||
```sh
|
||||
yarn example start
|
||||
```
|
||||
|
||||
To run the example app on Android:
|
||||
|
||||
```sh
|
||||
yarn example android
|
||||
```
|
||||
|
||||
To run the example app on iOS:
|
||||
|
||||
```sh
|
||||
yarn example ios
|
||||
```
|
||||
|
||||
Make sure your code passes TypeScript and ESLint. Run the following to verify:
|
||||
|
||||
```sh
|
||||
yarn typecheck
|
||||
yarn lint
|
||||
```
|
||||
|
||||
To fix formatting errors, run the following:
|
||||
|
||||
```sh
|
||||
yarn lint --fix
|
||||
```
|
||||
|
||||
Remember to add tests for your change if possible. Run the unit tests by:
|
||||
|
||||
```sh
|
||||
yarn test
|
||||
```
|
||||
|
||||
### Commit message convention
|
||||
|
||||
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
|
||||
|
||||
- `fix`: bug fixes, e.g. fix crash due to deprecated method.
|
||||
- `feat`: new features, e.g. add new method to the module.
|
||||
- `refactor`: code refactor, e.g. migrate from class components to hooks.
|
||||
- `docs`: changes into documentation, e.g. add usage example for the module..
|
||||
- `test`: adding or updating tests, e.g. add integration tests using detox.
|
||||
- `chore`: tooling changes, e.g. change CI config.
|
||||
|
||||
Our pre-commit hooks verify that your commit message matches this format when committing.
|
||||
|
||||
### Linting and tests
|
||||
|
||||
[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
|
||||
|
||||
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
|
||||
|
||||
Our pre-commit hooks verify that the linter and tests pass when committing.
|
||||
|
||||
### Publishing to npm
|
||||
|
||||
We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.
|
||||
|
||||
To publish new versions, run the following:
|
||||
|
||||
```sh
|
||||
yarn release
|
||||
```
|
||||
|
||||
### Scripts
|
||||
|
||||
The `package.json` file contains various scripts for common tasks:
|
||||
|
||||
- `yarn`: setup project by installing dependencies.
|
||||
- `yarn typecheck`: type-check files with TypeScript.
|
||||
- `yarn lint`: lint files with ESLint.
|
||||
- `yarn test`: run unit tests with Jest.
|
||||
- `yarn example start`: start the Metro server for the example app.
|
||||
- `yarn example android`: run the example app on Android.
|
||||
- `yarn example ios`: run the example app on iOS.
|
||||
|
||||
### Sending a pull request
|
||||
|
||||
> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
|
||||
|
||||
When you're sending a pull request:
|
||||
|
||||
- Prefer small pull requests focused on one change.
|
||||
- Verify that linters and tests are passing.
|
||||
- Review the documentation to make sure it looks good.
|
||||
- Follow the pull request template when opening a pull request.
|
||||
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
# @openreplay/react-native
|
||||
|
||||
Only iOS devices are supported right now. Regular View and empty callbacks are used for android devices,
|
||||
so its safe to use with crossplatform apps.
|
||||
Openreplay React-native connector for mobile applications.
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
buildscript {
|
||||
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
||||
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["Rntracker_kotlinVersion"]
|
||||
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["ReactNative_kotlinVersion"]
|
||||
|
||||
repositories {
|
||||
google()
|
||||
|
|
@ -8,7 +8,7 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:7.2.1"
|
||||
classpath "com.android.tools.build:gradle:8.2.2"
|
||||
// noinspection DifferentKotlinGradleVersion
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
|
|
@ -21,19 +21,16 @@ def isNewArchitectureEnabled() {
|
|||
apply plugin: "com.android.library"
|
||||
apply plugin: "kotlin-android"
|
||||
|
||||
|
||||
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
||||
|
||||
if (isNewArchitectureEnabled()) {
|
||||
apply plugin: "com.facebook.react"
|
||||
}
|
||||
|
||||
def getExtOrDefault(name) {
|
||||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Rntracker_" + name]
|
||||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["ReactNative_" + name]
|
||||
}
|
||||
|
||||
def getExtOrIntegerDefault(name) {
|
||||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Rntracker_" + name]).toInteger()
|
||||
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["ReactNative_" + name]).toInteger()
|
||||
}
|
||||
|
||||
def supportsNamespace() {
|
||||
|
|
@ -42,16 +39,12 @@ def supportsNamespace() {
|
|||
def minor = parsed[1].toInteger()
|
||||
|
||||
// Namespace support was added in 7.3.0
|
||||
if (major == 7 && minor >= 3) {
|
||||
return true
|
||||
}
|
||||
|
||||
return major >= 8
|
||||
return (major == 7 && minor >= 3) || major >= 8
|
||||
}
|
||||
|
||||
android {
|
||||
if (supportsNamespace()) {
|
||||
namespace "com.rntracker"
|
||||
namespace "com.openreplay.reactnative"
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
|
|
@ -65,8 +58,9 @@ android {
|
|||
defaultConfig {
|
||||
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
||||
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
||||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
|
|
@ -81,12 +75,12 @@ android {
|
|||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
maven { url = uri("https://jitpack.io") }
|
||||
}
|
||||
|
||||
def kotlin_version = getExtOrDefault("kotlinVersion")
|
||||
|
|
@ -95,14 +89,19 @@ dependencies {
|
|||
// For < 0.71, this will be from the local maven repo
|
||||
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
||||
//noinspection GradleDynamicVersion
|
||||
implementation "com.facebook.react:react-native:+"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation("com.facebook.react:react-native:0.20.1")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
|
||||
implementation("com.github.shekarsiri:android-tracker:v1.1.4")
|
||||
// implementation file("libs/tracker-release.aar")
|
||||
}
|
||||
|
||||
if (isNewArchitectureEnabled()) {
|
||||
react {
|
||||
jsRootDir = file("../src/")
|
||||
libraryName = "RntrackerView"
|
||||
codegenJavaPackageName = "com.rntracker"
|
||||
}
|
||||
}
|
||||
//allprojects {
|
||||
// repositories {
|
||||
// maven { url = uri("https://jitpack.io") }
|
||||
// google()
|
||||
// mavenCentral()
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,20 @@
|
|||
Rntracker_kotlinVersion=1.7.0
|
||||
Rntracker_minSdkVersion=21
|
||||
Rntracker_targetSdkVersion=31
|
||||
Rntracker_compileSdkVersion=31
|
||||
Rntracker_ndkversion=21.4.7075529
|
||||
## For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
#
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx1024m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
#
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. For more details, visit
|
||||
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||
# org.gradle.parallel=true
|
||||
#Thu Apr 25 11:25:09 CEST 2024
|
||||
ReactNative_compileSdkVersion=31
|
||||
ReactNative_kotlinVersion=1.7.0
|
||||
ReactNative_minSdkVersion=24
|
||||
ReactNative_ndkversion=21.4.7075529
|
||||
ReactNative_targetSdkVersion=31
|
||||
android.enableJetifier=true
|
||||
android.useAndroidX=true
|
||||
|
|
|
|||
BIN
tracker/tracker-reactnative/android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
tracker/tracker-reactnative/android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
tracker/tracker-reactnative/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
tracker/tracker-reactnative/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
249
tracker/tracker-reactnative/android/gradlew
vendored
Executable file
249
tracker/tracker-reactnative/android/gradlew
vendored
Executable file
|
|
@ -0,0 +1,249 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
92
tracker/tracker-reactnative/android/gradlew.bat
vendored
Normal file
92
tracker/tracker-reactnative/android/gradlew.bat
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.rntracker">
|
||||
package="com.openreplay.reactnative">
|
||||
</manifest>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package com.openreplay.reactnative
|
||||
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.Toast
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.uimanager.ViewGroupManager
|
||||
|
||||
class CustomViewManager : ViewGroupManager<FrameLayout>() {
|
||||
override fun getName(): String = "RnCustomView"
|
||||
|
||||
override fun createViewInstance(reactContext: ThemedReactContext): FrameLayout {
|
||||
return FrameLayout(reactContext).apply {
|
||||
isClickable = true
|
||||
setOnClickListener { Toast.makeText(reactContext, "Tap detected", Toast.LENGTH_SHORT).show() }
|
||||
}
|
||||
}
|
||||
|
||||
override fun addView(parent: FrameLayout, child: View, index: Int) {
|
||||
parent.addView(child, index)
|
||||
}
|
||||
|
||||
override fun getChildCount(parent: FrameLayout): Int {
|
||||
return parent.childCount
|
||||
}
|
||||
|
||||
override fun getChildAt(parent: FrameLayout, index: Int): View {
|
||||
return parent.getChildAt(index)
|
||||
}
|
||||
|
||||
override fun removeViewAt(parent: FrameLayout, index: Int) {
|
||||
parent.removeViewAt(index)
|
||||
}
|
||||
|
||||
override fun removeAllViews(parent: FrameLayout) {
|
||||
parent.removeAllViews()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
package com.openreplay.reactnative
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import com.facebook.common.activitylistener.BaseActivityListener
|
||||
import com.facebook.react.bridge.*
|
||||
import com.openreplay.tracker.OpenReplay
|
||||
import com.openreplay.tracker.models.OROptions
|
||||
|
||||
class ReactNativeModule(reactContext: ReactApplicationContext) :
|
||||
ReactContextBaseJavaModule(reactContext) {
|
||||
|
||||
// private val context = reactContext.acti
|
||||
override fun getName(): String {
|
||||
return NAME
|
||||
}
|
||||
|
||||
// Example method
|
||||
// See https://reactnative.dev/docs/native-modules-android
|
||||
@ReactMethod
|
||||
fun multiply(a: Double, b: Double, promise: Promise) {
|
||||
promise.resolve(a * b * 2)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val NAME = "ORTrackerConnector"
|
||||
}
|
||||
|
||||
data class Options(
|
||||
val crashes: Boolean = true,
|
||||
val analytics: Boolean = true,
|
||||
val performances: Boolean = true,
|
||||
val logs: Boolean = true,
|
||||
val screen: Boolean = true,
|
||||
val debugLogs: Boolean = false,
|
||||
val wifiOnly: Boolean = true // assuming you want this as well
|
||||
)
|
||||
|
||||
private fun getBooleanOrDefault(map: ReadableMap, key: String, default: Boolean): Boolean {
|
||||
return if (map.hasKey(key)) map.getBoolean(key) else default
|
||||
}
|
||||
|
||||
// optionsMap: ReadableMap?,
|
||||
@ReactMethod
|
||||
fun startSession(
|
||||
projectKey: String,
|
||||
optionsMap: ReadableMap,
|
||||
projectUrl: String?,
|
||||
promise: Promise
|
||||
) {
|
||||
val serverURL = projectUrl ?: "https://foss.openreplay.com/ingest"
|
||||
val options = OROptions(
|
||||
crashes = getBooleanOrDefault(optionsMap, "crashes", true),
|
||||
analytics = getBooleanOrDefault(optionsMap, "analytics", true),
|
||||
performances = getBooleanOrDefault(optionsMap, "performances", true),
|
||||
logs = getBooleanOrDefault(optionsMap, "logs", true),
|
||||
screen = getBooleanOrDefault(optionsMap, "screen", true),
|
||||
debugLogs = getBooleanOrDefault(optionsMap, "debugLogs", true),
|
||||
wifiOnly = getBooleanOrDefault(optionsMap, "wifiOnly", true),
|
||||
)
|
||||
|
||||
val context = currentActivity as Activity
|
||||
OpenReplay.serverURL = serverURL
|
||||
|
||||
OpenReplay.start(context, projectKey, options, onStarted = {
|
||||
println("OpenReplay started")
|
||||
promise.resolve("OpenReplay Started")
|
||||
})
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun stop() {
|
||||
OpenReplay.stop()
|
||||
}
|
||||
|
||||
|
||||
@ReactMethod
|
||||
fun setMetadata(key: String, value: String) {
|
||||
OpenReplay.setMetadata(key, value)
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun event(name: String, obj: String?) {
|
||||
OpenReplay.event(name, obj)
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun setUserID(userID: String) {
|
||||
OpenReplay.setUserID(userID)
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun userAnonymousID(userID: String) {
|
||||
OpenReplay.userAnonymousID(userID)
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun networkRequest(
|
||||
url: String,
|
||||
method: String,
|
||||
requestJSON: String,
|
||||
responseJSON: String,
|
||||
status: Int,
|
||||
duration: ULong
|
||||
) {
|
||||
OpenReplay.networkRequest(url, method, requestJSON, responseJSON, status, duration)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,22 @@
|
|||
package com.rntracker
|
||||
package com.openreplay.reactnative
|
||||
|
||||
import com.facebook.react.ReactPackage
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.uimanager.ViewManager
|
||||
|
||||
|
||||
class RntrackerPackage : ReactPackage {
|
||||
class ReactNativePackage : ReactPackage {
|
||||
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
||||
return emptyList()
|
||||
return listOf(ReactNativeModule(reactContext))
|
||||
}
|
||||
|
||||
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
||||
return listOf(RntrackerViewManager())
|
||||
return listOf(
|
||||
CustomViewManager(),
|
||||
RnTrackerSanitizedViewManager(),
|
||||
RnTrackerInputManager(),
|
||||
RnTrackerTouchManager(),
|
||||
RnTrackerViewManager(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
//package com.openreplay.reactnative
|
||||
//
|
||||
//import android.content.Context
|
||||
//import android.view.View
|
||||
//import com.facebook.react.uimanager.SimpleViewManager
|
||||
//import com.facebook.react.uimanager.ThemedReactContext
|
||||
//
|
||||
//import com.openreplay.tracker.listeners.Analytics
|
||||
//
|
||||
//class RnTrackerViewManager : SimpleViewManager<View>() {
|
||||
// override fun getName(): String = "RnTrackerView"
|
||||
//
|
||||
// override fun createViewInstance(reactContext: ThemedReactContext): View = RnTrackerView(reactContext)
|
||||
//
|
||||
// companion object {
|
||||
// fun requiresMainQueueSetup(): Boolean = true
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//class RnTrackerView(context: Context) : View(context) {
|
||||
// private var orViewName: String = ""
|
||||
// private var orScreenName: String = ""
|
||||
//
|
||||
// var viewName: String = ""
|
||||
// set(value) {
|
||||
// field = value
|
||||
// orViewName = value
|
||||
// }
|
||||
//
|
||||
// var screenName: String = ""
|
||||
// set(value) {
|
||||
// field = value
|
||||
// orScreenName = value
|
||||
// }
|
||||
//
|
||||
// override fun onAttachedToWindow() {
|
||||
// super.onAttachedToWindow()
|
||||
// Analytics.addObservedView(this, orScreenName, orViewName)
|
||||
// }
|
||||
//
|
||||
// override fun onDetachedFromWindow() {
|
||||
// super.onDetachedFromWindow()
|
||||
//// Analytics.removeObservedView(this)
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.openreplay.reactnative
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.EditText
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import com.facebook.react.uimanager.SimpleViewManager
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.openreplay.tracker.listeners.Analytics
|
||||
|
||||
class RnTrackerInputManager : SimpleViewManager<EditText>() {
|
||||
override fun getName(): String = "RnTrackedInput"
|
||||
|
||||
override fun createViewInstance(reactContext: ThemedReactContext): EditText =
|
||||
RnTrackerInput(reactContext)
|
||||
|
||||
companion object {
|
||||
fun requiresMainQueueSetup(): Boolean = true
|
||||
}
|
||||
}
|
||||
|
||||
class RnTrackerInput(context: Context) : AppCompatEditText(context) {
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
Analytics.addObservedInput(this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// Analytics.removeObservedInput(this)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.openreplay.reactnative
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.uimanager.ViewGroupManager
|
||||
import com.openreplay.tracker.managers.ScreenshotManager
|
||||
|
||||
class RnTrackerSanitizedViewManager : ViewGroupManager<RnTrackerSanitizedView>() {
|
||||
override fun getName(): String = "RnSanitizedView"
|
||||
|
||||
override fun createViewInstance(reactContext: ThemedReactContext): RnTrackerSanitizedView =
|
||||
RnTrackerSanitizedView(reactContext)
|
||||
|
||||
override fun addView(parent: RnTrackerSanitizedView, child: View, index: Int) {
|
||||
parent.addView(child, index)
|
||||
}
|
||||
|
||||
override fun getChildCount(parent: RnTrackerSanitizedView): Int =
|
||||
parent.childCount
|
||||
|
||||
override fun getChildAt(parent: RnTrackerSanitizedView, index: Int): View =
|
||||
parent.getChildAt(index)
|
||||
|
||||
override fun removeViewAt(parent: RnTrackerSanitizedView, index: Int) {
|
||||
parent.removeViewAt(index)
|
||||
}
|
||||
|
||||
override fun removeAllViews(parent: RnTrackerSanitizedView) {
|
||||
parent.removeAllViews()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun requiresMainQueueSetup(): Boolean = true
|
||||
}
|
||||
}
|
||||
|
||||
class RnTrackerSanitizedView(context: Context) : FrameLayout(context) {
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
ScreenshotManager.addSanitizedElement(this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
ScreenshotManager.removeSanitizedElement(this)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,237 @@
|
|||
package com.openreplay.reactnative
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.PointF
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.Toast
|
||||
import com.facebook.react.uimanager.SimpleViewManager
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.uimanager.ViewGroupManager
|
||||
import com.openreplay.tracker.listeners.Analytics
|
||||
import com.openreplay.tracker.listeners.SwipeDirection
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.sqrt
|
||||
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.GestureDetector
|
||||
import com.facebook.react.ReactRootView
|
||||
|
||||
//class RnTrackerTouchManager : ViewGroupManager<TouchableFrameLayout>() {
|
||||
// override fun getName(): String = "RnTrackerTouchView"
|
||||
//
|
||||
// override fun createViewInstance(reactContext: ThemedReactContext): TouchableFrameLayout {
|
||||
// return TouchableFrameLayout(reactContext)
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//class TouchableFrameLayout(context: Context) : FrameLayout(context) {
|
||||
// private var gestureDetector: GestureDetector
|
||||
// private var handler = Handler(Looper.getMainLooper())
|
||||
// private var isScrolling = false
|
||||
// private var lastX: Float = 0f
|
||||
// private var lastY: Float = 0f
|
||||
// private var swipeDirection: SwipeDirection = SwipeDirection.UNDEFINED
|
||||
//
|
||||
// init {
|
||||
// gestureDetector = GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() {
|
||||
// override fun onSingleTapUp(e: MotionEvent): Boolean {
|
||||
// Analytics.sendClick(e)
|
||||
// return true
|
||||
// }
|
||||
//
|
||||
// override fun onDown(e: MotionEvent): Boolean = true
|
||||
//
|
||||
// override fun onScroll(e1: MotionEvent?, e2: MotionEvent, distanceX: Float, distanceY: Float): Boolean {
|
||||
// if (!isScrolling) {
|
||||
// isScrolling = true
|
||||
// }
|
||||
//
|
||||
// swipeDirection = SwipeDirection.fromDistances(distanceX, distanceY)
|
||||
// lastX = e2.x
|
||||
// lastY = e2.y
|
||||
//
|
||||
// handler.removeCallbacksAndMessages(null)
|
||||
// handler.postDelayed({
|
||||
// if (isScrolling) {
|
||||
// isScrolling = false
|
||||
// Analytics.sendSwipe(swipeDirection, lastX, lastY)
|
||||
// }
|
||||
// }, 200)
|
||||
// return true
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// setOnTouchListener { _, event ->
|
||||
// Log.d("TouchEvent", "Event: ${event.actionMasked}, X: ${event.x}, Y: ${event.y}")
|
||||
// gestureDetector.onTouchEvent(event)
|
||||
// this.performClick()
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
class RnTrackerTouchManager : ViewGroupManager<FrameLayout>() {
|
||||
override fun getName(): String = "RnTrackerTouchView"
|
||||
|
||||
override fun createViewInstance(reactContext: ThemedReactContext): FrameLayout {
|
||||
return ReactRootView(reactContext).apply {
|
||||
// layoutParams = FrameLayout.LayoutParams(
|
||||
// FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
// FrameLayout.LayoutParams.MATCH_PARENT
|
||||
// )
|
||||
// isClickable = true
|
||||
// val touchStart = PointF()
|
||||
// setOnTouchListener { view, event ->
|
||||
// when (event.action) {
|
||||
// MotionEvent.ACTION_DOWN -> {
|
||||
// touchStart.set(event.x, event.y)
|
||||
// true
|
||||
// }
|
||||
//
|
||||
// MotionEvent.ACTION_UP -> {
|
||||
// val deltaX = event.x - touchStart.x
|
||||
// val deltaY = event.y - touchStart.y
|
||||
// val distance = sqrt(deltaX * deltaX + deltaY * deltaY)
|
||||
//
|
||||
// if (distance > 10) {
|
||||
// val direction = if (abs(deltaX) > abs(deltaY)) {
|
||||
// if (deltaX > 0) "RIGHT" else "LEFT"
|
||||
// } else {
|
||||
// if (deltaY > 0) "DOWN" else "UP"
|
||||
// }
|
||||
// Analytics.sendSwipe(SwipeDirection.valueOf(direction), event.x, event.y)
|
||||
// } else {
|
||||
// Analytics.sendClick(event)
|
||||
// view.performClick() // Perform click for accessibility
|
||||
// }
|
||||
// true
|
||||
// }
|
||||
//
|
||||
// else -> false
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
override fun addView(parent: FrameLayout, child: View, index: Int) {
|
||||
child.isClickable = true
|
||||
child.isFocusable = true
|
||||
// child.layoutParams = FrameLayout.LayoutParams(
|
||||
// FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
// FrameLayout.LayoutParams.MATCH_PARENT
|
||||
// )
|
||||
val touchStart = PointF()
|
||||
child.setOnTouchListener(
|
||||
View.OnTouchListener { view, event ->
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
view.performClick()
|
||||
Analytics.sendClick(event)
|
||||
true
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_UP -> {
|
||||
val deltaX = event.x - touchStart.x
|
||||
val deltaY = event.y - touchStart.y
|
||||
val distance = sqrt(deltaX * deltaX + deltaY * deltaY)
|
||||
|
||||
if (distance > 10) {
|
||||
val direction = if (abs(deltaX) > abs(deltaY)) {
|
||||
if (deltaX > 0) "RIGHT" else "LEFT"
|
||||
} else {
|
||||
if (deltaY > 0) "DOWN" else "UP"
|
||||
}
|
||||
Analytics.sendSwipe(SwipeDirection.valueOf(direction), event.x, event.y)
|
||||
} else {
|
||||
Analytics.sendClick(event)
|
||||
view.performClick() // Perform click for accessibility
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
)
|
||||
parent.addView(child)
|
||||
}
|
||||
|
||||
override fun getChildCount(parent: FrameLayout): Int = parent.childCount
|
||||
|
||||
override fun getChildAt(parent: FrameLayout, index: Int): View = parent.getChildAt(index)
|
||||
|
||||
override fun removeViewAt(parent: FrameLayout, index: Int) {
|
||||
parent.removeViewAt(index)
|
||||
}
|
||||
|
||||
override fun removeAllViews(parent: FrameLayout) {
|
||||
parent.removeAllViews()
|
||||
}
|
||||
}
|
||||
|
||||
//class RnTrackerTouchManager : ViewGroupManager<FrameLayout>() {
|
||||
// override fun getName(): String = "RnTrackerTouchView"
|
||||
//
|
||||
// override fun createViewInstance(reactContext: ThemedReactContext): FrameLayout {
|
||||
// return FrameLayout(reactContext).apply {
|
||||
// layoutParams = FrameLayout.LayoutParams(
|
||||
// FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
// FrameLayout.LayoutParams.MATCH_PARENT
|
||||
// )
|
||||
// isClickable = true
|
||||
// val touchStart = PointF()
|
||||
// setOnTouchListener { view, event ->
|
||||
// when (event.action) {
|
||||
// MotionEvent.ACTION_DOWN -> {
|
||||
// touchStart.set(event.x, event.y)
|
||||
// view.performClick()
|
||||
// }
|
||||
//
|
||||
// MotionEvent.ACTION_UP -> {
|
||||
// val deltaX = event.x - touchStart.x
|
||||
// val deltaY = event.y - touchStart.y
|
||||
// val distance = sqrt(deltaX * deltaX + deltaY * deltaY)
|
||||
//
|
||||
// if (distance > 10) {
|
||||
// val direction = if (abs(deltaX) > abs(deltaY)) {
|
||||
// if (deltaX > 0) "RIGHT" else "LEFT"
|
||||
// } else {
|
||||
// if (deltaY > 0) "DOWN" else "UP"
|
||||
// }
|
||||
// Analytics.sendSwipe(SwipeDirection.valueOf(direction), event.x, event.y)
|
||||
// view.performClick()
|
||||
// } else {
|
||||
// Analytics.sendClick(event)
|
||||
// view.performClick()
|
||||
// }
|
||||
// true
|
||||
// }
|
||||
//
|
||||
// else -> false
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun addView(parent: FrameLayout, child: View, index: Int) {
|
||||
// parent.addView(child, index)
|
||||
// }
|
||||
//
|
||||
// override fun getChildCount(parent: FrameLayout): Int = parent.childCount
|
||||
//
|
||||
// override fun getChildAt(parent: FrameLayout, index: Int): View = parent.getChildAt(index)
|
||||
//
|
||||
// override fun removeViewAt(parent: FrameLayout, index: Int) {
|
||||
// parent.removeViewAt(index)
|
||||
// }
|
||||
//
|
||||
// override fun removeAllViews(parent: FrameLayout) {
|
||||
// parent.removeAllViews()
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.openreplay.reactnative
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.uimanager.ViewGroupManager
|
||||
import com.facebook.react.uimanager.annotations.ReactProp
|
||||
import com.openreplay.tracker.listeners.Analytics
|
||||
|
||||
class RnTrackerViewManager : ViewGroupManager<FrameLayout>() {
|
||||
override fun getName(): String = "RnTrackerView"
|
||||
|
||||
override fun createViewInstance(reactContext: ThemedReactContext): FrameLayout {
|
||||
return TrackingFrameLayout(reactContext)
|
||||
}
|
||||
|
||||
@ReactProp(name = "screenName")
|
||||
fun setScreenName(view: TrackingFrameLayout, screenName: String) {
|
||||
view.screenName = screenName
|
||||
}
|
||||
|
||||
@ReactProp(name = "viewName")
|
||||
fun setViewName(view: TrackingFrameLayout, viewName: String) {
|
||||
view.viewName = viewName
|
||||
}
|
||||
|
||||
override fun addView(parent: FrameLayout, child: View, index: Int) {
|
||||
parent.addView(child, index)
|
||||
}
|
||||
|
||||
override fun getChildCount(parent: FrameLayout): Int = parent.childCount
|
||||
|
||||
override fun getChildAt(parent: FrameLayout, index: Int): View = parent.getChildAt(index)
|
||||
|
||||
override fun removeViewAt(parent: FrameLayout, index: Int) {
|
||||
parent.removeViewAt(index)
|
||||
}
|
||||
|
||||
override fun removeAllViews(parent: FrameLayout) {
|
||||
parent.removeAllViews()
|
||||
}
|
||||
}
|
||||
|
||||
class TrackingFrameLayout(context: Context) : FrameLayout(context) {
|
||||
var viewName: String? = null
|
||||
var screenName: String? = null
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
if (viewName != null && screenName != null) {
|
||||
Analytics.addObservedView(this, screenName!!, viewName!!)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// if (viewName != null && screenName != null) {
|
||||
// Analytics.removeObservedView(this)
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.rntracker
|
||||
|
||||
import android.graphics.Color
|
||||
import android.view.View
|
||||
import com.facebook.react.uimanager.SimpleViewManager
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.uimanager.annotations.ReactProp
|
||||
|
||||
class RntrackerViewManager : SimpleViewManager<View>() {
|
||||
override fun getName() = "RntrackerView"
|
||||
|
||||
override fun createViewInstance(reactContext: ThemedReactContext): View {
|
||||
return View(reactContext)
|
||||
}
|
||||
|
||||
@ReactProp(name = "color")
|
||||
fun setColor(view: View, color: String) {
|
||||
view.setBackgroundColor(Color.parseColor(color))
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = {
|
||||
presets: ['module:metro-react-native-babel-preset'],
|
||||
presets: ['module:@react-native/babel-preset'],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
.env
|
||||
debug.keystore
|
||||
*.keystore
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tracker/tracker-reactnative/example/.yarn/cache/@babel-core-npm-7.24.7-e0c71653c5-017497e2a1.zip
vendored
Normal file
BIN
tracker/tracker-reactnative/example/.yarn/cache/@babel-core-npm-7.24.7-e0c71653c5-017497e2a1.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tracker/tracker-reactnative/example/.yarn/cache/@babel-helpers-npm-7.24.7-8c3f5704f5-934da58098.zip
vendored
Normal file
BIN
tracker/tracker-reactnative/example/.yarn/cache/@babel-helpers-npm-7.24.7-8c3f5704f5-934da58098.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
tracker/tracker-reactnative/example/.yarn/cache/@babel-parser-npm-7.24.7-79d233f3d1-fc9d2c4c87.zip
vendored
Normal file
BIN
tracker/tracker-reactnative/example/.yarn/cache/@babel-parser-npm-7.24.7-79d233f3d1-fc9d2c4c87.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue