diff --git a/README.md b/README.md index 70aadea..d757581 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # AppMetrica Cordova Plugin ## Documentation -Common documentation available on [AppMetrica official site][DOCUMENTATION]. +Common documentation available on [AppMetrica official site][DOCUMENTATION]. Documentation for this plugin will be published soon. ## Sample project @@ -27,6 +27,10 @@ advertisement**. ## Changelog +### Version 1.0.0 +* Updated versions of the AppMetrica SDK (iOS 3.7.1 and Android 3.6.4). +* Changed API methods. + ### Version 0.4.0 * Updated iOS version of the AppMetrica SDK (iOS 2.9.8). * Changed the SDK to meet the requirements of the Apple App Store Review Team. Update the AppMetrica SDK to avoid any issues during the App Store moderation process. @@ -48,5 +52,5 @@ License agreement on use of Yandex AppMetrica is available at [EULA site][LICENS [LICENSE]: https://yandex.com/legal/appmetrica_sdk_agreement/ "Yandex AppMetrica agreement" -[DOCUMENTATION]: https://tech.yandex.com/appmetrica/doc/mobile-sdk-dg/concepts/about-docpage/ "Yandex AppMetrica documentation" +[DOCUMENTATION]: https://appmetrica.yandex.com/docs/quick-start/concepts/quick-start.html "Yandex AppMetrica documentation" [GitHubSAMPLE]: https://github.com/yandexmobile/metrica-plugin-cordova/tree/master/sample "Sample from reository" diff --git a/package.json b/package.json index 2243e41..570f914 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yandex-appmetrica-plugin-cordova", - "version": "0.4.0", + "version": "1.0.0", "description": "Cordova/PhoneGap plugin for AppMetrica analytics tool", "cordova": { "id": "yandex-appmetrica-plugin-cordova", @@ -30,7 +30,7 @@ ], "author": "Yandex, LLC", "license": "ISC", - "homepage": "https://tech.yandex.ru/metrica-mobile-sdk", + "homepage": "https://appmetrica.yandex.com/docs", "bugs": { "url": "https://github.com/yandexmobile/metrica-plugin-cordova/issues" }, diff --git a/platforms/android/build.gradle b/platforms/android/build.gradle index 9162211..a96389f 100644 --- a/platforms/android/build.gradle +++ b/platforms/android/build.gradle @@ -1,8 +1,16 @@ -repositories{ +/* + * Version for Cordova/PhoneGap + * © 2017-2019 YANDEX + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://yandex.com/legal/appmetrica_sdk_agreement/ + */ + +repositories{ jcenter() mavenCentral() } dependencies { - compile 'com.yandex.android:mobmetricalib:2.78' -} \ No newline at end of file + compile 'com.yandex.android:mobmetricalib:3.6.4' +} diff --git a/platforms/android/com/yandex/metrica/plugin/cordova/AppMetricaPlugin.java b/platforms/android/com/yandex/metrica/plugin/cordova/AppMetricaPlugin.java index 8909d88..1512def 100644 --- a/platforms/android/com/yandex/metrica/plugin/cordova/AppMetricaPlugin.java +++ b/platforms/android/com/yandex/metrica/plugin/cordova/AppMetricaPlugin.java @@ -1,6 +1,6 @@ /* * Version for Cordova/PhoneGap - * © 2017 YANDEX + * © 2017-2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ @@ -47,22 +47,10 @@ public void run() { reportEvent(args, callbackContext); } else if ("reportError".equals(action)) { reportError(args, callbackContext); - } else if ("setCustomAppVersion".equals(action)) { - setCustomAppVersion(args, callbackContext); } else if ("setLocation".equals(action)) { setLocation(args, callbackContext); - } else if ("setTrackLocationEnabled".equals(action)) { - setTrackLocationEnabled(args, callbackContext); - } else if ("setEnvironmentValue".equals(action)) { - setEnvironmentValue(args, callbackContext); - } else if ("setSessionTimeout".equals(action)) { - setSessionTimeout(args, callbackContext); - } else if ("setReportCrashesEnabled".equals(action)) { - setReportCrashesEnabled(args, callbackContext); - } else if ("setLoggingEnabled".equals(action)) { - setLoggingEnabled(args, callbackContext); - } else if ("setCollectInstalledAppsEnabled".equals(action)) { - setCollectInstalledAppsEnabled(args, callbackContext); + } else if ("setLocationTracking".equals(action)) { + setLocationTracking(args, callbackContext); } else { callbackContext.error("Unknown action: " + action); } @@ -76,12 +64,12 @@ public void run() { @Override public void onPause(final boolean multitasking) { - onPauseActivity(); + onPauseSession(); } @Override public void onResume(final boolean multitasking) { - onResumeActivity(); + onResumeSession(); } @Override @@ -104,20 +92,20 @@ private ExecutorService getAppMetricaExecutor() { return mExecutor; } - private void onPauseActivity() { + private void onPauseSession() { synchronized (mLock) { mActivityPaused = true; if (mAppMetricaActivated) { - YandexMetrica.onPauseActivity(getActivity()); + YandexMetrica.pauseSession(getActivity()); } } } - private void onResumeActivity() { + private void onResumeSession() { synchronized (mLock) { mActivityPaused = false; if (mAppMetricaActivated) { - YandexMetrica.onResumeActivity(getActivity()); + YandexMetrica.resumeSession(getActivity()); } } } @@ -154,40 +142,40 @@ public static YandexMetricaConfig toConfig(final JSONObject configObj) throws JS final String apiKey = configObj.getString("apiKey"); final YandexMetricaConfig.Builder builder = YandexMetricaConfig.newConfigBuilder(apiKey); - if (configObj.has("handleFirstActivationAsUpdateEnabled")) { - builder.handleFirstActivationAsUpdate(configObj.getBoolean("handleFirstActivationAsUpdateEnabled")); + if (configObj.has("handleFirstActivationAsUpdate")) { + builder.handleFirstActivationAsUpdate(configObj.getBoolean("handleFirstActivationAsUpdate")); } - if (configObj.has("trackLocationEnabled")) { - builder.setTrackLocationEnabled(configObj.getBoolean("trackLocationEnabled")); + if (configObj.has("locationTracking")) { + builder.withLocationTracking(configObj.getBoolean("locationTracking")); } if (configObj.has("sessionTimeout")) { - builder.setSessionTimeout(configObj.getInt("sessionTimeout")); + builder.withSessionTimeout(configObj.getInt("sessionTimeout")); } - if (configObj.has("reportCrashesEnabled")) { - builder.setReportCrashesEnabled(configObj.getBoolean("reportCrashesEnabled")); + if (configObj.has("crashReporting")) { + builder.withCrashReporting(configObj.getBoolean("crashReporting")); } if (configObj.has("appVersion")) { - builder.setAppVersion(configObj.getString("appVersion")); + builder.withAppVersion(configObj.getString("appVersion")); } - if (configObj.optBoolean("loggingEnabled", false)) { - builder.setLogEnabled(); + if (configObj.optBoolean("logs", false)) { + builder.withLogs(); } if (configObj.has("location")) { final Location location = toLocation(configObj.getJSONObject("location")); - builder.setLocation(location); + builder.withLocation(location); } if (configObj.has("preloadInfo")) { final JSONObject preloadInfoObj = configObj.getJSONObject("preloadInfo"); final PreloadInfo.Builder infoBuilder = PreloadInfo.newBuilder(preloadInfoObj.getString("trackingId")); - final JSONObject additionalInfoObj = preloadInfoObj.optJSONObject("additionalInfo"); + final JSONObject additionalInfoObj = preloadInfoObj.optJSONObject("additionalParams"); if (additionalInfoObj != null) { - for (Iterator keyIterator = additionalInfoObj.keys(); keyIterator.hasNext();) { + for (Iterator keyIterator = additionalInfoObj.keys(); keyIterator.hasNext(); ) { final String key = keyIterator.next(); final String value = additionalInfoObj.getString(key); infoBuilder.setAdditionalParams(key, value); } } - builder.setPreloadInfo(infoBuilder.build()); + builder.withPreloadInfo(infoBuilder.build()); } return builder.build(); @@ -205,7 +193,7 @@ private void activate(final JSONArray args, if (mAppMetricaActivated == false) { YandexMetrica.reportAppOpen(getActivity()); if (mActivityPaused == false) { - YandexMetrica.onResumeActivity(getActivity()); + YandexMetrica.resumeSession(getActivity()); } } mAppMetricaActivated = true; @@ -240,13 +228,6 @@ private void reportError(final JSONArray args, YandexMetrica.reportError(errorName, errorThrowable); } - private void setCustomAppVersion(final JSONArray args, - final CallbackContext callbackContext) throws JSONException { - final String appVersion = args.getString(0); - - YandexMetrica.setCustomAppVersion(appVersion); - } - private void setLocation(final JSONArray args, final CallbackContext callbackContext) throws JSONException { final JSONObject locationObj = args.getJSONObject(0); @@ -255,45 +236,10 @@ private void setLocation(final JSONArray args, YandexMetrica.setLocation(location); } - private void setTrackLocationEnabled(final JSONArray args, - final CallbackContext callbackContext) throws JSONException { - final boolean enabled = args.getBoolean(0); - - YandexMetrica.setTrackLocationEnabled(enabled); - } - - private void setEnvironmentValue(final JSONArray args, + private void setLocationTracking(final JSONArray args, final CallbackContext callbackContext) throws JSONException { - final String key = args.getString(0); - final String value = args.getString(1); - - YandexMetrica.setEnvironmentValue(key, value); - } - - private void setSessionTimeout(final JSONArray args, - final CallbackContext callbackContext) throws JSONException { - final int sessionTimeout = args.getInt(0); - - YandexMetrica.setSessionTimeout(sessionTimeout); - } - - private void setReportCrashesEnabled(final JSONArray args, - final CallbackContext callbackContext) throws JSONException { - final boolean enabled = args.getBoolean(0); - - YandexMetrica.setReportCrashesEnabled(enabled); - } - - private void setLoggingEnabled(final JSONArray args, - final CallbackContext callbackContext) throws JSONException { - YandexMetrica.setLogEnabled(); - } - - private void setCollectInstalledAppsEnabled(final JSONArray args, - final CallbackContext callbackContext) throws JSONException { final boolean enabled = args.getBoolean(0); - YandexMetrica.setCollectInstalledApps(enabled); + YandexMetrica.setLocationTracking(enabled); } - } diff --git a/platforms/ios/YMMAppMetricaPlugin.h b/platforms/ios/YMMAppMetricaPlugin.h index 36a6166..6e6ba9a 100644 --- a/platforms/ios/YMMAppMetricaPlugin.h +++ b/platforms/ios/YMMAppMetricaPlugin.h @@ -1,6 +1,6 @@ /* * Version for Cordova/PhoneGap - * © 2017 YANDEX + * © 2017-2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ @@ -13,14 +13,8 @@ - (void)activate:(CDVInvokedUrlCommand *)command; - (void)reportEvent:(CDVInvokedUrlCommand *)command; - (void)reportError:(CDVInvokedUrlCommand *)command; -- (void)setCustomAppVersion:(CDVInvokedUrlCommand *)command; - (void)setLocation:(CDVInvokedUrlCommand *)command; -- (void)setTrackLocationEnabled:(CDVInvokedUrlCommand *)command; -- (void)setEnvironmentValue:(CDVInvokedUrlCommand *)command; -- (void)setSessionTimeout:(CDVInvokedUrlCommand *)command; -- (void)setReportCrashesEnabled:(CDVInvokedUrlCommand *)command; -- (void)setLoggingEnabled:(CDVInvokedUrlCommand *)command; -- (void)setCollectInstalledAppsEnabled:(CDVInvokedUrlCommand *)command; +- (void)setLocationTracking:(CDVInvokedUrlCommand *)command; + (void)activateWithConfigurationDictionary:(NSDictionary *)configuration; + (bool)isAppMetricaActivated; diff --git a/platforms/ios/YMMAppMetricaPlugin.m b/platforms/ios/YMMAppMetricaPlugin.m index 34dda56..56e8691 100644 --- a/platforms/ios/YMMAppMetricaPlugin.m +++ b/platforms/ios/YMMAppMetricaPlugin.m @@ -1,6 +1,6 @@ /* * Version for Cordova/PhoneGap - * © 2017 YANDEX + * © 2017-2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ @@ -27,7 +27,7 @@ - (void)handleOpenURL:(NSNotification *)notification } } -#pragma mard - Commands +#pragma mark - Commands - (void)activate:(CDVInvokedUrlCommand *)command { @@ -63,15 +63,6 @@ - (void)reportError:(CDVInvokedUrlCommand *)command }]; } -- (void)setCustomAppVersion:(CDVInvokedUrlCommand *)command -{ - NSString *appVersion = [command argumentAtIndex:0 withDefault:nil andClass:[NSString class]]; - - [self dispatchAsync:^{ - [YMMYandexMetrica setCustomAppVersion:appVersion]; - }]; -} - - (void)setLocation:(CDVInvokedUrlCommand *)command { NSDictionary *locationDictionary = [command argumentAtIndex:0 withDefault:nil andClass:[NSDictionary class]]; @@ -82,61 +73,17 @@ - (void)setLocation:(CDVInvokedUrlCommand *)command }]; } -- (void)setTrackLocationEnabled:(CDVInvokedUrlCommand *)command -{ - NSNumber *enabledValue = [command argumentAtIndex:0 withDefault:nil andClass:[NSNumber class]]; - - if (enabledValue != nil) { - [self dispatchAsync:^{ - [YMMYandexMetrica setTrackLocationEnabled:enabledValue.boolValue]; - }]; - } -} - -- (void)setEnvironmentValue:(CDVInvokedUrlCommand *)command -{ - NSString *key = [command argumentAtIndex:0 withDefault:nil andClass:[NSString class]]; - NSString *value = [command argumentAtIndex:1 withDefault:nil andClass:[NSString class]]; - - [self dispatchAsync:^{ - [YMMYandexMetrica setEnvironmentValue:value forKey:key]; - }]; -} - -- (void)setSessionTimeout:(CDVInvokedUrlCommand *)command -{ - NSNumber *sessionTimeoutValue = [command argumentAtIndex:0 withDefault:nil andClass:[NSNumber class]]; - - if (sessionTimeoutValue != nil) { - [self dispatchAsync:^{ - [YMMYandexMetrica setSessionTimeout:sessionTimeoutValue.unsignedIntegerValue]; - }]; - } -} - -- (void)setReportCrashesEnabled:(CDVInvokedUrlCommand *)command +- (void)setLocationTracking:(CDVInvokedUrlCommand *)command { NSNumber *enabledValue = [command argumentAtIndex:0 withDefault:nil andClass:[NSNumber class]]; if (enabledValue != nil) { [self dispatchAsync:^{ - [YMMYandexMetrica setReportCrashesEnabled:enabledValue.boolValue]; + [YMMYandexMetrica setLocationTracking:enabledValue.boolValue]; }]; } } -- (void)setLoggingEnabled:(CDVInvokedUrlCommand *)command -{ - [self dispatchAsync:^{ - [YMMYandexMetrica setLoggingEnabled:YES]; - }]; -} - -- (void)setCollectInstalledAppsEnabled:(CDVInvokedUrlCommand *)command -{ - // Do nothing. Not available for iOS platform. -} - #pragma mark - Utils - (void (^)(NSError *error))failureCallbackForCommand:(CDVInvokedUrlCommand *)command @@ -153,41 +100,41 @@ + (YMMYandexMetricaConfiguration *)configurationForDictionary:(NSDictionary *)co NSString *apiKey = configurationDictionary[@"apiKey"]; YMMYandexMetricaConfiguration *configuration = [[YMMYandexMetricaConfiguration alloc] initWithApiKey:apiKey]; - NSNumber *handleFirstActivationAsUpdateEnabled = configurationDictionary[@"handleFirstActivationAsUpdateEnabled"]; - NSNumber *trackLocationEnabled = configurationDictionary[@"trackLocationEnabled"]; + NSNumber *handleFirstActivationAsUpdate = configurationDictionary[@"handleFirstActivationAsUpdate"]; + NSNumber *locationTracking = configurationDictionary[@"locationTracking"]; NSNumber *sessionTimeout = configurationDictionary[@"sessionTimeout"]; - NSNumber *reportCrashesEnabled = configurationDictionary[@"reportCrashesEnabled"]; - NSString *customAppVersion = configurationDictionary[@"appVersion"]; - NSNumber *loggingEnabled = configurationDictionary[@"loggingEnabled"]; + NSNumber *crashReporting = configurationDictionary[@"crashReporting"]; + NSString *appVersion = configurationDictionary[@"appVersion"]; + NSNumber *logs = configurationDictionary[@"logs"]; NSDictionary *customLocationDictionary = configurationDictionary[@"location"]; NSDictionary *preloadInfoDictionary = configurationDictionary[@"preloadInfo"]; - if (handleFirstActivationAsUpdateEnabled != nil) { - configuration.handleFirstActivationAsUpdateEnabled = [handleFirstActivationAsUpdateEnabled boolValue]; + if (handleFirstActivationAsUpdate != nil) { + configuration.handleFirstActivationAsUpdate = [handleFirstActivationAsUpdate boolValue]; } - if (trackLocationEnabled != nil) { - configuration.trackLocationEnabled = [trackLocationEnabled boolValue]; + if (locationTracking != nil) { + configuration.locationTracking = [locationTracking boolValue]; } if (sessionTimeout != nil) { configuration.sessionTimeout = [sessionTimeout unsignedIntegerValue]; } - if (reportCrashesEnabled != nil) { - configuration.reportCrashesEnabled = [reportCrashesEnabled boolValue]; + if (crashReporting != nil) { + configuration.crashReporting = [crashReporting boolValue]; } - if (customAppVersion != nil) { - configuration.customAppVersion = customAppVersion; + if (appVersion != nil) { + configuration.appVersion = appVersion; } - if (loggingEnabled != nil) { - configuration.loggingEnabled = [loggingEnabled boolValue]; + if (logs != nil) { + configuration.logs = [logs boolValue]; } if (customLocationDictionary != nil) { - configuration.location = [self locationForDictionary:customLocationDictionary];; + configuration.location = [self locationForDictionary:customLocationDictionary]; } if (preloadInfoDictionary != nil) { NSString *trackingID = preloadInfoDictionary[@"trackingId"]; YMMYandexMetricaPreloadInfo *preloadInfo = [[YMMYandexMetricaPreloadInfo alloc] initWithTrackingIdentifier:trackingID]; - NSDictionary *additionalInfo = preloadInfoDictionary[@"additionalInfo"]; + NSDictionary *additionalInfo = preloadInfoDictionary[@"additionalParams"]; for (NSString *key in additionalInfo) { [preloadInfo setAdditionalInfo:additionalInfo[key] forKey:key]; } diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMCompletionBlocks.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMCompletionBlocks.h new file mode 100644 index 0000000..907f063 --- /dev/null +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMCompletionBlocks.h @@ -0,0 +1,21 @@ +/* + * Version for iOS + * © 2012–2019 YANDEX + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://yandex.com/legal/appmetrica_sdk_agreement/ + */ + +#ifndef YMMCompletionBlocks_h +#define YMMCompletionBlocks_h + +/** Identifiers callback block + + @param appMetricaDeviceID Contains retrieved appMetricaDeviceID + Empty appMetricaDeviceID may be returned if server by any reason did not provide identifier. + + @param error Error of NSURLErrorDomain. In a case of error appMetricaDeviceID param is nil. + */ +typedef void(^YMMAppMetricaDeviceIDRetrievingBlock)(NSString * _Nullable appMetricaDeviceID, NSError * _Nullable error); + +#endif /* YMMCompletionBlocks_h */ diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMProfileAttribute.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMProfileAttribute.h new file mode 100644 index 0000000..999a659 --- /dev/null +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMProfileAttribute.h @@ -0,0 +1,326 @@ +/* + * Version for iOS + * © 2012–2019 YANDEX + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://yandex.com/legal/appmetrica_sdk_agreement/ + */ + +#import + +#ifndef NS_SWIFT_NAME +#define NS_SWIFT_NAME(name) +#endif + +NS_ASSUME_NONNULL_BEGIN + +/** This class indicates user profile update. + */ +@interface YMMUserProfileUpdate : NSObject + +@end + +/** The name attribute protocol. + It enables setting user name for the profile. + + @warning The maximum length of the user profile name is 100 characters. + */ +@protocol YMMNameAttribute + +/** Updates the name attribute with the specified value. + + @param value Name attribute. It can contain up to 100 characters + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValue:(nullable NSString *)value; + +/** Resets the name attribute value. + + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValueReset; + +@end + +/** Gender enumeration. + */ +typedef NS_ENUM(NSUInteger, YMMGenderType) { + +/** Male gender type. + */ + YMMGenderTypeMale, + +/** Female gender type. + */ + YMMGenderTypeFemale, + +/** Other gender type. + You can set the `YMMGenderTypeOther` value to the gender attribute and pass additional info using the custom attribute. + */ + YMMGenderTypeOther, +}; + +/** The gender attribute protocol. + It enables linking user gender with the profile. + */ +@protocol YMMGenderAttribute + +/** Updates the gender attribute with the specified value. + + @param value One of the `YMMGenderType` enumeration values + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValue:(YMMGenderType)value; + +/** Resets the gender attribute value. + + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValueReset; + +@end + +/** The birth date attribute protocol. + It enables linking user birth date with the profile. + */ +@protocol YMMBirthDateAttribute + +/** Updates the birth date attribute with the specified value. + It calculates the birth year by using the following formula: + + Birth Year = currentYear - age. + + @param value Age of the user + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withAge:(NSUInteger)value; + +/** Updates the birth date attribute with the specified value. + This method sets the year of birth date. + + @param year Year of birth + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withYear:(NSUInteger)year NS_SWIFT_NAME(withDate(year:)); + +/** Updates the birth date attribute with the specified values. + This method sets the year and month of the birth date. + + @param year Year of birth + @param month Month of birth + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withYear:(NSUInteger)year + month:(NSUInteger)month NS_SWIFT_NAME(withDate(year:month:)); + +/** Updates the birth date attribute with the specified values. + This methods sets year, month and day of the month of the birth date. + + @param year Year of birth + @param month Month of birth + @param day Day of the month of birth + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withYear:(NSUInteger)year + month:(NSUInteger)month + day:(NSUInteger)day NS_SWIFT_NAME(withDate(year:month:day:)); + +/** Updates the birth date attribute with the specified value. + + @param dateComponents Birth date value + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withDateComponents:(NSDateComponents *)dateComponents NS_SWIFT_NAME(withDate(dateComponents:)); + +/** Resets the birth date attribute value. + + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValueReset; + +@end + +/** The NotificationsEnabled attribute protocol. + It indicates whether the user has enabled notifications for the application. + It enables setting notification status for the profile. + */ +@protocol YMMNotificationsEnabledAttribute + +/** Updates the NotificationsEnabled attribute with the specified value. + It indicates whether the user has enabled notifications for the application. + + @param value Notification state value + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValue:(BOOL)value; + +/** Resets the NotificationsEnabled attribute value. + + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValueReset; + +@end + +/** The string attribute protocol. + It enables creating custom string attribute for the profile. + + @warning The maximum length of the custom string attribute value is 200 characters. + */ +@protocol YMMCustomStringAttribute + +/** Updates the string attribute with the specified value. + + @param value String value. It can contain up to 200 characters + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValue:(nullable NSString *)value; + +/** Updates the attribute with the specified value only if the attribute value is undefined. + The method doesn't affect the value if it has been set earlier. + + @param value String value. It can contain up to 200 characters + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValueIfUndefined:(nullable NSString *)value; + +/** Resets the attribute value. + + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValueReset; + +@end + +/** The number attribute protocol. + It enables creating custom number attribute for the profile. + */ +@protocol YMMCustomNumberAttribute + +/** Updates the number attribute with the specified value. + + @param value Number value + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValue:(double)value; + +/** Updates the attribute with the specified value only if the attribute value is undefined. + The method doesn't affect the value if it has been set earlier. + + @param value Number value + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValueIfUndefined:(double)value; + +/** Resets the attribute value. + + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValueReset; + +@end + +/** The counter attribute protocol. + It enables creating custom counter for the profile. + */ +@protocol YMMCustomCounterAttribute +/** Updates the counter attribute value with the specified delt a value. + + @param value Delta value to change the counter attribute value + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withDelta:(double)value; + +@end + +/** The boolean attribute protocol. + It enables creating custom boolean attribute for the profile. + */ +@protocol YMMCustomBoolAttribute + +/** Updates the bool attribute with the specified value. + + @param value Bool value + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValue:(BOOL)value; + +/** Updates the attribute with the specified value only if the attribute value is undefined. + The method doesn't affect the value if it has been set earlier. + + @param value Bool value + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValueIfUndefined:(BOOL)value; + +/** Resets the attribute value. + + @return The `YMMUserProfileUpdate` object + */ +- (YMMUserProfileUpdate *)withValueReset; + +@end + +/** The attribute class + Attribute is a property of the user profile. + You can use predefined attributes (e.g. name, gender, etc.) or create your own. + AppMetrica allows you to create up to 100 custom attributes. + */ +@interface YMMProfileAttribute : NSObject + +/** Creates a name attribute. + + @return The `YMMNameAttribute` object + */ ++ (id)name; + +/** Creates a gender attribute. + + @return The `YMMGenderAttribute` object + */ ++ (id)gender; + +/** Creates a birth date attribute. + + @return The `YMMBirthDateAttribute` object + */ ++ (id)birthDate; + +/** Creates a NotificationsEnabled attribute. + It indicates whether the user has enabled notifications for the application. + + @return The `YMMNotificationsEnabledAttribute` object + */ ++ (id)notificationsEnabled; + +/** Creates a custom string attribute. + + @param name Attribute name. It can contain up to 200 characters + @return The `YMMCustomStringAttribute` object + */ ++ (id)customString:(NSString *)name; + +/** Creates a custom number attribute. + + @param name Attribute name. It can contain up to 200 characters + @return The `YMMCustomNumberAttribute` object + */ ++ (id)customNumber:(NSString *)name; + +/** Creates a custom counter attribute. + + @param name Attribute name. It can contain up to 200 characters + @return The `YMMCustomCounterAttribute` object + */ ++ (id)customCounter:(NSString *)name; + +/** Creates a custom boolean attribute. + + @param name Attribute name. It can contain up to 200 characters + @return The `YMMCustomBoolAttribute` object + */ ++ (id)customBool:(NSString *)name; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMReporterConfiguration.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMReporterConfiguration.h new file mode 100644 index 0000000..0581721 --- /dev/null +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMReporterConfiguration.h @@ -0,0 +1,73 @@ +/* + * Version for iOS + * © 2012–2019 YANDEX + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://yandex.com/legal/appmetrica_sdk_agreement/ + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YMMReporterConfiguration : NSObject + +/** Application key used to initialize the configuration. + */ +@property (nonatomic, copy, nullable, readonly) NSString *apiKey; + +/** A boolean value indicating whether statistics sending to the AppMetrica server is enabled. + + @note Disabling this option doesn't affect data sending from the main apiKey. + + By default, the statistics sending is enabled. + */ +@property (nonatomic, assign, readonly) BOOL statisticsSending; + +/** Session timeout (in seconds). + Time interval which determines for how long the application is considered active after being resigned. + */ +@property (nonatomic, assign, readonly) NSUInteger sessionTimeout; + +/** Logging activation status. + */ +@property (nonatomic, assign, readonly) BOOL logs; + +/** Initialize configuration with specified Application key. + + @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 NS_UNAVAILABLE; + +@end + +@interface YMMMutableReporterConfiguration : YMMReporterConfiguration + +/** A boolean value indicating whether statistics sending to the AppMetrica server is enabled. + + @note Disabling this option doesn't affect data sending from the main apiKey. + + By default, the statistics sending is enabled. + */ +@property (nonatomic, assign) BOOL statisticsSending; + +/** Session timeout (in seconds). + Time interval which determines for how long the application is considered active after being resigned. + */ +@property (nonatomic, assign) NSUInteger sessionTimeout; + +/** Enables/disables logging. + + By default logging is disabled. + */ +@property (nonatomic, assign) BOOL logs; + +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMRevenueInfo.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMRevenueInfo.h new file mode 100644 index 0000000..986f45f --- /dev/null +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMRevenueInfo.h @@ -0,0 +1,216 @@ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** The class to store revenue data. + It enables revenue tracking from in-app purchases and other purchases in your application. + + The Revenue object should be passed to the AppMetrica server by using the + `reportRevenue` method of the `YMMYandexMetrica` class. + + Revenue events are displayed in the AppMetrica Revenue report. + @note This interface has the mutable version `YMMMutableRevenueInfo`. + */ +@interface YMMRevenueInfo : NSObject + +/** Price of the products purchased. + It can be negative, e.g. for refunds. + + EXAMPLE: 0.99 + @warning This property is deprecated. Use priceDecimal instead. + */ +@property (nonatomic, assign, readonly) double price DEPRECATED_MSG_ATTRIBUTE("Use priceDecimal"); + +/** Price of the products purchased. + It can be negative, e.g. for refunds. + + @warning Maximal supported accuracy(a scale of decimal number) is 6 digits in fraction. + + EXAMPLE: 0.99 + */ +@property (nonatomic, strong, nullable, readonly) NSDecimalNumber *priceDecimal; + +/** Currency code of the purchase in the ISO 4217 format. + The value should contain 3 Latin letters in uppercase. + + EXAMPLE: RUB + + @warning If the value is not in the ISO 4217 format, the purchase is ignored. + */ +@property (nonatomic, copy, readonly) NSString *currency; + +/** Quantity of products purchased. + + @note Revenue = quantity * price. + @warning The value should be larger than 0. If the value is 0, the purchase is ignored. + */ +@property (nonatomic, assign, readonly) NSUInteger quantity; + +/** ID of the product purchased. + + @warning The value can contain up to 200 characters. + */ +@property (nonatomic, copy, nullable, readonly) NSString *productID; + +/** Information about the in-app purchase order from App Store. + It should contain the `transactionIdentifier` string value of the `SKPaymentTransaction` class. + + @note This value should be passed along with `receiptData` to verify the transaction. + + For more information, see + https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier + */ +@property (nonatomic, copy, nullable, readonly) NSString *transactionID; + +/** Details about the in-app purchase order from App Store. + @code + NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; + revenueInfo.receiptData = [NSData dataWithContentsOfURL:receiptURL]; + @endcode + @note You should get the receipt data before calling [[SKPaymentQueue defaultQueue] finishTransaction:transaction]. + @note This value should be passed along with `transactionID` to verify the transaction. + + For more information, see + https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html + */ +@property (nonatomic, copy, nullable, readonly) NSData *receiptData; + +/** Additional information to be passed about the purchase. + It should contain the `NSDictionary` object that can be converted to valid JSON. + For instance, it can be used for categorizing your products. + + @warning The maximum size of the value is 30 KB. + */ +@property (nonatomic, copy, nullable, readonly) NSDictionary *payload; + +/** Use the `initWithPrice:currency:` method instead. + */ +- (instancetype)init NS_UNAVAILABLE; + +/** Initializes the RevenueInfo object with the specified price value. + + @warning This initializer is deprecated. Use initWithPriceDecimal:currency: instead. + + @param price Price of the products purchased. It can be negative, e.g. for refunds. EXAMPLE: 0.99 + @param currency Currency code of the purchase in the ISO 4217 format. + The value should contain 3 Latin letters in uppercase. EXAMPLE: RUB + */ +- (instancetype)initWithPrice:(double)price currency:(NSString *)currency DEPRECATED_MSG_ATTRIBUTE("Use initWithPriceDecimal:currency:"); + +/** Initializes the RevenueInfo object with the specified price value. + + @warning Maximal supported accuracy(a scale of decimal number) of priceDecimal is 6 digits in fraction. + + @param priceDecimal Price of the products purchased. It can be negative, e.g. for refunds. EXAMPLE: 0.99 + @param currency Currency code of the purchase in the ISO 4217 format. + The value should contain 3 Latin letters in uppercase. EXAMPLE: RUB + */ +- (instancetype)initWithPriceDecimal:(NSDecimalNumber *)priceDecimal currency:(NSString *)currency; + +/** Initializes the RevenueInfo object with the following values: + + - price; + - currency; + - quantity; + - productID; + - transactionID; + - receiptData; + - payload. + + @param price Price of the products purchased. It can be negative, e.g. for refunds. EXAMPLE: 0.99 + @param currency Currency code of the purchase in the ISO 4217 format. The value should contain 3 Latin letters in uppercase. EXAMPLE: RUB + @param quantity Quantity of the products purchased. + @param productID ID of the product purchased. + @param transactionID Information about the in-app purchase order from App Store. + @param receiptData Details about the in-app purchase order from App Store. + @param payload Additional information to be passed about the purchase. + */ +- (instancetype)initWithPrice:(double)price + currency:(NSString *)currency + quantity:(NSUInteger)quantity + productID:(nullable NSString *)productID + transactionID:(nullable NSString *)transactionID + receiptData:(nullable NSData *)receiptData + payload:(nullable NSDictionary *)payload DEPRECATED_MSG_ATTRIBUTE("Use initWithPriceDecimal:..."); + +/** Initializes the RevenueInfo object with the following values: + + - priceDecimal; + - currency; + - quantity; + - productID; + - transactionID; + - receiptData; + - payload. + + @warning Maximal supported accuracy(a scale of decimal number) of priceDecimal is 6 digits in fraction. + + @param priceDecimal Price of the products purchased. It can be negative, e.g. for refunds. EXAMPLE: 0.99 + @param currency Currency code of the purchase in the ISO 4217 format. The value should contain 3 Latin letters in uppercase. EXAMPLE: RUB + @param quantity Quantity of the products purchased. + @param productID ID of the product purchased. + @param transactionID Information about the in-app purchase order from App Store. + @param receiptData Details about the in-app purchase order from App Store. + @param payload Additional information to be passed about the purchase. + */ +- (instancetype)initWithPriceDecimal:(NSDecimalNumber *)priceDecimal + currency:(NSString *)currency + quantity:(NSUInteger)quantity + productID:(nullable NSString *)productID + transactionID:(nullable NSString *)transactionID + receiptData:(nullable NSData *)receiptData + payload:(nullable NSDictionary *)payload; + +@end + +/** Mutable version of the `YMMRevenueInfo` class.*/ +@interface YMMMutableRevenueInfo : YMMRevenueInfo + +/** Quantity of products purchased. + + @note Revenue = quantity * price. + @warning The value should be larger than 0. If the value is 0, the purchase is ignored. + */ +@property (nonatomic, assign) NSUInteger quantity; + +/** ID of the product purchased. + + @warning The value can contain up to 200 characters. + */ +@property (nonatomic, copy) NSString *productID; + +/** Information about the in-app purchase order from App Store. + It should contain the `transactionIdentifier` string value of the `SKPaymentTransaction` class. + + @note This value should be passed along with `receiptData` to verify the transaction. + + For more information, see + https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier + */ +@property (nonatomic, copy) NSString *transactionID; + +/** Details about the in-app purchase order from App Store. + @code + NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; + revenueInfo.receiptData = [NSData dataWithContentsOfURL:receiptURL]; + @endcode + @note You should get the receipt data before calling [[SKPaymentQueue defaultQueue] finishTransaction:transaction]. + @note This value should be passed along with `transactionID` to verify the transaction. + + For more information, see + https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html + */ +@property (nonatomic, copy) NSData *receiptData; + +/** Additional information to be passed about the purchase. + It should contain the `NSDictionary` object that can be converted to valid JSON. + For instance, it can be used for categorizing your products. + + @warning The maximum size of the value is 30 KB. + */ +@property (nonatomic, copy) NSDictionary *payload; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMUserProfile.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMUserProfile.h new file mode 100644 index 0000000..23ec96a --- /dev/null +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMUserProfile.h @@ -0,0 +1,59 @@ +/* + * Version for iOS + * © 2012–2019 YANDEX + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://yandex.com/legal/appmetrica_sdk_agreement/ + */ + +#import + +@class YMMUserProfileUpdate; + +NS_ASSUME_NONNULL_BEGIN + +/** The class to store a user profile. + User profile is a set of user attributes. + User profile details are displayed in the AppMetrica User profiles report. + + The UserProfile object should be passed to the AppMetrica server by using the `reportUserProfile` + method of the `YMMYandexMetrica` class. + + AppMetrica has some predefined attributes. You can use them or create own custom attributes. Use the + `YMMProfileAttribute` interface to create attributes. + + User profiles are stored on the AppMetrica server. + */ +@interface YMMUserProfile : NSObject + +/** An array with applied attributes. + */ +@property (nonatomic, copy, readonly) NSArray *updates; + +/** Initialize user profile with specified applied attributes. + + @param updates An array with profile updates + */ +- (instancetype)initWithUpdates:(NSArray *)updates; + +@end + +/** Mutable version of the `YMMUserProfile` class. + */ +@interface YMMMutableUserProfile : YMMUserProfile + +/** Applies single user profile update. + + @param update The `YMMUserProfileUpdate` object + */ +- (void)apply:(YMMUserProfileUpdate *)update; + +/** Applies user profile updates. + + @param updatesArray The array of `YMMUserProfileUpdate` objects + */ +- (void)applyFromArray:(NSArray *)updatesArray; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMVersion.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMVersion.h index f7c590c..2040111 100644 --- a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMVersion.h +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMVersion.h @@ -1,6 +1,6 @@ /* * Version for iOS - * © 2012–2017 YANDEX + * © 2012–2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ @@ -9,10 +9,13 @@ #ifndef __YMM_VERSION_H__ #define __YMM_VERSION_H__ -#define YMM_VERSION_MAJOR 2 -#define YMM_VERSION_MINOR 9 -#define YMM_VERSION_PATCH 8 +#define YMM_VERSION_MAJOR 3 +#define YMM_VERSION_MINOR 7 +#define YMM_VERSION_PATCH 1 -#define YMM_BUILD_NUMBER 11459 +// This line is uncommented in pre-releases. +// #define YMM_VERSION_PRERELEASE_ID "rc.1" + +#define YMM_BUILD_NUMBER 15098 #endif // __YMM_VERSION_H__ diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetrica.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetrica.h index aafcde4..ff0f4a9 100644 --- a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetrica.h +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetrica.h @@ -1,15 +1,19 @@ /* * Version for iOS - * © 2012–2017 YANDEX + * © 2012–2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ */ #import +#import "YMMCompletionBlocks.h" @class CLLocation; @class YMMYandexMetricaConfiguration; +@class YMMReporterConfiguration; +@class YMMUserProfile; +@class YMMRevenueInfo; @protocol YMMYandexMetricaReporting; NS_ASSUME_NONNULL_BEGIN @@ -20,18 +24,13 @@ typedef NS_ENUM(NSInteger, YMMYandexMetricaEventErrorCode) { YMMYandexMetricaEventErrorCodeInitializationError = 1000, YMMYandexMetricaEventErrorCodeInvalidName = 1001, YMMYandexMetricaEventErrorCodeJsonSerializationError = 1002, + YMMYandexMetricaEventErrorCodeInvalidRevenueInfo = 1003, + YMMYandexMetricaEventErrorCodeEmptyUserProfile = 1004, + YMMYandexMetricaEventErrorCodeNoCrashLibrary = 1005, }; @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. @@ -44,7 +43,7 @@ typedef NS_ENUM(NSInteger, YMMYandexMetricaEventErrorCode) { /** 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. + @param onFailure Block to be executed if an error occurs while reporting, the error is passed as block argument. */ + (void)reportEvent:(NSString *)message onFailure:(nullable void (^)(NSError *error))onFailure; @@ -53,7 +52,7 @@ typedef NS_ENUM(NSInteger, YMMYandexMetricaEventErrorCode) { @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. + @param onFailure Block to be executed if an error occurs while reporting, the error is passed as block argument. */ + (void)reportEvent:(NSString *)message parameters:(nullable NSDictionary *)params @@ -63,75 +62,73 @@ typedef NS_ENUM(NSInteger, YMMYandexMetricaEventErrorCode) { @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. + @param onFailure Block to be executed if an error occurs 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' +/** Sends information about the user profile. - @param location Custom device location to be reported. + @param userProfile The `YMMUserProfile` object. Contains user profile information. + @param onFailure Block to be executed if an error occurs while reporting, the error is passed as block argument. */ -+ (void)setLocation:(nullable CLLocation *)location; ++ (void)reportUserProfile:(YMMUserProfile *)userProfile + onFailure:(nullable void (^)(NSError *error))onFailure; -/** Setting session timeout (in seconds). +/** Sends information about the purchase. - @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. + @param revenueInfo The `YMMRevenueInfo` object. Contains purchase information + @param onFailure Block to be executed if an error occurs while reporting, the error is passed as block argument. */ -+ (void)setSessionTimeout:(NSUInteger)sessionTimeoutSeconds; ++ (void)reportRevenue:(YMMRevenueInfo *)revenueInfo + onFailure:(nullable void (^)(NSError *error))onFailure; -/** Tracking app crashes. +/** Sets the ID of the user profile. - @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. + @warning The value can contain up to 200 characters + @param userProfileID The custom user profile ID */ -+ (void)setReportCrashesEnabled:(BOOL)enabled; ++ (void)setUserProfileID:(nullable NSString *)userProfileID; -/** Setting the arbitrary application version. +/** Enables/disables statistics sending to the AppMetrica server. - @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; + @note Disabling this option also turns off data sending from the reporters that initialized for different apiKey. -/** Enable or disable logging. + @param enabled Flag indicating whether the statistics sending is enabled. By default, the sending is enabled. + */ ++ (void)setStatisticsSending:(BOOL)enabled; - @param isEnabled Boolean value to enable or disable logging. By default logging is disabled. +/** Enables/disables 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)setLoggingEnabled:(BOOL)isEnabled; ++ (void)setLocationTracking:(BOOL)enabled; -/** 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. +/** Sets location to AppMetrica. + To enable AppMetrica to use this location trackLocationEnabled should be 'YES' - @param value The error environment value. - @param key The error environment key. + @param location Custom device location to be reported. */ -+ (void)setEnvironmentValue:(nullable NSString *)value forKey:(NSString *)key; ++ (void)setLocation:(nullable CLLocation *)location; /** Retrieves current version of library. */ + (NSString *)libraryVersion; -/** Enables AppMetrica's tracking mechanism by providing application's url scheme. +/** Retrieves unique AppMetrica device identifier. It is used to identify a device in the statistics. - @param urlScheme Application's deep link scheme. Scheme should be registered in CFBundleURLTypes Info.plist section. + @note AppMetrica device ID is used in the Logs API and Post API as 'appmetrica_device_id'. + + @param queue Queue for the block to be dispatched to. If nil, main queue is used. + @param block Block will be dispatched upon identifier becoming available or in a case of error. */ -+ (BOOL)enableTrackingWithURLScheme:(NSURL *)urlScheme NS_EXTENSION_UNAVAILABLE_IOS("") NS_AVAILABLE_IOS(9_0); ++ (void)requestAppMetricaDeviceIDWithCompletionQueue:(nullable dispatch_queue_t)queue + completionBlock:(YMMAppMetricaDeviceIDRetrievingBlock)block; /** Handles the URL that has opened the application. Reports the URL for deep links tracking. @@ -141,7 +138,17 @@ typedef NS_ENUM(NSInteger, YMMYandexMetricaEventErrorCode) { */ + (BOOL)handleOpenURL:(NSURL *)url; +/** Activates reporter with specific configuration. + + @param configuration Configuration combines all reporter 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)activateReporterWithConfiguration:(YMMReporterConfiguration *)configuration; + /** Returns id that can send events to specific API key. + To customize configuration of reporter activate with 'activateReporterWithConfiguration:' method first. @param apiKey Api key to send events to. @return id that conforms to YMMYandexMetricaReporting and handles @@ -152,16 +159,34 @@ typedef NS_ENUM(NSInteger, YMMYandexMetricaEventErrorCode) { /** * Sets referral URL for this installation. This might be required to track some specific traffic sources like Facebook. * @param url referral URL value. + * @warning Referral URL reporting is no longer available. */ -+ (void)reportReferralUrl:(NSURL *)url; ++ (void)reportReferralUrl:(NSURL *)url DEPRECATED_MSG_ATTRIBUTE("Referral URL reporting is no longer available"); -@end +/** Sends all stored events from the buffer. + + AppMetrica SDK doesn't send events immediately after they occurred. It stores events data in the buffer. + This method sends all the data from the buffer and flushes it. + Use the method to force stored events sending after important checkpoints of user scenarios. + + @warning Frequent use of the method can lead to increasing outgoing internet traffic and energy consumption. + */ ++ (void)sendEventsBuffer; -@interface YMMYandexMetrica (YMMYandexMetricaDeprecatedOrUnavailable) +/** Resumes the last session or creates a new one if it has been expired. + + @warning You should disable the automatic tracking before using this method. + See the sessionsAutoTracking property of YMMYandexMetricaConfiguration. + */ ++ (void)resumeSession; -+ (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"))); +/** Pauses the current session. + All events reported after calling this method and till the session timeout will still join this session. + + @warning You should disable the automatic tracking before using this method. + See the sessionsAutoTracking property of YMMYandexMetricaConfiguration. + */ ++ (void)pauseSession; @end diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaConfiguration.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaConfiguration.h index 28d31e7..72d6027 100644 --- a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaConfiguration.h +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaConfiguration.h @@ -1,6 +1,6 @@ /* * Version for iOS - * © 2012–2017 YANDEX + * © 2012–2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ @@ -36,7 +36,35 @@ NS_ASSUME_NONNULL_BEGIN By default this option is disabled. */ -@property (nonatomic, assign) BOOL handleFirstActivationAsUpdateEnabled; +@property (nonatomic, assign) BOOL handleFirstActivationAsUpdate; + +/** Whether activation of AppMetrica should be considered as the start of a session. + If this option is disabled session starts at UIApplicationDidBecomeActiveNotification. + + The option is disabled by default. Enable this property if you want events that are reported after activation to join + the current session. + */ +@property (nonatomic, assign) BOOL handleActivationAsSessionStart; + +/** Whether AppMetrica should automatically track session starts and ends. + AppMetrica uses UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification notifications + to track sessions. + + The maximum length of the session is 24 hours. To continue the session after 24 hours, you should manually + invoke the resumeSession method. + + The option is enabled by default. If the option is disabled, you should manually control the session + using pauseSession and resumeSession methods. + */ +@property (nonatomic, assign) BOOL sessionsAutoTracking; + +/** A boolean value indicating whether statistics sending to the AppMetrica server is enabled. + + @note Disabling this option also turns off data sending from the reporters that initialized for different apiKey. + + By default, the statistics sending is enabled. + */ +@property (nonatomic, assign) BOOL statisticsSending; /** Enable/disable location reporting to AppMetrica. If enabled and location set via setLocation: method - that location would be used. @@ -45,7 +73,7 @@ NS_ASSUME_NONNULL_BEGIN Enabled by default. */ -@property (nonatomic, assign) BOOL trackLocationEnabled; +@property (nonatomic, assign) BOOL locationTracking; /** Set/get location to AppMetrica To enable AppMetrica to use this location trackLocationEnabled should be 'YES' @@ -67,19 +95,19 @@ NS_ASSUME_NONNULL_BEGIN Enabled by default. To disable crash tracking, set the parameter value to false. */ -@property (nonatomic, assign) BOOL reportCrashesEnabled; +@property (nonatomic, assign) BOOL crashReporting; /** 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; +@property (nonatomic, copy, nullable) NSString *appVersion; /** Enable/disable logging. By default logging is disabled. */ -@property (nonatomic, assign) BOOL loggingEnabled; +@property (nonatomic, assign) BOOL logs; /** Set/get preload info, which is used for tracking preload installs. Additional info could be https://appmetrica.yandex.com diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaPreloadInfo.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaPreloadInfo.h index 9eb8913..822a9c9 100644 --- a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaPreloadInfo.h +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaPreloadInfo.h @@ -1,6 +1,6 @@ /* * Version for iOS - * © 2012–2017 YANDEX + * © 2012–2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaReporting.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaReporting.h index bae693c..b746d70 100644 --- a/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaReporting.h +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YMMYandexMetricaReporting.h @@ -1,6 +1,6 @@ /* * Version for iOS - * © 2012–2017 YANDEX + * © 2012–2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ @@ -8,6 +8,9 @@ #import +@class YMMUserProfile; +@class YMMRevenueInfo; + NS_ASSUME_NONNULL_BEGIN /** YMMYandexMetricaReporting protocol groups methods that are used by custom reporting objects. @@ -17,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN /** 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. + @param onFailure Block to be executed if an error occurs while reporting, the error is passed as block argument. */ - (void)reportEvent:(NSString *)name onFailure:(nullable void (^)(NSError *error))onFailure; @@ -26,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN @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. + @param onFailure Block to be executed if an error occurs while reporting, the error is passed as block argument. */ - (void)reportEvent:(NSString *)name parameters:(nullable NSDictionary *)params @@ -36,12 +39,35 @@ NS_ASSUME_NONNULL_BEGIN @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. + @param onFailure Block to be executed if an error occurs while reporting, the error is passed as block argument. */ - (void)reportError:(NSString *)name exception:(nullable NSException *)exception onFailure:(nullable void (^)(NSError *error))onFailure; +/** Sends information about the user profile. + + @param userProfile The `YMMUserProfile` object. Contains user profile information. + @param onFailure Block to be executed if an error occurs while reporting, the error is passed as block argument. + */ +- (void)reportUserProfile:(YMMUserProfile *)userProfile + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Sends information about the purchase. + + @param revenueInfo The `YMMRevenueInfo` object. Contains purchase information. + @param onFailure Block to be executed if an error occurs while reporting, the error is passed as block argument. + */ +- (void)reportRevenue:(YMMRevenueInfo *)revenueInfo + onFailure:(nullable void (^)(NSError *error))onFailure; + +/** Sets the ID of the user profile. + + @warning The value can contain up to 200 characters. + @param userProfileID The custom user profile ID. + */ +- (void)setUserProfileID:(nullable NSString *)userProfileID; + /** 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. */ @@ -53,6 +79,24 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)pauseSession; +/** Enables/disables statistics sending to the AppMetrica server. + + @note Disabling this option doesn't affect data sending from the main apiKey. + + @param enabled Flag indicating whether the statistics sending is enabled. By default, the sending is enabled. + */ +- (void)setStatisticsSending:(BOOL)enabled; + +/** Sends all stored events from the buffer. + + AppMetrica SDK doesn't send events immediately after they occurred. It stores events data in the buffer. + This method sends all the data from the buffer and flushes it. + Use the method to force stored events sending after important checkpoints of user scenarios. + + @warning Frequent use of the method can lead to increasing outgoing internet traffic and energy consumption. + */ +- (void)sendEventsBuffer; + @end NS_ASSUME_NONNULL_END diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YandexMobileMetrica-umbrella.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YandexMobileMetrica-umbrella.h new file mode 100644 index 0000000..f3c344b --- /dev/null +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YandexMobileMetrica-umbrella.h @@ -0,0 +1,9 @@ +/* + * Version for iOS + * © 2012–2019 YANDEX + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://yandex.com/legal/appmetrica_sdk_agreement/ + */ + +#import "YandexMobileMetrica.h" diff --git a/platforms/ios/YandexMobileMetrica.framework/Headers/YandexMobileMetrica.h b/platforms/ios/YandexMobileMetrica.framework/Headers/YandexMobileMetrica.h index 06d009f..33fe574 100644 --- a/platforms/ios/YandexMobileMetrica.framework/Headers/YandexMobileMetrica.h +++ b/platforms/ios/YandexMobileMetrica.framework/Headers/YandexMobileMetrica.h @@ -1,6 +1,6 @@ /* * Version for iOS - * © 2012–2017 YANDEX + * © 2012–2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ @@ -10,12 +10,20 @@ #import "YMMYandexMetrica.h" #import "YMMVersion.h" #import "YMMYandexMetricaConfiguration.h" + #import "YMMReporterConfiguration.h" #import "YMMYandexMetricaReporting.h" #import "YMMYandexMetricaPreloadInfo.h" + #import "YMMProfileAttribute.h" + #import "YMMUserProfile.h" + #import "YMMRevenueInfo.h" #else #import #import #import + #import #import #import + #import + #import + #import #endif diff --git a/platforms/ios/YandexMobileMetrica.framework/Modules/module.modulemap b/platforms/ios/YandexMobileMetrica.framework/Modules/module.modulemap index 1f9db92..19dd92a 100644 --- a/platforms/ios/YandexMobileMetrica.framework/Modules/module.modulemap +++ b/platforms/ios/YandexMobileMetrica.framework/Modules/module.modulemap @@ -1,6 +1,6 @@ framework module YandexMobileMetrica { - umbrella header "YandexMobileMetrica.h" + umbrella header "YandexMobileMetrica-umbrella.h" - export * - module * { export * } + export * + module * { export * } } diff --git a/platforms/ios/YandexMobileMetrica.framework/YandexMobileMetrica b/platforms/ios/YandexMobileMetrica.framework/YandexMobileMetrica index 590f939..062748b 100755 Binary files a/platforms/ios/YandexMobileMetrica.framework/YandexMobileMetrica and b/platforms/ios/YandexMobileMetrica.framework/YandexMobileMetrica differ diff --git a/platforms/ios/YandexMobileMetricaCrashes.framework/Headers/YandexMobileMetricaCrashes-umbrella.h b/platforms/ios/YandexMobileMetricaCrashes.framework/Headers/YandexMobileMetricaCrashes-umbrella.h new file mode 100644 index 0000000..dad15a7 --- /dev/null +++ b/platforms/ios/YandexMobileMetricaCrashes.framework/Headers/YandexMobileMetricaCrashes-umbrella.h @@ -0,0 +1,9 @@ +/* + * Version for iOS + * © 2012–2019 YANDEX + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://yandex.com/legal/appmetrica_sdk_agreement/ + */ + +// This framework has no headers diff --git a/platforms/ios/YandexMobileMetricaCrashes.framework/Modules/module.modulemap b/platforms/ios/YandexMobileMetricaCrashes.framework/Modules/module.modulemap new file mode 100644 index 0000000..d750a01 --- /dev/null +++ b/platforms/ios/YandexMobileMetricaCrashes.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module YandexMobileMetricaCrashes { + umbrella header "YandexMobileMetricaCrashes-umbrella.h" + + export * + module * { export * } +} diff --git a/platforms/ios/YandexMobileMetricaCrashes.framework/YandexMobileMetricaCrashes b/platforms/ios/YandexMobileMetricaCrashes.framework/YandexMobileMetricaCrashes new file mode 100755 index 0000000..e5003bf Binary files /dev/null and b/platforms/ios/YandexMobileMetricaCrashes.framework/YandexMobileMetricaCrashes differ diff --git a/plugin.xml b/plugin.xml index a100050..f20bb2f 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,8 +1,16 @@ + + + version="1.0.0"> AppMetrica Cordova/PhoneGap plugin for AppMetrica analytics tool Yandex, LLC @@ -42,6 +50,7 @@ + diff --git a/sample/cordova/.gitignore b/sample/cordova/.gitignore index 36115c9..7b88a59 100644 --- a/sample/cordova/.gitignore +++ b/sample/cordova/.gitignore @@ -5,3 +5,5 @@ platforms/* !/plugins/android.json !/plugins/fetch.json !/plugins/ios.json +package.json +package-lock.json diff --git a/sample/cordova/config.xml b/sample/cordova/config.xml index 59efcf3..2730454 100644 --- a/sample/cordova/config.xml +++ b/sample/cordova/config.xml @@ -1,14 +1,13 @@ - + AppMerica Cordova Sample A sample Apache Cordova application for AppMetrica plugin. - + Yandex, LLC - @@ -23,11 +22,13 @@ + + Track location for AppMetrica + + + + + - - - - - diff --git a/sample/cordova/plugins/android.json b/sample/cordova/plugins/android.json index 94fae42..219571a 100644 --- a/sample/cordova/plugins/android.json +++ b/sample/cordova/plugins/android.json @@ -1,25 +1,21 @@ { - "prepare_queue": { - "installed": [], - "uninstalled": [] + "prepare_queue": { + "installed": [], + "uninstalled": [] + }, + "config_munge": { + "files": {} + }, + "installed_plugins": { + "cordova-plugin-geolocation": { + "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" }, - "config_munge": { - "files": {} + "cordova-plugin-whitelist": { + "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" }, - "installed_plugins": { - "cordova-plugin-geolocation": { - "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" - }, - "cordova-plugin-whitelist": { - "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" - }, - "yandex-appmetrica-plugin-cordova": { - "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" - } - }, - "dependent_plugins": { - "cordova-plugin-compat": { - "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" - } + "yandex-appmetrica-plugin-cordova": { + "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" } -} \ No newline at end of file + }, + "dependent_plugins": {} +} diff --git a/sample/cordova/plugins/fetch.json b/sample/cordova/plugins/fetch.json index aa880bc..bd865fe 100644 --- a/sample/cordova/plugins/fetch.json +++ b/sample/cordova/plugins/fetch.json @@ -1,36 +1,26 @@ { - "cordova-plugin-whitelist": { - "source": { - "type": "registry", - "id": "cordova-plugin-whitelist@1" - }, - "is_top_level": true, - "variables": {} + "cordova-plugin-whitelist": { + "source": { + "type": "registry", + "id": "cordova-plugin-whitelist@~1.3.4" }, - "yandex-appmetrica-plugin-cordova": { - "source": { - "type": "local", - "path": "../.." - }, - "is_top_level": true, - "variables": {} + "is_top_level": true, + "variables": {} + }, + "cordova-plugin-geolocation": { + "source": { + "type": "registry", + "id": "cordova-plugin-geolocation@~4.0.2" }, - "cordova-plugin-geolocation": { - "source": { - "type": "registry", - "id": "cordova-plugin-geolocation" - }, - "is_top_level": true, - "variables": { - "GEOLOCATION_USAGE_DESCRIPTION": "Track location for AppMetrica" - } + "is_top_level": true, + "variables": {} + }, + "yandex-appmetrica-plugin-cordova": { + "source": { + "type": "local", + "path": "../.." }, - "cordova-plugin-compat": { - "source": { - "type": "registry", - "id": "cordova-plugin-compat" - }, - "is_top_level": false, - "variables": {} - } + "is_top_level": true, + "variables": {} + } } \ No newline at end of file diff --git a/sample/cordova/plugins/ios.json b/sample/cordova/plugins/ios.json index ca98fe5..9ae4992 100644 --- a/sample/cordova/plugins/ios.json +++ b/sample/cordova/plugins/ios.json @@ -1,26 +1,21 @@ { - "prepare_queue": { - "installed": [], - "uninstalled": [] + "prepare_queue": { + "installed": [], + "uninstalled": [] + }, + "config_munge": { + "files": {} + }, + "installed_plugins": { + "cordova-plugin-geolocation": { + "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" }, - "config_munge": { - "files": {} + "cordova-plugin-whitelist": { + "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" }, - "installed_plugins": { - "cordova-plugin-geolocation": { - "GEOLOCATION_USAGE_DESCRIPTION": "Track location for AppMetrica", - "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" - }, - "cordova-plugin-whitelist": { - "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" - }, - "yandex-appmetrica-plugin-cordova": { - "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" - } - }, - "dependent_plugins": { - "cordova-plugin-compat": { - "PACKAGE_NAME": "com.yandex.mobile.appmetrica.plugin.cordova.sample" - } + "yandex-appmetrica-plugin-cordova": { + "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)" } -} \ No newline at end of file + }, + "dependent_plugins": {} +} diff --git a/sample/cordova/www/css/index.css b/sample/cordova/www/css/index.css index c06ca63..a8ddfb4 100644 --- a/sample/cordova/www/css/index.css +++ b/sample/cordova/www/css/index.css @@ -1,6 +1,6 @@ /* * Version for Cordova/PhoneGap - * © 2017 YANDEX + * © 2017-2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ diff --git a/sample/cordova/www/index.html b/sample/cordova/www/index.html index d294e71..766a2c4 100644 --- a/sample/cordova/www/index.html +++ b/sample/cordova/www/index.html @@ -1,11 +1,12 @@ - + ~ Version for Cordova/PhoneGap + ~ © 2017-2019 YANDEX + ~ You may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ https://yandex.com/legal/appmetrica_sdk_agreement/ + --> + + @@ -33,29 +34,8 @@

AppMetrica Cordova Plugin
Sample

- - - -
-
- - - -
-
- -
-
- - -
-
- - -
-
- - + +
diff --git a/sample/cordova/www/js/index.js b/sample/cordova/www/js/index.js index ed19697..914068a 100644 --- a/sample/cordova/www/js/index.js +++ b/sample/cordova/www/js/index.js @@ -1,6 +1,6 @@ /* * Version for Cordova/PhoneGap - * © 2017 YANDEX + * © 2017-2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ @@ -65,23 +65,8 @@ var actions = { timestamp: 1490352342 }); }, - setAppVersionBtn: function () { - window.appMetrica.setCustomAppVersion(document.getElementById('appVersionInput').value); - }, - setSessionTimeoutBtn: function () { - window.appMetrica.setSessionTimeout(parseInt(document.getElementById('sessionTimeoutInput').value)); - }, - setLoggingEnabledBtn: function () { - window.appMetrica.setLoggingEnabled(); - }, - trackLocationInput: function () { - window.appMetrica.setTrackLocationEnabled(document.getElementById('trackLocationInput').checked); - }, - collectInstalledAppsInput: function () { - window.appMetrica.setCollectInstalledAppsEnabled(document.getElementById('collectInstalledAppsInput').checked); - }, - reportCrashesInput: function () { - window.appMetrica.setReportCrashesEnabled(document.getElementById('reportCrashesInput').checked); + locationTracking: function () { + window.appMetrica.setLocationTracking(document.getElementById('locationTracking').checked); }, requestLocation: function () { var onSuccess = function(position) { @@ -104,7 +89,7 @@ var actions = { } navigator.geolocation.getCurrentPosition(onSuccess, onError); } -} +}; function forEach (arr, foo) { // Workaround for old browsers. diff --git a/www/appmetrica.js b/www/appmetrica.js index c291b94..0270f12 100644 --- a/www/appmetrica.js +++ b/www/appmetrica.js @@ -1,6 +1,6 @@ /* * Version for Cordova/PhoneGap - * © 2017 YANDEX + * © 2017-2019 YANDEX * You may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://yandex.com/legal/appmetrica_sdk_agreement/ @@ -29,15 +29,15 @@ module.exports = { * @param {Object} config * Object with activation properties: * apiKey {String} GUID-like API key from AppMetrica web interface. - * handleFirstActivationAsUpdateEnabled {Boolean?} First app launch with the AppMetrica SDK should be treated - * as the first launch of the updated app version, and not as - * the very first launch. Default: false. - * trackLocationEnabled {Boolean?} Allow or forbid the library to send device location data in reports. - * Default: true. + * handleFirstActivationAsUpdate {Boolean?} First app launch with the AppMetrica SDK should be treated + * as the first launch of the updated app version, and not as + * the very first launch. Default: false. + * locationTracking {Boolean?} Allow or forbid the library to send device location data in reports. + * Default: true. * sessionTimeout {Number?} Session timeout in seconds. Default: 10. - * reportCrashesEnabled {Boolean?} Monitor app crashes. Default: true. + * crashReporting {Boolean?} Monitor app crashes. Default: true. * appVersion {String?} Custom app version. Default: null. - * loggingEnabled {Boolean?} Logging. Default: false. + * logs {Boolean?} Logging. Default: false. * location {Object?} Custom location (default: null): * latitude {Number} Latitude. * longitude {Number} Longitude. @@ -49,8 +49,8 @@ module.exports = { * timestamp {Number?} Unix time stamp of location. * preloadInfo {Object?} Information for tracking pre-installed apps (Default: null): * trackingId {String} Identifier of tracker. - * additionalInfo {Object?} Additional information in key-value form. - * @see https://tech.yandex.com/appmetrica/doc/mobile-sdk-dg/concepts/mobilesdk-about-docpage/ + * additionalParams {Object?} Additional information in key-value form. + * @see https://appmetrica.yandex.com/docs/mobile-sdk-dg/concepts/mobilesdk-about.html */ activate: function (config) { appMetricaExec('activate', [config]); @@ -78,15 +78,6 @@ module.exports = { reportError: function (errorName, reason) { appMetricaExec('reportError', [errorName, reason]); }, - /** - * Setting the arbitrary application version. - * - * @param {String?} appVersion - * Application version to be reported. - */ - setCustomAppVersion: function (appVersion) { - appMetricaExec('setCustomAppVersion', [appVersion]); - }, /** * Custom geolocation of device. * @@ -103,56 +94,7 @@ module.exports = { * @param {Boolean} enabled * Flag indicating if reporting location to AppMetrica enabled. */ - setTrackLocationEnabled: function (enabled) { - appMetricaExec('setTrackLocationEnabled', [enabled]); - }, - /** - * Setting key - value data to be used as additional information, associated with future unhandled exception. - * If value is null, previously set key-value is removed. Does nothing if key hasn't been added. - * - * @param {String} key - * The error environment key. - * @param {String?} value - * The error environment value. - */ - setEnvironmentValue: function (key, value) { - appMetricaExec('setEnvironmentValue', [key, value]); - }, - /** - * Setting session timeout (in seconds). - * - * @param {Number} 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. - */ - setSessionTimeout: function (sessionTimeoutSeconds) { - appMetricaExec('setSessionTimeout', [sessionTimeoutSeconds]); - }, - /** - * Enable/disable app crashes tracking. - * - * @param {Boolean} enabled - * Flag indicating if reporting crashes to AppMetrica enabled. - */ - setReportCrashesEnabled: function (enabled) { - appMetricaExec('setReportCrashesEnabled', [enabled]); - }, - /** - * Enable logging. - */ - setLoggingEnabled: function () { - appMetricaExec('setLoggingEnabled', []); - }, - /** - * Enable/disable transmission of data about installed apps on the device. - * By default, sending data about installed apps is disabled. - * (Android only) - * - * @param {Boolean} enabled - * Flag indicating if reporting installed apps to AppMetrica enabled. - */ - setCollectInstalledAppsEnabled: function (enabled) { - appMetricaExec('setCollectInstalledAppsEnabled', [enabled]); + setLocationTracking: function (enabled) { + appMetricaExec('setLocationTracking', [enabled]); } -} +};