Skip to content

Commit

Permalink
Merge pull request #23 from capacitor-community/appcenter-analytics
Browse files Browse the repository at this point in the history
analytics appcenter sdk upgrade
  • Loading branch information
johnborges authored Jun 24, 2021
2 parents 18e4601 + c12a6fa commit 0377449
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 32 deletions.
10 changes: 10 additions & 0 deletions appcenter-analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Change Log

## 0.2.1

* Update `Appcenter/Analytics` to 4.2.0
* Update `AppCenterCapacitorShared` to 0.3.1
* Update `docgen` to 0.0.17

### Fixes
* correct void return type methods (iOS)
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Pod::Spec.new do |s|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
s.ios.deployment_target = '12.0'
s.dependency 'Capacitor'
s.dependency 'AppCenterCapacitorShared', '0.3.0'
s.dependency 'AppCenter/Analytics', '4.1.1'
s.dependency 'AppCenterCapacitorShared', '0.3.1'
s.dependency 'AppCenter/Analytics', '4.2.0'
s.static_framework = true
s.swift_version = '5.1'
end
21 changes: 21 additions & 0 deletions appcenter-analytics/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) COPYRIGHT_YEAR COPYRIGHT_HOLDER

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 9 additions & 17 deletions appcenter-analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</p>

<p align="center">
<img src="https://img.shields.io/maintenance/yes/2020?style=flat-square" />
<a href="https://github.com/capacitor-community/appcenter-sdk-capacitor/tree/master/appcenter-analytics/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/appcenter-sdk-capacitor/tree/master/appcenter-analytics/CI?style=flat-square" /></a>
<img src="https://img.shields.io/maintenance/yes/2021?style=flat-square" />
<a href="https://github.com/capacitor-community/appcenter-sdk-capacitor/tree/master/appcenter-analytics/actions?query=workflow%3A%22CI%22"></a>
<a href="https://www.npmjs.com/package/@capacitor-community/appcenter-analytics"><img src="https://img.shields.io/npm/l/@capacitor-community/appcenter-analytics?style=flat-square" /></a>
<br>
<a href="https://www.npmjs.com/package/@capacitor-community/appcenter-analytics"><img src="https://img.shields.io/npm/dw/@capacitor-community/appcenter-analytics?style=flat-square" /></a>
Expand Down Expand Up @@ -55,7 +55,7 @@ Once you add App Center Analytics to your app and the SDK is started, it will au
### enable(...)

```typescript
enable(options: { enableFlag: boolean; }) => any
enable(options: { enableFlag: boolean; }) => Promise<void>
```

You can enable and disable App Center Analytics at runtime. If you disable it, the SDK won't collect any more analytics information for the app.
Expand All @@ -64,8 +64,6 @@ You can enable and disable App Center Analytics at runtime. If you disable it, t
| ------------- | ------------------------------------- |
| **`options`** | <code>{ enableFlag: boolean; }</code> |

**Returns:** <code>any</code>

**Since:** 0.1.0

--------------------
Expand All @@ -74,12 +72,12 @@ You can enable and disable App Center Analytics at runtime. If you disable it, t
### isEnabled()

```typescript
isEnabled() => any
isEnabled() => Promise<{ value: boolean; }>
```

Check if Analytics is enabled or not.

**Returns:** <code>any</code>
**Returns:** <code>Promise&lt;{ value: boolean; }&gt;</code>

**Since:** 0.0.1

Expand All @@ -89,13 +87,11 @@ Check if Analytics is enabled or not.
### pause()

```typescript
pause() => any
pause() => Promise<void>
```

Pause transmission of Analytics logs. While paused, Analytics logs are saved to disk.

**Returns:** <code>any</code>

**Since:** 0.1.0

--------------------
Expand All @@ -104,13 +100,11 @@ Pause transmission of Analytics logs. While paused, Analytics logs are saved to
### resume()

```typescript
resume() => any
resume() => Promise<void>
```

Resume transmission of Analytics logs. Any Analytics logs that accumulated on disk while paused are sent to the server.

**Returns:** <code>any</code>

**Since:** 0.1.0

--------------------
Expand All @@ -119,7 +113,7 @@ Resume transmission of Analytics logs. Any Analytics logs that accumulated on di
### trackEvent(...)

```typescript
trackEvent(options: AnalyticsEvent) => any
trackEvent(options: AnalyticsEvent) => Promise<void>
```

Track an event with optional custom properties to know what's happening in your app, understand user actions, and see the aggregates in the App Center portal.
Expand All @@ -128,8 +122,6 @@ Track an event with optional custom properties to know what's happening in your
| ------------- | --------------------------------------------------------- |
| **`options`** | <code><a href="#analyticsevent">AnalyticsEvent</a></code> |

**Returns:** <code>any</code>

**Since:** 0.1.0

--------------------
Expand All @@ -144,6 +136,6 @@ Track an event with optional custom properties to know what's happening in your
| ---------------- | --------------------------------------- | ------------------------------------ |
| **`name`** | <code>string</code> | 256 character limit |
| **`properties`** | <code>{ [key: string]: string; }</code> | Only 20 properties allowed per event |
| **`flag`** | <code>"normal" \| "critical"</code> | |
| **`flag`** | <code>'normal' \| 'critical'</code> | |

</docgen-api>
8 changes: 4 additions & 4 deletions appcenter-analytics/ios/Plugin/AppCenterAnalyticsPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// Define the plugin using the CAP_PLUGIN Macro, and
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
CAP_PLUGIN(AnalyticsPlugin, "Analytics",
CAP_PLUGIN_METHOD(enable, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(enable, CAPPluginReturnNone);
CAP_PLUGIN_METHOD(isEnabled, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(pause, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(resume, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(trackEvent, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(pause, CAPPluginReturnNone);
CAP_PLUGIN_METHOD(resume, CAPPluginReturnNone);
CAP_PLUGIN_METHOD(trackEvent, CAPPluginReturnNone);
)
4 changes: 2 additions & 2 deletions appcenter-analytics/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ end

target 'Plugin' do
capacitor_pods
pod 'AppCenterCapacitorShared', '0.3.0'
pod 'AppCenter/Analytics', '4.1.1'
pod 'AppCenterCapacitorShared', '0.3.1'
pod 'AppCenter/Analytics', '4.2.0'
end

target 'PluginTests' do
Expand Down
11 changes: 7 additions & 4 deletions appcenter-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@capacitor-community/appcenter-analytics",
"version": "0.2.0",
"description": "App Center Analytics will help you understand more about your app users and their behavior when using your app.",
"version": "0.2.1",
"description": "Capacitor plugin for AppCenter Analytics",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
Expand All @@ -25,7 +25,10 @@
"keywords": [
"capacitor",
"plugin",
"native"
"appcenter",
"analytics",
"azure",
"microsoft"
],
"scripts": {
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
Expand All @@ -46,7 +49,7 @@
"devDependencies": {
"@capacitor/android": "3.0.0",
"@capacitor/core": "3.0.0",
"@capacitor/docgen": "^0.0.10",
"@capacitor/docgen": "^0.0.17",
"@capacitor/ios": "3.0.0",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^1.0.1",
Expand Down
14 changes: 12 additions & 2 deletions appcenter-analytics/src/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
export interface AnalyticsEvent {
/** 256 character limit */
/**
* 256 character limit
*/
name: string,
/** Only 20 properties allowed per event */
/**
* Only 20 properties allowed per event
*/
properties?: {[key: string]: string},
flag?: 'normal' | 'critical'
}
Expand All @@ -10,6 +14,7 @@ export interface AnalyticsPlugin {
/**
* You can enable and disable App Center Analytics at runtime. If you disable it, the SDK won't collect any more analytics information for the app.
* @param {enableFlag: boolean} options
* @returns {Promise<void>}
* @since 0.1.0
*/
enable(options: {enableFlag: boolean}): Promise<void>;
Expand All @@ -21,18 +26,23 @@ export interface AnalyticsPlugin {
isEnabled(): Promise<{value: boolean}>;
/**
* Pause transmission of Analytics logs. While paused, Analytics logs are saved to disk.
* @returns {Promise<void>}
* @since 0.1.0
*/
pause(): Promise<void>;
/**
* Resume transmission of Analytics logs. Any Analytics logs that accumulated on disk while paused are sent to the server.
* @returns {Promise<void>}
* @since 0.1.0
*/
resume(): Promise<void>;
/**
* Track an event with optional custom properties to know what's happening in your app, understand user actions, and see the aggregates in the App Center portal.
* @param {AnalyticsEvent} options
* @returns {Promise<void>}
* @example
* import Analytics from '@capacitor-community/appcenter-analytics';
*
* Analytics.trackEvent("Video Clicked")
* Analytics.trackEvent('Video Clicked', {"Category" : "Music", "FileName" : "favorite.avi"}, flag: 'critical')
* @since 0.1.0
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"@capacitor-community/appcenter": "^0.4.0",
"@capacitor-community/appcenter-analytics": "0.2.0",
"@capacitor-community/appcenter-analytics": "0.2.1",
"@capacitor-community/appcenter-crashes": "^0.3.0",
"@capacitor/app": "^1.0.0",
"@capacitor/cli": "3.0.0",
Expand Down

0 comments on commit 0377449

Please sign in to comment.