-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dbaa185
Showing
21 changed files
with
1,162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*.pbxproj -text | ||
/.github export-ignore | ||
/example export-ignore | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/CHANGELOG.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
/.idea | ||
/.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
## [Unreleased](https://github.com/Teknasyon-Teknoloji/deepwall-cordova-sdk/compare/1.0.0...main) | ||
|
||
|
||
--- | ||
|
||
|
||
## 1.0.0 (2021-03-08) | ||
### Added | ||
- Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License | ||
|
||
Copyright (c) 2020 DeepWall. https://deepwall.com | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# DeepWall (deepwall-cordova-plugin) | ||
* This package gives wrapper methods for deepwall sdks. [iOS](https://github.com/Teknasyon-Teknoloji/deepwall-ios-sdk) - [Android](https://github.com/Teknasyon-Teknoloji/deepwall-android-sdk) | ||
|
||
* Before implementing this package, you need to have **api_key** and list of **actions**. | ||
|
||
* You can get api_key and actions from [DeepWall Dashboard](https://console.deepwall.com/) | ||
|
||
--- | ||
|
||
## Getting started | ||
|
||
`$ cordova plugin add https://github.com/Teknasyon-Teknoloji/deepwall-cordova-sdk.git#1.0.0` | ||
|
||
* After adding plugin in the dependency section, | ||
add `AndroidXEnabled` as `true` in the `config.xml` of your application. | ||
```xml | ||
<preference name="AndroidXEnabled" value="true" /> | ||
``` | ||
|
||
### Installation Notes | ||
- **IOS** | ||
- Set minimum ios version to `10.0` in `platforms/ios/Podfile` like: `platform :ios, '10.0'` | ||
- Add `use_frameworks!` into `platforms/ios/Podfile` if not exists. | ||
- Run `$ cd platforms/ios && pod install` | ||
|
||
- **ANDROID** | ||
- Set `minSdkVersion` to `21 in` `platforms/android/app/build.gradle` | ||
- Add `maven { url 'https://raw.githubusercontent.com/Teknasyon-Teknoloji/deepwall-android-sdk/master/' }` into `platforms/android/app/build.gradle` (Add into repositories under allprojects) | ||
|
||
--- | ||
|
||
## Usage | ||
|
||
### 1. Initialize DeepWall SDK | ||
- On application start you need to initialize sdk with api key and environment. | ||
```javascript | ||
cordova.DeepwallCordovaPlugin.initialize("API_KEY", Environments.PRODUCTION, function(response){ | ||
console.log(response); | ||
}, function(error){ | ||
console.log(error); | ||
}); | ||
``` | ||
|
||
### 2. set User Properties | ||
- Before requesting any paywall you need to set UserProperties (device uuid, country, language). [See all parameters](https://github.com/Teknasyon-Teknoloji/deepwall-ios-sdk#configuration) | ||
````javascript | ||
cordova.DeepwallCordovaPlugin.setUserProperties('UNIQUE_DEVICE_ID_HERE (UUID)','en-us','us', EnvironmentStyles.LIGHT, function(response){ | ||
console.log(response); | ||
}, function(error){ | ||
console.log(error); | ||
}); | ||
```` | ||
|
||
### 3. request Paywall | ||
- After setting userProperties, you are ready for requesting paywall with an action name. You can find action name in DeepWall dashboard. You can send extra paramteres as well. | ||
````javascript | ||
cordova.DeepwallCordovaPlugin.requestPaywall('AppLaunch',{}, function(response){ | ||
console.log(response); | ||
}, function(error){ | ||
console.log(error); | ||
}); | ||
```` | ||
|
||
### 4. close Paywall | ||
- You can also close paywall using: | ||
````javascript | ||
cordova.DeepwallCordovaPlugin.closePaywall(function(response){ | ||
console.log(response); | ||
}, function(error){ | ||
console.log(error); | ||
}); | ||
```` | ||
|
||
### 5. update userProperties | ||
- If any of userProperties is changed you need to call updateUserProperties method. (For example if user changed application language) | ||
````javascript | ||
cordova.DeepwallCordovaPlugin.updateUserProperties('fr-fr','fr',EnvironmentStyles.LIGHT, function(response){ | ||
console.log(response); | ||
}, function(error){ | ||
console.log(error); | ||
}); | ||
```` | ||
|
||
### 6. listen all Deepwall Events | ||
- There is also bunch of events triggering before and after DeepWall Actions. You may listen any action like below. | ||
````javascript | ||
cordova.DeepwallCordovaPlugin.observeEvents(function(response){ | ||
console.log(JSON.stringify(response)); | ||
// access response.data | ||
}, function(error){ | ||
console.log(error); | ||
}) | ||
```` | ||
|
||
## Notes | ||
- You may find complete list of _events_ in [enums/Events.js](./www/enums/Events.js) or [Native Sdk Page](https://github.com/Teknasyon-Teknoloji/deepwall-ios-sdk#event-handling) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Wait for the deviceready event | ||
// See https://cordova.apache.org/docs/en/latest/cordova/events/events.html#deviceready | ||
document.addEventListener('deviceready', onDeviceReady, false); | ||
|
||
function onDeviceReady() { | ||
cordova.DeepwallCordovaPlugin.initialize('API_KEY', Environments.SANDBOX); | ||
cordova.DeepwallCordovaPlugin.setUserProperties( | ||
'deepwall-test-device', | ||
'en', | ||
'en-en', | ||
EnvironmentStyles.LIGHT | ||
); | ||
|
||
// Listen all events | ||
cordova.DeepwallCordovaPlugin.observeEvents(function (response) { | ||
console.log('Event SUCCESS: ', JSON.stringify(response)); | ||
}, function (error) { | ||
console.log('Event ERROR: ', error); | ||
}); | ||
|
||
// Open Paywall | ||
cordova.DeepwallCordovaPlugin.requestPaywall('Settings', extraData = {}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "cordova-plugin-deepwall", | ||
"version": "1.0.0", | ||
"description": "Deepwall Cordova Wrapper", | ||
"homepage": "https://deepwall.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Teknasyon-Teknoloji/deepwall-cordova-sdk.git" | ||
}, | ||
"cordova": { | ||
"id": "cordova-plugin-deepwall", | ||
"platforms": [ | ||
"ios", | ||
"android" | ||
] | ||
}, | ||
"keywords": [ | ||
"ecosystem:cordova", | ||
"cordova-ios", | ||
"cordova-android" | ||
], | ||
"author": "Deepwall", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<plugin id="cordova-plugin-deepwall" | ||
version="1.0.0" | ||
xmlns="http://apache.org/cordova/ns/plugins/1.0" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<name>Deepwall</name> | ||
<dependency id="cordova-plugin-add-swift-support" version="2.0.2" /> | ||
<js-module name="DeepwallCordovaPlugin" src="www/DeepwallCordovaPlugin.js"> | ||
<clobbers target="cordova.DeepwallCordovaPlugin" /> | ||
</js-module> | ||
<js-module name="DeepwallException" src="www/enums/DeepwallException.js"> | ||
<clobbers target="DeepwallException" /> | ||
</js-module> | ||
<js-module name="Environments" src="www/enums/Environments.js"> | ||
<clobbers target="Environments" /> | ||
</js-module> | ||
<js-module name="EnvironmentStyles" src="www/enums/EnvironmentStyles.js"> | ||
<clobbers target="EnvironmentStyles" /> | ||
</js-module> | ||
<js-module name="ErrorCodes" src="www/enums/ErrorCodes.js"> | ||
<clobbers target="ErrorCodes" /> | ||
</js-module> | ||
<js-module name="ProrationTypes" src="www/enums/ProrationTypes.js"> | ||
<clobbers target="ProrationTypes" /> | ||
</js-module> | ||
<js-module name="PurchaseUpgradePolicy" src="www/enums/PurchaseUpgradePolicy.js"> | ||
<clobbers target="PurchaseUpgradePolicy" /> | ||
</js-module> | ||
<js-module name="ValidateReceiptTypes" src="www/enums/ValidateReceiptTypes.js"> | ||
<clobbers target="ValidateReceiptTypes" /> | ||
</js-module> | ||
<platform name="android"> | ||
<config-file parent="/*" target="res/xml/config.xml"> | ||
<feature name="DeepwallCordovaPlugin"> | ||
<param name="android-package" value="deepwallcordova.DeepwallCordovaPlugin" /> | ||
</feature> | ||
</config-file> | ||
<config-file parent="/*" target="AndroidManifest.xml" /> | ||
<source-file src="src/android/DeepwallCordovaPlugin.java" target-dir="src/deepwallcordova/DeepwallCordovaPlugin" /> | ||
<framework custom="true" src="src/android/plugin.gradle" type="gradleReference" /> | ||
<framework src="org.greenrobot:eventbus:3.2.0" /> | ||
</platform> | ||
<platform name="ios"> | ||
<config-file parent="/*" target="config.xml"> | ||
<feature name="DeepwallCordovaPlugin"> | ||
<param name="ios-package" value="DeepwallCordovaPlugin" /> | ||
</feature> | ||
</config-file> | ||
<header-file src="src/ios/bridging-header.h" /> | ||
<source-file src="src/ios/DeepwallCordovaPlugin.swift" /> | ||
<podspec> | ||
<pods use-frameworks="true"> | ||
<pod name="DeepWall"/> | ||
</pods> | ||
</podspec> | ||
</platform> | ||
</plugin> |
Oops, something went wrong.