Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: OONI Run v2 API Bootstrap #582

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b81dc16
added ooni run v2 in experimental mode
aanorbel Jul 10, 2023
64a54cf
updated app to support OONI Run V2 links
aanorbel Jul 12, 2023
0e1a351
updated app to cache test descriptors
aanorbel Jul 13, 2023
b12636a
updated app to cache test descriptors
aanorbel Jul 13, 2023
57c3bba
updated app to use string resources in dashboard and overview instead…
aanorbel Jul 13, 2023
ba1076e
added result row
aanorbel Jul 13, 2023
6ec5283
updated result list and ooni run screen
aanorbel Jul 14, 2023
cabac91
update with change in cli interface
aanorbel Jul 15, 2023
b8dedf6
updated run activity to install link and navigate to overview activity
aanorbel Jul 18, 2023
d996736
modified list on ooni run activity to display inputs for nettests
aanorbel Jul 19, 2023
22cf159
Updates recycler view for inputs
aanorbel Jul 21, 2023
c19ac4f
Updates OONI Run V2 to install links even when tests are already runn…
aanorbel Aug 1, 2023
1158fb0
Merge branch 'master' of github.com:ooni/probe-android into xoonirun
aanorbel Aug 1, 2023
92950eb
Merge branch 'master' of github.com:ooni/probe-android into xoonirun
aanorbel Aug 2, 2023
44a3d4f
Merge branch 'xoonirun' of github.com:ooni/probe-android into xoonirun
aanorbel Aug 2, 2023
f6e3782
Adds support for icons and a default icons when the Ooni Run V2 link …
aanorbel Aug 2, 2023
e8f2307
Updated Icon color for OONI Run V2 Icons
aanorbel Aug 3, 2023
09c61e0
Merge branch 'chore/running-activity-upgrade-to-view-binding' of gith…
aanorbel Aug 3, 2023
a94376f
Updated `RunningActivity` to show Icon of OONI Run V2 link
aanorbel Aug 3, 2023
4d7c065
Merge branch 'chore/upgdate-ooni-run-activity-to-viewbinding' of gith…
aanorbel Aug 3, 2023
23d541f
Merge branch 'chore/overview-activity-upgrade-to-view-binding' of git…
aanorbel Aug 3, 2023
781c70d
Updated Result to contain reference to the descriptor.
aanorbel Aug 4, 2023
8c13a21
Added support for translation
aanorbel Aug 4, 2023
e4989af
Satisfied constructor dependency for testsuites in test package
aanorbel Aug 5, 2023
003a9c5
Add measurement count to run item
aanorbel Aug 7, 2023
221d446
Start implementation of autorun and auto update
aanorbel Aug 10, 2023
a981699
add support for item update by swipe to refresh
aanorbel Aug 10, 2023
c6d1f43
Updated logic for automatically updating and approved updated
aanorbel Aug 11, 2023
b82cc0b
Merge branch 'master' of github.com:ooni/probe-android into xoonirun
aanorbel Aug 11, 2023
ca44991
Merge branch 'xoonirun' of github.com:ooni/probe-android into oonirun…
aanorbel Aug 11, 2023
ea8c3da
Updated `OoniRunActivity` to fetch v2 descriptor async
aanorbel Aug 14, 2023
0e3dc3c
Merge branch 'xoonirun' of github.com:ooni/probe-android into oonirun…
aanorbel Aug 14, 2023
2d7d8b7
Updated xml to remove duplicate tools
aanorbel Aug 14, 2023
ebeca76
Updates UI on refresh complete
aanorbel Aug 15, 2023
f41142a
Updated ViewModel
aanorbel Aug 16, 2023
6f85191
Merge pull request #599 from ooni/oonirun/add-autorun-and-auto-update…
aanorbel Aug 17, 2023
7ab812a
- Changed theme for `OverviewActivity`, `ResultDetailActivity`, `Meas…
aanorbel Aug 18, 2023
f99de74
Adds default property values for `color` and `animation` if backend d…
aanorbel Aug 21, 2023
b9a03b3
removed default animation
aanorbel Aug 21, 2023
75d166b
Modified scheduling of workers.
aanorbel Aug 25, 2023
04eaff1
Updated scheduling of workers
aanorbel Aug 25, 2023
368b509
Merge pull request #601 from ooni/oonirun/add-support-for-color-and-a…
aanorbel Aug 28, 2023
c0d34c2
Adds ooni run id to anotations
aanorbel Oct 9, 2023
c152544
Merge pull request #620 from ooni/oonirun/add-run-id-to-anotations
aanorbel Oct 11, 2023
21e5ebb
Merge branch 'master' of github.com:ooni/probe-android into xoonirun
aanorbel Oct 31, 2023
fa156e8
Merge branches 'xoonirun' and 'master' of github.com:ooni/probe-andro…
aanorbel Nov 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class LocaleUtils {


private static Locale sLocale;
public static Locale sLocale;

public static void setLocale(Locale locale) {
sLocale = locale;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.openobservatory.ooniprobe.domain;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.raizlabs.android.dbflow.converter.TypeConverter;

import java.lang.reflect.Type;
import java.util.HashMap;

@com.raizlabs.android.dbflow.annotation.TypeConverter
public class MapConverter extends TypeConverter<String, HashMap> {
@Override
public String getDBValue(HashMap model) {
return new Gson().toJson(model);
}

@Override
public HashMap getModelValue(String json) {
Gson gson = new Gson();
Type type = new TypeToken<HashMap<String, String>>() {
}.getType();
HashMap<String, String> map = gson.fromJson(json, type);
return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ public static FetchTestDescriptorResponse fetchDataFromRunId(long runId, Context
.withName(descriptor.getName())
.withNameIntl(descriptor.getNameIntl())
.withShortDescription(descriptor.getShortDescription())
.withShortDescriptionIntl(descriptor.getShortDescriptionIntl())
.withDescription(descriptor.getDescription())
.withDescriptionIntl(descriptor.getDescriptionIntl().toString())
.withDescriptionIntl(descriptor.getDescriptionIntl())
.withIcon(descriptor.getIcon())
.withArchived(descriptor.getArchived())
.withAuthor(descriptor.getAuthor())
Expand Down
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

. .
Screenshot_20230804_145522 Screenshot_20230804_145538
Screenshot_20230804_145549 Screenshot_20230804_145603
Screenshot_20230804_145649 .

Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package org.openobservatory.ooniprobe.model.database;

import com.raizlabs.android.dbflow.annotation.Column;
import com.raizlabs.android.dbflow.annotation.ConflictAction;
import com.raizlabs.android.dbflow.annotation.PrimaryKey;
import com.raizlabs.android.dbflow.annotation.Table;
import com.raizlabs.android.dbflow.annotation.Unique;
import com.raizlabs.android.dbflow.structure.BaseModel;

import org.openobservatory.engine.OONIRunNettest;
import org.openobservatory.ooniprobe.common.AppDatabase;
import org.openobservatory.ooniprobe.common.LocaleUtils;
import org.openobservatory.ooniprobe.common.MapUtility;
import org.openobservatory.ooniprobe.domain.MapConverter;
import org.openobservatory.ooniprobe.domain.NettestConverter;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;

@Table(database = AppDatabase.class)
Expand All @@ -22,17 +23,20 @@ public class TestDescriptor extends BaseModel implements Serializable {
@Column
private String name;

@Column(name = "name_intl")
private String nameIntl;

@Column
private String description;
@Column(name = "name_intl", typeConverter = MapConverter.class)
private HashMap nameIntl;

@Column(name = "short_description")
private String shortDescription;

@Column(name = "description_intl")
private String descriptionIntl;
@Column(name = "short_description_intl", typeConverter = MapConverter.class)
private HashMap shortDescriptionIntl;

@Column
private String description;

@Column(name = "description_intl", typeConverter = MapConverter.class)
private HashMap descriptionIntl;

@Column
private String icon;
Expand All @@ -55,42 +59,50 @@ public void setRunId(long runId) {
}

public String getName() {
return name;
return MapUtility.getOrDefaultCompat(nameIntl, LocaleUtils.sLocale.getLanguage(), name).toString();
}

public void setName(String name) {
this.name = name;
}

public String getNameIntl() {
public HashMap getNameIntl() {
return nameIntl;
}

public void setNameIntl(String nameIntl) {
public void setNameIntl(HashMap nameIntl) {
this.nameIntl = nameIntl;
}

public String getDescription() {
return description;
public String getShortDescription() {
return MapUtility.getOrDefaultCompat(shortDescriptionIntl, LocaleUtils.sLocale.getLanguage(), shortDescription).toString();
}

public void setDescription(String description) {
this.description = description;
public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
}

public String getShortDescription() {
return shortDescription;
public HashMap getShortDescriptionIntl() {
return shortDescriptionIntl;
}

public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
public void setShortDescriptionIntl(HashMap shortDescriptionIntl) {
this.shortDescriptionIntl = shortDescriptionIntl;
}

public String getDescription() {
return MapUtility.getOrDefaultCompat(descriptionIntl, LocaleUtils.sLocale.getLanguage(), description).toString();
}

public String getDescriptionIntl() {
public void setDescription(String description) {
this.description = description;
}

public HashMap getDescriptionIntl() {
return descriptionIntl;
}

public void setDescriptionIntl(String descriptionIntl) {
public void setDescriptionIntl(HashMap descriptionIntl) {
this.descriptionIntl = descriptionIntl;
}

Expand Down Expand Up @@ -130,10 +142,11 @@ public void setNettests(List nettests) {
public static final class Builder {
private long runId;
private String name;
private String nameIntl;
private String description;
private HashMap nameIntl;
private String shortDescription;
private String descriptionIntl;
private HashMap shortDescriptionIntl;
private String description;
private HashMap descriptionIntl;
private String icon;
private String author;
private boolean archived;
Expand All @@ -156,22 +169,27 @@ public Builder withName(String name) {
return this;
}

public Builder withNameIntl(String nameIntl) {
public Builder withNameIntl(HashMap nameIntl) {
this.nameIntl = nameIntl;
return this;
}

public Builder withDescription(String description) {
this.description = description;
public Builder withShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
return this;
}

public Builder withShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
public Builder withShortDescriptionIntl(HashMap shortDescriptionIntl) {
this.shortDescriptionIntl = shortDescriptionIntl;
return this;
}

public Builder withDescriptionIntl(String descriptionIntl) {
public Builder withDescription(String description) {
this.description = description;
return this;
}

public Builder withDescriptionIntl(HashMap descriptionIntl) {
this.descriptionIntl = descriptionIntl;
return this;
}
Expand Down Expand Up @@ -201,8 +219,9 @@ public TestDescriptor build() {
testDescriptor.setRunId(runId);
testDescriptor.setName(name);
testDescriptor.setNameIntl(nameIntl);
testDescriptor.setDescription(description);
testDescriptor.setShortDescription(shortDescription);
testDescriptor.setShortDescriptionIntl(shortDescriptionIntl);
testDescriptor.setDescription(description);
testDescriptor.setDescriptionIntl(descriptionIntl);
testDescriptor.setIcon(icon);
testDescriptor.setAuthor(author);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.openobservatory.engine

import com.google.gson.annotations.SerializedName
import java.io.Serializable
import java.util.HashMap

data class OONIRunFetchResponse(
@JvmField
Expand All @@ -14,15 +15,16 @@ data class OONIRunDescriptor(
val author: String,
val description: String,
@SerializedName("description_intl")
val descriptionIntl: Map<String, String>,
val descriptionIntl: HashMap<String, String>,
val icon: String,
val name: String,
val nameIntl: String,
@SerializedName("name_intl")
val nameIntl: HashMap<String, String>,
val archived: Boolean,
@SerializedName("short_description")
val shortDescription: String,
@SerializedName("short_description_intl")
val shortDescriptionIntl: Map<String, String>,
val shortDescriptionIntl: HashMap<String, String>,
val nettests: List<OONIRunNettest>
) : Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.openobservatory.engine;

import android.util.Log;

import com.google.gson.Gson;

import oonimkall.Oonimkall;
Expand All @@ -17,7 +19,9 @@ public OONIContext newContext() {
}

public OONIRunFetchResponse ooniRunFetch(OONIContext ctx, long id) throws Exception {
return new Gson().fromJson(session.ooniRunFetch(ctx.ctx,id),OONIRunFetchResponse.class);
String response = session.ooniRunFetch(ctx.ctx,id);
Log.d(PESession.class.getName(), response);
return new Gson().fromJson(response, OONIRunFetchResponse.class);
}

public OONIContext newContextWithTimeout(long timeout) {
Expand Down
Loading