Skip to content

Improve QR code flow & permissions, and update lots of assorted build config & Android API usage #32

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

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
85 changes: 0 additions & 85 deletions app/build.gradle

This file was deleted.

77 changes: 77 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
id("kotlin-parcelize")
}

android {
namespace = "tech.httptoolkit.android"
compileSdk = 35

defaultConfig {
applicationId = "tech.httptoolkit.android.v1"
minSdk = 21
targetSdk = 34
versionCode = 34
versionName = "1.5.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

manifestPlaceholders["sentryEnabled"] = "false"
manifestPlaceholders["sentryDsn"] = "null"
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")

manifestPlaceholders["sentryEnabled"] = "true"
manifestPlaceholders["sentryDsn"] = "https://[email protected]/1809979"
}
}


compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = "11"
}

buildFeatures {
viewBinding = true
buildConfig = true
}
lint {
lintConfig = file("./lint.xml")
}
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation(libs.kotlin.stdlib.jdk7)
implementation(libs.kotlin.reflect)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.appcompat)
implementation(libs.core.ktx)
implementation(libs.constraintlayout)
implementation(libs.localbroadcastmanager)
implementation(libs.zxing.android.embedded) { isTransitive = false }
implementation(libs.core)
implementation(libs.klaxon)
implementation(libs.okhttp)
implementation(libs.material)
implementation(libs.semver)
implementation(libs.sentry.android)
implementation(libs.slf4j.nop)
implementation(libs.play.services.base)
implementation(libs.installreferrer)
implementation(libs.swiperefreshlayout)
testImplementation(libs.junit)
androidTestImplementation(libs.runner)
androidTestImplementation(libs.espresso.core)
}
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<application
android:name=".HttpToolkitApplication"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down Expand Up @@ -100,7 +101,7 @@
</intent-filter>
</activity-alias>

<activity android:name=".ScanActivity" android:parentActivityName=".MainActivity">
<activity android:name=".QRScanActivity" android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import kotlinx.coroutines.*
import tech.httptoolkit.android.databinding.AppsListBinding
import java.util.*
import kotlin.collections.ArrayList

// Used to both to send and return the current list of selected apps
const val UNSELECTED_APPS_EXTRA = "tech.httptoolkit.android.UNSELECTED_APPS_EXTRA"

class ApplicationListActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener,
CoroutineScope by MainScope(), PopupMenu.OnMenuItemClickListener, View.OnClickListener {
Expand All @@ -38,8 +34,7 @@ class ApplicationListActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefres
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

blockedPackages = intent.getStringArrayExtra(UNSELECTED_APPS_EXTRA)!!.toHashSet()

blockedPackages = intent.getStringArrayExtra(IntentExtras.UNSELECTED_APPS_EXTRA)!!.toHashSet()
binding = AppsListBinding.inflate(layoutInflater)
setContentView(binding.root)

Expand All @@ -60,7 +55,7 @@ class ApplicationListActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefres
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
setResult(RESULT_OK, Intent().putExtra(
UNSELECTED_APPS_EXTRA,
IntentExtras.UNSELECTED_APPS_EXTRA,
blockedPackages.toTypedArray()
))
finish()
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/tech/httptoolkit/android/Constants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package tech.httptoolkit.android

object IntentExtras {
const val SCANNED_URL_EXTRA = "tech.httptoolkit.android.SCANNED_URL"
const val SELECTED_PORTS_EXTRA = "tech.httptoolkit.android.SELECTED_PORTS_EXTRA"
const val UNSELECTED_APPS_EXTRA = "tech.httptoolkit.android.UNSELECTED_APPS_EXTRA"
const val PROXY_CONFIG_EXTRA = "tech.httptoolkit.android.PROXY_CONFIG"
const val UNINTERCEPTED_APPS_EXTRA = "tech.httptoolkit.android.UNINTERCEPTED_APPS"
const val INTERCEPTED_PORTS_EXTRA = "tech.httptoolkit.android.INTERCEPTED_PORTS"
}
Loading
Loading