summaryrefslogtreecommitdiff
path: root/wallee-c2ec/app/src/main/java/ch/bfh/habej2/wallee_c2ec/ExchangeActivity.kt
blob: 134115ed979471c7d4a37f6a1e3d2676e43f7b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package ch.bfh.habej2.wallee_c2ec

import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import ch.bfh.habej2.wallee_c2ec.config.EXCHANGES
import ch.bfh.habej2.wallee_c2ec.ui.theme.Walleec2ecTheme

class ExchangeActivity : ComponentActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            Walleec2ecTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {

                    Column(
                        horizontalAlignment = Alignment.CenterHorizontally
                    ) {

                        Text(text = "Choose the exchange to withdraw from")

                        // TODO let user select exchanges from config here
                        //  config must contain display name, credentials (generated by cli)
                        //  and the base url of the c2ec bank-integration api
                        EXCHANGES.forEach { Text(text = it.displayName) }

                        val ctx = LocalContext.current
                        Button(onClick = { ctx.startActivity(Intent(this@ExchangeActivity.parent, WithdrawalCreationActivity::class.java)) }) {
                            Text(text = "withdraw")
                        }

                        Button(onClick = { finish() }) {
                            Text(text = "back")
                        }
                    }
                }
            }
        }
    }
}