Android-Password-Store/app/build.gradle
Harsh Shandilya b94b52a42d
Refactor Git related activities (#685)
* Refactor git logic into separate parts

* Extract hardcoded strings

* Add KDoc to updateHostname, remove unused field

* Cleanups

* Fix dialog message

* Wire in repository clone flow

* spotless

* Remove unused method

* Cleanup GitActivity

- Rename to GitOperationActivity.
- Ensure identityBuilder is always closed regardless of what fragment uses it.
- Remove hardcoded "Operation" strings and replace with REQUEST_ARG_OP.
- Apply a transparent theme to GitOperationActivity make the UI less jarring.

* Tweak some stupidly worded dialog messages

As pointed out in #629, these strings are shoddily worded and do not express any clear intent to the
user, leaving them confused and angry.

* GitOperationActivity: wrap Context to ensure right theme is used

* spotless

* undo build.gradle change

* Use correct parent theme, remove now useless wrapping

* GitServerConfigActivity: fix repository clone flow

* temp: disable leakcanary

framework leaks on Samsung are pissing me off

* Make system bars transparent in git activity

* Tweak HTTPS password layout

* Unhardcode wrong passphrase string

* Store SSH passphrase in EncryptedSharedPreferences

Also revamp the dialog to look a bit better

* Implement support for remembering HTTPS password

Fixes #521

* Try to patch HTTPS remote creation logic

* Update security-crypto

* Clear saved passphrase/password on auth failure

* Revert "Update security-crypto"

Broken on R DP2.1

This reverts commit 4b20371dd42c512a3dd3b759859abb6c1ffd2961.

* Revert "temp: disable leakcanary"

This reverts commit 2db7d41bd67b79c6dc8c5b359a7b27100379f45f.

* Update CHANGELOG

* Remove spacer

* Remove useless override

* Wrap git server activity in a ScrollView

* GitOperation: always finish calling activity when dialogs are dismissed

* Wipe saved password/passphrase when hostname changes

* Don't commit prefs updates

* Don't call listFiles excessively

* Finish activity after saving configuration

* Make ConnectionMode and Protocol enum classes

* Change SSH key passphrase key, don't wipe on host change

* Reimplement BaseGitActivity.updateUrl (was updateHostname)

* Use SharedPreferences.edit KTX extension

* Disable inapplicable connection modes depending on scheme

* BaseGitActivity: annotate onDestroy with CallSuper

We'll leak the identityBuilder connection otherwise

* Move input hack for AlertDialog into an extension function

We re-use this in many places

* Fix protocol/mode toggle issue and consistenly name options

* Fix a crash when opening GitServerConfigActivity without a repo

* Fix OpenKeychain callbacks by moving onActivityResult to BaseGitActivity

* Run spotlessApply

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Co-authored-by: Fabian Henneke <fabian@henneke.me>
2020-04-17 18:36:07 +05:30

131 lines
4.4 KiB
Groovy

/*
* Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
* SPDX-License-Identifier: GPL-3.0-only
*/
plugins {
id 'kotlin-android'
id 'kotlin-android-extensions'
}
final def keystorePropertiesFile = rootProject.file 'keystore.properties'
final def gitHash = { ->
final def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
stdout.toString().trim()
}
static final def isSnapshot() {
return System.env['GITHUB_WORKFLOW'] != null && System.env['SNAPSHOT'] != null
}
android {
if (isSnapshot()) {
android.applicationVariants.all { final variant ->
variant.outputs.all {
outputFileName = "aps_${versions.versionName}.apk"
}
}
}
viewBinding.enabled = true
defaultConfig {
applicationId versions.packageName
}
lintOptions {
abortOnError = true // make sure build fails with lint errors!
disable 'MissingTranslation', 'PluralsCandidate'
}
packagingOptions {
exclude '.readme'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
buildTypes {
release {
minifyEnabled = true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField 'boolean', 'ENABLE_DEBUG_FEATURES', isSnapshot() ? 'true' : 'false'
}
debug {
applicationIdSuffix = '.debug'
versionNameSuffix = '-debug'
minifyEnabled = false
buildConfigField 'boolean', 'ENABLE_DEBUG_FEATURES', 'true'
}
}
if (keystorePropertiesFile.exists()) {
final def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
signingConfigs {
release {
keyAlias = keystoreProperties['keyAlias']
keyPassword = keystoreProperties['keyPassword']
storeFile = rootProject.file keystoreProperties['storeFile']
storePassword = keystoreProperties['storePassword']
}
}
buildTypes.release.signingConfig = signingConfigs.release
buildTypes.debug.signingConfig = signingConfigs.release
}
}
dependencies {
implementation deps.androidx.annotation
implementation deps.androidx.activity_ktx
implementation deps.androidx.appcompat
implementation deps.androidx.biometric
implementation deps.androidx.constraint_layout
implementation deps.androidx.core_ktx
implementation deps.androidx.documentfile
implementation deps.androidx.fragment_ktx
implementation deps.androidx.lifecycle_livedata_ktx
implementation deps.androidx.lifecycle_viewmodel_ktx
implementation deps.androidx.local_broadcast_manager
implementation deps.androidx.material
implementation deps.androidx.preference
implementation deps.androidx.recycler_view
implementation deps.androidx.recycler_view_selection
implementation deps.androidx.security
implementation deps.androidx.swiperefreshlayout
implementation deps.kotlin.coroutines.android
implementation deps.kotlin.coroutines.core
implementation deps.third_party.commons_io
implementation deps.third_party.commons_codec
implementation deps.third_party.fastscroll
implementation(deps.third_party.jgit) {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
implementation deps.third_party.jsch
implementation deps.third_party.openpgp_ktx
implementation deps.third_party.publicsuffixlist
implementation deps.third_party.ssh_auth
implementation deps.third_party.timber
implementation deps.third_party.timberkt
implementation deps.third_party.whatthestack
if (isSnapshot()) {
implementation deps.third_party.leakcanary
} else {
debugImplementation deps.third_party.leakcanary
}
// Testing-only dependencies
androidTestImplementation deps.testing.junit
androidTestImplementation deps.testing.kotlin_test_junit
androidTestImplementation deps.testing.androidx.runner
androidTestImplementation deps.testing.androidx.rules
androidTestImplementation deps.testing.androidx.junit
androidTestImplementation deps.testing.androidx.espresso_core
androidTestImplementation deps.testing.androidx.espresso_intents
}