/deepwallkids-ios-sdk

Deepwall iOS SDK for Kids Apps

Primary LanguageObjective-CMIT LicenseMIT

DeepWall Kids

Platform Cocoapods

End-to-end solution for building, managing and maintaining profitable mobile apps offering in-app purchases.

We have published iOS Kids SDK for kids category apps who want to use Deepwall.

Deepwall Kids SDK does not collect IDFA from user devices and excludes Adjust and AppsFlyer integrations, and ATT prompt support since Apple has specific requirements for kids category apps.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website.

DeepWall is available through CocoaPods. To install it, add the following lines to your Podfile.

  1. Add DeepWall pod.
use_frameworks!

pod 'DeepWallKids'
  1. Run pod install or pod update.
  2. Then, you could use DeepWall by adding import DeepWallKids to your project files.

Usage

Initialization

import DeepWallKids

let yourApiKey = "{YOUR_API_KEY}"
let environment: DeepWallKidsEnvironment = .sandbox
DeepWallKids.initialize(apiKey: yourApiKey, environment: environment)

Replace {YOUR_API_KEY} with your app token. You can find this key in your dashboard.

Depending on whether you build your app for testing or for production, you must set environment with one of these values:

let environment: DeepWallKidsEnvironment = .sandbox
let environment: DeepWallKidsEnvironment = .production

Important:

This value should be set to .sandbox only during testing your application. Make sure to set the environment to .production just before you publish the app.

We use this environment to distinguish between real traffic and test traffic from test devices. It is very important that you keep this value meaningful at all times!

Configuration

DeepWall need to know following user properties for targeting.

  • UUID: String
    • Unique identifer for specifying user profile or device.
  • Country: DeepWallCountry
    • Two-letter country code -- ISO 3166-1 alpha-2
    • Usage: DeepWallCountryManager.getCountry(by: "TR") // TURKEY
  • Language: DeepWallLanguage
    • Two-letter language code -- ISO 639-1
    • Usage: DeepWallLanguageManager.getLanguage(by: "tr") // TURKISH
  • Environment Style: DeepWallEnvironmentStyle
    • Environment style for paywall appearance.
    • Values:
      • automatic: Uses system appearance (Default)
      • light: Light appearance
      • dark: Dark appearance

Important:

You must call setUserProperties method before requesting any paywall.

let userProperties = DeepWallKidsUserProperties(uuid: uuid, country: country, language: language)

DeepWallKids.shared.setUserProperties(userProperties)

Updating User Properties

You could update the following user properties with DeepWallKids.shared.updateUserProperties() method.

func updateUserProperties(country: DeepWallCountry? = nil,
			  language: DeepWallLanguage? = nil,
			  environmentStyle: DeepWallEnvironmentStyle? = nil)

Requesting Paywall

For pages to be displayed successfully, it is strongly recommended to wait for DeepWallKids.shared.readyStatus before sending a page request.

You could use requestPaywall method with action parameter for showing paywalls.

// SomeUIViewController.swift

DeepWallKids.shared.requestPaywall(action: "{ACTION_KEY}", in: self)

Replace {ACTION_KEY} with your related action key. You can find or create action keys in your dashboard.

Sending Extra Data

You could also use extraDataparameter for sending extra data to paywalls.

// SomeUIViewController.swift

let deepwallExtraData: DeepWallExtraDataType = [
    "some": "value"
]
DeepWallKids.shared.requestPaywall(action: "{ACTION_KEY}", in: self, extraData: deepwallExtraData)

Closing Paywall

You could use closePaywall method to close paywalls.

DeepWallKids.shared.closePaywall()

Event Handling

DeepWall posts some various events depending on ....

  • deepWallKidsPaywallRequested

    • Fired after paywall requested. Useful for displaying loading indicator in your app.
  • deepWallKidsPaywallResponseReceived

    • Fired after paywall response received. Useful for hiding loading indicator in your app.
  • deepWallKidsPaywallOpened

    • Paywall opened event
    • Parameters:
      • pageId: Int
  • deepWallKidsPaywallNotOpened

    • Paywall not opened event. Fired on error cases only.
    • Parameters:
      • pageId: Int
  • deepWallKidsPaywallActionShowDisabled

    • Paywall action show disabled event.
      • Parameters:
        • pageId: Int
  • deepWallKidsPaywallClosed

    • Paywall closed event
    • Parameters:
      • pageId: Int
  • deepWallKidsPaywallResponseFailure

    • Paywall response failure event
    • Parameters:
      • errorCode: String
      • reason: String
  • deepWallKidsPaywallPurchasingProduct

    • Paywall purchasing product event
    • Parameters:
      • productCode: String
  • deepWallKidsPaywallPurchaseSuccess

    • Purchase success event. Fired after receipt validation if Ploutos service active.
    • Parameters:
      • type: PloutosValidationType
      • result: PLPurchaseResponse
        • subscriptions: Array of SubscriptionItem
        • products: Array of ProductItem
  • deepWallKidsPaywallPurchaseFailed

    • Purchase failed event
    • Parameters:
      • productCode: String
      • reason: String
      • errorCode: String
      • isPaymentCancelled: Bool
  • deepWallKidsPaywallRestoreSuccess

    • Restore success event
  • deepWallKidsPaywallRestoreFailed

    • Restore failed event
    • Parameters:
      • reason: RestoreFailedReason
        • .noReceipt
        • .failed
      • errorCode: String
      • errorText: String?
      • isPaymentCancelled: Bool
  • deepWallKidsPaywallExtraDataReceived

    • Extra data received event
    • Parameters:
      • DeepWallExtraDataType model

Usage Example

First implement DeepWallKidsNotifierDelegate protocol to your class. Then you could use observeEvents method for observing events.

DeepWallKids.shared.observeEvents(for: self)

For removing observer, you could use removeObserver method.

DeepWallKids.shared.removeObserver(for: self)

Requirements

  • iOS 10.0+
  • Xcode 11.0+
  • Swift 5.0+

Additional Features

  • Dark Mode support
  • Automatic in app purchase flows