Skip to content

Commit 557795b

Browse files
committed
Fixing linting issues and upgrade testing and QR dependencies
1 parent 58673b6 commit 557795b

File tree

37 files changed

+81
-69
lines changed

37 files changed

+81
-69
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ insert_final_newline = true
1010
end_of_line = lf
1111

1212
# ktlint
13-
disabled_rules = no-wildcard-imports, import-ordering, max-line-length
13+
disabled_rules = no-wildcard-imports, import-ordering, max-line-length, no-unused-imports

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ dependencies {
178178

179179
// Testing
180180
testImplementation 'junit:junit:4.13.2'
181-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
181+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
182182
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
183183
}
184184

app/src/main/AndroidManifest.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
android:supportsRtl="true"
3939
android:theme="@style/AppTheme"
4040
tools:ignore="AllowBackup">
41-
41+
<!-- TODO: verify the validity of used export options -->
4242
<activity
4343
android:name=".ui.dashboard.DashboardActivity"
4444
android:exported="true"
@@ -140,6 +140,7 @@
140140

141141
<activity
142142
android:name="nl.tudelft.trustchain.valuetransfer.passport.PassportCaptureActivity"
143+
android:exported="true"
143144
android:screenOrientation="portrait"
144145
android:stateNotNeeded="true"
145146
android:windowSoftInputMode="stateAlwaysHidden" />
@@ -172,7 +173,9 @@
172173
android:resource="@xml/searchable" />
173174
</activity>
174175

175-
<service android:name="nl.tudelft.trustchain.app.service.TrustChainService" />
176+
<service
177+
android:name="nl.tudelft.trustchain.app.service.TrustChainService"
178+
android:exported="false" />
176179

177180
<service
178181
android:name="com.example.musicdao.MusicGossipingService"
@@ -182,6 +185,8 @@
182185
<meta-data
183186
android:name="com.google.android.geo.API_KEY"
184187
android:value="AIzaSyBAGd8-KwX1epS_0CPl5RF0hD8VeTmM-7Y" />
188+
185189
</application>
186190

191+
187192
</manifest>

app/src/main/java/nl/tudelft/trustchain/app/TrustChainApplication.kt

+10-8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import com.squareup.sqldelight.android.AndroidSqliteDriver
1818
import com.squareup.sqldelight.db.SqlDriver
1919
import kotlinx.coroutines.*
2020
import kotlinx.coroutines.flow.Flow
21-
import kotlinx.coroutines.flow.collect
2221
import kotlinx.coroutines.flow.first
2322
import kotlinx.coroutines.flow.map
2423
import nl.tudelft.ipv8.IPv8Configuration
@@ -214,12 +213,12 @@ class TrustChainApplication : Application() {
214213
database: TrustChainStore
215214
): ValidationResult {
216215
if ((
217-
block.transaction[AtomicSwapTrustchainConstants.TRANSACTION_FROM_COIN] != null &&
218-
block.transaction[AtomicSwapTrustchainConstants.TRANSACTION_TO_COIN] != null &&
219-
block.transaction[AtomicSwapTrustchainConstants.TRANSACTION_FROM_AMOUNT] != null &&
220-
block.transaction[AtomicSwapTrustchainConstants.TRANSACTION_TO_AMOUNT] != null &&
221-
block.transaction[AtomicSwapTrustchainConstants.TRANSACTION_OFFER_ID] != null
222-
) ||
216+
block.transaction[AtomicSwapTrustchainConstants.TRANSACTION_FROM_COIN] != null &&
217+
block.transaction[AtomicSwapTrustchainConstants.TRANSACTION_TO_COIN] != null &&
218+
block.transaction[AtomicSwapTrustchainConstants.TRANSACTION_FROM_AMOUNT] != null &&
219+
block.transaction[AtomicSwapTrustchainConstants.TRANSACTION_TO_AMOUNT] != null &&
220+
block.transaction[AtomicSwapTrustchainConstants.TRANSACTION_OFFER_ID] != null
221+
) ||
223222
block.isAgreement
224223
) {
225224
return ValidationResult.Valid
@@ -390,6 +389,8 @@ class TrustChainApplication : Application() {
390389
)
391390
}
392391

392+
// TODO: Fix for older Android versions.
393+
@SuppressLint("NewApi")
393394
private fun createLiteratureCommunity(): OverlayConfiguration<LiteratureCommunity> {
394395
val settings = TrustChainSettings()
395396
val driver = AndroidSqliteDriver(Database.Schema, this, "music.db")
@@ -462,7 +463,8 @@ class TrustChainApplication : Application() {
462463

463464
private suspend fun checkFirstRun(): Boolean {
464465
val key = booleanPreferencesKey(
465-
FIRST_RUN)
466+
FIRST_RUN
467+
)
466468
val preferredApps: Flow<Boolean> = dataStore.data
467469
.map { preferences ->
468470
preferences[key] ?: true

app/src/main/java/nl/tudelft/trustchain/app/ui/dashboard/DashboardActivity.kt

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import android.os.Bundle
99
import android.provider.Settings
1010
import androidx.annotation.RequiresApi
1111
import androidx.appcompat.app.AppCompatActivity
12-
import androidx.navigation.findNavController
1312
import androidx.recyclerview.widget.GridLayoutManager
1413
import com.mattskala.itemadapter.ItemAdapter
1514
import nl.tudelft.ipv8.android.IPv8Android

app/src/main/java/nl/tudelft/trustchain/app/ui/dashboard/DashboardSelectorActivity.kt

-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,4 @@ class DashboardSelectorActivity : AppCompatActivity() {
3636

3737
adapter.updateItems((application as TrustChainApplication).appLoader.apps.toList())
3838
}
39-
40-
4139
}

app/src/main/java/nl/tudelft/trustchain/app/ui/dashboard/DashboardSelectorRenderer.kt

-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ package nl.tudelft.trustchain.app.ui.dashboard
33
import android.content.res.ColorStateList
44
import androidx.core.content.res.ResourcesCompat
55
import com.mattskala.itemadapter.BindingItemRenderer
6-
import nl.tudelft.trustchain.app.databinding.ItemDashboardBinding
76
import nl.tudelft.trustchain.app.databinding.ItemSelectorBinding
8-
import org.web3j.abi.datatypes.Bool
97

108
class DashboardSelectorRenderer(
119
private val onItemClick: (DashboardItem, Boolean) -> Unit
@@ -27,5 +25,4 @@ class DashboardSelectorRenderer(
2725
onItemClick(item, isChecked)
2826
}
2927
}
30-
3128
}

atomic-swap/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ dependencies {
6969
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
7070

7171
testImplementation 'junit:junit:4.12'
72-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
72+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
7373
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
7474
}

build.gradle

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
buildscript {
44
ext.kotlin_version = '1.7.10'
5-
ext.ktlint_version = '0.40.0'
5+
ext.ktlint_version = '0.44.0'
66
ext.coroutines_version = '1.6.4'
77
ext.ktlint_gradle_version = '11.0.0'
88
ext.sqldelight_version = '1.5.2'
@@ -40,9 +40,6 @@ allprojects {
4040
jcenter()
4141
mavenCentral()
4242
maven { url 'https://jitpack.io' }
43-
flatDir {
44-
dirs 'common/libs'
45-
}
4643
}
4744

4845
// Temp fix for issue https://github.com/mockk/mockk/issues/281

common-bitcoin/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ dependencies {
4343
implementation 'com.google.android.material:material:1.1.0'
4444

4545
testImplementation 'junit:junit:4.13.2'
46-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
46+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
4747
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
4848
}

common-ethereum/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ dependencies {
6060
implementation 'com.google.android.material:material:1.1.0'
6161

6262
testImplementation 'junit:junit:4.13.2'
63-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
63+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
6464
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
6565
}

common/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ dependencies {
9898
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
9999

100100
// QR
101-
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
101+
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
102102

103103
// Material
104104
implementation 'com.google.android.material:material:1.1.0'
@@ -111,13 +111,13 @@ dependencies {
111111

112112
// Logging
113113
implementation 'io.github.microutils:kotlin-logging:1.7.7'
114-
//implementation 'com.github.tony19:logback-android:2.0.0'
115114

116115
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
117116

118117
implementation group: 'org.bitcoinj', name: 'bitcoinj-core', version: '0.15.10'
119118

120119
api project(':geth-android')
120+
121121
// BitTorrent
122122
implementation files('libs/jlibtorrent-1.2.10.0.jar')
123123
implementation files('libs/jlibtorrent-android-arm64-1.2.10.0.jar')
@@ -127,8 +127,8 @@ dependencies {
127127

128128
// Testing
129129
testImplementation 'junit:junit:4.12'
130-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
131-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
130+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
131+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
132132
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.3'
133133
testImplementation "io.mockk:mockk:1.9.3"
134134
testImplementation 'org.json:json:20190722'

common/src/main/java/nl/tudelft/trustchain/common/BaseActivity.kt

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package nl.tudelft.trustchain.common
22

3+
import android.annotation.SuppressLint
34
import android.os.Bundle
45
import androidx.annotation.MenuRes
56
import androidx.appcompat.app.AppCompatActivity
@@ -50,7 +51,11 @@ abstract class BaseActivity : AppCompatActivity() {
5051

5152
// Setup bottom navigation
5253
binding.bottomNavigation.setupWithNavController(navController)
54+
55+
// Usage is valid for now, as we check whether it has been set.
56+
@SuppressLint("ResourceType")
5357
binding.bottomNavigation.isVisible = bottomNavigationMenu > 0
58+
@SuppressLint("ResourceType")
5459
if (bottomNavigationMenu > 0) {
5560
binding.bottomNavigation.inflateMenu(bottomNavigationMenu)
5661
}

common/src/main/java/nl/tudelft/trustchain/common/DemoCommunity.kt

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package nl.tudelft.trustchain.common
22

3-
import kotlinx.coroutines.ExperimentalCoroutinesApi
43
import kotlinx.coroutines.ObsoleteCoroutinesApi
54
import kotlinx.coroutines.channels.BroadcastChannel
65
import nl.tudelft.ipv8.Community

common/src/main/java/nl/tudelft/trustchain/common/eurotoken/TransactionRepository.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ import nl.tudelft.ipv8.keyvault.defaultCryptoProvider
1515
import nl.tudelft.ipv8.util.hexToBytes
1616
import nl.tudelft.ipv8.util.toHex
1717
import nl.tudelft.trustchain.common.bitcoin.WalletService
18+
import nl.tudelft.trustchain.common.eurotoken.blocks.EuroTokenCheckpointValidator
19+
import nl.tudelft.trustchain.common.eurotoken.blocks.EuroTokenDestructionValidator
20+
import nl.tudelft.trustchain.common.eurotoken.blocks.EuroTokenRollBackValidator
21+
import nl.tudelft.trustchain.common.eurotoken.blocks.EuroTokenTransferValidator
1822
import org.bitcoinj.core.Address
1923
import org.bitcoinj.core.Coin
2024
import org.bitcoinj.wallet.SendRequest
21-
import nl.tudelft.trustchain.common.eurotoken.blocks.*
2225
import nl.tudelft.trustchain.common.util.TrustChainHelper
2326
import java.lang.Math.abs
2427
import java.math.BigInteger
2528

26-
@OptIn(ExperimentalUnsignedTypes::class)
2729
class TransactionRepository(
2830
val trustChainCommunity: TrustChainCommunity,
2931
val gatewayStore: GatewayStore

common/src/main/java/nl/tudelft/trustchain/common/util/FragmentIntentIntegrator.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("DEPRECATION") // TODO: Use new method of handing intent results.
2+
13
package nl.tudelft.trustchain.common.util
24

35
import android.content.Intent
@@ -10,7 +12,6 @@ import com.google.zxing.integration.android.IntentIntegrator
1012
class FragmentIntentIntegrator(private val fragment: Fragment) :
1113
IntentIntegrator(fragment.activity) {
1214
override fun startActivityForResult(intent: Intent, code: Int) {
13-
@Suppress("DEPRECATION") // TODO: Use new method of handing intent results.
1415
fragment.startActivityForResult(intent, code)
1516
}
1617
}

common/src/main/java/nl/tudelft/trustchain/common/util/QRCodeUtils.kt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("DEPRECATION") // TODO: Use new method of handing intent results.
2+
13
package nl.tudelft.trustchain.common.util
24

35
import android.content.Context

currencyii/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ dependencies {
8888
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
8989
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
9090
testImplementation "io.mockk:mockk:1.9.3"
91-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
92-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
91+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
92+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
9393

9494
// BitcoinJ
9595
implementation 'org.bitcoinj:bitcoinj-core:0.15.10'

debug/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ dependencies {
6969

7070
// Testing
7171
testImplementation 'junit:junit:4.12'
72-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
73-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
72+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
73+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
7474
}
7575

7676
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {

distributedai/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ dependencies {
7171

7272
// Testing
7373
testImplementation 'junit:junit:4.12'
74-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
75-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
74+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
75+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
7676
}

eurotoken/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ dependencies {
7979

8080
testImplementation 'junit:junit:4.12'
8181

82-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
83-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
82+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
83+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
8484

8585
annotationProcessor 'androidx.room:room-compiler:2.2.2'
8686

eurotoken/src/main/java/nl/tudelft/trustchain/eurotoken/ui/exchange/ExchangeFragment.kt

+7-3
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,17 @@ class ExchangeFragment : EurotokenBaseFragment() {
136136
if (amount > 0) {
137137
val iban = edtIBAN.text.toString()
138138
// if (Regex("^NL\\d{2}\\s[A-Z]{4}\\s0(\\d\\s?){9,30}\$").matches(iban)) {
139-
transactionRepository.sendDestroyProposalWithIBAN(iban, amount)
140-
findNavController().navigate( R.id.action_exchangeFragment_to_transactionsFragment )
139+
transactionRepository.sendDestroyProposalWithIBAN(iban, amount)
140+
findNavController().navigate(R.id.action_exchangeFragment_to_transactionsFragment)
141141
// } else {
142142
// Toast.makeText(requireContext(), "Please specify a valid iban", Toast.LENGTH_LONG).show()
143143
// }
144144
} else {
145-
Toast.makeText(requireContext(), "Please specify a positive amount", Toast.LENGTH_LONG).show()
145+
Toast.makeText(
146+
requireContext(),
147+
"Please specify a positive amount",
148+
Toast.LENGTH_LONG
149+
).show()
146150
}
147151
}
148152
}

eurotoken/src/main/res/layout/fragment_create_money.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
app:layout_constraintEnd_toEndOf="parent"
155155
app:layout_constraintStart_toStartOf="@id/txtGatewayName"
156156
app:layout_constraintTop_toBottomOf="@id/txtGatewayName"
157-
tools:text="4nmZNbpULdgYtjC2CW4NMveU8N6d4WW6" />kkkzz
157+
tools:text="4nmZNbpULdgYtjC2CW4NMveU8N6d4WW6" />
158158

159159
</androidx.constraintlayout.widget.ConstraintLayout>
160160

eurotoken/src/main/res/layout/fragment_destroy_money.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
app:layout_constraintEnd_toEndOf="parent"
164164
app:layout_constraintStart_toStartOf="@id/txtGatewayName"
165165
app:layout_constraintTop_toBottomOf="@id/txtGatewayName"
166-
tools:text="4nmZNbpULdgYtjC2CW4NMveU8N6d4WW6" />kkkzz
166+
tools:text="4nmZNbpULdgYtjC2CW4NMveU8N6d4WW6" />
167167

168168
</androidx.constraintlayout.widget.ConstraintLayout>
169169

freedomOfComputing/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ dependencies {
6666
testImplementation "io.mockk:mockk:1.10.4"
6767
testImplementation group: 'org.awaitility', name: 'awaitility', version: '3.0.0'
6868

69-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
70-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
69+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
70+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
7171
implementation project(':common')
7272
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.1'
7373
implementation 'androidx.navigation:navigation-ui-ktx:2.2.1'

freedomOfComputing/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<application>
1212
<activity
1313
android:name=".ExecutionActivity"
14+
android:exported="false"
1415
android:configChanges="keyboardHidden|orientation|screenSize" />
1516
<activity
1617
android:name="nl.tudelft.trustchain.FOC.MainActivityFOC"

freedomOfComputing/src/main/res/layout/activity_main_foc.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<ImageView
8787
android:layout_width="wrap_content"
8888
android:layout_height="wrap_content"
89-
android:tint="#8f8c83"
89+
app:tint="#8f8c83"
9090
app:srcCompat="@drawable/ic_baseline_search_24" />
9191

9292
<EditText

gossipML/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ dependencies {
106106
implementation 'com.google.android.material:material:1.3.0'
107107
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
108108
testImplementation 'junit:junit:4.12'
109-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
110-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
109+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
110+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
111111
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.3'
112112
implementation 'androidx.navigation:navigation-ui-ktx:2.3.3'
113113
implementation 'com.google.android:flexbox:2.0.1'

0 commit comments

Comments
 (0)