Skip to content

Commit

Permalink
Merge pull request #19 from anonaddy/5.4.4
Browse files Browse the repository at this point in the history
5.5.0
  • Loading branch information
Stjin authored Feb 1, 2025
2 parents 38a38ce + 64af1b7 commit 5346b90
Show file tree
Hide file tree
Showing 99 changed files with 761 additions and 769 deletions.
1 change: 1 addition & 0 deletions .idea/appInsightsSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## [v5.5.0] - 2025-02-01

### addy.io

##### Added

- Added the ability to change the default tab to open on app launch
- Added the ability to download failed deliveries (if enabled)

##### Fixed/Improved

- Improve wording of dates in alias list
- Renamed Dashboard to Home to keep consistency with the iOS app
- Updated dependencies

### addy.io for Android wearables _(v1.5.0)_

##### Fixed/Improved

- Performance improvements and other things to make the app even smoother

##### Removed

- Due to the need for watchfaces to comply with the new WFF format and the low usage of the original watchface, it has been discontinued. However, it is now available as a standalone app on Google Play under the name "Tokens watchface"

## [v5.4.3] - 2025-01-06

### addy.io
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Easily create and manage your addy.io aliases, recipients and more from your pho

> addy.io
- addy.io instance running v1.3.0 or higher (current version of the addy.io app has been tested with v1.3.0)
- addy.io instance running v1.3.1 or higher (current version of the addy.io app has been tested with v1.3.1)

> Android
Expand Down
12 changes: 2 additions & 10 deletions anonaddy_shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ plugins {

}

composeCompiler {
enableStrongSkippingMode = true


reportsDestination = layout.buildDirectory.dir("compose_compiler")
//stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf")
}

android {
namespace = "host.stjin.anonaddy_shared"
compileSdk = 35
Expand Down Expand Up @@ -62,7 +54,7 @@ dependencies {
}

dependencies {
implementation("com.google.code.gson:gson:2.11.0")
implementation("com.google.code.gson:gson:2.12.0")

// Preferences for storing settings (and crypto settings)
implementation("androidx.preference:preference-ktx:1.2.1")
Expand All @@ -81,7 +73,7 @@ dependencies {
// Fuel, network requests
dependencies {
implementation("com.github.kittinunf.fuel:fuel:2.3.1")
implementation("com.google.code.gson:gson:2.11.0")
implementation("com.google.code.gson:gson:2.12.0")
implementation("com.github.kittinunf.fuel:fuel-coroutines:2.3.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ object AddyIo {
// The versioncode is a combination of MAJOR MINOR PATCH
//TODO Update on every release

// 1.3.0
// 1.3.1
var MINIMUMVERSIONCODEMAJOR = 1
var MINIMUMVERSIONCODEMINOR = 3
var MINIMUMVERSIONCODEPATCH = 0
var MINIMUMVERSIONCODEPATCH = 1

var VERSIONMAJOR = 0
var VERSIONMINOR = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package host.stjin.anonaddy_shared

import android.content.Context
import android.os.Environment
import android.os.Handler
import android.os.Looper
import android.util.Log
Expand All @@ -12,6 +13,7 @@ import com.einmalfel.earl.Feed
import com.github.kittinunf.fuel.Fuel
import com.github.kittinunf.fuel.core.Headers
import com.github.kittinunf.fuel.core.Response
import com.github.kittinunf.fuel.coroutines.awaitByteArrayResponseResult
import com.github.kittinunf.fuel.coroutines.awaitStringResponseResult
import com.google.gson.Gson
import host.stjin.anonaddy_shared.AddyIo.API_BASE_URL
Expand Down Expand Up @@ -89,6 +91,8 @@ import host.stjin.anonaddy_shared.models.Version
import host.stjin.anonaddy_shared.utils.LoggingHelper
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
import java.io.FileOutputStream
import java.io.InputStream


Expand Down Expand Up @@ -800,7 +804,7 @@ class NetworkHelper(private val context: Context) {
domain: String,
description: String,
format: String,
local_part: String,
aliasLocalPart: String,
recipients: ArrayList<String>?
) {

Expand All @@ -820,7 +824,7 @@ class NetworkHelper(private val context: Context) {
json.put("domain", domain)
json.put("description", description)
json.put("format", format)
json.put("local_part", local_part)
json.put("local_part", aliasLocalPart)
json.put("recipient_ids", array)


Expand Down Expand Up @@ -5000,6 +5004,73 @@ class NetworkHelper(private val context: Context) {
}
}

suspend fun downloadSpecificFailedDelivery(
context: Context,
callback: (File?, String?) -> Unit,
id: String
) {
if (BuildConfig.DEBUG) {
println("${object {}.javaClass.enclosingMethod?.name} called from ${Thread.currentThread().stackTrace[3].className};${Thread.currentThread().stackTrace[3].methodName}")
}

val (_, response, result) = Fuel.get("${API_URL_FAILED_DELIVERIES}/$id/download")
.appendHeader(
*getHeaders()
)
.awaitByteArrayResponseResult()


when (response.statusCode) {
200 -> {
val directory = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)
val file = File(directory, "$id.eml")
try {
FileOutputStream(file).use { fileOut ->
fileOut.write(result.get())
}
callback(file, null)
} catch (e: Exception) {
loggingHelper.addLog(
LOGIMPORTANCE.CRITICAL.int,
e.message ?: "Unknown error",
"downloadSpecificFailedDelivery",
ErrorHelper.getErrorMessage(e.toString().toByteArray())
)
callback(null, "Error saving file: ${e.message}")
}
}

401 -> {
invalidApiKey()
Handler(Looper.getMainLooper()).postDelayed({
// Unauthenticated, clear settings
SettingsManager(true, context).clearSettingsAndCloseApp()
}, 5000)
callback(null, null)
}

else -> {
val ex = result.component2()?.message
val fuelResponse = getFuelResponse(response) ?: ex.toString().toByteArray()
Log.e("AFA", "${response.statusCode} - $ex")
loggingHelper.addLog(
LOGIMPORTANCE.CRITICAL.int,
ex.toString(),
"downloadSpecificFailedDelivery",
ErrorHelper.getErrorMessage(
fuelResponse
)
)
callback(
null,
ErrorHelper.getErrorMessage(
fuelResponse
)
)
}
}
}

suspend fun deleteFailedDelivery(
callback: (String?) -> Unit,
id: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SettingsManager(encrypt: Boolean, private val context: Context) {
NOTIFY_SUBSCRIPTION_EXPIRY(false, PREFTYPES.BOOLEAN, "notify_subscription_expiry"),
MAILTO_ACTIVITY_SHOW_SUGGESTIONS(false, PREFTYPES.BOOLEAN, "mailto_activity_show_suggestions"),
TIMES_THE_APP_HAS_BEEN_OPENED(false, PREFTYPES.INT, "times_the_app_has_been_opened"),
STARTUP_PAGE(false, PREFTYPES.STRING, "startup_page"),

// Sorting and Filtering for aliasFragment
ALIAS_SORT_FILTER(false, PREFTYPES.STRING, "alias_sort_filter"),
Expand Down Expand Up @@ -150,8 +151,8 @@ class SettingsManager(encrypt: Boolean, private val context: Context) {
prefs.edit().putString(key.key, string).apply()
}

fun getSettingsString(key: PREFS): String? {
return prefs.getString(key.key, null)
fun getSettingsString(key: PREFS, default: String? = null): String? {
return prefs.getString(key.key, default)
}

fun putSettingsInt(key: PREFS, int: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ data class AccountNotificationsArray(
val `data`: List<AccountNotifications>
)

@Suppress("PropertyName", "PropertyName")
data class AccountNotifications(
val category: String,
val created_at: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ data class SingleAlias(
val `data`: Aliases
)


@Suppress("PropertyName", "PropertyName")
data class Aliases(
val id: String,
val user_id: String,
Expand All @@ -40,6 +42,7 @@ data class Aliases(
var deleted_at: String?
)

@Suppress("PropertyName", "PropertyName")
data class Meta(
val current_page: Int,
val from: Int?,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package host.stjin.anonaddy_shared.models

@Suppress("PropertyName", "PropertyName")
data class ApiTokenDetails(
val created_at: String,
val expires_at: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ data class SingleDomain(
val `data`: Domains
)

@Suppress("PropertyName", "PropertyName")
data class Domains(
val id: String,
val user_id: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ data class SingleFailedDelivery(
val `data`: FailedDeliveries
)

@Suppress("PropertyName", "PropertyName")
data class FailedDeliveries(
val id: String,
val user_id: String,
Expand All @@ -22,6 +23,7 @@ data class FailedDeliveries(
val email_type: String,
val status: String,
val code: String,
val is_stored: Boolean,
val attempted_at: String,
val created_at: String,
val updated_at: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package host.stjin.anonaddy_shared.models


@Suppress("PropertyName", "PropertyName")
// Login data class representing the successful login response
data class Login(
val api_key: String,
Expand All @@ -9,6 +10,7 @@ data class Login(
val expires_at: String?
)

@Suppress("PropertyName", "PropertyName")
// LoginMfaRequired data class for when MFA is required
data class LoginMfaRequired(
val message: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ data class SingleRecipient(
val `data`: Recipients
)

@Suppress("PropertyName", "PropertyName")
data class Recipients(
val id: String,
val user_id: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ data class RulesArray(
val `data`: List<Rules>
)

@Suppress("PropertyName", "PropertyName")
data class Rules(
val id: String,
val user_id: String,
Expand Down
Loading

0 comments on commit 5346b90

Please sign in to comment.