mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 10:05:15 +00:00
f6d50ac858
* Initial commit with high level structure for new message deletion logic * Adding admin logic * New dialog styles * Matching existing dialog closer to new designs * Using the theme attribute danger instead of a hardcoded colour * Using classes for the dialogs Also cleaned up older references to align with newer look * Adding cancel handling Cleaning unused code * Handling local deletion with batch message deletion * Reusing the 'delete locally' * Delete on device should "marl the message as deleted", not remove it from the db directly * Displaying "marked as deleted" messages Split the `BASE_DELETED_TYPE` into two types: BASE_DELETED_OUTGOING_TYPE and BASE_DELETED_INCOMING_TYPE so we can differentiate them visually. * Proper handling of merged code * Removed temp bg color * Making sure the deleted message view is visible * Renaming functions for clarity * Adding the ability to customise the text for the deleted control messages * Removing code that was added back from merging dev back in * Using the updated strings * Toast confirmation on 'delete locally' * Recreating xml dialogs in Compose and moved logic in VM * Removing hardcoded strings * Updated message deletion logic Still need to finalise "note to self" and "legacy groups" * Deletion logic rework Moving away from promises * More deletion logic Hndling unsend request retrieval as per figma docs * Making sure multi-select works as expectec * Multi message handling Sharing admin logic * Deleting reactions when deleting a message * Deleting reactions when deleting a message * Grabbing server hash from notification data * Fixed unit tests * Handling deletion od "marked as deleted" messages * Handling Control Messages longpress and deletion * Back up handling of no map data for huawei notifications Also rethemed the send buttona dn home plus button to have better ax contrast by standardising the colour displayed on the accent color to be the same as the one on the sent messages * Removed test line * Reworking the deletion dialogs We removed the 'delete locally' dialog, instead we show the 'delete for everyone' with the second option disabled * Outgoing messages can all be marked as 'delete for everyone' Cleaned up invisible copy button on black bgs * Adding a confirmation dialog when clearing emoji * Message request text update * Restyling menu items to not show in uppercase * Proper hint for seach * Do not show seconds when they're 0 * Making the change to "hidden recovery" reactive so it can be dynamically updated in the settings page. This can be simplified once we make SharedPreferences widely accessible as Flows --------- Co-authored-by: ThomasArtProcessors <71994342+ThomasArtProcessors@users.noreply.github.com>
425 lines
18 KiB
Groovy
425 lines
18 KiB
Groovy
plugins {
|
|
id 'com.google.devtools.ksp'
|
|
id 'com.google.dagger.hilt.android'
|
|
}
|
|
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'kotlin-android'
|
|
apply plugin: 'witness'
|
|
apply plugin: 'kotlin-parcelize'
|
|
apply plugin: 'kotlinx-serialization'
|
|
|
|
configurations.forEach {
|
|
it.exclude module: "commons-logging"
|
|
}
|
|
|
|
def canonicalVersionCode = 384
|
|
def canonicalVersionName = "1.20.2"
|
|
|
|
def postFixSize = 10
|
|
def abiPostFix = ['armeabi-v7a' : 1,
|
|
'arm64-v8a' : 2,
|
|
'x86' : 3,
|
|
'x86_64' : 4,
|
|
'universal' : 5]
|
|
|
|
// Function to get the current git commit hash so we can embed it along w/ the build version.
|
|
// Note: This is visible in the SettingsActivity, right at the bottom (R.id.versionTextView).
|
|
def getGitHash = { ->
|
|
def stdout = new ByteArrayOutputStream()
|
|
exec {
|
|
commandLine "git", "rev-parse", "--short", "HEAD"
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString().trim()
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion androidCompileSdkVersion
|
|
namespace 'network.loki.messenger'
|
|
useLibrary 'org.apache.http.legacy'
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = '1.8'
|
|
}
|
|
|
|
packagingOptions {
|
|
resources {
|
|
excludes += ['LICENSE.txt', 'LICENSE', 'NOTICE', 'asm-license.txt', 'META-INF/LICENSE', 'META-INF/NOTICE', 'META-INF/proguard/androidx-annotations.pro']
|
|
}
|
|
}
|
|
|
|
splits {
|
|
abi {
|
|
enable !project.hasProperty('huawei') // huawei builds do not need the split variants
|
|
reset()
|
|
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
|
universalApk true
|
|
}
|
|
}
|
|
|
|
buildFeatures {
|
|
compose true
|
|
}
|
|
|
|
composeOptions {
|
|
kotlinCompilerExtensionVersion '1.5.15'
|
|
}
|
|
|
|
defaultConfig {
|
|
versionCode canonicalVersionCode * postFixSize
|
|
versionName canonicalVersionName
|
|
|
|
minSdkVersion androidMinimumSdkVersion
|
|
targetSdkVersion androidTargetSdkVersion
|
|
|
|
multiDexEnabled = true
|
|
|
|
vectorDrawables.useSupportLibrary = true
|
|
project.ext.set("archivesBaseName", "session")
|
|
|
|
buildConfigField "long", "BUILD_TIMESTAMP", getLastCommitTimestamp() + "L"
|
|
buildConfigField "String", "GIT_HASH", "\"$getGitHash\""
|
|
buildConfigField "String", "CONTENT_PROXY_HOST", "\"contentproxy.signal.org\""
|
|
buildConfigField "int", "CONTENT_PROXY_PORT", "443"
|
|
buildConfigField "String", "USER_AGENT", "\"OWA\""
|
|
buildConfigField "int", "CANONICAL_VERSION_CODE", "$canonicalVersionCode"
|
|
resourceConfigurations += []
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
// The following argument makes the Android Test Orchestrator run its
|
|
// "pm clear" command after each test invocation. This command ensures
|
|
// that the app's state is completely cleared between tests.
|
|
testInstrumentationRunnerArguments clearPackageData: 'true'
|
|
testOptions {
|
|
execution 'ANDROIDX_TEST_ORCHESTRATOR'
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
String sharedTestDir = 'src/sharedTest/java'
|
|
test.java.srcDirs += sharedTestDir
|
|
androidTest.java.srcDirs += sharedTestDir
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
}
|
|
debug {
|
|
isDefault true
|
|
minifyEnabled false
|
|
enableUnitTestCoverage true
|
|
}
|
|
}
|
|
|
|
signingConfigs {
|
|
play {
|
|
if (project.hasProperty('SESSION_STORE_FILE')) {
|
|
storeFile file(SESSION_STORE_FILE)
|
|
storePassword SESSION_STORE_PASSWORD
|
|
keyAlias SESSION_KEY_ALIAS
|
|
keyPassword SESSION_KEY_PASSWORD
|
|
}
|
|
}
|
|
huawei {
|
|
if (project.hasProperty('SESSION_HUAWEI_STORE_FILE')) {
|
|
storeFile file(SESSION_HUAWEI_STORE_FILE)
|
|
storePassword SESSION_HUAWEI_STORE_PASSWORD
|
|
keyAlias SESSION_HUAWEI_KEY_ALIAS
|
|
keyPassword SESSION_HUAWEI_KEY_PASSWORD
|
|
}
|
|
}
|
|
}
|
|
|
|
flavorDimensions "distribution"
|
|
productFlavors {
|
|
play {
|
|
isDefault true
|
|
dimension "distribution"
|
|
apply plugin: 'com.google.gms.google-services'
|
|
ext.websiteUpdateUrl = "null"
|
|
buildConfigField "boolean", "PLAY_STORE_DISABLED", "false"
|
|
buildConfigField "org.session.libsession.utilities.Device", "DEVICE", "org.session.libsession.utilities.Device.ANDROID"
|
|
buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl"
|
|
buildConfigField 'String', 'PUSH_KEY_SUFFIX', '\"\"'
|
|
signingConfig signingConfigs.play
|
|
}
|
|
|
|
huawei {
|
|
dimension "distribution"
|
|
ext.websiteUpdateUrl = "null"
|
|
buildConfigField "boolean", "PLAY_STORE_DISABLED", "true"
|
|
buildConfigField "org.session.libsession.utilities.Device", "DEVICE", "org.session.libsession.utilities.Device.HUAWEI"
|
|
buildConfigField "String", "NOPLAY_UPDATE_URL", "$ext.websiteUpdateUrl"
|
|
buildConfigField 'String', 'PUSH_KEY_SUFFIX', '\"_HUAWEI\"'
|
|
signingConfig signingConfigs.huawei
|
|
}
|
|
|
|
website {
|
|
dimension "distribution"
|
|
ext.websiteUpdateUrl = "https://github.com/oxen-io/session-android/releases"
|
|
buildConfigField "boolean", "PLAY_STORE_DISABLED", "true"
|
|
buildConfigField "org.session.libsession.utilities.Device", "DEVICE", "org.session.libsession.utilities.Device.ANDROID"
|
|
buildConfigField "String", "NOPLAY_UPDATE_URL", "\"$ext.websiteUpdateUrl\""
|
|
buildConfigField 'String', 'PUSH_KEY_SUFFIX', '\"\"'
|
|
}
|
|
}
|
|
|
|
applicationVariants.configureEach { variant ->
|
|
variant.outputs.each { output ->
|
|
def abiName = output.getFilter("ABI") ?: 'universal'
|
|
def postFix = abiPostFix.get(abiName, 0)
|
|
|
|
def flavour = (variant.flavorName == 'huawei') ? "-huawei" : ""
|
|
|
|
if (postFix >= postFixSize) throw new AssertionError("postFix is too large")
|
|
output.outputFileName = output.outputFileName = "session-${variant.versionName}-${abiName}${flavour}.apk"
|
|
output.versionCodeOverride = canonicalVersionCode * postFixSize + postFix
|
|
}
|
|
}
|
|
|
|
|
|
testOptions {
|
|
unitTests {
|
|
includeAndroidResources = true
|
|
}
|
|
}
|
|
|
|
buildFeatures {
|
|
viewBinding true
|
|
}
|
|
|
|
def huaweiEnabled = project.properties['huawei'] != null
|
|
|
|
applicationVariants.configureEach { variant ->
|
|
if (variant.flavorName == 'huawei') {
|
|
variant.getPreBuildProvider().configure { task ->
|
|
task.doFirst {
|
|
if (!huaweiEnabled) {
|
|
def message = 'Huawei is not enabled. Please add -Phuawei command line arg. See BUILDING.md'
|
|
logger.error(message)
|
|
throw new GradleException(message)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register('testPlayDebugUnitTestCoverageReport', JacocoReport) {
|
|
dependsOn 'testPlayDebugUnitTest'
|
|
|
|
reports {
|
|
xml.required = true
|
|
}
|
|
|
|
// Add files that should not be listed in the report (e.g. generated Files from dagger)
|
|
def fileFilter = []
|
|
def mainSrc = "$projectDir/src/main/java"
|
|
def kotlinDebugTree = fileTree(dir: "${buildDir}/tmp/kotlin-classes/playDebug", excludes: fileFilter)
|
|
|
|
// Compiled Kotlin class files are written into build-variant-specific subdirectories of 'build/tmp/kotlin-classes'.
|
|
classDirectories.from = files([kotlinDebugTree])
|
|
|
|
// To produce an accurate report, the bytecode is mapped back to the original source code.
|
|
sourceDirectories.from = files([mainSrc])
|
|
|
|
// Execution data generated when running the tests against classes instrumented by the JaCoCo agent.
|
|
// This is enabled with 'enableUnitTestCoverage' in the 'debug' build type.
|
|
executionData.from = "${project.buildDir}/outputs/unit_test_code_coverage/playDebugUnitTest/testPlayDebugUnitTest.exec"
|
|
}
|
|
|
|
|
|
testNamespace 'network.loki.messenger.test'
|
|
lint {
|
|
abortOnError true
|
|
baseline file('lint-baseline.xml')
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':content-descriptions')
|
|
|
|
ksp("androidx.hilt:hilt-compiler:$jetpackHiltVersion")
|
|
ksp("com.google.dagger:hilt-compiler:$daggerHiltVersion")
|
|
ksp("com.github.bumptech.glide:ksp:$glideVersion")
|
|
|
|
implementation("com.google.dagger:hilt-android:$daggerHiltVersion")
|
|
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
|
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
|
implementation "com.google.android.material:material:$materialVersion"
|
|
implementation 'com.google.android.flexbox:flexbox:3.0.0'
|
|
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
|
implementation 'androidx.cardview:cardview:1.0.0'
|
|
implementation "androidx.preference:preference-ktx:$preferenceVersion"
|
|
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
|
|
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
|
implementation 'androidx.exifinterface:exifinterface:1.3.4'
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
|
|
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion"
|
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
|
|
implementation "androidx.lifecycle:lifecycle-process:$lifecycleVersion"
|
|
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycleVersion"
|
|
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
|
|
implementation "androidx.paging:paging-runtime-ktx:$pagingVersion"
|
|
implementation 'androidx.activity:activity-ktx:1.9.2'
|
|
implementation 'androidx.activity:activity-compose:1.9.2'
|
|
implementation 'androidx.fragment:fragment-ktx:1.8.4'
|
|
implementation "androidx.core:core-ktx:$coreVersion"
|
|
implementation "androidx.work:work-runtime-ktx:2.7.1"
|
|
|
|
playImplementation ("com.google.firebase:firebase-messaging:24.0.0") {
|
|
exclude group: 'com.google.firebase', module: 'firebase-core'
|
|
exclude group: 'com.google.firebase', module: 'firebase-analytics'
|
|
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
|
|
}
|
|
|
|
if (project.hasProperty('huawei')) huaweiImplementation 'com.huawei.hms:push:6.7.0.300'
|
|
|
|
implementation 'androidx.media3:media3-exoplayer:1.4.0'
|
|
implementation 'androidx.media3:media3-ui:1.4.0'
|
|
implementation 'org.conscrypt:conscrypt-android:2.5.2'
|
|
implementation 'org.signal:aesgcmprovider:0.0.3'
|
|
implementation 'io.github.webrtc-sdk:android:125.6422.04'
|
|
implementation "me.leolin:ShortcutBadger:1.1.16"
|
|
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
|
|
implementation 'com.jpardogo.materialtabstrip:library:1.0.9'
|
|
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
|
|
implementation 'commons-net:commons-net:3.7.2'
|
|
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
|
|
implementation "com.github.bumptech.glide:glide:$glideVersion"
|
|
implementation "com.github.bumptech.glide:compose:1.0.0-beta01"
|
|
implementation 'com.makeramen:roundedimageview:2.1.0'
|
|
implementation 'com.pnikosis:materialish-progress:1.5'
|
|
implementation 'org.greenrobot:eventbus:3.0.0'
|
|
implementation 'pl.tajchert:waitingdots:0.1.0'
|
|
implementation 'com.vanniktech:android-image-cropper:4.5.0'
|
|
implementation 'com.melnykov:floatingactionbutton:1.3.0'
|
|
implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') {
|
|
exclude group: 'com.android.support', module: 'support-annotations'
|
|
}
|
|
implementation ('com.tomergoldst.android:tooltips:1.0.6') {
|
|
exclude group: 'com.android.support', module: 'appcompat-v7'
|
|
}
|
|
implementation ('com.klinkerapps:android-smsmms:4.0.1') {
|
|
exclude group: 'com.squareup.okhttp', module: 'okhttp'
|
|
exclude group: 'com.squareup.okhttp', module: 'okhttp-urlconnection'
|
|
}
|
|
implementation 'com.annimon:stream:1.1.8'
|
|
implementation 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3-S2'
|
|
implementation 'androidx.sqlite:sqlite-ktx:2.3.1'
|
|
implementation 'net.zetetic:sqlcipher-android:4.5.4@aar'
|
|
implementation project(":libsignal")
|
|
implementation project(":libsession")
|
|
implementation project(":libsession-util")
|
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxJsonVersion"
|
|
implementation "com.github.oxen-io.session-android-curve-25519:curve25519-java:$curve25519Version"
|
|
implementation project(":liblazysodium")
|
|
implementation "net.java.dev.jna:jna:5.12.1@aar"
|
|
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
|
|
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
|
|
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
|
implementation "com.squareup.phrase:phrase:$phraseVersion"
|
|
implementation 'app.cash.copper:copper-flow:1.0.0'
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
|
|
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
|
|
implementation "nl.komponents.kovenant:kovenant-android:$kovenantVersion"
|
|
implementation "com.jakewharton.rxbinding3:rxbinding:3.1.0"
|
|
implementation "com.github.ybq:Android-SpinKit:1.4.0"
|
|
implementation "com.opencsv:opencsv:4.6"
|
|
testImplementation "junit:junit:$junitVersion"
|
|
testImplementation 'org.assertj:assertj-core:3.11.1'
|
|
testImplementation "org.mockito:mockito-inline:4.11.0"
|
|
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
|
androidTestImplementation "org.mockito:mockito-android:4.11.0"
|
|
androidTestImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
|
|
testImplementation "androidx.test:core:$testCoreVersion"
|
|
testImplementation "androidx.arch.core:core-testing:2.2.0"
|
|
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
|
|
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
|
|
// Core library
|
|
androidTestImplementation "androidx.test:core:$testCoreVersion"
|
|
|
|
androidTestImplementation('com.adevinta.android:barista:4.2.0') {
|
|
exclude group: 'org.jetbrains.kotlin'
|
|
}
|
|
|
|
// AndroidJUnitRunner and JUnit Rules
|
|
androidTestImplementation 'androidx.test:runner:1.5.2'
|
|
androidTestImplementation 'androidx.test:rules:1.5.0'
|
|
|
|
// Assertions
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
|
androidTestImplementation 'androidx.test.ext:truth:1.5.0'
|
|
testImplementation 'com.google.truth:truth:1.1.3'
|
|
androidTestImplementation 'com.google.truth:truth:1.1.3'
|
|
|
|
// Espresso dependencies
|
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
|
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.1'
|
|
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
|
|
androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.5.1'
|
|
androidTestImplementation 'androidx.test.espresso:espresso-web:3.5.1'
|
|
androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.5.1'
|
|
androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.5.1'
|
|
androidTestUtil 'androidx.test:orchestrator:1.4.2'
|
|
|
|
testImplementation 'org.robolectric:robolectric:4.12.2'
|
|
testImplementation 'org.robolectric:shadows-multidex:4.12.2'
|
|
testImplementation 'org.conscrypt:conscrypt-openjdk-uber:2.5.2' // For Robolectric
|
|
testImplementation 'app.cash.turbine:turbine:1.1.0'
|
|
|
|
// compose
|
|
Dependency composeBom = platform('androidx.compose:compose-bom:2024.09.01')
|
|
implementation composeBom
|
|
testImplementation composeBom
|
|
androidTestImplementation composeBom
|
|
|
|
implementation "androidx.compose.ui:ui"
|
|
implementation "androidx.compose.animation:animation"
|
|
implementation "androidx.compose.ui:ui-tooling"
|
|
implementation "androidx.compose.runtime:runtime-livedata"
|
|
implementation "androidx.compose.foundation:foundation-layout"
|
|
implementation "androidx.compose.material3:material3"
|
|
|
|
androidTestImplementation "androidx.compose.ui:ui-test-junit4-android"
|
|
debugImplementation "androidx.compose.ui:ui-test-manifest"
|
|
|
|
implementation "com.google.accompanist:accompanist-themeadapter-appcompat:0.33.1-alpha"
|
|
implementation "com.google.accompanist:accompanist-permissions:0.36.0"
|
|
implementation "com.google.accompanist:accompanist-drawablepainter:0.33.1-alpha"
|
|
|
|
implementation "androidx.camera:camera-camera2:1.3.2"
|
|
implementation "androidx.camera:camera-lifecycle:1.3.2"
|
|
implementation "androidx.camera:camera-view:1.3.2"
|
|
|
|
// Note: ZXing 3.5.3 is the latest stable release as of 2024/08/21
|
|
implementation "com.google.zxing:core:$zxingVersion"
|
|
}
|
|
|
|
static def getLastCommitTimestamp() {
|
|
new ByteArrayOutputStream().withStream { os ->
|
|
return os.toString() + "000"
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Discovers supported languages listed as under the res/values- directory.
|
|
*/
|
|
def autoResConfig() {
|
|
def files = new ArrayList<String>()
|
|
def root = file("src/main/res")
|
|
root.eachFile { f -> files.add(f.name) }
|
|
['en'] + files.collect { f -> f =~ /^values-([a-z]{2}(-r[A-Z]{2})?)$/ }
|
|
.findAll { matcher -> matcher.find() }
|
|
.collect { matcher -> matcher.group(1) }
|
|
.sort()
|
|
}
|