diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9f91e796..3ac71aabd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,10 +26,10 @@ jobs: - name: Install liboqs dependencies run: sudo apt-get update && sudo apt-get install -y astyle cmake gcc ninja-build libssl-dev python3-pytest python3-pytest-xdist unzip xsltproc doxygen graphviz python3-yaml valgrind - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'temurin' cache: gradle diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 269db8612..bca4e521c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -36,10 +36,10 @@ jobs: - name: Checkout submodules run: git submodule update --init --recursive - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'temurin' cache: gradle @@ -53,32 +53,3 @@ jobs: uses: github/codeql-action/analyze@v2 with: category: "/language:Java" - - analyze_go: - name: Analyze Go - runs-on: ubuntu-latest - - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: go - - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:Go" diff --git a/build.gradle b/build.gradle index 29919e2f8..bb3aad305 100644 --- a/build.gradle +++ b/build.gradle @@ -1,17 +1,17 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.6.20' + ext.kotlin_version = '1.8.0' ext.kotlin_coroutines_version = '1.2.1' - ext.nav_version = '2.3.5' - ext.compose_version = '1.2.0-alpha08' - ext.dagger_version = '2.42' + ext.nav_version = '2.5.0' + ext.compose_version = '1.4.1' + ext.dagger_version = '2.44' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.3' + classpath 'com.android.tools.build:gradle:8.0.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" } @@ -40,6 +40,6 @@ ext { powerMockito = '1.6.2' hamcrestVersion = '2.1' espressoCore = '3.0.1' - lifecycleVersion = '2.3.1' + lifecycleVersion = '2.4.1' coroutenes = '1.5.2' } \ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle index d72e50c6d..153409d99 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' -apply plugin: 'kotlin-android-extensions' apply plugin: "androidx.navigation.safeargs.kotlin" @@ -14,6 +13,8 @@ if (new File("keystore.properties").exists()) { } android { + namespace "net.ivpn.core" + signingConfigs { release { keyAlias keystoreProperties['release.key.alias'] @@ -81,11 +82,11 @@ android { enabled = true } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8 + jvmTarget = JavaVersion.VERSION_17 } testOptions { execution 'ANDROIDX_TEST_ORCHESTRATOR' @@ -97,14 +98,6 @@ android { path 'CMakeLists.txt' } } - androidExtensions { - experimental = true - } - - dexOptions { - incremental true - javaMaxHeapSize "4g" - } splits { abi { @@ -228,37 +221,37 @@ dependencies { implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.legacy:legacy-preference-v14:1.0.0' - //Used to support stream API from JAVA8 and JAVA9 - //ToDo remove it in future + // Used to support stream API from JAVA8 and JAVA9 + // ToDo remove it in future implementation "net.sourceforge.streamsupport:android-retrofuture:$streamsupportVersion" implementation "net.sourceforge.streamsupport:android-retrostreams:$streamsupportVersion" - //Sliding up panel + // Sliding up panel implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0" - //Constraint layout + // Constraint layout implementation "androidx.constraintlayout:constraintlayout:2.0.4" -// QR support + // QR support implementation 'com.google.zxing:core:3.3.0' implementation 'com.journeyapps:zxing-android-embedded:4.1.0@aar' - //Encrypted shared preference + // Encrypted shared preference implementation "androidx.security:security-crypto:1.1.0-alpha03" - //Powerful library for logging + // Powerful library for logging implementation 'org.slf4j:slf4j-api:1.7.24' implementation 'org.slf4j:jul-to-slf4j:1.7.0' implementation 'com.github.tony19:logback-android:2.0.0' - //Navigation component + // Navigation component implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" - //LiveData component + // LiveData component implementation "androidx.lifecycle:lifecycle-livedata-ktx:$rootProject.lifecycleVersion" - //Coroutines + // Coroutines implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutenes" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutenes" @@ -272,7 +265,7 @@ dependencies { testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.2' testImplementation 'org.powermock:powermock-module-junit4:1.6.2' - //Dagger + // Dagger kapt "com.google.dagger:dagger-compiler:$dagger_version" implementation "com.google.dagger:dagger:$dagger_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" @@ -284,6 +277,10 @@ dependencies { // liboqs implementation project(path: ':liboqs-android') + + // For crash logging. + implementation 'io.sentry:sentry-android:4.3.0' + implementation "androidx.multidex:multidex:2.0.1" } repositories { diff --git a/core/src/main/java/net/ivpn/core/common/bindings/IPSelectorBindingAdapter.kt b/core/src/main/java/net/ivpn/core/common/bindings/IPSelectorBindingAdapter.kt index 0d206a1c0..a9fed6773 100644 --- a/core/src/main/java/net/ivpn/core/common/bindings/IPSelectorBindingAdapter.kt +++ b/core/src/main/java/net/ivpn/core/common/bindings/IPSelectorBindingAdapter.kt @@ -26,12 +26,12 @@ import androidx.databinding.BindingAdapter import net.ivpn.core.common.views.IPSelectorView import net.ivpn.core.v2.viewmodel.LocationViewModel -@BindingAdapter("app:ipstate") +@BindingAdapter("ipstate") fun setState(view: IPSelectorView, state: LocationViewModel.IPState) { view.setState(state) } -@BindingAdapter("app:ipStateListener") +@BindingAdapter("ipStateListener") fun setStateListener(view: IPSelectorView, listener: LocationViewModel.OnIPStateChangedListener?) { view.setStateListener(listener) } \ No newline at end of file diff --git a/core/src/main/java/net/ivpn/core/common/bindings/ImageViewSrcBindingAdapter.kt b/core/src/main/java/net/ivpn/core/common/bindings/ImageViewSrcBindingAdapter.kt index 8c11ed969..02ec00be9 100644 --- a/core/src/main/java/net/ivpn/core/common/bindings/ImageViewSrcBindingAdapter.kt +++ b/core/src/main/java/net/ivpn/core/common/bindings/ImageViewSrcBindingAdapter.kt @@ -38,20 +38,6 @@ import net.ivpn.core.v2.splittunneling.items.ApplicationItem import java.io.File import java.io.IOException -@BindingAdapter("android:src") -fun setImageUri(view: ImageView, imageUri: String?) { - if (imageUri == null) { - view.setImageURI(null) - } else { - view.setImageURI(Uri.parse(imageUri)) - } -} - -@BindingAdapter("android:src") -fun setImageUri(view: ImageView, imageUri: Uri?) { - view.setImageURI(imageUri) -} - @BindingAdapter("android:src") fun setImageDrawable(view: ImageView, drawable: Drawable?) { view.setImageDrawable(drawable) diff --git a/core/src/main/java/net/ivpn/core/common/pinger/PingDataSet.kt b/core/src/main/java/net/ivpn/core/common/pinger/PingDataSet.kt index 0c6ab8c93..ad93e605b 100644 --- a/core/src/main/java/net/ivpn/core/common/pinger/PingDataSet.kt +++ b/core/src/main/java/net/ivpn/core/common/pinger/PingDataSet.kt @@ -23,7 +23,7 @@ package net.ivpn.core.common.pinger */ import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.Transformations +import androidx.lifecycle.map import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -40,9 +40,7 @@ class PingDataSet @Inject constructor( ) { val pings: MutableLiveData> = MutableLiveData() - val fastestServer = Transformations.map(pings) { - calculateFastestServer(it) - } + val fastestServer = pings.map { calculateFastestServer(it) } private var _pings: MutableMap = mutableMapOf() diff --git a/core/tools/CMakeLists.txt b/core/tools/CMakeLists.txt index f6763518c..c799b7d31 100644 --- a/core/tools/CMakeLists.txt +++ b/core/tools/CMakeLists.txt @@ -14,17 +14,18 @@ add_executable(libwg.so ${WG_SOURCES}) target_include_directories(libwg.so PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/wireguard-tools/src/uapi/linux/" "${CMAKE_CURRENT_SOURCE_DIR}/wireguard-tools/src/") target_compile_options(libwg.so PUBLIC -O3 -std=gnu11 -D_GNU_SOURCE -include ${CMAKE_CURRENT_SOURCE_DIR}/ndk-compat/compat.h -DHAVE_VISIBILITY_HIDDEN -DRUNSTATEDIR=\"/data/data/${ANDROID_PACKAGE_NAME}/cache\") -add_custom_target(libwg-go.so WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/libwg-go" COMMENT "Building wireguard-go" VERBATIM COMMAND make - ANDROID_ARCH_NAME=${ANDROID_ARCH_NAME} - ANDROID_C_COMPILER=${ANDROID_C_COMPILER} - ANDROID_TOOLCHAIN_ROOT=${ANDROID_TOOLCHAIN_ROOT} - ANDROID_LLVM_TRIPLE=${ANDROID_LLVM_TRIPLE} - ANDROID_SYSROOT=${ANDROID_SYSROOT} - ANDROID_PACKAGE_NAME=${ANDROID_PACKAGE_NAME} - GRADLE_USER_HOME=${GRADLE_USER_HOME} - CFLAGS=${CMAKE_C_FLAGS}\ -Wno-unused-command-line-argument - DESTDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - BUILDDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../generated-src - ) +add_custom_target(libwg-go.so WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/libwg-go" COMMENT "Building wireguard-go" VERBATIM COMMAND "${ANDROID_HOST_PREBUILTS}/bin/make" + ANDROID_ARCH_NAME=${ANDROID_ARCH_NAME} + ANDROID_PACKAGE_NAME=${ANDROID_PACKAGE_NAME} + GRADLE_USER_HOME=${GRADLE_USER_HOME} + CC=${CMAKE_C_COMPILER} + CFLAGS=${CMAKE_C_FLAGS} + LDFLAGS=${CMAKE_SHARED_LINKER_FLAGS} + SYSROOT=${CMAKE_SYSROOT} + TARGET=${CMAKE_C_COMPILER_TARGET} + DESTDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + BUILDDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../generated-src +) + # Hack to make it actually build as part of the default target add_dependencies(libwg.so libwg-go.so) diff --git a/core/tools/libwg-go/Makefile b/core/tools/libwg-go/Makefile index 8302a1264..a33afa844 100644 --- a/core/tools/libwg-go/Makefile +++ b/core/tools/libwg-go/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # -# Copyright © 2017-2019 WireGuard LLC. All Rights Reserved. +# Copyright © 2017-2023 WireGuard LLC. All Rights Reserved. BUILDDIR ?= $(CURDIR)/build DESTDIR ?= $(CURDIR)/out @@ -12,20 +12,20 @@ NDK_GO_ARCH_MAP_arm64 := arm64 NDK_GO_ARCH_MAP_mips := mipsx NDK_GO_ARCH_MAP_mips64 := mips64x -CLANG_FLAGS := --target=$(ANDROID_LLVM_TRIPLE) --gcc-toolchain=$(ANDROID_TOOLCHAIN_ROOT) --sysroot=$(ANDROID_SYSROOT) -export CGO_CFLAGS := $(CLANG_FLAGS) $(CFLAGS) -export CGO_LDFLAGS := $(CLANG_FLAGS) $(LDFLAGS) -Wl,-soname=libwg-go.so -export CC := $(ANDROID_C_COMPILER) +comma := , +CLANG_FLAGS := --target=$(TARGET) --sysroot=$(SYSROOT) +export CGO_CFLAGS := $(CLANG_FLAGS) $(subst -mthumb,-marm,$(CFLAGS)) +export CGO_LDFLAGS := $(CLANG_FLAGS) $(patsubst -Wl$(comma)--build-id=%,-Wl$(comma)--build-id=none,$(LDFLAGS)) -Wl,-soname=libwg-go.so export GOARCH := $(NDK_GO_ARCH_MAP_$(ANDROID_ARCH_NAME)) export GOOS := android export CGO_ENABLED := 1 -GO_VERSION := 1.16 +GO_VERSION := 1.20.3 GO_PLATFORM := $(shell uname -s | tr '[:upper:]' '[:lower:]')-$(NDK_GO_ARCH_MAP_$(shell uname -m)) GO_TARBALL := go$(GO_VERSION).$(GO_PLATFORM).tar.gz -GO_HASH_darwin-amd64 := 6000a9522975d116bf76044967d7e69e04e982e9625330d9a539a8b45395f9a8 -GO_HASH_darwin-arm64 := 4dac57c00168d30bbd02d95131d5de9ca88e04f2c5a29a404576f30ae9b54810 -GO_HASH_linux-amd64 := 013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2 +GO_HASH_darwin-amd64 := c1e1161d6d859deb576e6cfabeb40e3d042ceb1c6f444f617c3c9d76269c3565 +GO_HASH_darwin-arm64 := 86b0ed0f2b2df50fa8036eea875d1cf2d76cefdacf247c44639a1464b7e36b95 +GO_HASH_linux-amd64 := 979694c2c25c735755bf26f4f45e19e64e4811d661dd07b8c010f7a8e18adfca default: $(DESTDIR)/libwg-go.so @@ -42,11 +42,10 @@ $(BUILDDIR)/go-$(GO_VERSION)/.prepared: $(GRADLE_USER_HOME)/caches/golang/$(GO_T flock "$@.lock" -c ' \ [ -f "$@" ] && exit 0; \ tar -C "$(dir $@)" --strip-components=1 -xzf "$^" && \ - patch -p1 -f -N -r- -d "$(dir $@)" < goruntime-boottime-over-monotonic.diff && \ touch "$@"' $(DESTDIR)/libwg-go.so: export PATH := $(BUILDDIR)/go-$(GO_VERSION)/bin/:$(PATH) $(DESTDIR)/libwg-go.so: $(BUILDDIR)/go-$(GO_VERSION)/.prepared go.mod - go build -tags linux -ldflags="-X golang.zx2c4.com/wireguard/ipc.socketDirectory=/data/data/$(ANDROID_PACKAGE_NAME)/cache/wireguard" -v -trimpath -o "$@" -buildmode c-shared + go build -tags linux -ldflags="-X golang.zx2c4.com/wireguard/ipc.socketDirectory=/data/data/$(ANDROID_PACKAGE_NAME)/cache/wireguard -buildid=" -v -trimpath -buildvcs=false -o "$@" -buildmode c-shared .DELETE_ON_ERROR: diff --git a/core/tools/libwg-go/api-android.go b/core/tools/libwg-go/api-android.go index 6d0802ff8..d47c5d76c 100644 --- a/core/tools/libwg-go/api-android.go +++ b/core/tools/libwg-go/api-android.go @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 * - * Copyright (C) 2017-2019 Jason A. Donenfeld . All Rights Reserved. + * Copyright © 2017-2022 Jason A. Donenfeld . All Rights Reserved. */ package main diff --git a/core/tools/libwg-go/go.mod b/core/tools/libwg-go/go.mod index 280e464e4..0be5f7ef6 100644 --- a/core/tools/libwg-go/go.mod +++ b/core/tools/libwg-go/go.mod @@ -1,10 +1,14 @@ module golang.zx2c4.com/wireguard/android -go 1.16 +go 1.19 require ( - golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect - golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d // indirect - golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43 - golang.zx2c4.com/wireguard v0.0.0-20210222142647-219296a1e787 + golang.org/x/sys v0.6.0 + golang.zx2c4.com/wireguard v0.0.0-20230223181233-21636207a675 +) + +require ( + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect ) diff --git a/core/tools/libwg-go/go.sum b/core/tools/libwg-go/go.sum index b3df24809..3b49b497d 100644 --- a/core/tools/libwg-go/go.sum +++ b/core/tools/libwg-go/go.sum @@ -1,21 +1,10 @@ -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g= -golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d h1:1aflnvSoWWLI2k/dMUAl5lvU1YO4Mb4hz0gh+1rjcxU= -golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210105210732-16f7687f5001/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43 h1:SgQ6LNaYJU0JIuEHv9+s6EbhSCwYeAf5Yvj6lpYlqAE= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.zx2c4.com/wireguard v0.0.0-20210222142647-219296a1e787 h1:zrctiUlt4hD1sgxBYrG5CAjobVhpdxnUXy+qyWWLR1w= -golang.zx2c4.com/wireguard v0.0.0-20210222142647-219296a1e787/go.mod h1:LofpIKqPJNvHiwKXuzsBshJCTe7IgRAz3iizquljFDk= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg= +golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI= +golang.zx2c4.com/wireguard v0.0.0-20230223181233-21636207a675 h1:/J/RVnr7ng4fWPRH3xa4WtBJ1Jp+Auu4YNLmGiPv5QU= +golang.zx2c4.com/wireguard v0.0.0-20230223181233-21636207a675/go.mod h1:whfbyDBt09xhCYQWtO2+3UVjlaq6/9hDZrjg2ZE6SyA= diff --git a/core/tools/libwg-go/jni.c b/core/tools/libwg-go/jni.c index 3f877d472..7ad94d350 100644 --- a/core/tools/libwg-go/jni.c +++ b/core/tools/libwg-go/jni.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 * - * Copyright © 2017-2019 Jason A. Donenfeld . All Rights Reserved. + * Copyright © 2017-2021 Jason A. Donenfeld . All Rights Reserved. */ #include diff --git a/core/tools/ndk-compat/compat.c b/core/tools/ndk-compat/compat.c index 7cc99fc48..c5ce85ec1 100644 --- a/core/tools/ndk-compat/compat.c +++ b/core/tools/ndk-compat/compat.c @@ -1,64 +1,12 @@ /* SPDX-License-Identifier: BSD * - * Copyright © 2017-2019 WireGuard LLC. All Rights Reserved. + * Copyright © 2017-2023 WireGuard LLC. All Rights Reserved. * */ #define FILE_IS_EMPTY -#if defined(__ANDROID_API__) && __ANDROID_API__ < 18 -#undef FILE_IS_EMPTY -#include -#include - -ssize_t getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp) -{ - char *ptr, *eptr; - - if (*buf == NULL || *bufsiz == 0) { - *bufsiz = BUFSIZ; - if ((*buf = malloc(*bufsiz)) == NULL) - return -1; - } - - for (ptr = *buf, eptr = *buf + *bufsiz;;) { - int c = fgetc(fp); - if (c == -1) { - if (feof(fp)) { - ssize_t diff = (ssize_t)(ptr - *buf); - if (diff != 0) { - *ptr = '\0'; - return diff; - } - } - return -1; - } - *ptr++ = c; - if (c == delimiter) { - *ptr = '\0'; - return ptr - *buf; - } - if (ptr + 2 >= eptr) { - char *nbuf; - size_t nbufsiz = *bufsiz * 2; - ssize_t d = ptr - *buf; - if ((nbuf = realloc(*buf, nbufsiz)) == NULL) - return -1; - *buf = nbuf; - *bufsiz = nbufsiz; - eptr = nbuf + nbufsiz; - ptr = nbuf + d; - } - } -} - -ssize_t getline(char **buf, size_t *bufsiz, FILE *fp) -{ - return getdelim(buf, bufsiz, '\n', fp); -} -#endif - -#if defined(__ANDROID_API__) && __ANDROID_API__ < 24 +#if defined(__ANDROID_MIN_SDK_VERSION__) && __ANDROID_MIN_SDK_VERSION__ < 24 #undef FILE_IS_EMPTY #include diff --git a/core/tools/ndk-compat/compat.h b/core/tools/ndk-compat/compat.h index 52f6c1274..7dfd8e14e 100644 --- a/core/tools/ndk-compat/compat.h +++ b/core/tools/ndk-compat/compat.h @@ -1,16 +1,10 @@ /* SPDX-License-Identifier: BSD * - * Copyright © 2017-2019 WireGuard LLC. All Rights Reserved. + * Copyright © 2017-2023 WireGuard LLC. All Rights Reserved. * */ -#if defined(__ANDROID_API__) && __ANDROID_API__ < 18 -#include -ssize_t getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp); -ssize_t getline(char **buf, size_t *bufsiz, FILE *fp); -#endif - -#if defined(__ANDROID_API__) && __ANDROID_API__ < 24 +#if defined(__ANDROID_MIN_SDK_VERSION__) && __ANDROID_MIN_SDK_VERSION__ < 24 char *strchrnul(const char *s, int c); #endif diff --git a/core/tools/wireguard-tools b/core/tools/wireguard-tools index ecb1ea29d..b4f6b4f22 160000 --- a/core/tools/wireguard-tools +++ b/core/tools/wireguard-tools @@ -1 +1 @@ -Subproject commit ecb1ea29d71e850d245f89ac709cf77438dc7b02 +Subproject commit b4f6b4f229d291daf7c35c6f1e7f4841cc6d69bc diff --git a/fdroid/build.gradle b/fdroid/build.gradle index 6776df796..d52d5f584 100644 --- a/fdroid/build.gradle +++ b/fdroid/build.gradle @@ -2,7 +2,6 @@ plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-kapt' - id 'kotlin-android-extensions' } def keystoreProperties = new Properties() @@ -13,6 +12,8 @@ if (new File("keystore.properties").exists()) { } android { + namespace "net.ivpn.client" + signingConfigs { release { keyAlias keystoreProperties['release.key.alias'] @@ -25,7 +26,6 @@ android { } compileSdkVersion 33 - buildToolsVersion "30.0.3" defaultConfig { applicationId "net.ivpn.client" @@ -68,25 +68,16 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = JavaVersion.VERSION_17 } dataBinding { enabled = true } - - androidExtensions { - experimental = true - } - - dexOptions { - incremental true - javaMaxHeapSize "4g" - } } dependencies { @@ -96,17 +87,17 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'com.google.android.material:material:1.4.0' - //Dagger + // Dagger kapt "com.google.dagger:dagger-compiler:$dagger_version" implementation "com.google.dagger:dagger:$dagger_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" - //Powerful library for logging + // Powerful library for logging implementation 'org.slf4j:slf4j-api:1.7.24' implementation 'org.slf4j:jul-to-slf4j:1.7.0' implementation 'com.github.tony19:logback-android:2.0.0' - //Navigation component + // Navigation component implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" diff --git a/gradle.properties b/gradle.properties index c34ec1156..1bfb63e15 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,7 @@ android.enableJetifier=true android.useAndroidX=true android.bundle.enableUncompressedNativeLibs = false org.gradle.jvmargs=-Xmx2048M +android.defaults.buildfeatures.buildconfig=true # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 88b9b87a4..566de501b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Mar 09 10:10:35 CET 2023 +#Thu Sep 28 18:15:45 CEST 2023 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/liboqs-android/build.gradle b/liboqs-android/build.gradle index 0858a511d..7c8eddf2f 100644 --- a/liboqs-android/build.gradle +++ b/liboqs-android/build.gradle @@ -3,6 +3,8 @@ plugins { } android { + namespace "net.ivpn.liboqs" + compileSdkVersion 33 defaultConfig { minSdkVersion 21 @@ -21,7 +23,6 @@ android { buildTypes { release { - debuggable false jniDebuggable false zipAlignEnabled true minifyEnabled false @@ -30,8 +31,8 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } externalNativeBuild { diff --git a/site/build.gradle b/site/build.gradle index 8f350b654..b99968afc 100644 --- a/site/build.gradle +++ b/site/build.gradle @@ -2,7 +2,6 @@ plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-kapt' - id 'kotlin-android-extensions' } def keystoreProperties = new Properties() @@ -13,6 +12,8 @@ if (new File("keystore.properties").exists()) { } android { + namespace "net.ivpn.client" + signingConfigs { release { keyAlias keystoreProperties['release.key.alias'] @@ -69,25 +70,16 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = JavaVersion.VERSION_17 } dataBinding { enabled = true } - - androidExtensions { - experimental = true - } - - dexOptions { - incremental true - javaMaxHeapSize "4g" - } } kapt { @@ -105,24 +97,24 @@ dependencies { implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.squareup.retrofit2:converter-gson:2.6.2' - //Dagger + // Dagger kapt "com.google.dagger:dagger-compiler:$dagger_version" implementation "com.google.dagger:dagger:$dagger_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" - //Powerful library for logging + // Powerful library for logging implementation 'org.slf4j:slf4j-api:1.7.24' implementation 'org.slf4j:jul-to-slf4j:1.7.0' implementation 'com.github.tony19:logback-android:2.0.0' - //Navigation component + // Navigation component implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" - //Navigation component dynamic feature module support + // Navigation component dynamic feature module support implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version" - //For crash logging. + // For crash logging. implementation 'io.sentry:sentry-android:4.3.0' implementation "androidx.multidex:multidex:2.0.1" diff --git a/site/src/main/java/net/ivpn/client/updater/UpdateHelper.kt b/site/src/main/java/net/ivpn/client/updater/UpdateHelper.kt index a464b6174..982f51894 100644 --- a/site/src/main/java/net/ivpn/client/updater/UpdateHelper.kt +++ b/site/src/main/java/net/ivpn/client/updater/UpdateHelper.kt @@ -161,8 +161,8 @@ class UpdateHelper @Inject constructor( LOGGER.info("Open settings") NavDeepLinkBuilder(IVPNApplication.application) - .setGraph(R.navigation.nav_graph) - .setDestination(R.id.settingsFragment) + .setGraph(net.ivpn.core.R.navigation.nav_graph) + .setDestination(net.ivpn.core.R.id.settingsFragment) .createTaskStackBuilder() .startActivities() diff --git a/site/src/main/java/net/ivpn/client/updates/UpdatesViewModel.kt b/site/src/main/java/net/ivpn/client/updates/UpdatesViewModel.kt index f02e02c49..e37197585 100644 --- a/site/src/main/java/net/ivpn/client/updates/UpdatesViewModel.kt +++ b/site/src/main/java/net/ivpn/client/updates/UpdatesViewModel.kt @@ -142,7 +142,7 @@ class UpdatesViewModel @Inject constructor( } override fun openUpdatesScreen(navController: NavController?) { - IVPNApplication.moduleNavGraph.startDestination = R.id.updatesFragment + IVPNApplication.moduleNavGraph.setStartDestination(R.id.updatesFragment) navController?.navigate(IVPNApplication.moduleNavGraph.id) } diff --git a/store/build.gradle b/store/build.gradle index 4d4a40f42..766c940f1 100644 --- a/store/build.gradle +++ b/store/build.gradle @@ -2,7 +2,6 @@ plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-kapt' - id 'kotlin-android-extensions' id "androidx.navigation.safeargs.kotlin" } @@ -14,6 +13,8 @@ if (new File("keystore.properties").exists()) { } android { + namespace "net.ivpn.client" + signingConfigs { release { keyAlias keystoreProperties['release.key.alias'] @@ -68,25 +69,16 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8 + jvmTarget = JavaVersion.VERSION_17 } dataBinding { enabled = true } - - androidExtensions { - experimental = true - } - - dexOptions { - incremental true - javaMaxHeapSize "4g" - } } kapt { @@ -104,29 +96,29 @@ dependencies { // Retrofit implementation 'com.squareup.retrofit2:retrofit:2.6.2' - // Purchases + // Purchases implementation 'com.android.billingclient:billing:6.0.0' - //Dagger + // Dagger kapt "com.google.dagger:dagger-compiler:$dagger_version" implementation "com.google.dagger:dagger:$dagger_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version" - //Powerful library for logging + // Powerful library for logging implementation 'org.slf4j:slf4j-api:1.7.24' implementation 'org.slf4j:jul-to-slf4j:1.7.0' implementation 'com.github.tony19:logback-android:2.0.0' - //Navigation component + // Navigation component implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" - //Navigation component dynamic feature module support + // Navigation component dynamic feature module support implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version" implementation "androidx.multidex:multidex:2.0.1" - //For crash logging. + // For crash logging. implementation 'io.sentry:sentry-android:4.3.0' testImplementation 'junit:junit:4.+' diff --git a/store/src/main/java/net/ivpn/client/billing/BillingActivity.java b/store/src/main/java/net/ivpn/client/billing/BillingActivity.java index 5e08963e5..1227c7b60 100644 --- a/store/src/main/java/net/ivpn/client/billing/BillingActivity.java +++ b/store/src/main/java/net/ivpn/client/billing/BillingActivity.java @@ -101,7 +101,7 @@ public void onPurchaseAlreadyDone() { @Override public void createPurchaseErrorDialog(String errorCode, String errorMessage) { DialogBuilder.createFullCustomNotificationDialog(this, - this.getString(R.string.dialogs_error) + " " + errorCode, + this.getString(net.ivpn.core.R.string.dialogs_error) + " " + errorCode, errorMessage != null ? errorMessage : "", dialog -> { BillingActivity.this.finish(); }); diff --git a/store/src/main/java/net/ivpn/client/signup/SignUpAccountCreatedFragment.kt b/store/src/main/java/net/ivpn/client/signup/SignUpAccountCreatedFragment.kt index a6bc501cf..360b97e08 100644 --- a/store/src/main/java/net/ivpn/client/signup/SignUpAccountCreatedFragment.kt +++ b/store/src/main/java/net/ivpn/client/signup/SignUpAccountCreatedFragment.kt @@ -105,7 +105,7 @@ class SignUpAccountCreatedFragment : Fragment() { val myClip: ClipData = ClipData.newPlainText("User Id", userId) myClipboard.setPrimaryClip(myClip) - ToastUtil.toast(R.string.account_clipboard) + ToastUtil.toast(net.ivpn.core.R.string.account_clipboard) } } diff --git a/store/src/main/java/net/ivpn/client/signup/SignUpPeriodFragment.kt b/store/src/main/java/net/ivpn/client/signup/SignUpPeriodFragment.kt index 2ea9e89d4..e26724655 100644 --- a/store/src/main/java/net/ivpn/client/signup/SignUpPeriodFragment.kt +++ b/store/src/main/java/net/ivpn/client/signup/SignUpPeriodFragment.kt @@ -131,8 +131,8 @@ class SignUpPeriodFragment : Fragment(), SignUpViewModel.SignUpNavigator { override fun onGoogleConnectFailure() { if (activity != null) { - DialogBuilder.createFullCustomNotificationDialog(activity, getString(R.string.dialogs_error), - getString(R.string.billing_error_message)) { + DialogBuilder.createFullCustomNotificationDialog(activity, getString(net.ivpn.core.R.string.dialogs_error), + getString(net.ivpn.core.R.string.billing_error_message)) { findNavControllerSafely()?.popBackStack() } } diff --git a/store/src/main/java/net/ivpn/client/signup/SignUpProductFragment.kt b/store/src/main/java/net/ivpn/client/signup/SignUpProductFragment.kt index 27dd32f96..908d728fa 100644 --- a/store/src/main/java/net/ivpn/client/signup/SignUpProductFragment.kt +++ b/store/src/main/java/net/ivpn/client/signup/SignUpProductFragment.kt @@ -115,8 +115,8 @@ class SignUpProductFragment : Fragment(), SignUpViewModel.SignUpNavigator { override fun onGoogleConnectFailure() { if (activity != null) { - DialogBuilder.createFullCustomNotificationDialog(activity, getString(R.string.dialogs_error), - getString(R.string.billing_error_message)) { + DialogBuilder.createFullCustomNotificationDialog(activity, getString(net.ivpn.core.R.string.dialogs_error), + getString(net.ivpn.core.R.string.billing_error_message)) { findNavControllerSafely()?.popBackStack() } } diff --git a/store/src/main/java/net/ivpn/client/signup/SignUpViewModel.kt b/store/src/main/java/net/ivpn/client/signup/SignUpViewModel.kt index 70c40805d..fc453e17b 100644 --- a/store/src/main/java/net/ivpn/client/signup/SignUpViewModel.kt +++ b/store/src/main/java/net/ivpn/client/signup/SignUpViewModel.kt @@ -135,7 +135,7 @@ class SignUpViewModel @Inject constructor( if (accountID.isEmpty() || !isBlankAccountFresh()) { createNewAccount() } else { - IVPNApplication.moduleNavGraph.startDestination = R.id.signUpAccountCreatedFragment + IVPNApplication.moduleNavGraph.setStartDestination(R.id.signUpAccountCreatedFragment) navController?.navigate(IVPNApplication.moduleNavGraph.id) } } ?: kotlin.run { @@ -146,7 +146,7 @@ class SignUpViewModel @Inject constructor( override fun signUpWith(navController: NavController?, username: String?) { blankAccountID.set(username) - IVPNApplication.moduleNavGraph.startDestination = R.id.signUpProductFragment + IVPNApplication.moduleNavGraph.setStartDestination(R.id.signUpProductFragment) navController?.navigate(IVPNApplication.moduleNavGraph.id) } @@ -156,7 +156,7 @@ class SignUpViewModel @Inject constructor( blankAccountID.set(null) selectedPlan.set(plan) - IVPNApplication.moduleNavGraph.startDestination = R.id.signUpPeriodFragment2 + IVPNApplication.moduleNavGraph.setStartDestination(R.id.signUpPeriodFragment2) navController?.navigate(IVPNApplication.moduleNavGraph.id) } else { openSite()