Skip to content

Commit

Permalink
Merge pull request #176 from Tribler/CS4160/class-of-2024
Browse files Browse the repository at this point in the history
Dependency Upgrades
  • Loading branch information
InvictusRMC authored Feb 19, 2024
2 parents 8e5442e + 0d74168 commit 61588e9
Show file tree
Hide file tree
Showing 367 changed files with 14,344 additions and 10,405 deletions.
7 changes: 5 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

# ktlint
disabled_rules = no-wildcard-imports, import-ordering, max-line-length, no-unused-imports
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_import-ordering = disabled
ktlint_function_naming_ignore_when_annotated_with = Composable
5 changes: 3 additions & 2 deletions .github/workflows/apk_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ jobs:
- uses: ./.github/actions/checkout_submodules

- name: Setup Java
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
java-version: '17'

- name: Build release APK
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/apk_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ jobs:
- uses: ./.github/actions/checkout_submodules

- name: Setup Java
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
java-version: '17'

- name: Build release APK
run: |
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,29 @@ on:
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
# TODO: Ubuntu currently broken.
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: ./.github/actions/checkout_submodules

- name: Setup Java
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
java-version: '17'

# TODO: This is currently broken due to SqlDelight.
# - name: Run check
# run: bash ./gradlew check

- name: Run tests
run: bash ./gradlew check
run: bash ./gradlew test

- name: Run lint
run: bash ./gradlew ktlintCheck

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# TrustChain Super App [![Build Status](https://github.com/Tribler/trustchain-superapp/workflows/build/badge.svg)](https://github.com/Tribler/trustchain-superapp/actions)
# TrustChain Super App
[![Build Status](https://github.com/Tribler/trustchain-superapp/workflows/build/badge.svg)](https://github.com/Tribler/trustchain-superapp/actions) [![ktlint](https://img.shields.io/badge/ktlint%20code--style-%E2%9D%A4-FF4081)](https://pinterest.github.io/ktlint/)

This repository contains a collection of Android apps built on top of [IPv8](https://github.com/MattSkala/kotlin-ipv8) (our P2P networking stack) and [TrustChain](https://github.com/Tribler/kotlin-ipv8/blob/master/doc/TrustChainCommunity.md) (a scalable, distributed, pair-wise ledger). All applications are built into a single APK, following the concept of [super apps](https://home.kpmg/xx/en/home/insights/2019/06/super-app-or-super-disruption.html) – an emerging trend that allows to provide an ecosystem for multiple services within a single all-in-one app experience.

Expand Down Expand Up @@ -134,6 +135,7 @@ Run unit tests:
```
./gradlew test
```
*Note: Currently tests fail on Linux, but pass on Windows and Mac. This is due to the tests relying on a native jlibtorrent binary, of which the linux version cannot be bundled with android builds. We are working on a solution to this problem.*

Run instrumented tests:
```
Expand All @@ -142,7 +144,7 @@ Run instrumented tests:

## Code style

[Ktlint](https://ktlint.github.io/) is used to enforce a consistent code style across the whole project.
[Ktlint](https://ktlint.github.io/) is used to enforce a consistent code style across the whole project. It is recommended to install the [ktlint plugin](https://plugins.jetbrains.com/plugin/15057-ktlint) for your IDE to get real-time feedback.

Check code style:
```
Expand Down
28 changes: 15 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'androidx.navigation.safeargs'
apply plugin: 'org.jlleitschuh.gradle.ktlint'
apply plugin: 'com.google.gms.google-services'
Expand All @@ -27,6 +26,7 @@ ktlint {
android = true
outputToConsole = true
ignoreFailures = false
verbose = true
}

// Generate a version code from git commit count
Expand All @@ -36,12 +36,11 @@ static def generateVersionCode() {


android {
compileSdkVersion 33

defaultConfig {
applicationId "nl.tudelft.trustchain"
minSdkVersion 24
targetSdkVersion 33
minSdkVersion 26
compileSdk 34
targetSdkVersion 34
versionCode generateVersionCode()
versionName "0.3.3"

Expand All @@ -59,6 +58,8 @@ android {

sourceSets {
main {
// TODO: Find a way to exclude linux .so
// TODO: Reintroduce the jlibtorrent library for linux.
jniLibs.srcDirs = ['../common/libs']
}
}
Expand All @@ -69,17 +70,19 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
}
}

// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)
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.toString()
}

buildFeatures {
Expand All @@ -91,7 +94,6 @@ android {
}
}

ndkVersion '21.4.7075529'
namespace 'nl.tudelft.trustchain.app'
}

Expand Down Expand Up @@ -189,7 +191,7 @@ dependencies {

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.freeCompilerArgs += [
"-opt-in=kotlin.Experimental,kotlin.ExperimentalUnsignedTypes",
"-opt-in=kotlin.RequiresOptIn"
"-opt-in=kotlin.ExperimentalUnsignedTypes",
"-opt-in=kotlin.RequiresOptIn"
]
}
40 changes: 40 additions & 0 deletions app/src/debug/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"project_info": {
"project_number": "327016605343",
"firebase_url": "https://trustchain-superapp.firebaseio.com",
"project_id": "trustchain-superapp",
"storage_bucket": "trustchain-superapp.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:327016605343:android:3055eb92f8bea31f5ae4aa",
"android_client_info": {
"package_name": "nl.tudelft.trustchain.debug"
}
},
"oauth_client": [
{
"client_id": "327016605343-rkvebn5hatrighvkr3ea8gn0br7d7f9d.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAUq3-O12VR884jokteVn14yiXDeckIxAQ"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "327016605343-rkvebn5hatrighvkr3ea8gn0br7d7f9d.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
11 changes: 9 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<uses-permission
android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"
android:minSdkVersion="34" />


<!--BLUETOOTH PERMISSION-->
<!-- Request legacy Bluetooth permissions on older devices. -->
Expand Down Expand Up @@ -80,7 +86,7 @@
android:theme="@style/Theme.PeerChat" />

<activity
android:name="nl.tudelft.trustchain.FOC.MainActivityFOC"
android:name="nl.tudelft.trustchain.foc.MainActivityFOC"
android:parentActivityName=".ui.dashboard.DashboardActivity"
tools:ignore="InnerclassSeparator" />

Expand Down Expand Up @@ -130,7 +136,8 @@

<service
android:name="nl.tudelft.trustchain.app.service.TrustChainService"
android:exported="false" />
android:exported="false"
android:foregroundServiceType="dataSync" />

<service
android:name="nl.tudelft.trustchain.musicdao.core.repositories.MusicGossipingService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.app.Activity
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import nl.tudelft.trustchain.musicdao.MusicActivity
import nl.tudelft.trustchain.FOC.MainActivityFOC
import nl.tudelft.trustchain.foc.MainActivityFOC
import nl.tudelft.trustchain.common.R
import nl.tudelft.trustchain.currencyii.CurrencyIIMainActivity
import nl.tudelft.trustchain.debug.DebugActivity
Expand Down
38 changes: 20 additions & 18 deletions app/src/main/java/nl/tudelft/trustchain/app/AppLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class AppLoader(
private val dataStore: DataStore<Preferences>,
private val firstRun: Boolean = false
) {

val preferredApps: List<DashboardItem>
get() = apps.filter { it.isPreferred }
var apps: Set<DashboardItem>
Expand All @@ -26,12 +25,13 @@ class AppLoader(
setPreferredAppList(DEFAULT_APPS)
} else {
val pApps = getPreferredAppList()
apps = AppDefinition.values().map { app ->
DashboardItem(
app,
isPreferred = pApps.contains(app.appName)
)
}.toSet()
apps =
AppDefinition.values().map { app ->
DashboardItem(
app,
isPreferred = pApps.contains(app.appName)
)
}.toSet()
}
}
}
Expand All @@ -49,10 +49,11 @@ class AppLoader(
}

private suspend fun getPreferredAppList(): Set<String> {
val preferredApps: Flow<Set<String>> = dataStore.data
.map { preferences ->
preferences[PREFERRED_APPS] ?: emptySet()
}
val preferredApps: Flow<Set<String>> =
dataStore.data
.map { preferences ->
preferences[PREFERRED_APPS] ?: emptySet()
}
preferredApps.first().let {
return it
}
Expand All @@ -69,12 +70,13 @@ class AppLoader(

companion object {
val PREFERRED_APPS = stringSetPreferencesKey("preferred_apps")
val DEFAULT_APPS = setOf(
AppDefinition.CURRENCY_II.appName,
AppDefinition.VALUETRANSFER.appName,
AppDefinition.MUSIC_DAO.appName,
AppDefinition.EUROTOKEN.appName,
AppDefinition.FREEDOM_OF_COMPUTING.appName
)
val DEFAULT_APPS =
setOf(
AppDefinition.CURRENCY_II.appName,
AppDefinition.VALUETRANSFER.appName,
AppDefinition.MUSIC_DAO.appName,
AppDefinition.EUROTOKEN.appName,
AppDefinition.FREEDOM_OF_COMPUTING.appName
)
}
}
Loading

0 comments on commit 61588e9

Please sign in to comment.