Commit 186ce8b1 authored by Drahomír Karchňák's avatar Drahomír Karchňák

#421 Added Flurry support for IOS

parent 839241ba
......@@ -64,6 +64,9 @@ allprojects {
roboPodsVersion = '1.13.0'
androidSupportV4Version = '22.0.0'
googlePlayServicesVersion = '8.3.+'
servletApiVersion = '5.5.23'
ravenVersion = '7.5.0'
}
version = getVersionNameFromGit()
......@@ -400,8 +403,8 @@ project(":core") {
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "com.google.guava:guava:$guavaVersion"
compile 'tomcat:servlet-api:5.5.23'
compile 'com.getsentry.raven:raven:7.5.0'
compile "tomcat:servlet-api:$servletApiVersion"
compile "com.getsentry.raven:raven:$ravenVersion"
testCompile "junit:junit:4.11"
testCompile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
......
......@@ -69,10 +69,10 @@ public class TablexiaSettings {
public enum BuildType {
// boxes aInfo sInfo dMenu btName bReport debugBtn
RELEASE ("release", false, false, false, false, false, true, false, Log.TablexiaLogLevel.ERROR),
DEBUG ("debug", false, true, true, true, true, true, true, Log.TablexiaLogLevel.DEBUG),
DEVEL ("devel", true, true, true, true, true, false, true, Log.TablexiaLogLevel.DEBUG);
// boxes aInfo sInfo dMenu btName bReport analytics debugBtn
RELEASE ("release", false, false, false, false, false, true, true, false, Log.TablexiaLogLevel.ERROR),
DEBUG ("debug", false, true, true, true, true, true, false, true, Log.TablexiaLogLevel.DEBUG),
DEVEL ("devel", true, true, true, true, true, false, false, true, Log.TablexiaLogLevel.DEBUG);
private final static BuildType FALLBACK_VARIANT = BuildType.DEVEL;
......@@ -83,10 +83,11 @@ public class TablexiaSettings {
private boolean debugMenu;
private boolean showBuildTypeInName;
private boolean bugReport;
private boolean analytics;
private boolean showDebugButtons;
private final Log.TablexiaLogLevel logLevel;
BuildType(String key, boolean boundingBoxes, boolean applicationInfo, boolean screenInfo, boolean debugMenu, boolean showBuildTypeInName, boolean bugReport, boolean showDebugButtons, Log.TablexiaLogLevel logLevel) {
BuildType(String key, boolean boundingBoxes, boolean applicationInfo, boolean screenInfo, boolean debugMenu, boolean showBuildTypeInName, boolean bugReport, boolean analytics, boolean showDebugButtons, Log.TablexiaLogLevel logLevel) {
this.key = key;
this.boundingBoxes = boundingBoxes;
this.applicationInfo = applicationInfo;
......@@ -94,6 +95,7 @@ public class TablexiaSettings {
this.debugMenu = debugMenu;
this.showBuildTypeInName = showBuildTypeInName;
this.bugReport = bugReport;
this.analytics = analytics;
this.showDebugButtons = showDebugButtons;
this.logLevel = logLevel;
}
......@@ -126,6 +128,10 @@ public class TablexiaSettings {
return bugReport;
}
public boolean isAnalytics() {
return analytics;
}
public boolean isShowDebugButtons() {
return showDebugButtons;
}
......
package cz.nic.tablexia;
import org.robovm.apple.foundation.NSObject;
import org.robovm.objc.annotation.Method;
import org.robovm.objc.annotation.NativeClass;
import org.robovm.apple.foundation.NSException;
@NativeClass
public class Flurry extends NSObject {
/**
* Starts session with apiKey
* [ObjC] + (void)startSession:(NSString *)apiKey;
*/
@Method(selector = "startSession:")
public static native void start(String apiKey);
//TODO + (void) startSession:(NSString *)apiKey withOptions:(id)options;
@Method(selector = "logError:message:exception:")
public static native void logError(String errorID, String message, NSException exception);
//+ (void)logError:(NSString *)errorID message:(NSString *)message exception:(NSException *)exception;
/**
* Sets session properties. Immutable map mapping values to keys...
*
* @note You should not pass private or confidential information about your origin info in a
* custom origin. A maximum of 20 parameter names may be associated with any origin. Sending
* over 20 parameter names with a single origin will result in no parameters being logged
* for that origin.
* [ObjC] + (void)sessionProperties:(NSDictionary *)parameters;
*/
//@Method(selector = "sessionProperties:")
//public static native void sessionProperties(NSDictionary parameters);
//TODO - Not Tested Yet! Add import blabla... NSDic
/**
* Enabled/Disables crash reporting feature
* [ObjC] + (void)setCrashReportingEnabled:(BOOL)value;
*/
@Method(selector = "setCrashReportingEnabled:")
public static native void setCrashReportingEnabled(boolean value);
/**
* Sets sessions continue time. Basicaly how long is session kept active
* after the app has been minimalized/hidden.
* [ObjC] + (void)setSessionContinueSeconds:(int)seconds;
*/
@Method(selector = "setSessionContinueSeconds:")
public static native void setSessionContinueSeconds(int seconds);
/**
* Set current version of application
* [ObjC] + (void)setAppVersion:(NSString *)version;
*/
@Method(selector = "setAppVersion:")
public static native void setAppVersion(String version);
/**
* Set current users ID for logging
* [ObjC] + (void)setUserID:(NSString *)userID;
*/
@Method(selector = "setUserID:")
public static native void setUserID(String userID);
/**
* Set currents users age
* [ObjC] + (void)setAge:(int)age;
*/
@Method(selector = "setAge:")
public static native void setUserAge(int age);
/**
* Set currents users gender
* [ObjC] + (void)setGender:(NSString *)gender;
*/
@Method(selector = "setGender:")
public static native void setUserGender(String gneder);
/**
* Return flurry agent version
* [ObjC] + (NSString *)getFlurryAgentVersion;
*/
@Method(selector = "getFlurryAgentVersion")
public static native String getFlurryAgentVersion();
/**
* Enables/Disables errors in log
* [ObjC] + (void)setShowErrorInLogEnabled:(BOOL)value;
*/
@Method(selector = "setShowErrorInLogEnabled:")
public static native void setShowErrorInLogEnabled(boolean value);
/**
* Enables/Disables debug log
* [ObjC] + (void)setDebugLogEnabled:(BOOL)value;
*/
@Method(selector = "setDebugLogEnabled:")
public static native void setDebugLogEnabled(boolean value);
/**
* Returns true if active session exists
* [ObjC] + (BOOL)activeSessionExists;
*/
@Method(selector = "activeSessionExists")
public static native boolean activeSessionExists();
/**
* Returns session id
* [ObjC] + (NSString*)getSessionID;
*/
@Method(selector = "getSessionID")
public static native String getSessionID();
/**
* Sets whether or not should session be enabled when app is in background
* [ObjC] + (void)setBackgroundSessionEnabled:(BOOL)setBackgroundSessionEnabled;
*/
@Method(selector = "setBackgroundSessionEnabled:")
public static native void setBackgroundSessionEnabled(boolean setBackgroundSessionEnabled);
}
\ No newline at end of file
......@@ -60,6 +60,14 @@ public class IOSLauncher extends IOSApplication.Delegate {
@Override
public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) {
if(TablexiaSettings.getInstance().getBuildType().isAnalytics()) {
Flurry.start(TablexiaBuildConfig.FLURRY_KEY);
Flurry.setAppVersion(TablexiaBuildConfig.VERSION_NAME);
Flurry.setBackgroundSessionEnabled(true);
if(TablexiaSettings.getInstance().getBuildType().isBugReport()) Flurry.setCrashReportingEnabled(true);
}
boolean result = super.didFinishLaunching(application, launchOptions);
Gdx.files = tablexiaIOSFiles;
return result;
......@@ -93,4 +101,4 @@ public class IOSLauncher extends IOSApplication.Delegate {
else return ConnectionType.Wifi;
}
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment