Skip to content

Commit

Permalink
PIA-937: Update dependencies and TV improvements (#48)
Browse files Browse the repository at this point in the history
* PIA-937: Update dependencies

* PIA-937: Limit latency and fetching of servers to logged in users

* PIA-937: Fix tv theme changing during app startup

* PIA-937: Update workflow with package read access

* PIA-937: Update workflow java version to 17

* PIA-937: Update unit tests
  • Loading branch information
kp-juan-docal authored Nov 16, 2023
1 parent a1beeb4 commit 556286a
Show file tree
Hide file tree
Showing 32 changed files with 252 additions and 151 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-playstore-android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17
cache: gradle
- name: key
run: openssl base64 -d -A -out /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/app/key.keystore <<< ${{ secrets.SIGNING_PLAYSTORE_KEYSTORE }}
- name: build AAB
run: ./gradlew bundleProductionPlaystoreRelease --parallel
env:
GITHUB_USERNAME: ${{ secrets.USERNAME_GITHUB }}
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_PLAYSTORE_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_PLAYSTORE_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_PLAYSTORE_STORE_PASSWORD }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build-web-android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17
cache: gradle
- name: use web version code
run: |
Expand All @@ -27,6 +27,8 @@ jobs:
- name: build APK
run: ./gradlew assembleProductionNoinappRelease --parallel
env:
GITHUB_USERNAME: ${{ secrets.USERNAME_GITHUB }}
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_WEB_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_WEB_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_WEB_STORE_PASSWORD }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test-android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17
cache: gradle
- name: unit-tests
run: ./gradlew testProductionPlaystoreReleaseUnitTest testProductionNoinappReleaseUnitTest --parallel
env:
GITHUB_USERNAME: ${{ secrets.USERNAME_GITHUB }}
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
Binary file removed account/account-release.aar
Binary file not shown.
2 changes: 0 additions & 2 deletions account/build.gradle

This file was deleted.

66 changes: 35 additions & 31 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ buildscript {

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlinx-serialization'
apply plugin: 'kape.licenses'


repositories {
google()
jcenter()
mavenCentral()
mavenLocal()
maven { url "https://jitpack.io" }
}

Expand All @@ -31,41 +30,37 @@ dependencies {

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.preference:preference:1.1.0'
implementation 'com.madgag.spongycastle:core:1.54.0.0'
implementation 'com.madgag.spongycastle:core:1.58.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0-alpha03'
implementation "androidx.core:core-ktx:1.3.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation 'com.google.code.gson:gson:2.10.1'
implementation "io.ktor:ktor-client-okhttp:2.3.3"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1"
implementation "org.jetbrains.kotlinx:kotlinx-datetime:0.4.0"

// PIA
implementation project(':openvpnTunnel')
implementation project(":core")
implementation project(":regions")
implementation project(":account")
implementation project(":csi")
implementation project(":kpi")

// Commons
implementation "io.ktor:ktor-client-okhttp:1.6.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation "org.jetbrains.kotlinx:kotlinx-datetime:0.2.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.2.1"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
implementation "androidx.security:security-crypto:1.1.0-alpha03"
implementation "com.russhwolf:multiplatform-settings:0.8"
implementation 'com.google.code.gson:gson:2.10.1'
implementation("com.kape.android:account-android:1.4.5")
implementation("com.kape.android:regions-android:1.6.2")
implementation("com.kape.android:csi-android:1.3.2")
implementation("com.kape.android:kpi-android:1.2.2")

// Tests
testImplementation 'com.github.gmazzo:okhttp-mock:1.3.2'
testImplementation "org.json:json:20180813"
testImplementation "org.json:json:20231013"
testImplementation 'junit:junit:4.13.2'
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'org.robolectric:robolectric:4.4'
testImplementation 'org.mockito:mockito-inline:2.23.0'
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"
testImplementation 'androidx.test:core:1.5.0'
testImplementation 'org.robolectric:robolectric:4.10.3'
testImplementation 'org.mockito:mockito-inline:4.4.0'
testImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3"
androidTestImplementation 'com.github.gmazzo:okhttp-mock:1.3.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:core:1.4.0'
Expand All @@ -77,8 +72,8 @@ dependencies {
implementation 'org.greenrobot:eventbus:3.1.1'

//ButterKnife
implementation 'com.jakewharton:butterknife:10.2.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
implementation 'com.jakewharton:butterknife:10.2.3'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'

//Wireguard
implementation "com.jakewharton.threetenabp:threetenabp:1.2.1"
Expand Down Expand Up @@ -115,19 +110,24 @@ dependencies {
}

android {
namespace 'com.privateinternetaccess.android'
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion

ndkVersion '21.1.6352462'
dataBinding.enabled true

buildFeatures {
buildConfig = true
viewBinding = true
}

compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}

defaultConfig {
Expand Down Expand Up @@ -163,9 +163,6 @@ android {
}
}

lintOptions {
disable 'InvalidPackage', 'MissingTranslation', 'MissingDefaultResource', 'ExtraTranslation'
}

flavorDimensions "pia", "store"

Expand Down Expand Up @@ -249,7 +246,14 @@ android {
buildConfigField 'String', 'PIA_VALID_DIP_TOKEN', "\"${System.getenv("PIA_VALID_DIP_TOKEN")}\""
}
}
ndkVersion '21.1.6352462'
packagingOptions {
jniLibs {
useLegacyPackaging true
}
}
lint {
disable 'InvalidPackage', 'MissingTranslation', 'MissingDefaultResource', 'ExtraTranslation'
}
}

task fetchRegions {
Expand Down
3 changes: 1 addition & 2 deletions app/src/amazonstore/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.privateinternetaccess.android">
xmlns:tools="http://schemas.android.com/tools">

</manifest>
4 changes: 1 addition & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.privateinternetaccess.android">
xmlns:tools="http://schemas.android.com/tools">

<queries>
<intent>
Expand Down Expand Up @@ -69,7 +68,6 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/pia_theme_3_0"
android:name=".PIAApplication"
android:extractNativeLibs="true"
android:usesCleartextTraffic="true"
android:label="@string/launcher_name"
android:appCategory="productivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.privateinternetaccess.android.pia.handlers.PIAServerHandler;
import com.privateinternetaccess.android.pia.handlers.PiaPrefHandler;
import com.privateinternetaccess.android.pia.handlers.ThemeHandler;
import com.privateinternetaccess.android.pia.interfaces.IAccount;
import com.privateinternetaccess.android.pia.model.events.VpnStateEvent;
import com.privateinternetaccess.android.pia.utils.DLog;
import com.privateinternetaccess.android.pia.utils.Prefs;
Expand Down Expand Up @@ -200,8 +201,6 @@ public void onCreate() {
.enableLogging(notRelease)
.setDebugParameters(debugMode, debugLevel, context.getFilesDir());

PIAServerHandler.startup(context);

updateOrResetValues();

ThemeHandler.setAppTheme(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ class PIALifecycleObserver(private val context: Context) : LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_START)
fun onForeground() {
DLog.d(TAG, "Application Foregrounded")
PIAServerHandler.getInstance(context).triggerLatenciesUpdate()
migrateApiTokenIfNeeded()
val account = PIAFactory.getInstance().getAccount(context)
if (account.loggedIn()) {
PIAServerHandler.startup(context)
PIAServerHandler.getInstance(context).triggerLatenciesUpdate()
migrateApiTokenIfNeeded()
}
}

@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ class Gen4PortForwardApi : PIACertPinningAPI() {
}
}

@UseExperimental(ExperimentalTime::class)
private fun tokenExpirationDateDaysLeft(
tokenExpirationDate: String
): Long {
Expand Down
Loading

0 comments on commit 556286a

Please sign in to comment.