Skip to content

Instantly share code, notes, and snippets.

@giginet
Last active December 16, 2015 04:39
Show Gist options
  • Save giginet/5379026 to your computer and use it in GitHub Desktop.
Save giginet/5379026 to your computer and use it in GitHub Desktop.
TestFlight SDK Wrapper for C++ https://testflightapp.com/sdk/
//
// TestFlightWrapper.h
// TestFlightWrapper
//
// Created by giginet on 2013/4/9.
//
//
#ifndef __VOXCHRONICLE__TestFlightWrapper__
#define __VOXCHRONICLE__TestFlightWrapper__
#include <iostream>
#include <map>
using namespace std;
namespace Kawaz {
class TestFlightWrapper {
public:
static void addCustomEnvironmentInformation(const char* information, const char* key);
static void takeOff(const char* teamToken);
static void setOptions(map<string, bool> options);
static void passCheckpoint(const char* checkpointName);
static void openFeedbackView();
static void submitFeedback(const char* feedback);
static void setDeviceIndetifier(const char* deviceIdentifier);
};
};
#endif /* defined(__VOXCHRONICLE__TestFlightWrapper__) */
//
// TestFlightWrapper.cpp
// TestFlightWrapper
//
// Created by giginet on 2013/4/9.
//
//
#import "TestFlight.h"
#include "TestFlightWrapper.h"
void Kawaz::TestFlightWrapper::addCustomEnvironmentInformation(const char* information, const char* key) {
[TestFlight addCustomEnvironmentInformation:[NSString stringWithCString:information encoding:NSASCIIStringEncoding]
forKey:[NSString stringWithCString:key encoding:NSASCIIStringEncoding]];
}
void Kawaz::TestFlightWrapper::takeOff(const char *teamToken) {
[TestFlight takeOff:[NSString stringWithCString:teamToken encoding:NSASCIIStringEncoding]];
}
void Kawaz::TestFlightWrapper::setOptions(map<string, bool> options) {
NSMutableDictionary* dictionary = [NSDictionary dictionary];
for (map<string, bool>::iterator it = options.begin(); it != options.end(); ++it) {
NSString* key = [NSString stringWithCString:it->first.c_str() encoding:NSASCIIStringEncoding];
bool value = it->second;
[dictionary setObject:[NSNumber numberWithBool:(BOOL)value] forKey:key];
}
[TestFlight setOptions:dictionary];
}
void Kawaz::TestFlightWrapper::passCheckpoint(const char *checkpointName) {
[TestFlight passCheckpoint:[NSString stringWithCString:checkpointName encoding:NSASCIIStringEncoding]];
}
void Kawaz::TestFlightWrapper::openFeedbackView() {
[TestFlight openFeedbackView];
}
void Kawaz::TestFlightWrapper::submitFeedback(const char *feedback) {
[TestFlight submitFeedback:[NSString stringWithCString:feedback encoding:NSASCIIStringEncoding]];
}
void Kawaz::TestFlightWrapper::setDeviceIndetifier(const char *deviceIdentifier) {
[TestFlight passCheckpoint:[NSString stringWithCString:deviceIdentifier encoding:NSASCIIStringEncoding]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment