Skip to content

Instantly share code, notes, and snippets.

View andresilveirah's full-sized avatar
💭
🤖

André Herculano andresilveirah

💭
🤖
View GitHub Profile

onReceiveMessageData(Object msgData):

when the scenario "decides" a message should show, msgData is:

{
  msgID: 50983,
  d: { abp: false, abt: false },
  o: { wl: false, oir: false },
  ci: { comp: false, src: 0 },
  u: { uuid: "3febf9dc-af84-42b8-ab23-9325bcf68ad7", bucket: 554 },
  info: {
import React from 'react';
import './App.css';
const Winner = (props) => (
<div className="winner-section">
<img src="https://image.flaticon.com/icons/png/512/321/321773.png" width="50" height="50" />
Winner: {props.winnerName}
</div>
)

Unified Wrapper

The majority of (if not all) our clients, when integrating with our SDKs, have pointed out the integration is really cumbersome when covering both GDPR and CCPA. We also pay a high price in terms of development to maintain two repositories in sync (x2 platforms, iOS and Android).

In oder to solve this problem we're merging the two SDKs into one meaning the SDKs will no longer "know" if they are dealing with CCPA or GDPR only. Instead, they will deal with all legislations at the same time.

POST message-url?inApp=true&native=true|false

Also known as "get", this endpoint will receive the account/property/campaign info as well as meta and uuid for all legislations (gdpr/ccpa).

Request

@andresilveirah
andresilveirah / SourcePoint_AppleTV.md
Last active August 19, 2020 10:02
Using the SP SDK with Apple TV

Apple TV

There are 2 ways of developing apps for Apple TV. They are known as Native and TVML. Native is quite straight forward and works pretty much the same as an iOS app with all of its native components and lifecycle methods. TVML is a client-server based. Views are built using predefined templates by Apple or using the markup language provided (TVML).

Native

It's possible to reuse almost the entire SDK with a few remarks:

  1. There's no WebView. Therefore, we can only leverage the native message. Since we do not yet support a native PM, we're only able to support 1st layer messaging.
  2. The code will need a bit of a refactoring. Since a big chunk of the SDK relies on the existence of the WebKit module, we'll need to conditionally load code for different platforms (iOS or tvOS).

TVML

After applying the changes to make the SDK reusable on tvOS (described above) we are able to support TVML as well. With the same caveats as the native approach, no webview, no external browser.

@andresilveirah
andresilveirah / SourcePoint_AndroidTV.md
Created August 26, 2020 10:28
Using SourcePoint's Android SDK with Android TV

Android TV

Our Android SDK can be used, without modifications, with Android TV.

Limitations

  1. Although a WebView is present, most of Android TV don't include an external browser. Opening links from within the consent message or PM, needs re-thinking. We currently open them in an external browser, this narrows the scope of the SDK and can concentrate on dealing with only SDK related resources in the WebView.

  2. Navigation needs to be 1st class citzen. On mobile, the user is free to tap anywhere in the screen and navigating between elements is effortless. On an OTT environment, the navigation is limited to a directional controller, making it difficult to navigate from one element to another when the order of the elements is not thought up-front.

import Foundation
import CoreData
class PersistentContainer: NSPersistentContainer {
static let modelName = "MyDataModel"
static var main: PersistentContainer? = {
guard
let modelURL = Bundle.framework.url(forResource: modelName, withExtension: "momd"),
let model = NSManagedObjectModel(contentsOf: modelURL)
else {
@andresilveirah
andresilveirah / WaitBeforeRelaunch.swift
Created November 3, 2022 16:53
I'm not sure the app's threads are suspended like `sleep`, but the code in this gist will pause for a bit before relaunching the app for UI testing.
func waitAndRelaunch(timeout: TimeInterval = 0) {
let waitingExpectation = XCTestExpectation(description: "Wait a bit")
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(Int(timeout))) {
waitingExpectation.fulfill()
}
self.wait(for: [waitingExpectation], timeout: timeout + 1)
self.app.relaunch()
}