Skip to content

Commit

Permalink
Merge pull request #132 from Tealium/MT-1106
Browse files Browse the repository at this point in the history
Bumped version and added 18 to list of supported react versions
  • Loading branch information
trister1997 authored Sep 2, 2022
2 parents 6f1b35b + f63076a commit 0d945d3
Show file tree
Hide file tree
Showing 65 changed files with 4,377 additions and 3,289 deletions.
2 changes: 2 additions & 0 deletions example/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
3 changes: 0 additions & 3 deletions example/.editorconfig

This file was deleted.

9 changes: 9 additions & 0 deletions example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
module.exports = {
root: true,
extends: '@react-native-community',
settings: {
...
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
moduleDirectory: ['node_modules', 'src/'],
},
},
}
};
10 changes: 5 additions & 5 deletions example/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ node_modules/react-native/Libraries/polyfills/.*
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js

.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*

Expand All @@ -23,11 +25,10 @@ node_modules/react-native/flow/
[options]
emoji=true

esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

exact_by_default=true

format.bracket_spacing=false

module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js
Expand All @@ -51,7 +52,6 @@ nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
unnecessary-invariant=warn
signature-verification-failure=warn

[strict]
deprecated-type
Expand All @@ -63,4 +63,4 @@ untyped-import
untyped-type-import

[version]
^0.137.0
^0.176.3
3 changes: 0 additions & 3 deletions example/.gitattributes

This file was deleted.

20 changes: 16 additions & 4 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local

# Android/IntelliJ
#
Expand All @@ -28,6 +29,7 @@ build/
.gradle
local.properties
*.iml
*.hprof

# node.js
#
Expand All @@ -41,11 +43,21 @@ buck-out/
*.keystore
!debug.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# CocoaPods
# Ruby / CocoaPods
/ios/Pods/
Podfile.lock
yarn.lock
*xcshareddata*
/vendor/bundle/
4 changes: 2 additions & 2 deletions example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
};
1 change: 1 addition & 0 deletions example/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.5
74 changes: 43 additions & 31 deletions example/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/

import React, { Component } from 'react';
import { Platform, Button, StyleSheet, Text, TextInput, View, TouchableOpacity, Alert, ScrollView, SafeAreaView } from 'react-native';
import { Platform, Button, StyleSheet, Text, TextInput, View, TouchableOpacity, Alert, ScrollView,
SafeAreaView } from 'react-native';
import Tealium from 'tealium-react-native';
import TealiumLocation from 'tealium-react-native-location';
import { TealiumLocationConfig, Accuracy, DesiredAccuracy } from 'tealium-react-native-location/common';
import { TealiumConfig, TealiumView, TealiumEvent, ConsentCategories, Dispatchers, Collectors, ConsentPolicy, Expiry, ConsentExpiry, TimeUnit, ConsentStatus, TealiumEnvironment, RemoteCommand } from 'tealium-react-native/common';
import { TealiumConfig, TealiumView, TealiumEvent, ConsentCategories, Dispatchers, Collectors,
ConsentPolicy, Expiry, ConsentExpiry, TimeUnit, ConsentStatus, TealiumEnvironment, RemoteCommand } from
'tealium-react-native/common';
import FirebaseRemoteCommand from 'tealium-react-firebase';
import BrazeRemoteCommand from 'tealium-react-braze';
import AdjustRemoteCommand from 'tealium-react-adjust';
Expand All @@ -20,39 +31,39 @@ export default class App extends Component < {} > {
}

let adjustConfig: AdjustConfig = {
appToken: "someToken",
environment: AdjustEnvironemnt.sandbox,
allowSuppressLogLevel: false
appToken: "someToken",
environment: AdjustEnvironemnt.sandbox,
allowSuppressLogLevel: false
}

TealiumLocation.configure(locationConfig);
FirebaseRemoteCommand.initialize();
BrazeRemoteCommand.initialize();
AdjustRemoteCommand.initialize();
let config: TealiumConfig = {
account: 'tealiummobile',
profile: 'demo',
environment: TealiumEnvironment.dev,
let config: TealiumConfig = {
account: 'tealiummobile',
profile: 'demo',
environment: TealiumEnvironment.dev,
dispatchers: [
Dispatchers.Collect,
Dispatchers.TagManagement,
Dispatchers.Collect,
Dispatchers.TagManagement,
Dispatchers.RemoteCommands
],
],
collectors: [
Collectors.AppData,
Collectors.DeviceData,
Collectors.Lifecycle,
Collectors.AppData,
Collectors.DeviceData,
Collectors.Lifecycle,
Collectors.Connectivity
],
],
lifecycleAutotrackingEnabled: true,
consentLoggingEnabled: true,
consentExpiry: {
consentLoggingEnabled: true,
consentExpiry: {
'time': 10,
'unit': 'days'
},
consentPolicy: ConsentPolicy.gdpr,
batchingEnabled: false,
visitorServiceEnabled: true,
'unit': 'days'
},
consentPolicy: ConsentPolicy.gdpr,
batchingEnabled: false,
visitorServiceEnabled: true,
useRemoteLibrarySettings: false,
remoteCommands: [{
id: FirebaseRemoteCommand.name,
Expand All @@ -62,14 +73,14 @@ export default class App extends Component < {} > {
path: 'braze.json'
}, {
id: AdjustRemoteCommand.name,
path: 'adjust.json'
path: 'adjust.json'
}]
};
Tealium.initialize(config, success => {
if (!success) {
console.log("Tealium not initialized")
return
}
}
console.log("Tealium initialized")
Tealium.setConsentStatus(ConsentStatus.consented)
Tealium.addRemoteCommand("hello", payload => {
Expand All @@ -90,7 +101,7 @@ export default class App extends Component < {} > {
});
}

trackEvent() {
trackEvent() {
let event = new TealiumEvent('Test Event', {'event_name': 'test'});
Tealium.track(event);
}
Expand All @@ -105,7 +116,7 @@ export default class App extends Component < {} > {
}

setRandomConsentCategories() {
let randomCategories =
let randomCategories =
[ConsentCategories.affiliates,
ConsentCategories.analytics,
ConsentCategories.bigData,
Expand Down Expand Up @@ -204,7 +215,7 @@ export default class App extends Component < {} > {
async startLocationTracking() {
let result = await checkAndRequestPermissions()
if (!result) return;

TealiumLocation.startLocationTracking();
}

Expand All @@ -218,13 +229,13 @@ export default class App extends Component < {} > {
async getLastLocation() {
let result = await checkAndRequestPermissions()
if (!result) return;

TealiumLocation.lastLocation((loc) => {
if (loc) {
Alert.alert(`Lat: ${loc.lat} | Lng: ${loc.lng}`)
}
})

}


Expand Down Expand Up @@ -353,7 +364,8 @@ class Trace extends Component {
placeholderTextColor = "#007CC1"
autoCapitalize = "none"
onChangeText = {this.handleTraceId}/>
<TouchableOpacity style={styles.buttonContainer} onPress={() => this.joinTrace(this.state.traceId)}>
<TouchableOpacity style={styles.buttonContainer} onPress={() =>
this.joinTrace(this.state.traceId)}>
<Text style={styles.textStyle}>START TRACE</Text>
</TouchableOpacity>
<View style={styles.space} />
Expand Down
6 changes: 6 additions & 0 deletions example/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.5'

gem 'cocoapods', '~> 1.11', '>= 1.11.2'
14 changes: 14 additions & 0 deletions example/__tests__/App-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @format
*/

import 'react-native';
import React from 'react';
import App from '../App';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
renderer.create(<App />);
});
File renamed without changes.
Loading

0 comments on commit 0d945d3

Please sign in to comment.