Skip to content

Commit

Permalink
chore: add support for run id in annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
aanorbel committed Oct 31, 2024
1 parent c70c40c commit f554e5b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ooniprobe/Test/Test/AbstractTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
@property id<OONIMKTask> task;
@property BOOL storeDB;
@property BOOL autoRun;
@property NSString *runId;

@property BOOL isPreparing;

-(id)initTest:(NSString*)testName;
Expand Down
1 change: 1 addition & 0 deletions ooniprobe/Test/Test/AbstractTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ - (Measurement*)createMeasurementObject{

-(void)prepareRun{
self.settings = [Settings new];
self.settings.annotations[@"ooni_run_link_id"] = self.runId;
if (self.autoRun) {
self.settings.annotations[@"origin"] = @"autorun";
self.settings.options.software_name = [NSString stringWithFormat:@"%@%@",SOFTWARE_NAME,@"-unattended"];
Expand Down
2 changes: 2 additions & 0 deletions ooniprobe/View/OONIRun/OoniRunViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
@property (nonatomic, strong) IBOutlet RunButton *runButton;

@property (nonatomic, retain) NSString *testName;

@property (nonatomic, retain) NSString *runId;
@property (nonatomic, retain) NSDictionary *testArguments;
@property (nonatomic, retain) NSString *testDescription;

Expand Down
7 changes: 6 additions & 1 deletion ooniprobe/View/OONIRun/OoniRunViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ -(void)handleUrlScheme{
if ([self checkMv:parameters]) {
if ([parameters objectForKey:@"tn"] && [TestUtility getCategoryForTest:[parameters objectForKey:@"tn"]]) {
[self setTestName:[parameters objectForKey:@"tn"]];
if ([parameters objectForKey:@"ta"])
if ([parameters objectForKey:@"ta"]) {
[self setTestArguments:[parameters objectForKey:@"ta"]];
}
if ([parameters objectForKey:@"runId"]) {
[self setRunId:[parameters objectForKey:@"runId"]];
}
[self showTestScreen];
} else {
[self showErrorScreen];
Expand Down Expand Up @@ -275,6 +279,7 @@ -(IBAction)runTest {
AbstractSuite *testSuite = [[AbstractSuite alloc] initSuite:testSuiteName];
AbstractTest *test = [[AbstractTest alloc] initTest:testName];
[test setAnnotation:YES];
[test setRunId:self.runId];
[testSuite setTestList:[NSMutableArray arrayWithObject:test]];
if ([testSuiteName isEqualToString:@"websites"] && [urls count] > 0)
[(WebConnectivity*)test setInputs:urls];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ - (void)viewDidLoad {
-(IBAction)openExplorerUrl:(id)sender{
NSString *url = [self getExplorerUrl];
if (url != nil)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url] options:@{} completionHandler:nil];

}

-(NSString*)getExplorerUrl{
Expand Down

0 comments on commit f554e5b

Please sign in to comment.