Skip to content

Commit

Permalink
Added stop method
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysharm committed Apr 11, 2017
1 parent d5902d7 commit 471edec
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions actionscript/src/com/testfairy/AirTestFairy.as
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ package com.testfairy
public static function setScreenName(aName:String):void {
call("setScreenName", aName);
}

public static function stop():void {
call("stop");
}

private static const EXTENSION_ID : String = "com.testfairy";

Expand Down
12 changes: 12 additions & 0 deletions android/src/com/testfairy/AirTestFairyContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public Map<String, FREFunction> getFunctions() {
functions.put("sendUserFeedback", new SendUserFeedback());
functions.put("checkpoint", new SetCheckpoint());
functions.put("setScreenName", new SetScreenName());
functions.put("stop", new Stop());

return functions;
}
Expand Down Expand Up @@ -251,6 +252,17 @@ public FREObject call(FREContext freContext, FREObject[] freObjects) {
}
}

private static class Stop implements FREFunction {
@Override
public FREObject call(FREContext freContext, FREObject[] freObjects) {
try {
TestFairy.stop();
} catch (Exception exception) {
Log.e("AirTestFairyContext", "Failed to stop session in TestFairy", exception);
}
return null;
}
}

private static HashMap<String, Object> toHashMap(String input) {
HashMap<String, Object> map = new HashMap<String, Object>();
Expand Down
1 change: 1 addition & 0 deletions ios/AirTestFairy/AirTestFairy/AirTestFairy.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ DEFINE_ANE_FUNCTION(AirTestFairySetServerEndpoint);
DEFINE_ANE_FUNCTION(AirTestFairySendUserFeedback);
DEFINE_ANE_FUNCTION(AirTestFairyCheckpoint);
DEFINE_ANE_FUNCTION(AirTestFairySetScreenName);
DEFINE_ANE_FUNCTION(AirTestFairyStop);

// ANE Setup
void AirTestFairyContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet);
Expand Down
6 changes: 6 additions & 0 deletions ios/AirTestFairy/AirTestFairy/AirTestFairy.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@
return nil;
}

DEFINE_ANE_FUNCTION(AirTestFairyStop) {
[TestFairy stop];
return nil;
}

#pragma mark - ANE Setup

void AirTestFairyContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet)
Expand All @@ -150,6 +155,7 @@ void AirTestFairyContextInitializer(void* extData, const uint8_t* ctxType, FRECo
@"sendUserFeedback": [NSValue valueWithPointer:&AirTestFairySendUserFeedback],
@"checkpoint": [NSValue valueWithPointer:&AirTestFairyCheckpoint],
@"setScreenName": [NSValue valueWithPointer:&AirTestFairySetScreenName],
@"stop": [NSValue valueWithPointer:&AirTestFairyStop],
};

*numFunctionsToTest = (uint32_t)[functions count];
Expand Down

0 comments on commit 471edec

Please sign in to comment.