Skip to content

Commit

Permalink
Upgrade minSdkVersion to 26
Browse files Browse the repository at this point in the history
  • Loading branch information
InvictusRMC committed Feb 19, 2024
1 parent 655ef2c commit 3c4d39a
Show file tree
Hide file tree
Showing 79 changed files with 127 additions and 345 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static def generateVersionCode() {
android {
defaultConfig {
applicationId "nl.tudelft.trustchain"
minSdkVersion 24
minSdkVersion 26
compileSdk 34
targetSdkVersion 34
versionCode generateVersionCode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.bluetooth.BluetoothManager
import android.content.Context
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.core.content.getSystemService
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
Expand Down Expand Up @@ -79,7 +78,6 @@ class TrustChainApplication : Application() {
var isFirstRun: Boolean = false
lateinit var appLoader: AppLoader

@RequiresApi(Build.VERSION_CODES.M)
override fun onCreate() =
runBlocking {
super.onCreate()
Expand All @@ -95,7 +93,6 @@ class TrustChainApplication : Application() {
}
}

@RequiresApi(Build.VERSION_CODES.M)
fun initIPv8() {
val config =
IPv8Configuration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,16 @@ package nl.tudelft.trustchain.app.service

import android.app.PendingIntent
import android.content.Intent
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.app.TaskStackBuilder
import androidx.annotation.RequiresApi
import nl.tudelft.ipv8.android.service.IPv8Service
import nl.tudelft.trustchain.app.R
import nl.tudelft.trustchain.app.ui.dashboard.DashboardActivity

@RequiresApi(Build.VERSION_CODES.M)
class TrustChainService : IPv8Service() {
override fun createNotification(): NotificationCompat.Builder {
val trustChainDashboardIntent = Intent(this, DashboardActivity::class.java)
val flags =
when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
else -> PendingIntent.FLAG_UPDATE_CURRENT
}
val flags = PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
val pendingIntent =
TaskStackBuilder.create(this)
.addNextIntentWithParentStack(trustChainDashboardIntent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import com.mattskala.itemadapter.ItemAdapter
Expand All @@ -17,7 +16,6 @@ import nl.tudelft.trustchain.app.TrustChainApplication
import nl.tudelft.trustchain.app.databinding.ActivityDashboardBinding
import nl.tudelft.trustchain.common.util.viewBinding

@RequiresApi(Build.VERSION_CODES.M)
class DashboardActivity : AppCompatActivity() {
private val binding by viewBinding(ActivityDashboardBinding::inflate)

Expand Down
2 changes: 1 addition & 1 deletion common-bitcoin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ktlint {

android {
defaultConfig {
minSdkVersion 24
minSdkVersion 26
compileSdk 34
targetSdkVersion 34

Expand Down
2 changes: 1 addition & 1 deletion common-ethereum/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ktlint {

android {
defaultConfig {
minSdkVersion 24
minSdkVersion 26
compileSdk 34
targetSdkVersion 34

Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sqldelight {

android {
defaultConfig {
minSdkVersion 24
minSdkVersion 26
compileSdk 34
targetSdkVersion 34

Expand Down
2 changes: 1 addition & 1 deletion currencyii/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ktlint {

android {
defaultConfig {
minSdkVersion 24
minSdkVersion 26
compileSdk 34
targetSdkVersion 34

Expand Down
2 changes: 1 addition & 1 deletion debug/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ktlint {

android {
defaultConfig {
minSdkVersion 24
minSdkVersion 26
compileSdk 34
targetSdkVersion 34

Expand Down
2 changes: 1 addition & 1 deletion eurotoken/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sqldelight {

android {
defaultConfig {
minSdkVersion 24
minSdkVersion 26
compileSdk 34
targetSdkVersion 34

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package nl.tudelft.trustchain.eurotoken.community

import android.content.Context
import androidx.annotation.RequiresApi
import kotlin.random.Random
import nl.tudelft.ipv8.Community
import nl.tudelft.ipv8.IPv4Address
Expand Down Expand Up @@ -88,7 +87,6 @@ class EuroTokenCommunity(
transactionRepository.attemptRollback(peer, payload.transactionHash)
}

@RequiresApi(Build.VERSION_CODES.O)
fun connectToGateway(
public_key: String,
ip: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package nl.tudelft.trustchain.eurotoken.ui.exchange
import android.content.Context
import android.os.Bundle
import android.view.View
import androidx.annotation.RequiresApi
import androidx.navigation.fragment.findNavController
import nl.tudelft.ipv8.keyvault.defaultCryptoProvider
import nl.tudelft.ipv8.util.hexToBytes
Expand Down Expand Up @@ -39,8 +38,6 @@ class CreateMoneyFragment : EurotokenBaseFragment(R.layout.fragment_create_money
?: throw java.lang.IllegalStateException("EuroTokenCommunity is not configured")
}


@RequiresApi(Build.VERSION_CODES.O)
override fun onViewCreated(
view: View,
savedInstanceState: Bundle?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package nl.tudelft.trustchain.eurotoken.ui.exchange

import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
Expand All @@ -11,7 +10,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.EditText
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
Expand Down Expand Up @@ -66,7 +64,7 @@ class ExchangeFragment : EurotokenBaseFragment() {
_binding = null
}

@RequiresApi(Build.VERSION_CODES.O)
@Deprecated("Deprecated in Java")
override fun onActivityResult(
requestCode: Int,
resultCode: Int,
Expand All @@ -85,31 +83,43 @@ class ExchangeFragment : EurotokenBaseFragment() {
try {
val connectionData = ConnectionData(it)
Toast.makeText(requireContext(), connectionData.ip, Toast.LENGTH_LONG).show()
if (connectionData.type == "destruction") {
val args = Bundle()
args.putString(DestroyMoneyFragment.ARG_PUBLIC_KEY, connectionData.publicKey)
args.putString(DestroyMoneyFragment.ARG_NAME, connectionData.name)
args.putLong(DestroyMoneyFragment.ARG_AMOUNT, connectionData.amount)
args.putInt(DestroyMoneyFragment.ARG_PORT, connectionData.port)
args.putString(DestroyMoneyFragment.ARG_IP, connectionData.ip)
args.putString(DestroyMoneyFragment.ARG_PAYMENT_ID, connectionData.paymentId)
findNavController().navigate(
R.id.action_exchangeFragment_to_destroyMoneyFragment,
args
)
} else if (connectionData.type == "creation") {
val args = Bundle()
args.putString(CreateMoneyFragment.ARG_PUBLIC_KEY, connectionData.publicKey)
args.putString(CreateMoneyFragment.ARG_NAME, connectionData.name)
args.putInt(CreateMoneyFragment.ARG_PORT, connectionData.port)
args.putString(CreateMoneyFragment.ARG_IP, connectionData.ip)
args.putString(CreateMoneyFragment.ARG_PAYMENT_ID, connectionData.paymentId)
findNavController().navigate(
R.id.action_exchangeFragment_to_createMoneyFragment,
args
)
} else {
Toast.makeText(requireContext(), "Invalid QR", Toast.LENGTH_LONG).show()
when (connectionData.type) {
"destruction" -> {
val args = Bundle()
args.putString(
DestroyMoneyFragment.ARG_PUBLIC_KEY,
connectionData.publicKey
)
args.putString(DestroyMoneyFragment.ARG_NAME, connectionData.name)
args.putLong(DestroyMoneyFragment.ARG_AMOUNT, connectionData.amount)
args.putInt(DestroyMoneyFragment.ARG_PORT, connectionData.port)
args.putString(DestroyMoneyFragment.ARG_IP, connectionData.ip)
args.putString(
DestroyMoneyFragment.ARG_PAYMENT_ID,
connectionData.paymentId
)
findNavController().navigate(
R.id.action_exchangeFragment_to_destroyMoneyFragment,
args
)
}

"creation" -> {
val args = Bundle()
args.putString(CreateMoneyFragment.ARG_PUBLIC_KEY, connectionData.publicKey)
args.putString(CreateMoneyFragment.ARG_NAME, connectionData.name)
args.putInt(CreateMoneyFragment.ARG_PORT, connectionData.port)
args.putString(CreateMoneyFragment.ARG_IP, connectionData.ip)
args.putString(CreateMoneyFragment.ARG_PAYMENT_ID, connectionData.paymentId)
findNavController().navigate(
R.id.action_exchangeFragment_to_createMoneyFragment,
args
)
}

else -> {
Toast.makeText(requireContext(), "Invalid QR", Toast.LENGTH_LONG).show()
}
}
} catch (e: JSONException) {
Toast.makeText(requireContext(), "Scan failed, try again", Toast.LENGTH_LONG).show()
Expand Down
2 changes: 1 addition & 1 deletion freedomOfComputing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ktlint {

android {
defaultConfig {
minSdkVersion 24
minSdkVersion 26
compileSdk 34
targetSdkVersion 34

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ private void storeState() {
*
* @return the latest known state of the dynamically loaded code or null if it does not exist
*/
@RequiresApi(Build.VERSION_CODES.O) // TODO: this should be usable on all versions.
private Fragment.SavedState getState() {
// states are stored in the same directories as apks themselves (in the app specific files)
String fileName = this.apkName + DATA_DOT_EXTENSION;
Expand Down Expand Up @@ -127,11 +126,9 @@ protected void onCreate(Bundle savedInstanceState) {
String mainFragmentClass = getMainFragmentClass(apkPath);
Class<?> fragmentClass = classLoader.loadClass((mainFragmentClass != null) ? mainFragmentClass : "com.execmodule." + activeApp + ".MainFragment");
this.mainFragment = (Fragment) fragmentClass.newInstance();
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
Fragment.SavedState state = this.getState();
if (state != null) {
this.mainFragment.setInitialSavedState(state);
}
Fragment.SavedState state = this.getState();
if (state != null) {
this.mainFragment.setInitialSavedState(state);
}

LinearLayout tmpLayout = new LinearLayout(context);
Expand Down
2 changes: 1 addition & 1 deletion musicdao/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ android {
useLibrary 'android.test.mock'

defaultConfig {
minSdkVersion 24
minSdkVersion 26
compileSdk 34
targetSdkVersion 34

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package nl.tudelft.trustchain.musicdao

import android.net.Uri
import android.os.Build
import androidx.annotation.RequiresApi

object AppContainer {
lateinit var currentCallback: (List<Uri>) -> Unit
lateinit var activity: MusicActivity

@RequiresApi(Build.VERSION_CODES.O)
fun provide(_activity: MusicActivity) {
activity = _activity
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package nl.tudelft.trustchain.musicdao

import android.content.Context
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.preference.PreferenceManager
import androidx.room.Room
import nl.tudelft.trustchain.musicdao.core.cache.CacheDatabase
Expand Down Expand Up @@ -109,7 +107,6 @@ class HiltModules {
?: throw IllegalStateException("DaoCommunity is not configured")
}

@RequiresApi(Build.VERSION_CODES.O)
@Provides
@Singleton
fun path(
Expand All @@ -118,7 +115,6 @@ class HiltModules {
return CachePath(applicationContext)
}

@RequiresApi(Build.VERSION_CODES.O)
@Provides
@Singleton
fun downloadFinishUseCase(
Expand All @@ -128,7 +124,6 @@ class HiltModules {
return DownloadFinishUseCase(database = database, cachePath = cachePath)
}

@RequiresApi(Build.VERSION_CODES.O)
@Provides
@Singleton
fun provideWalletService(
Expand All @@ -148,7 +143,6 @@ class HiltModules {
)
}

@RequiresApi(Build.VERSION_CODES.O)
@Provides
@Singleton
fun provideWalletManager(
Expand Down Expand Up @@ -179,7 +173,6 @@ class HiltModules {
}

class CachePath(val applicationContext: Context) {
@RequiresApi(Build.VERSION_CODES.O)
fun getPath(): Path? {
return Paths.get("${applicationContext.cacheDir}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.IBinder
import android.util.Log
import androidx.activity.compose.setContent
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.ExperimentalFoundationApi
Expand Down Expand Up @@ -73,7 +71,6 @@ class MusicActivity : AppCompatActivity() {
@DelicateCoroutinesApi
@ExperimentalAnimationApi
@ExperimentalFoundationApi
@RequiresApi(Build.VERSION_CODES.O)
@ExperimentalMaterialApi
@ExperimentalComposeUiApi
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -233,7 +230,6 @@ class MusicActivity : AppCompatActivity() {
return uriList
}

@RequiresApi(Build.VERSION_CODES.O)
private fun iterativelyFetchReleases() {
@Suppress("DEPRECATION")
lifecycleScope.launchWhenStarted {
Expand Down
Loading

0 comments on commit 3c4d39a

Please sign in to comment.