Skip to content

Commit

Permalink
Harmony v1.2.2 & Crypto v0.1.1 Release Candidates (#48)
Browse files Browse the repository at this point in the history
* Clear warning about `kotlin-dsl`

* Don't create unnecessary hash set if no string set is found for given key

* Update dependencies

* Fix bug where transaction file metadata was not being written right away

* Update all libraries

* Improve ci build times

* Prep for 1.2.2 & 0.1.1 releases
  • Loading branch information
pablobaxter committed Oct 22, 2022
1 parent 86bb9cb commit b894763
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 36 deletions.
9 changes: 9 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ jobs:
./gradlew :harmony:publishToMavenLocal
./gradlew :crypto:assembleRelease
- persist_to_workspace:
root: ~/repo
paths:
- .

Android-Harmony-Upload:
docker:
- image: cimg/android:2022.09.1
Expand All @@ -125,6 +130,8 @@ jobs:

steps:
- checkout
- attach_workspace:
at: ~/repo
- run:
name: Upload Harmony Library
command: |
Expand All @@ -144,6 +151,8 @@ jobs:

steps:
- checkout
- attach_workspace:
at: ~/repo
- run:
name: Upload Harmony Crypto
command: |
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Change Log

### Version 1.2.2 & Harmony-Crypto Version 0.1.1 / 2022-10-22
- Fix bug where transaction file metadata was not being written right away
- Don't create unnecessary hash set if no string set is found for given key
- Update annotation library

### Version 1.2.1 / 2022-09-17
- Fixes crash with putting a string set with a `null` item [#46](https://github.com/pablobaxter/Harmony/issues/46)

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CircleCI](https://circleci.com/gh/pablobaxter/Harmony/tree/main.svg?style=shield)](https://circleci.com/gh/pablobaxter/Harmony/tree/main)
[![GitHub](https://img.shields.io/github/license/pablobaxter/harmony)](https://github.com/pablobaxter/Harmony/blob/main/LICENSE)
[![Maven Central](https://img.shields.io/maven-central/v/com.frybits.harmony/harmony?label=Harmony)](https://search.maven.org/artifact/com.frybits.harmony/harmony/1.2.1/aar) [![Harmony API](https://img.shields.io/badge/API-17%2B-brightgreen.svg?style=flat&label=Harmony%20API)](https://android-arsenal.com/api?level=17) [![Maven Central](https://img.shields.io/maven-central/v/com.frybits.harmony/harmony-crypto?label=Harmony-Crypto)](https://search.maven.org/artifact/com.frybits.harmony/harmony-crypto/0.1.0/aar) [![Crypto API](https://img.shields.io/badge/API-23%2B-purple.svg?style=flat&label=Crypto%20API)](https://android-arsenal.com/api?level=23)
[![Maven Central](https://img.shields.io/maven-central/v/com.frybits.harmony/harmony?label=Harmony)](https://search.maven.org/artifact/com.frybits.harmony/harmony/1.2.2/aar) [![Harmony API](https://img.shields.io/badge/API-17%2B-brightgreen.svg?style=flat&label=Harmony%20API)](https://android-arsenal.com/api?level=17) [![Maven Central](https://img.shields.io/maven-central/v/com.frybits.harmony/harmony-crypto?label=Harmony-Crypto)](https://search.maven.org/artifact/com.frybits.harmony/harmony-crypto/0.1.1/aar) [![Crypto API](https://img.shields.io/badge/API-23%2B-purple.svg?style=flat&label=Crypto%20API)](https://android-arsenal.com/api?level=23)

Working on multiprocess Android apps is a complex undertaking. One of the biggest challenges is managing shared data between the multiple processes. Most solutions rely on one process to be available for another to read the data, which can be quite slow and could potentially lead to ANRs.

Expand All @@ -18,11 +18,11 @@ Harmony is a thread-safe, process-safe, full [`SharedPreferences`](https://devel
- Supports Android API 17+ (Crypto Android API 23+)

## Download
The latest release is available on [Maven Central](https://search.maven.org/artifact/com.frybits.harmony/harmony/1.2.1/aar).
The latest release is available on [Maven Central](https://search.maven.org/artifact/com.frybits.harmony/harmony/1.2.2/aar).
### Gradle
```
implementation 'com.frybits.harmony:harmony:1.2.1'
// implementation 'com.frybits.harmony:harmony-crypto:0.1.0' // For Encrypted SharedPreferences
implementation 'com.frybits.harmony:harmony:1.2.2'
// implementation 'com.frybits.harmony:harmony-crypto:0.1.1' // For Encrypted SharedPreferences
```

## Usage
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: 'frybits-application'

android {
namespace 'com.frybits.harmony.app'
defaultConfig {
applicationId "com.frybits.harmony.app"
targetSdk targetSdk_version
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.frybits.harmony.app">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".HarmonyApp"
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ ext {
// Android libraries
appcompat_version = '1.5.1'
corektx_version = '1.9.0'
annotation_version = '1.4.0'
annotation_version = '1.5.0'
androidx_crypto_version = "1.0.0"
tink_version = "1.7.0"
material_version = "1.6.1"
material_version = "1.7.0"

// Test
junit_version = '4.13.2'
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("org.gradle.kotlin.kotlin-dsl") version "3.1.0"
`kotlin-dsl`
kotlin("jvm") version "1.7.10"
}

Expand All @@ -12,8 +12,8 @@ repositories {
dependencies {
implementation(gradleApi())
implementation(gradleKotlinDsl())
implementation("com.android.tools.build:gradle:7.2.2")
implementation("com.android.tools.build:gradle-api:7.2.2")
implementation("com.android.tools.build:gradle:7.3.1")
implementation("com.android.tools.build:gradle-api:7.3.1")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.7.10")
implementation("androidx.navigation:navigation-safe-args-gradle-plugin:2.5.2")
Expand Down
1 change: 1 addition & 0 deletions crypto/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: 'frybits-library'

android {
namespace 'com.frybits.harmony.secure'
defaultConfig {
minSdk crypto_minSdk_version
}
Expand Down
2 changes: 1 addition & 1 deletion crypto/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.1.0
version=0.1.1
2 changes: 0 additions & 2 deletions crypto/src/main/AndroidManifest.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,7 @@ private class SecureHarmonyPreferencesImpl(
override fun getStringSet(key: String?, defValues: MutableSet<String>?): MutableSet<String>? {
val obj = getDecryptedObject(key)
@Suppress("UNCHECKED_CAST")
val result = (obj as Set<String>?)?.toMutableSet() ?: hashSetOf()
return if (result.size > 0) {
result
} else {
defValues
}
return (obj as Set<String>?)?.toMutableSet() ?: defValues
}

override fun getInt(key: String?, defValue: Int): Int {
Expand Down
2 changes: 2 additions & 0 deletions harmony/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'frybits-library'

android.namespace 'com.frybits.harmony'

dependencies {
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
Expand Down
2 changes: 1 addition & 1 deletion harmony/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.2.1
version=1.2.2
2 changes: 0 additions & 2 deletions harmony/src/main/AndroidManifest.xml

This file was deleted.

19 changes: 8 additions & 11 deletions harmony/src/main/java/com/frybits/harmony/Harmony.kt
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,7 @@ private class HarmonyImpl constructor(
awaitForLoad()
val obj = mapReentrantReadWriteLock.read { harmonyMap[key] }
@Suppress("UNCHECKED_CAST")
val result = (obj as Set<String?>?)?.toMutableSet() ?: hashSetOf()
return if (result.size > 0) {
result
} else {
defValues
}
return (obj as Set<String?>?)?.toMutableSet() ?: defValues
}

override fun contains(key: String?): Boolean {
Expand Down Expand Up @@ -635,12 +630,14 @@ private class HarmonyImpl constructor(
FileOutputStream(harmonyTransactionsFile, true).use { outputStream ->
val bufferedOutputStream = outputStream.buffered()
// Transaction batching to improve cross-process replication
repeat(transactionMaxBatchCount) {
val peekedTransaction = transactionQueue.peek() ?: return@use
peekedTransaction.commitTransactionToOutputStream(bufferedOutputStream)
bufferedOutputStream.flush()
transactionQueue.remove(peekedTransaction)
run transactionQueue@ {
repeat(transactionMaxBatchCount) {
val peekedTransaction = transactionQueue.peek() ?: return@transactionQueue
peekedTransaction.commitTransactionToOutputStream(bufferedOutputStream)
transactionQueue.remove(peekedTransaction)
}
}
bufferedOutputStream.flush()
// Write all changes to the physical storage
outputStream.sync()
}
Expand Down
1 change: 1 addition & 0 deletions target31test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: 'frybits-test'

android {
namespace 'com.frybits.harmony.test'
targetProjectPath ":app"

defaultConfig {
Expand Down
2 changes: 0 additions & 2 deletions target31test/src/main/AndroidManifest.xml

This file was deleted.

0 comments on commit b894763

Please sign in to comment.