-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated suite to run from
BaseDescriptor
- Loading branch information
Showing
12 changed files
with
294 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
app/src/main/java/org/openobservatory/ooniprobe/common/PreferenceManagerExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package org.openobservatory.ooniprobe.common | ||
|
||
import org.openobservatory.ooniprobe.R | ||
import org.openobservatory.ooniprobe.test.test.* | ||
|
||
|
||
fun PreferenceManager.enableTest(name: String) { | ||
this.setValue(name, true) | ||
} | ||
|
||
fun PreferenceManager.disableTest(name: String) { | ||
this.setValue(name, false) | ||
} | ||
|
||
fun PreferenceManager.setValue(name: String, value: Boolean) { | ||
when (name) { | ||
WebConnectivity.NAME -> {} | ||
Dash.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.run_dash), value) | ||
apply() | ||
} | ||
} | ||
|
||
FacebookMessenger.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.test_facebook_messenger), value) | ||
apply() | ||
} | ||
} | ||
|
||
HttpHeaderFieldManipulation.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.run_http_header_field_manipulation), value) | ||
apply() | ||
} | ||
} | ||
|
||
HttpInvalidRequestLine.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.run_http_invalid_request_line), value) | ||
apply() | ||
} | ||
} | ||
|
||
Ndt.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.run_ndt), value) | ||
apply() | ||
} | ||
} | ||
|
||
Psiphon.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.test_psiphon), value) | ||
apply() | ||
} | ||
} | ||
|
||
RiseupVPN.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.test_riseupvpn), value) | ||
apply() | ||
} | ||
} | ||
|
||
Signal.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.test_signal), value) | ||
apply() | ||
} | ||
} | ||
|
||
Telegram.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.test_telegram), value) | ||
apply() | ||
} | ||
} | ||
|
||
Tor.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.test_tor), value) | ||
apply() | ||
} | ||
} | ||
|
||
Whatsapp.NAME -> { | ||
with(sp.edit()) { | ||
putBoolean(r.getString(R.string.test_whatsapp), value) | ||
apply() | ||
} | ||
} | ||
|
||
else -> { | ||
throw IllegalArgumentException("Unknown preference for: $name") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.