Code Monkey home page Code Monkey logo

deepwall-flutter-sdk's Introduction

DeepWall (flutter sdk)

  • This package gives' wrapper methods for deepwall sdks. iOS - Android

  • Before implementing this package, you need to have api_key and list of actions.

  • You can get api_key and actions from DeepWall Dashboard


Version Guidance

Version Status
1.x Non null safety
2.x Null safety

Getting started

Add below code into your pubspec.yaml file under dependencies section.

deepwall_flutter_plugin:
    git:
      url: https://github.com/Teknasyon-Teknoloji/deepwall-flutter-sdk.git
      ref: 3.0.1

And run $ flutter pub get

Installation Notes

  • IOS

    • Set minimum ios version 10.0 or higher in ios/Podfile like: platform :ios, '10.0'
    • Add use_frameworks! into ios/Podfile if not exists.
    • Run $ cd ios && pod install
  • ANDROID

    • Set kotlin_version "1.4.32" or higher in android/build.gradle
    • Set minSdkVersion to 21 or higher in android/app/build.gradle
    • Add code below into android/build.gradle (Add into repositories under allprojects)
  maven { url 'https://raw.githubusercontent.com/Teknasyon-Teknoloji/deepwall-android-sdk/master/' }
  maven { url 'https://developer.huawei.com/repo/' }

Usage

Let's start

  • On application start you need to initialize sdk with api key and environment.
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';
import 'package:deepwall_flutter_plugin/enums/environments.dart';

DeepwallFlutterPlugin.initialize('{API_KEY}', Environment.PRODUCTION.value);
  • Before requesting any paywall you need to set UserProperties (device uuid, country, language). See all parameters
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

DeepwallFlutterPlugin.setUserProperties('UNIQUE_DEVICE_ID_HERE (UUID)', 'en-us', 'us');
  • After setting userProperties, you are ready for requesting paywall with an action key. You can find action key in DeepWall dashboard.
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

DeepwallFlutterPlugin.requestPaywall('{ACTION_KEY}', null);

// You can send extra parameter if needed as below
Map<String, Object> extraData = new HashMap();
extraData['sliderIndex'] = 2;
extraData['title'] = 'Deepwall';

DeepwallFlutterPlugin.requestPaywall('{ACTION_KEY}', extraData);
  • You can also close paywall.
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

DeepwallFlutterPlugin.closePaywall();
  • When any of userProperties is changed, you need to call updateUserProperties method. (For example if user changed application language)
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

DeepwallFlutterPlugin.updateUserProperties('fr-fr','fr');
  • You can validate receipts like below.
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';
import 'package:deepwall_flutter_plugin/enums/validate_receipt_types.dart';

DeepwallFlutterPlugin.validateReceipt(ReceiptValidationType.RESTORE.value);

Events

  • There is also bunch of events triggering before and after DeepWall Actions. You may listen any event like below.
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

StreamSubscription subscribeToStream =
    DeepwallFlutterPlugin.eventBus.on<DeepwallFlutterEvent>().listen((event) {
        // // access event.data
    });
  • Adding and removing event listener example
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

StreamSubscription subscribeToStream =
    DeepwallFlutterPlugin.eventBus.on<DeepwallFlutterEvent>().listen((event) {
        // // access event.data
    });

subscribeToStream.cancel();

iOS Only Methods

  • Requesting ATT Prompts
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

DeepwallFlutterPlugin.requestAppTracking('{ACTION_KEY}', null);

// You can send extra parameter if needed as below
Map<String, Object> extraData = new HashMap();
extraData['appName'] = 'My awesome app';
DeepwallFlutterPlugin.requestAppTracking('{ACTION_KEY}', extraData);
  • Sending extra data to paywall while it's open.
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

Map<String, Object> extraData = new HashMap();
extraData['appName'] = 'My awesome app';

DeepwallFlutterPlugin.sendExtraDataToPaywall('{ACTION_KEY}', extraData);

Android Only Methods

  • You can set orientation when calling requestPaywall method.
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';
import 'package:deepwall_flutter_plugin/enums/device_orientations.dart';

DeepwallFlutterPlugin.requestPaywall('{ACTION_KEY}', null, orientation: DeviceOrientations.PORTRAIT.value);
  • For consumable products, you need to mark the purchase as consumed for consumable product to be purchased again.
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

DeepwallFlutterPlugin.consumeProduct('consumable_product_id');
  • Use setProductUpgradePolicy method to set the product upgrade policy for Google Play apps.
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

DeepwallFlutterPlugin.setProductUpgradePolicy(
  ProrationMode.IMMEDIATE_WITHOUT_PRORATION.value,
  Policy.ENABLE_ALL_POLICIES.value
);
  • Use updateProductUpgradePolicy method to update the product upgrade policy within the app workflow before requesting paywalls.
import 'package:deepwall_flutter_plugin/deepwall_flutter_plugin.dart';

DeepwallFlutterPlugin.updateProductUpgradePolicy(
  ProrationMode.IMMEDIATE_WITHOUT_PRORATION.value,
  Policy.ENABLE_ALL_POLICIES.value
);

Notes

  • You may found complete list of events in lib/enums/events.dart or Native Sdk Page
  • UserProperties are:
    • uuid
    • country
    • language
    • environmentStyle
    • debugAdvertiseAttributions
    • phoneNumber
    • emailAddress
    • firstName
    • lastName

deepwall-flutter-sdk's People

Contributors

buraksyalcin avatar semiherdogan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.