diff --git a/example/.eslintignore b/example/.eslintignore new file mode 100644 index 0000000..ad728d5 --- /dev/null +++ b/example/.eslintignore @@ -0,0 +1,3 @@ +android/ +ios/ +node_modules/ diff --git a/example/.eslintrc.json b/example/.eslintrc.json new file mode 100644 index 0000000..51a9fd9 --- /dev/null +++ b/example/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "globals": { + "appNavigator": false + } +} diff --git a/example/__tests__/.eslintrc b/example/__tests__/.eslintrc new file mode 100644 index 0000000..eba2077 --- /dev/null +++ b/example/__tests__/.eslintrc @@ -0,0 +1,5 @@ +{ + "env": { + "jest": true + } +} diff --git a/example/__tests__/index.android.js b/example/__tests__/index.android.js index b49b908..dfa575d 100644 --- a/example/__tests__/index.android.js +++ b/example/__tests__/index.android.js @@ -6,7 +6,7 @@ import Index from '../index.android.js'; import renderer from 'react-test-renderer'; it('renders correctly', () => { - const tree = renderer.create( - - ); + renderer.create( + + ); }); diff --git a/example/__tests__/index.ios.js b/example/__tests__/index.ios.js index ba7c5b5..db43fbe 100644 --- a/example/__tests__/index.ios.js +++ b/example/__tests__/index.ios.js @@ -6,7 +6,7 @@ import Index from '../index.ios.js'; import renderer from 'react-test-renderer'; it('renders correctly', () => { - const tree = renderer.create( - - ); + renderer.create( + + ); }); diff --git a/example/index.android.js b/example/index.android.js index 265ffba..497acb1 100644 --- a/example/index.android.js +++ b/example/index.android.js @@ -1,56 +1,16 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * @flow - */ - -import React, { Component } from 'react'; +import React from 'react'; import { - AppRegistry, - StyleSheet, - Text, - View + AppRegistry, } from 'react-native'; -import Navigation from './Navigation'; +import Navigation from './src/Navigation'; -export default class RNAppMetrika extends Component { - render() { - return ; - return ( - - - Welcome to React Native! 111 - - - To get started, edit index.android.js - - - Double tap R on your keyboard to reload,{'\n'} - Shake or press menu button for dev menu - - - ); - } +export default class RNAppMetrika extends React.PureComponent { + render() { + return ( + + ); + } } -const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: '#F5FCFF', - }, - welcome: { - fontSize: 20, - textAlign: 'center', - margin: 10, - }, - instructions: { - textAlign: 'center', - color: '#333333', - marginBottom: 5, - }, -}); - AppRegistry.registerComponent('RNAppMetrika', () => RNAppMetrika); diff --git a/example/index.ios.js b/example/index.ios.js index c41c4d3..b86638d 100644 --- a/example/index.ios.js +++ b/example/index.ios.js @@ -1,53 +1,17 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * @flow - */ - -import React, { Component } from 'react'; +import React from 'react'; import { - AppRegistry, - StyleSheet, - Text, - View + AppRegistry, } from 'react-native'; -export default class RNAppMetrika extends Component { - render() { - return ( - - - Welcome to React Native! - - - To get started, edit index.ios.js - - - Press Cmd+R to reload,{'\n'} - Cmd+D or shake for dev menu - - - ); - } +import Navigation from './src/Navigation'; +import './src/appmetrica'; + +export default class RNAppMetrika extends React.PureComponent { + render() { + return ( + + ); + } } -const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: '#F5FCFF', - }, - welcome: { - fontSize: 20, - textAlign: 'center', - margin: 10, - }, - instructions: { - textAlign: 'center', - color: '#333333', - marginBottom: 5, - }, -}); - AppRegistry.registerComponent('RNAppMetrika', () => RNAppMetrika); diff --git a/example/ios/RNAppMetrika.xcodeproj/project.pbxproj b/example/ios/RNAppMetrika.xcodeproj/project.pbxproj index c0a003f..628da2d 100644 --- a/example/ios/RNAppMetrika.xcodeproj/project.pbxproj +++ b/example/ios/RNAppMetrika.xcodeproj/project.pbxproj @@ -5,6 +5,7 @@ }; objectVersion = 46; objects = { + /* Begin PBXBuildFile section */ 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; @@ -24,15 +25,29 @@ 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */; }; + 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */; }; 2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */; }; 2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */; }; 2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */; }; 2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */; }; 2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */; }; - 2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; }; + 2D02E4C91E0B4AEC006451C7 /* libReact-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact-tvOS.a */; }; 2DCD954D1E0B4F2C00145EB5 /* RNAppMetrikaTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* RNAppMetrikaTests.m */; }; + 594077BF1F7FBBC300032B32 /* libRCTAppMetrica.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077A11F7FB81700032B32 /* libRCTAppMetrica.a */; }; + 594077C21F7FBC4C00032B32 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077C11F7FBC4C00032B32 /* SystemConfiguration.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077C41F7FBC5800032B32 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077C31F7FBC5800032B32 /* UIKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077C61F7FBC6100032B32 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077C51F7FBC6000032B32 /* Foundation.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077C81F7FBC6900032B32 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077C71F7FBC6900032B32 /* CoreTelephony.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077CA1F7FBC8A00032B32 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077C91F7FBC8A00032B32 /* CoreLocation.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077CC1F7FBC9000032B32 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077CB1F7FBC9000032B32 /* CoreGraphics.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077CE1F7FBC9800032B32 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077CD1F7FBC9700032B32 /* AdSupport.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077D01F7FBCAE00032B32 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077CF1F7FBCAE00032B32 /* libz.tbd */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077D21F7FBCBA00032B32 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077D11F7FBCB900032B32 /* libsqlite3.tbd */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077D41F7FBCC300032B32 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077D31F7FBCC300032B32 /* Security.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077D61F7FBCCD00032B32 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077D51F7FBCCD00032B32 /* libc++.tbd */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077D81F7FBCD600032B32 /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077D71F7FBCD500032B32 /* SafariServices.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 594077D91F7FBD1D00032B32 /* YandexMobileMetrica.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594077A31F7FB89A00032B32 /* YandexMobileMetrica.framework */; }; 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; }; @@ -200,6 +215,20 @@ remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4; remoteInfo = "jschelpers-tvOS"; }; + 5940778D1F7FB81700032B32 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = ADD01A681E09402E00F6D226; + remoteInfo = "RCTBlob-tvOS"; + }; + 594077A01F7FB81700032B32 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E4F8D4F4AABD4D1294D3E542 /* RCTAppMetrica.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 59FB35C21F6FA64700A6608F; + remoteInfo = RCTAppMetrica; + }; 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; @@ -259,10 +288,25 @@ 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; 2D02E47B1E0B4A5D006451C7 /* RNAppMetrika-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RNAppMetrika-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 2D02E4901E0B4A5D006451C7 /* RNAppMetrika-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "RNAppMetrika-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 594077A31F7FB89A00032B32 /* YandexMobileMetrica.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = YandexMobileMetrica.framework; sourceTree = SOURCE_ROOT; }; + 594077C11F7FBC4C00032B32 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + 594077C31F7FBC5800032B32 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 594077C51F7FBC6000032B32 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 594077C71F7FBC6900032B32 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; }; + 594077C91F7FBC8A00032B32 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; + 594077CB1F7FBC9000032B32 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 594077CD1F7FBC9700032B32 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; + 594077CF1F7FBCAE00032B32 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; + 594077D11F7FBCB900032B32 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; + 594077D31F7FBCC300032B32 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 594077D51F7FBCCD00032B32 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; + 594077D71F7FBCD500032B32 /* SafariServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SafariServices.framework; path = System/Library/Frameworks/SafariServices.framework; sourceTree = SDKROOT; }; 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; + 9B04986D6A1F416392D1AA68 /* libRCTAppMetrica.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTAppMetrica.a; sourceTree = ""; }; ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = ""; }; + E4F8D4F4AABD4D1294D3E542 /* RCTAppMetrica.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTAppMetrica.xcodeproj; path = "../node_modules/react-native-appmetrica/ios/RCTAppMetrica/RCTAppMetrica.xcodeproj"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -278,6 +322,20 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 594077D81F7FBCD600032B32 /* SafariServices.framework in Frameworks */, + 594077D61F7FBCCD00032B32 /* libc++.tbd in Frameworks */, + 594077D41F7FBCC300032B32 /* Security.framework in Frameworks */, + 594077D21F7FBCBA00032B32 /* libsqlite3.tbd in Frameworks */, + 594077D01F7FBCAE00032B32 /* libz.tbd in Frameworks */, + 594077CE1F7FBC9800032B32 /* AdSupport.framework in Frameworks */, + 594077CC1F7FBC9000032B32 /* CoreGraphics.framework in Frameworks */, + 594077CA1F7FBC8A00032B32 /* CoreLocation.framework in Frameworks */, + 594077C81F7FBC6900032B32 /* CoreTelephony.framework in Frameworks */, + 594077C61F7FBC6100032B32 /* Foundation.framework in Frameworks */, + 594077C41F7FBC5800032B32 /* UIKit.framework in Frameworks */, + 594077C21F7FBC4C00032B32 /* SystemConfiguration.framework in Frameworks */, + 594077D91F7FBD1D00032B32 /* YandexMobileMetrica.framework in Frameworks */, + 594077BF1F7FBBC300032B32 /* libRCTAppMetrica.a in Frameworks */, ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */, 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, @@ -298,8 +356,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */, - 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation-tvOS.a in Frameworks */, + 2D02E4C91E0B4AEC006451C7 /* libReact-tvOS.a in Frameworks */, + 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */, 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */, 2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */, 2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */, @@ -414,7 +472,6 @@ isa = PBXGroup; children = ( 146834041AC3E56700842450 /* libReact.a */, - 3DAD3EA31DF850E9000B6D8A /* libReact.a */, 3DAD3EA51DF850E9000B6D8A /* libyoga.a */, 3DAD3EA71DF850E9000B6D8A /* libyoga.a */, 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */, @@ -426,11 +483,47 @@ name = Products; sourceTree = ""; }; + 594077871F7FB81300032B32 /* Recovered References */ = { + isa = PBXGroup; + children = ( + 9B04986D6A1F416392D1AA68 /* libRCTAppMetrica.a */, + ); + name = "Recovered References"; + sourceTree = ""; + }; + 5940779D1F7FB81700032B32 /* Products */ = { + isa = PBXGroup; + children = ( + 594077A11F7FB81700032B32 /* libRCTAppMetrica.a */, + ); + name = Products; + sourceTree = ""; + }; + 594077A21F7FB87E00032B32 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 594077D71F7FBCD500032B32 /* SafariServices.framework */, + 594077D51F7FBCCD00032B32 /* libc++.tbd */, + 594077D31F7FBCC300032B32 /* Security.framework */, + 594077D11F7FBCB900032B32 /* libsqlite3.tbd */, + 594077CF1F7FBCAE00032B32 /* libz.tbd */, + 594077CD1F7FBC9700032B32 /* AdSupport.framework */, + 594077CB1F7FBC9000032B32 /* CoreGraphics.framework */, + 594077C91F7FBC8A00032B32 /* CoreLocation.framework */, + 594077C71F7FBC6900032B32 /* CoreTelephony.framework */, + 594077C51F7FBC6000032B32 /* Foundation.framework */, + 594077C31F7FBC5800032B32 /* UIKit.framework */, + 594077C11F7FBC4C00032B32 /* SystemConfiguration.framework */, + 594077A31F7FB89A00032B32 /* YandexMobileMetrica.framework */, + ); + path = Frameworks; + sourceTree = ""; + }; 5E91572E1DD0AC6500FF2AA8 /* Products */ = { isa = PBXGroup; children = ( 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */, - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */, + 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */, ); name = Products; sourceTree = ""; @@ -459,6 +552,7 @@ 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, + E4F8D4F4AABD4D1294D3E542 /* RCTAppMetrica.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -475,10 +569,12 @@ 83CBB9F61A601CBA00E9B192 = { isa = PBXGroup; children = ( + 594077A21F7FB87E00032B32 /* Frameworks */, 13B07FAE1A68108700A75B9A /* RNAppMetrika */, 832341AE1AAA6A7D00B99B32 /* Libraries */, 00E356EF1AD99517003FC87E /* RNAppMetrikaTests */, 83CBBA001A601CBA00E9B192 /* Products */, + 594077871F7FB81300032B32 /* Recovered References */, ); indentWidth = 2; sourceTree = ""; @@ -500,6 +596,7 @@ isa = PBXGroup; children = ( ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */, + 5940778E1F7FB81700032B32 /* libRCTBlob-tvOS.a */, ); name = Products; sourceTree = ""; @@ -623,6 +720,10 @@ ProductGroup = 5E91572E1DD0AC6500FF2AA8 /* Products */; ProjectRef = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; }, + { + ProductGroup = 5940779D1F7FB81700032B32 /* Products */; + ProjectRef = E4F8D4F4AABD4D1294D3E542 /* RCTAppMetrica.xcodeproj */; + }, { ProductGroup = ADBDB9201DFEBF0600ED6528 /* Products */; ProjectRef = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; @@ -822,6 +923,20 @@ remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 5940778E1F7FB81700032B32 /* libRCTBlob-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRCTBlob-tvOS.a"; + remoteRef = 5940778D1F7FB81700032B32 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 594077A11F7FB81700032B32 /* libRCTAppMetrica.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTAppMetrica.a; + remoteRef = 594077A01F7FB81700032B32 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -829,10 +944,10 @@ remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = { + 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = "libRCTAnimation-tvOS.a"; + path = libRCTAnimation.a; remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -995,21 +1110,23 @@ "DEBUG=1", "$(inherited)", ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../node_modules/react-native-appmetrica/ios/RCTAppMetrica/RCTAppMetrica", + ); INFOPLIST_FILE = RNAppMetrikaTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); OTHER_LDFLAGS = ( "-ObjC", "-lc++", ); PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNAppMetrika.app/RNAppMetrika"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ); }; name = Debug; }; @@ -1018,21 +1135,23 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../node_modules/react-native-appmetrica/ios/RCTAppMetrica/RCTAppMetrica", + ); INFOPLIST_FILE = RNAppMetrikaTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); OTHER_LDFLAGS = ( "-ObjC", "-lc++", ); PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNAppMetrika.app/RNAppMetrika"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ); }; name = Release; }; @@ -1042,7 +1161,13 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = NO; + FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)"; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../node_modules/react-native-appmetrica/ios/RCTAppMetrica/RCTAppMetrica", + ); INFOPLIST_FILE = RNAppMetrika/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ( "$(inherited)", @@ -1051,9 +1176,6 @@ ); PRODUCT_NAME = RNAppMetrika; VERSIONING_SYSTEM = "apple-generic"; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ); }; name = Debug; }; @@ -1062,7 +1184,13 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = 1; + FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)"; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../node_modules/react-native-appmetrica/ios/RCTAppMetrica/RCTAppMetrica", + ); INFOPLIST_FILE = RNAppMetrika/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ( "$(inherited)", @@ -1071,9 +1199,6 @@ ); PRODUCT_NAME = RNAppMetrika; VERSIONING_SYSTEM = "apple-generic"; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ); }; name = Release; }; @@ -1089,8 +1214,16 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../node_modules/react-native-appmetrica/ios/RCTAppMetrica/RCTAppMetrica", + ); INFOPLIST_FILE = "RNAppMetrika-tvOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); OTHER_LDFLAGS = ( "-ObjC", "-lc++", @@ -1100,12 +1233,6 @@ SDKROOT = appletvos; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.2; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ); }; name = Debug; }; @@ -1121,8 +1248,16 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_NO_COMMON_BLOCKS = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../node_modules/react-native-appmetrica/ios/RCTAppMetrica/RCTAppMetrica", + ); INFOPLIST_FILE = "RNAppMetrika-tvOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); OTHER_LDFLAGS = ( "-ObjC", "-lc++", @@ -1132,12 +1267,6 @@ SDKROOT = appletvos; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.2; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - ); }; name = Release; }; @@ -1154,14 +1283,15 @@ GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = "RNAppMetrika-tvOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNAppMetrika-tvOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNAppMetrika-tvOS.app/RNAppMetrika-tvOS"; TVOS_DEPLOYMENT_TARGET = 10.1; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - ); }; name = Debug; }; @@ -1178,14 +1308,15 @@ GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = "RNAppMetrika-tvOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNAppMetrika-tvOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNAppMetrika-tvOS.app/RNAppMetrika-tvOS"; TVOS_DEPLOYMENT_TARGET = 10.1; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - ); }; name = Release; }; diff --git a/example/ios/RNAppMetrika/Info.plist b/example/ios/RNAppMetrika/Info.plist index acdbf95..d4b6732 100644 --- a/example/ios/RNAppMetrika/Info.plist +++ b/example/ios/RNAppMetrika/Info.plist @@ -24,24 +24,7 @@ 1 LSRequiresIPhoneOS - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - NSLocationWhenInUseUsageDescription - NSAppTransportSecurity - NSExceptionDomains @@ -52,5 +35,19 @@ + NSLocationWhenInUseUsageDescription + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UIViewControllerBasedStatusBarAppearance + diff --git a/example/ios/YandexMobileMetrica.framework/Headers/YMMVersion.h b/example/ios/YandexMobileMetrica.framework/Headers/YMMVersion.h new file mode 100644 index 0000000..1bc8adb --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Headers/YMMVersion.h @@ -0,0 +1,21 @@ +/* + * YMMVersion.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#ifndef __YMM_VERSION_H__ +#define __YMM_VERSION_H__ + +#define YMM_VERSION_MAJOR 2 +#define YMM_VERSION_MINOR 9 +#define YMM_VERSION_PATCH 1 + +#define YMM_BUILD_NUMBER 8517 + +#endif // __YMM_VERSION_H__ diff --git a/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetrica.h b/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetrica.h new file mode 100644 index 0000000..4ef31fe --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetrica.h @@ -0,0 +1,171 @@ +/* + * YMMYandexMetrica.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +@class CLLocation; +@class YMMYandexMetricaConfiguration; +@protocol YMMYandexMetricaReporting; + +NS_ASSUME_NONNULL_BEGIN + +extern NSString *const kYMMYandexMetricaErrorDomain; + +typedef NS_ENUM(NSInteger, YMMYandexMetricaEventErrorCode) { + YMMYandexMetricaEventErrorCodeInitializationError = 1000, + YMMYandexMetricaEventErrorCodeInvalidName = 1001, + YMMYandexMetricaEventErrorCodeJsonSerializationError = 1002, +}; + +@interface YMMYandexMetrica : NSObject + +/** Starting the statistics collection process. + + @param apiKey Application key that is issued during application registration in AppMetrica. + Application key must be a hexadecimal string in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. + The key can be requested or checked at https://appmetrica.yandex.com + */ ++ (void)activateWithApiKey:(NSString *)apiKey; + +/** Starting the statistics collection process. + + @param configuration Configuration combines all AppMetrica settings in one place. + Configuration initialized with unique application key that is issued during application registration in AppMetrica. + Application key must be a hexadecimal string in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. + The key can be requested or checked at https://appmetrica.yandex.com + */ ++ (void)activateWithConfiguration:(YMMYandexMetricaConfiguration *)configuration; + +/** Reporting custom event. + + @param message Short name or description of the event. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ ++ (void)reportEvent:(NSString *)message + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom event with additional parameters. + + @param message Short name or description of the event. + @param params Dictionary of name/value pairs that should be sent to the server. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ ++ (void)reportEvent:(NSString *)message + parameters:(nullable NSDictionary *)params + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom error messages. + + @param message Short name or description of the error + @param exception Exception contains an NSException object that must be passed to the server. It can take the nil value. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ ++ (void)reportError:(NSString *)message + exception:(nullable NSException *)exception + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Enable/disable location reporting to AppMetrica. + If enabled and location set via setLocation: method - that location would be used. + If enabled and location is not set via setLocation, + but application has appropriate permission - CLLocationManager would be used to acquire location data. + + @param enabled Flag indicating if reporting location to AppMetrica enabled + Enabled by default. + */ ++ (void)setTrackLocationEnabled:(BOOL)enabled; + +/** Set location to AppMetrica + To enable AppMetrica to use this location trackLocationEnabled should be 'YES' + + @param location Custom device location to be reported. + */ ++ (void)setLocation:(nullable CLLocation *)location; + +/** Setting session timeout (in seconds). + + @param sessionTimeoutSeconds Time limit before the application is considered inactive. + By default, the session times out if the application is in background for 10 seconds. + Minimum accepted value is 10 seconds. All passed values below 10 seconds automatically become 10 seconds. + */ ++ (void)setSessionTimeout:(NSUInteger)sessionTimeoutSeconds; + +/** Tracking app crashes. + + @param enabled Boolean value to enable or disable collecting and sending crash reports. + By default, reports on application crashes are sent, meaning enabled=true. + To disable crash tracking, set the parameter value to enabled=false. + */ ++ (void)setReportCrashesEnabled:(BOOL)enabled; + +/** Setting the arbitrary application version. + + @param appVersion Application version to be reported. + By default, the application version is set in the app configuration file Info.plist (CFBundleShortVersionString). + */ ++ (void)setCustomAppVersion:(NSString *)appVersion; + +/** Enable or disable logging. + + @param isEnabled Boolean value to enable or disable logging. By default logging is disabled. + */ ++ (void)setLoggingEnabled:(BOOL)isEnabled; + +/** Setting key - value data to be used as additional information, associated with future unhandled exception. + If value is nil, previously set key-value is removed. Does nothing if key hasn't been added. + + @param value The error environment value. + @param key The error environment key. + */ ++ (void)setEnvironmentValue:(nullable NSString *)value forKey:(NSString *)key; + +/** Retrieves current version of library. + */ ++ (NSString *)libraryVersion; + +/** Enables AppMetrica's tracking mechanism by providing application's url scheme. + + @param urlScheme Application's deep link scheme. Scheme should be registered in CFBundleURLTypes Info.plist section. + */ ++ (BOOL)enableTrackingWithURLScheme:(NSURL *)urlScheme NS_EXTENSION_UNAVAILABLE_IOS("") NS_AVAILABLE_IOS(9_0); + +/** Handles the URL that has opened the application. + Reports the URL for deep links tracking. + URL scheme should be registered beforehand via `enableTrackingWithUrlScheme:` method for tracking to work correctly. + + @param url URL that has opened the application. + */ ++ (BOOL)handleOpenURL:(NSURL *)url; + +/** Returns id that can send events to specific API key. + + @param apiKey Api key to send events to. + @return id that conforms to YMMYandexMetricaReporting and handles + sending events to specified apikey + */ ++ (nullable id)reporterForApiKey:(NSString *)apiKey; + +/** + * Sets referral URL for this installation. This might be required to track some specific traffic sources like Facebook. + * @param url referral URL value. + */ ++ (void)reportReferralUrl:(NSURL *)url; + +@end + +@interface YMMYandexMetrica (YMMYandexMetricaDeprecatedOrUnavailable) + ++ (void)startWithAPIKey:(NSString *)apiKey + __attribute__((unavailable("WARNING: apiKey used in startWithAPIKey isn't compatible with activateWithApiKey:. " + "Use activateWithApiKey: with updated key. More info in activateWithApiKey:'s description"))); + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaConfiguration.h b/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaConfiguration.h new file mode 100644 index 0000000..73c2d40 --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaConfiguration.h @@ -0,0 +1,96 @@ +/* + * YMMYandexMetricaConfiguration.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +@class CLLocation; +@class YMMYandexMetricaPreloadInfo; + +NS_ASSUME_NONNULL_BEGIN + +@interface YMMYandexMetricaConfiguration : NSObject + +/** Initialize configuration with specified Application key. + For invalid Application initialization returns nil in release and raises an exception in debug. + + @param apiKey Application key that is issued during application registration in AppMetrica. + Application key must be a hexadecimal string in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. + The key can be requested or checked at https://appmetrica.yandex.com + */ +- (nullable instancetype)initWithApiKey:(NSString *)apiKey; + +- (instancetype)init __attribute__((unavailable("initWithApiKey: must be used instead."))); + +/** Get Application key used to initialize the configuration. + */ +@property (nonatomic, copy, readonly) NSString *apiKey; + +/** Whether first activation of AppMetrica should be considered as app update or new app install. + If this option is enabled the first call of +[YMMYandexMetrica activateWithApiKey:] or + +[YMMYandexMetrica activateWithConfiguration:] will be considered as an application update. + + By default this option is disabled. + */ +@property (nonatomic, assign) BOOL handleFirstActivationAsUpdateEnabled; + +/** Enable/disable location reporting to AppMetrica. + If enabled and location set via setLocation: method - that location would be used. + If enabled and location is not set via setLocation, + but application has appropriate permission - CLLocationManager would be used to acquire location data. + + Enabled by default. + */ +@property (nonatomic, assign) BOOL trackLocationEnabled; + +/** Set/get location to AppMetrica + To enable AppMetrica to use this location trackLocationEnabled should be 'YES' + + By default is nil + */ +@property (nonatomic, strong, nullable) CLLocation *location; + +/** Set/get session timeout (in seconds). + Time limit before the application is considered inactive. + Minimum accepted value is 10 seconds. All passed values below 10 seconds automatically become 10 seconds. + + By default, the session times out if the application is in background for 10 seconds. + */ +@property (nonatomic, assign) NSUInteger sessionTimeout; + +/** Enable/disable tracking app crashes. + + Enabled by default. + To disable crash tracking, set the parameter value to false. + */ +@property (nonatomic, assign) BOOL reportCrashesEnabled; + +/** Set/get the arbitrary application version for AppMetrica to report. + + By default, the application version is set in the app configuration file Info.plist (CFBundleShortVersionString). + */ +@property (nonatomic, copy, nullable) NSString *customAppVersion; + +/** Enable/disable logging. + + By default logging is disabled. + */ +@property (nonatomic, assign) BOOL loggingEnabled; + +/** Set/get preload info, which is used for tracking preload installs. + Additional info could be https://appmetrica.yandex.com + + By default is nil. + */ +@property (nonatomic, copy, nullable) YMMYandexMetricaPreloadInfo *preloadInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaPreloadInfo.h b/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaPreloadInfo.h new file mode 100644 index 0000000..7da0ece --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaPreloadInfo.h @@ -0,0 +1,36 @@ +/* + * YMMYandexMetricaPreloadInfo.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YMMYandexMetricaPreloadInfo : NSObject + +- (instancetype)init __attribute__((unavailable("initWithTrackingIdentifier: must be used instead."))); + +/** Initialize Preload info with specific publisher and tracking identifiers. + If case of invalid identifiers constructor returns nil in release and raises an exception in debug + + @param trackingID Tracking identifier + */ +- (nullable instancetype)initWithTrackingIdentifier:(NSString *)trackingID; + +/** Setting key - value data to be used as additional information, associated with preload info. + + @param info Additional preload info. + @param key Additional preload key. + */ +- (void)setAdditionalInfo:(NSString *)info forKey:(NSString *)key; + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaReporting.h b/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaReporting.h new file mode 100644 index 0000000..29f0edc --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaReporting.h @@ -0,0 +1,61 @@ +/* + * YMMYandexMetricaReporting.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** YMMYandexMetricaReporting protocol groups methods that are used by custom reporting objects. + */ +@protocol YMMYandexMetricaReporting + +/** Reporting custom event. + + @param name Short name or description of the event. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ +- (void)reportEvent:(NSString *)name + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom event with additional parameters. + + @param name Short name or description of the event. + @param params Dictionary of name/value pairs that must be sent to the server. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ +- (void)reportEvent:(NSString *)name + parameters:(nullable NSDictionary *)params + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom error messages. + + @param name Short name or description of the error. + @param exception NSException object that must be sent to the server. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ +- (void)reportError:(NSString *)name + exception:(nullable NSException *)exception + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Resumes last session or creates a new one if it has been expired. + Should be used when auto tracking of application state is unavailable or is different. + */ +- (void)resumeSession; + +/** Pause current session. + All events reported after calling this method and till the session timeout will still join this session. + Should be used when auto tracking of application state is unavailable or is different. + */ +- (void)pauseSession; + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Headers/YandexMobileMetrica.h b/example/ios/YandexMobileMetrica.framework/Headers/YandexMobileMetrica.h new file mode 100644 index 0000000..e0ac0a5 --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Headers/YandexMobileMetrica.h @@ -0,0 +1,24 @@ +/* + * YandexMobileMetrica.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#if __has_include("YMMYandexMetrica.h") + #import "YMMYandexMetrica.h" + #import "YMMVersion.h" + #import "YMMYandexMetricaConfiguration.h" + #import "YMMYandexMetricaReporting.h" + #import "YMMYandexMetricaPreloadInfo.h" +#else + #import + #import + #import + #import + #import +#endif diff --git a/example/ios/YandexMobileMetrica.framework/Modules/module.modulemap b/example/ios/YandexMobileMetrica.framework/Modules/module.modulemap new file mode 100644 index 0000000..1f9db92 --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module YandexMobileMetrica { + umbrella header "YandexMobileMetrica.h" + + export * + module * { export * } +} diff --git a/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMVersion.h b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMVersion.h new file mode 100644 index 0000000..1bc8adb --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMVersion.h @@ -0,0 +1,21 @@ +/* + * YMMVersion.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#ifndef __YMM_VERSION_H__ +#define __YMM_VERSION_H__ + +#define YMM_VERSION_MAJOR 2 +#define YMM_VERSION_MINOR 9 +#define YMM_VERSION_PATCH 1 + +#define YMM_BUILD_NUMBER 8517 + +#endif // __YMM_VERSION_H__ diff --git a/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetrica.h b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetrica.h new file mode 100644 index 0000000..4ef31fe --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetrica.h @@ -0,0 +1,171 @@ +/* + * YMMYandexMetrica.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +@class CLLocation; +@class YMMYandexMetricaConfiguration; +@protocol YMMYandexMetricaReporting; + +NS_ASSUME_NONNULL_BEGIN + +extern NSString *const kYMMYandexMetricaErrorDomain; + +typedef NS_ENUM(NSInteger, YMMYandexMetricaEventErrorCode) { + YMMYandexMetricaEventErrorCodeInitializationError = 1000, + YMMYandexMetricaEventErrorCodeInvalidName = 1001, + YMMYandexMetricaEventErrorCodeJsonSerializationError = 1002, +}; + +@interface YMMYandexMetrica : NSObject + +/** Starting the statistics collection process. + + @param apiKey Application key that is issued during application registration in AppMetrica. + Application key must be a hexadecimal string in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. + The key can be requested or checked at https://appmetrica.yandex.com + */ ++ (void)activateWithApiKey:(NSString *)apiKey; + +/** Starting the statistics collection process. + + @param configuration Configuration combines all AppMetrica settings in one place. + Configuration initialized with unique application key that is issued during application registration in AppMetrica. + Application key must be a hexadecimal string in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. + The key can be requested or checked at https://appmetrica.yandex.com + */ ++ (void)activateWithConfiguration:(YMMYandexMetricaConfiguration *)configuration; + +/** Reporting custom event. + + @param message Short name or description of the event. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ ++ (void)reportEvent:(NSString *)message + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom event with additional parameters. + + @param message Short name or description of the event. + @param params Dictionary of name/value pairs that should be sent to the server. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ ++ (void)reportEvent:(NSString *)message + parameters:(nullable NSDictionary *)params + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom error messages. + + @param message Short name or description of the error + @param exception Exception contains an NSException object that must be passed to the server. It can take the nil value. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ ++ (void)reportError:(NSString *)message + exception:(nullable NSException *)exception + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Enable/disable location reporting to AppMetrica. + If enabled and location set via setLocation: method - that location would be used. + If enabled and location is not set via setLocation, + but application has appropriate permission - CLLocationManager would be used to acquire location data. + + @param enabled Flag indicating if reporting location to AppMetrica enabled + Enabled by default. + */ ++ (void)setTrackLocationEnabled:(BOOL)enabled; + +/** Set location to AppMetrica + To enable AppMetrica to use this location trackLocationEnabled should be 'YES' + + @param location Custom device location to be reported. + */ ++ (void)setLocation:(nullable CLLocation *)location; + +/** Setting session timeout (in seconds). + + @param sessionTimeoutSeconds Time limit before the application is considered inactive. + By default, the session times out if the application is in background for 10 seconds. + Minimum accepted value is 10 seconds. All passed values below 10 seconds automatically become 10 seconds. + */ ++ (void)setSessionTimeout:(NSUInteger)sessionTimeoutSeconds; + +/** Tracking app crashes. + + @param enabled Boolean value to enable or disable collecting and sending crash reports. + By default, reports on application crashes are sent, meaning enabled=true. + To disable crash tracking, set the parameter value to enabled=false. + */ ++ (void)setReportCrashesEnabled:(BOOL)enabled; + +/** Setting the arbitrary application version. + + @param appVersion Application version to be reported. + By default, the application version is set in the app configuration file Info.plist (CFBundleShortVersionString). + */ ++ (void)setCustomAppVersion:(NSString *)appVersion; + +/** Enable or disable logging. + + @param isEnabled Boolean value to enable or disable logging. By default logging is disabled. + */ ++ (void)setLoggingEnabled:(BOOL)isEnabled; + +/** Setting key - value data to be used as additional information, associated with future unhandled exception. + If value is nil, previously set key-value is removed. Does nothing if key hasn't been added. + + @param value The error environment value. + @param key The error environment key. + */ ++ (void)setEnvironmentValue:(nullable NSString *)value forKey:(NSString *)key; + +/** Retrieves current version of library. + */ ++ (NSString *)libraryVersion; + +/** Enables AppMetrica's tracking mechanism by providing application's url scheme. + + @param urlScheme Application's deep link scheme. Scheme should be registered in CFBundleURLTypes Info.plist section. + */ ++ (BOOL)enableTrackingWithURLScheme:(NSURL *)urlScheme NS_EXTENSION_UNAVAILABLE_IOS("") NS_AVAILABLE_IOS(9_0); + +/** Handles the URL that has opened the application. + Reports the URL for deep links tracking. + URL scheme should be registered beforehand via `enableTrackingWithUrlScheme:` method for tracking to work correctly. + + @param url URL that has opened the application. + */ ++ (BOOL)handleOpenURL:(NSURL *)url; + +/** Returns id that can send events to specific API key. + + @param apiKey Api key to send events to. + @return id that conforms to YMMYandexMetricaReporting and handles + sending events to specified apikey + */ ++ (nullable id)reporterForApiKey:(NSString *)apiKey; + +/** + * Sets referral URL for this installation. This might be required to track some specific traffic sources like Facebook. + * @param url referral URL value. + */ ++ (void)reportReferralUrl:(NSURL *)url; + +@end + +@interface YMMYandexMetrica (YMMYandexMetricaDeprecatedOrUnavailable) + ++ (void)startWithAPIKey:(NSString *)apiKey + __attribute__((unavailable("WARNING: apiKey used in startWithAPIKey isn't compatible with activateWithApiKey:. " + "Use activateWithApiKey: with updated key. More info in activateWithApiKey:'s description"))); + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetricaConfiguration.h b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetricaConfiguration.h new file mode 100644 index 0000000..73c2d40 --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetricaConfiguration.h @@ -0,0 +1,96 @@ +/* + * YMMYandexMetricaConfiguration.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +@class CLLocation; +@class YMMYandexMetricaPreloadInfo; + +NS_ASSUME_NONNULL_BEGIN + +@interface YMMYandexMetricaConfiguration : NSObject + +/** Initialize configuration with specified Application key. + For invalid Application initialization returns nil in release and raises an exception in debug. + + @param apiKey Application key that is issued during application registration in AppMetrica. + Application key must be a hexadecimal string in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. + The key can be requested or checked at https://appmetrica.yandex.com + */ +- (nullable instancetype)initWithApiKey:(NSString *)apiKey; + +- (instancetype)init __attribute__((unavailable("initWithApiKey: must be used instead."))); + +/** Get Application key used to initialize the configuration. + */ +@property (nonatomic, copy, readonly) NSString *apiKey; + +/** Whether first activation of AppMetrica should be considered as app update or new app install. + If this option is enabled the first call of +[YMMYandexMetrica activateWithApiKey:] or + +[YMMYandexMetrica activateWithConfiguration:] will be considered as an application update. + + By default this option is disabled. + */ +@property (nonatomic, assign) BOOL handleFirstActivationAsUpdateEnabled; + +/** Enable/disable location reporting to AppMetrica. + If enabled and location set via setLocation: method - that location would be used. + If enabled and location is not set via setLocation, + but application has appropriate permission - CLLocationManager would be used to acquire location data. + + Enabled by default. + */ +@property (nonatomic, assign) BOOL trackLocationEnabled; + +/** Set/get location to AppMetrica + To enable AppMetrica to use this location trackLocationEnabled should be 'YES' + + By default is nil + */ +@property (nonatomic, strong, nullable) CLLocation *location; + +/** Set/get session timeout (in seconds). + Time limit before the application is considered inactive. + Minimum accepted value is 10 seconds. All passed values below 10 seconds automatically become 10 seconds. + + By default, the session times out if the application is in background for 10 seconds. + */ +@property (nonatomic, assign) NSUInteger sessionTimeout; + +/** Enable/disable tracking app crashes. + + Enabled by default. + To disable crash tracking, set the parameter value to false. + */ +@property (nonatomic, assign) BOOL reportCrashesEnabled; + +/** Set/get the arbitrary application version for AppMetrica to report. + + By default, the application version is set in the app configuration file Info.plist (CFBundleShortVersionString). + */ +@property (nonatomic, copy, nullable) NSString *customAppVersion; + +/** Enable/disable logging. + + By default logging is disabled. + */ +@property (nonatomic, assign) BOOL loggingEnabled; + +/** Set/get preload info, which is used for tracking preload installs. + Additional info could be https://appmetrica.yandex.com + + By default is nil. + */ +@property (nonatomic, copy, nullable) YMMYandexMetricaPreloadInfo *preloadInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetricaPreloadInfo.h b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetricaPreloadInfo.h new file mode 100644 index 0000000..7da0ece --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetricaPreloadInfo.h @@ -0,0 +1,36 @@ +/* + * YMMYandexMetricaPreloadInfo.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YMMYandexMetricaPreloadInfo : NSObject + +- (instancetype)init __attribute__((unavailable("initWithTrackingIdentifier: must be used instead."))); + +/** Initialize Preload info with specific publisher and tracking identifiers. + If case of invalid identifiers constructor returns nil in release and raises an exception in debug + + @param trackingID Tracking identifier + */ +- (nullable instancetype)initWithTrackingIdentifier:(NSString *)trackingID; + +/** Setting key - value data to be used as additional information, associated with preload info. + + @param info Additional preload info. + @param key Additional preload key. + */ +- (void)setAdditionalInfo:(NSString *)info forKey:(NSString *)key; + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetricaReporting.h b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetricaReporting.h new file mode 100644 index 0000000..29f0edc --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YMMYandexMetricaReporting.h @@ -0,0 +1,61 @@ +/* + * YMMYandexMetricaReporting.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** YMMYandexMetricaReporting protocol groups methods that are used by custom reporting objects. + */ +@protocol YMMYandexMetricaReporting + +/** Reporting custom event. + + @param name Short name or description of the event. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ +- (void)reportEvent:(NSString *)name + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom event with additional parameters. + + @param name Short name or description of the event. + @param params Dictionary of name/value pairs that must be sent to the server. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ +- (void)reportEvent:(NSString *)name + parameters:(nullable NSDictionary *)params + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom error messages. + + @param name Short name or description of the error. + @param exception NSException object that must be sent to the server. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ +- (void)reportError:(NSString *)name + exception:(nullable NSException *)exception + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Resumes last session or creates a new one if it has been expired. + Should be used when auto tracking of application state is unavailable or is different. + */ +- (void)resumeSession; + +/** Pause current session. + All events reported after calling this method and till the session timeout will still join this session. + Should be used when auto tracking of application state is unavailable or is different. + */ +- (void)pauseSession; + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YandexMobileMetrica.h b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YandexMobileMetrica.h new file mode 100644 index 0000000..e0ac0a5 --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/A/Headers/YandexMobileMetrica.h @@ -0,0 +1,24 @@ +/* + * YandexMobileMetrica.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#if __has_include("YMMYandexMetrica.h") + #import "YMMYandexMetrica.h" + #import "YMMVersion.h" + #import "YMMYandexMetricaConfiguration.h" + #import "YMMYandexMetricaReporting.h" + #import "YMMYandexMetricaPreloadInfo.h" +#else + #import + #import + #import + #import + #import +#endif diff --git a/example/ios/YandexMobileMetrica.framework/Versions/A/YandexMobileMetrica b/example/ios/YandexMobileMetrica.framework/Versions/A/YandexMobileMetrica new file mode 100644 index 0000000..550d72f Binary files /dev/null and b/example/ios/YandexMobileMetrica.framework/Versions/A/YandexMobileMetrica differ diff --git a/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMVersion.h b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMVersion.h new file mode 100644 index 0000000..1bc8adb --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMVersion.h @@ -0,0 +1,21 @@ +/* + * YMMVersion.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#ifndef __YMM_VERSION_H__ +#define __YMM_VERSION_H__ + +#define YMM_VERSION_MAJOR 2 +#define YMM_VERSION_MINOR 9 +#define YMM_VERSION_PATCH 1 + +#define YMM_BUILD_NUMBER 8517 + +#endif // __YMM_VERSION_H__ diff --git a/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetrica.h b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetrica.h new file mode 100644 index 0000000..4ef31fe --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetrica.h @@ -0,0 +1,171 @@ +/* + * YMMYandexMetrica.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +@class CLLocation; +@class YMMYandexMetricaConfiguration; +@protocol YMMYandexMetricaReporting; + +NS_ASSUME_NONNULL_BEGIN + +extern NSString *const kYMMYandexMetricaErrorDomain; + +typedef NS_ENUM(NSInteger, YMMYandexMetricaEventErrorCode) { + YMMYandexMetricaEventErrorCodeInitializationError = 1000, + YMMYandexMetricaEventErrorCodeInvalidName = 1001, + YMMYandexMetricaEventErrorCodeJsonSerializationError = 1002, +}; + +@interface YMMYandexMetrica : NSObject + +/** Starting the statistics collection process. + + @param apiKey Application key that is issued during application registration in AppMetrica. + Application key must be a hexadecimal string in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. + The key can be requested or checked at https://appmetrica.yandex.com + */ ++ (void)activateWithApiKey:(NSString *)apiKey; + +/** Starting the statistics collection process. + + @param configuration Configuration combines all AppMetrica settings in one place. + Configuration initialized with unique application key that is issued during application registration in AppMetrica. + Application key must be a hexadecimal string in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. + The key can be requested or checked at https://appmetrica.yandex.com + */ ++ (void)activateWithConfiguration:(YMMYandexMetricaConfiguration *)configuration; + +/** Reporting custom event. + + @param message Short name or description of the event. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ ++ (void)reportEvent:(NSString *)message + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom event with additional parameters. + + @param message Short name or description of the event. + @param params Dictionary of name/value pairs that should be sent to the server. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ ++ (void)reportEvent:(NSString *)message + parameters:(nullable NSDictionary *)params + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom error messages. + + @param message Short name or description of the error + @param exception Exception contains an NSException object that must be passed to the server. It can take the nil value. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ ++ (void)reportError:(NSString *)message + exception:(nullable NSException *)exception + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Enable/disable location reporting to AppMetrica. + If enabled and location set via setLocation: method - that location would be used. + If enabled and location is not set via setLocation, + but application has appropriate permission - CLLocationManager would be used to acquire location data. + + @param enabled Flag indicating if reporting location to AppMetrica enabled + Enabled by default. + */ ++ (void)setTrackLocationEnabled:(BOOL)enabled; + +/** Set location to AppMetrica + To enable AppMetrica to use this location trackLocationEnabled should be 'YES' + + @param location Custom device location to be reported. + */ ++ (void)setLocation:(nullable CLLocation *)location; + +/** Setting session timeout (in seconds). + + @param sessionTimeoutSeconds Time limit before the application is considered inactive. + By default, the session times out if the application is in background for 10 seconds. + Minimum accepted value is 10 seconds. All passed values below 10 seconds automatically become 10 seconds. + */ ++ (void)setSessionTimeout:(NSUInteger)sessionTimeoutSeconds; + +/** Tracking app crashes. + + @param enabled Boolean value to enable or disable collecting and sending crash reports. + By default, reports on application crashes are sent, meaning enabled=true. + To disable crash tracking, set the parameter value to enabled=false. + */ ++ (void)setReportCrashesEnabled:(BOOL)enabled; + +/** Setting the arbitrary application version. + + @param appVersion Application version to be reported. + By default, the application version is set in the app configuration file Info.plist (CFBundleShortVersionString). + */ ++ (void)setCustomAppVersion:(NSString *)appVersion; + +/** Enable or disable logging. + + @param isEnabled Boolean value to enable or disable logging. By default logging is disabled. + */ ++ (void)setLoggingEnabled:(BOOL)isEnabled; + +/** Setting key - value data to be used as additional information, associated with future unhandled exception. + If value is nil, previously set key-value is removed. Does nothing if key hasn't been added. + + @param value The error environment value. + @param key The error environment key. + */ ++ (void)setEnvironmentValue:(nullable NSString *)value forKey:(NSString *)key; + +/** Retrieves current version of library. + */ ++ (NSString *)libraryVersion; + +/** Enables AppMetrica's tracking mechanism by providing application's url scheme. + + @param urlScheme Application's deep link scheme. Scheme should be registered in CFBundleURLTypes Info.plist section. + */ ++ (BOOL)enableTrackingWithURLScheme:(NSURL *)urlScheme NS_EXTENSION_UNAVAILABLE_IOS("") NS_AVAILABLE_IOS(9_0); + +/** Handles the URL that has opened the application. + Reports the URL for deep links tracking. + URL scheme should be registered beforehand via `enableTrackingWithUrlScheme:` method for tracking to work correctly. + + @param url URL that has opened the application. + */ ++ (BOOL)handleOpenURL:(NSURL *)url; + +/** Returns id that can send events to specific API key. + + @param apiKey Api key to send events to. + @return id that conforms to YMMYandexMetricaReporting and handles + sending events to specified apikey + */ ++ (nullable id)reporterForApiKey:(NSString *)apiKey; + +/** + * Sets referral URL for this installation. This might be required to track some specific traffic sources like Facebook. + * @param url referral URL value. + */ ++ (void)reportReferralUrl:(NSURL *)url; + +@end + +@interface YMMYandexMetrica (YMMYandexMetricaDeprecatedOrUnavailable) + ++ (void)startWithAPIKey:(NSString *)apiKey + __attribute__((unavailable("WARNING: apiKey used in startWithAPIKey isn't compatible with activateWithApiKey:. " + "Use activateWithApiKey: with updated key. More info in activateWithApiKey:'s description"))); + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetricaConfiguration.h b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetricaConfiguration.h new file mode 100644 index 0000000..73c2d40 --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetricaConfiguration.h @@ -0,0 +1,96 @@ +/* + * YMMYandexMetricaConfiguration.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +@class CLLocation; +@class YMMYandexMetricaPreloadInfo; + +NS_ASSUME_NONNULL_BEGIN + +@interface YMMYandexMetricaConfiguration : NSObject + +/** Initialize configuration with specified Application key. + For invalid Application initialization returns nil in release and raises an exception in debug. + + @param apiKey Application key that is issued during application registration in AppMetrica. + Application key must be a hexadecimal string in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. + The key can be requested or checked at https://appmetrica.yandex.com + */ +- (nullable instancetype)initWithApiKey:(NSString *)apiKey; + +- (instancetype)init __attribute__((unavailable("initWithApiKey: must be used instead."))); + +/** Get Application key used to initialize the configuration. + */ +@property (nonatomic, copy, readonly) NSString *apiKey; + +/** Whether first activation of AppMetrica should be considered as app update or new app install. + If this option is enabled the first call of +[YMMYandexMetrica activateWithApiKey:] or + +[YMMYandexMetrica activateWithConfiguration:] will be considered as an application update. + + By default this option is disabled. + */ +@property (nonatomic, assign) BOOL handleFirstActivationAsUpdateEnabled; + +/** Enable/disable location reporting to AppMetrica. + If enabled and location set via setLocation: method - that location would be used. + If enabled and location is not set via setLocation, + but application has appropriate permission - CLLocationManager would be used to acquire location data. + + Enabled by default. + */ +@property (nonatomic, assign) BOOL trackLocationEnabled; + +/** Set/get location to AppMetrica + To enable AppMetrica to use this location trackLocationEnabled should be 'YES' + + By default is nil + */ +@property (nonatomic, strong, nullable) CLLocation *location; + +/** Set/get session timeout (in seconds). + Time limit before the application is considered inactive. + Minimum accepted value is 10 seconds. All passed values below 10 seconds automatically become 10 seconds. + + By default, the session times out if the application is in background for 10 seconds. + */ +@property (nonatomic, assign) NSUInteger sessionTimeout; + +/** Enable/disable tracking app crashes. + + Enabled by default. + To disable crash tracking, set the parameter value to false. + */ +@property (nonatomic, assign) BOOL reportCrashesEnabled; + +/** Set/get the arbitrary application version for AppMetrica to report. + + By default, the application version is set in the app configuration file Info.plist (CFBundleShortVersionString). + */ +@property (nonatomic, copy, nullable) NSString *customAppVersion; + +/** Enable/disable logging. + + By default logging is disabled. + */ +@property (nonatomic, assign) BOOL loggingEnabled; + +/** Set/get preload info, which is used for tracking preload installs. + Additional info could be https://appmetrica.yandex.com + + By default is nil. + */ +@property (nonatomic, copy, nullable) YMMYandexMetricaPreloadInfo *preloadInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetricaPreloadInfo.h b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetricaPreloadInfo.h new file mode 100644 index 0000000..7da0ece --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetricaPreloadInfo.h @@ -0,0 +1,36 @@ +/* + * YMMYandexMetricaPreloadInfo.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YMMYandexMetricaPreloadInfo : NSObject + +- (instancetype)init __attribute__((unavailable("initWithTrackingIdentifier: must be used instead."))); + +/** Initialize Preload info with specific publisher and tracking identifiers. + If case of invalid identifiers constructor returns nil in release and raises an exception in debug + + @param trackingID Tracking identifier + */ +- (nullable instancetype)initWithTrackingIdentifier:(NSString *)trackingID; + +/** Setting key - value data to be used as additional information, associated with preload info. + + @param info Additional preload info. + @param key Additional preload key. + */ +- (void)setAdditionalInfo:(NSString *)info forKey:(NSString *)key; + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetricaReporting.h b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetricaReporting.h new file mode 100644 index 0000000..29f0edc --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YMMYandexMetricaReporting.h @@ -0,0 +1,61 @@ +/* + * YMMYandexMetricaReporting.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** YMMYandexMetricaReporting protocol groups methods that are used by custom reporting objects. + */ +@protocol YMMYandexMetricaReporting + +/** Reporting custom event. + + @param name Short name or description of the event. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ +- (void)reportEvent:(NSString *)name + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom event with additional parameters. + + @param name Short name or description of the event. + @param params Dictionary of name/value pairs that must be sent to the server. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ +- (void)reportEvent:(NSString *)name + parameters:(nullable NSDictionary *)params + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Reporting custom error messages. + + @param name Short name or description of the error. + @param exception NSException object that must be sent to the server. + @param onFailure Block to be executed if an error occurres while reporting, the error is passed as block argument. + */ +- (void)reportError:(NSString *)name + exception:(nullable NSException *)exception + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Resumes last session or creates a new one if it has been expired. + Should be used when auto tracking of application state is unavailable or is different. + */ +- (void)resumeSession; + +/** Pause current session. + All events reported after calling this method and till the session timeout will still join this session. + Should be used when auto tracking of application state is unavailable or is different. + */ +- (void)pauseSession; + +@end + +NS_ASSUME_NONNULL_END diff --git a/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YandexMobileMetrica.h b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YandexMobileMetrica.h new file mode 100644 index 0000000..e0ac0a5 --- /dev/null +++ b/example/ios/YandexMobileMetrica.framework/Versions/Current/Headers/YandexMobileMetrica.h @@ -0,0 +1,24 @@ +/* + * YandexMobileMetrica.h + * + * This file is a part of the AppMetrica + * + * Version for iOS © 2017 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://legal.yandex.com/metrica_termsofuse/ + */ + +#if __has_include("YMMYandexMetrica.h") + #import "YMMYandexMetrica.h" + #import "YMMVersion.h" + #import "YMMYandexMetricaConfiguration.h" + #import "YMMYandexMetricaReporting.h" + #import "YMMYandexMetricaPreloadInfo.h" +#else + #import + #import + #import + #import + #import +#endif diff --git a/example/ios/YandexMobileMetrica.framework/Versions/Current/YandexMobileMetrica b/example/ios/YandexMobileMetrica.framework/Versions/Current/YandexMobileMetrica new file mode 100644 index 0000000..550d72f Binary files /dev/null and b/example/ios/YandexMobileMetrica.framework/Versions/Current/YandexMobileMetrica differ diff --git a/example/ios/YandexMobileMetrica.framework/YandexMobileMetrica b/example/ios/YandexMobileMetrica.framework/YandexMobileMetrica new file mode 100644 index 0000000..550d72f Binary files /dev/null and b/example/ios/YandexMobileMetrica.framework/YandexMobileMetrica differ diff --git a/example/Navigation.js b/example/src/Navigation.js similarity index 94% rename from example/Navigation.js rename to example/src/Navigation.js index c3c0593..1fd1894 100644 --- a/example/Navigation.js +++ b/example/src/Navigation.js @@ -22,11 +22,10 @@ class Navigation extends React.PureComponent { renderScene={ this.renderScene } /> - ) + ); } renderScene(route) { - console.log('renderScene', route); switch (route.id) { case 'page1': return ; case 'page2': return ; diff --git a/example/Page1.js b/example/src/Page1.js similarity index 52% rename from example/Page1.js rename to example/src/Page1.js index e85cf26..74eab09 100644 --- a/example/Page1.js +++ b/example/src/Page1.js @@ -1,22 +1,37 @@ import React from 'react'; import { + Alert, StyleSheet, TouchableOpacity, Text, View, } from 'react-native'; +import AppMetrica from './appmetrica'; + class Page1 extends React.PureComponent { render() { return ( page1 - appNavigator.push({ id: 'page2' }) }> + go to page2 + + report event to AppMetrica + - ) + ); + } + + handlePress() { + appNavigator.push({ id: 'page2' }); + } + + reportEventToAppMetrica() { + AppMetrica.reportEvent('event from page1'); + Alert.alert('OK!'); } } diff --git a/example/Page2.js b/example/src/Page2.js similarity index 78% rename from example/Page2.js rename to example/src/Page2.js index e780f9f..c930638 100644 --- a/example/Page2.js +++ b/example/src/Page2.js @@ -12,11 +12,15 @@ class Page2 extends React.PureComponent { return ( page2 - appNavigator.pop() }> + go back - ) + ); + } + + handlePress() { + appNavigator.push({ id: 'page2' }); } } diff --git a/example/Page404.js b/example/src/Page404.js similarity index 97% rename from example/Page404.js rename to example/src/Page404.js index 58850e9..e13fcd6 100644 --- a/example/Page404.js +++ b/example/src/Page404.js @@ -12,7 +12,7 @@ class Page2 extends React.PureComponent { Unknown page - ) + ); } } diff --git a/example/src/appmetrica.js b/example/src/appmetrica.js new file mode 100644 index 0000000..28d2bf7 --- /dev/null +++ b/example/src/appmetrica.js @@ -0,0 +1,5 @@ +import AppMetrica from 'react-native-appmetrica'; + +AppMetrica.activateWithApiKey('2dee16d2-1143-4cd3-a904-39ce10ac2755'); + +export default AppMetrica;