Skip to content

Commit

Permalink
Merge pull request #9 from Infomaniak/init-new-transfer-ui
Browse files Browse the repository at this point in the history
core: Init new transfer UI screens
  • Loading branch information
sirambd authored Jul 29, 2024
2 parents 8a111a3 + 592e0b0 commit 101bdbd
Show file tree
Hide file tree
Showing 13 changed files with 317 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.NewTransferActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.swisstransfer.ui

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import com.infomaniak.swisstransfer.ui.screen.newtransfer.NewTransferScreen

class NewTransferActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
NewTransferScreen()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ sealed class MainNavigation : NavigationDestination() {

@Serializable
data object SettingsDestination : MainNavigation()

companion object {
val startDestination = SentDestination
}
}

/**
Expand All @@ -57,6 +61,10 @@ sealed class NewTransferNavigation : NavigationDestination() {
data object UploadProgressDestination : NewTransferNavigation()
@Serializable
data object UploadSuccessDestination : NewTransferNavigation()

companion object {
val startDestination = ImportFilesDestination
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.toRoute
import com.infomaniak.swisstransfer.ui.navigation.MainNavigation
import com.infomaniak.swisstransfer.ui.navigation.MainNavigation.*
import com.infomaniak.swisstransfer.ui.screen.main.received.ReceivedScreen
import com.infomaniak.swisstransfer.ui.screen.main.sent.SentScreen
Expand All @@ -35,10 +36,9 @@ import com.infomaniak.swisstransfer.ui.screen.main.transferdetails.TransferDetai
@Composable
fun MainNavHost(
navController: NavHostController,
startDestination: SentDestination,
windowAdaptiveInfo: WindowAdaptiveInfo,
) {
NavHost(navController, startDestination, modifier = Modifier.safeDrawingPadding()) {
NavHost(navController, MainNavigation.startDestination, modifier = Modifier.safeDrawingPadding()) {
composable<SentDestination> {
SentScreen(
navigateToDetails = { navController.navigate(TransferDetailsDestination(it)) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import androidx.compose.runtime.remember
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import com.infomaniak.swisstransfer.ui.navigation.MainNavigation
import com.infomaniak.swisstransfer.ui.navigation.MainNavigation.SentDestination
import com.infomaniak.swisstransfer.ui.navigation.NavigationDestination.Companion.toDestination
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
Expand All @@ -35,19 +34,18 @@ import com.infomaniak.swisstransfer.ui.utils.PreviewTablet
@Composable
fun MainScreen() {
val navController = rememberNavController()
val startDestination = SentDestination
val windowAdaptiveInfo = currentWindowAdaptiveInfo()

val navBackStackEntry by navController.currentBackStackEntryAsState()

val currentDestination by remember(navBackStackEntry) {
derivedStateOf {
navBackStackEntry?.toDestination<MainNavigation>() ?: startDestination
navBackStackEntry?.toDestination<MainNavigation>() ?: MainNavigation.startDestination
}
}

MainScaffold(navController, currentDestination, windowAdaptiveInfo) {
MainNavHost(navController, startDestination, windowAdaptiveInfo)
MainNavHost(navController, windowAdaptiveInfo)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.swisstransfer.ui.screen.newtransfer

import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.infomaniak.swisstransfer.ui.navigation.NewTransferNavigation
import com.infomaniak.swisstransfer.ui.navigation.NewTransferNavigation.*
import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.ImportFilesScreen
import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.TransferOptionsScreen
import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.TransferTypeScreen
import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.ValidateUserEmailScreen
import com.infomaniak.swisstransfer.ui.screen.newtransfer.upload.UploadProgressScreen
import com.infomaniak.swisstransfer.ui.screen.newtransfer.upload.UploadSuccessScreen

@Composable
fun NewTransferNavHost(navController: NavHostController, modifier: Modifier) {

NavHost(navController, NewTransferNavigation.startDestination, modifier = modifier.safeDrawingPadding()) {
composable<ImportFilesDestination> {
ImportFilesScreen()
}
composable<TransferTypeDestination> {
TransferTypeScreen()
}
composable<TransferOptionsDestination> {
TransferOptionsScreen()
}
composable<ValidateUserEmailDestination> {
ValidateUserEmailScreen()
}
composable<UploadProgressDestination> {
UploadProgressScreen()
}
composable<UploadSuccessDestination> {
UploadSuccessScreen()
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.swisstransfer.ui.screen.newtransfer

import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.compose.rememberNavController
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
import com.infomaniak.swisstransfer.ui.utils.PreviewTablet

@Composable
fun NewTransferScreen() {
val navController = rememberNavController()

Scaffold { paddingValues ->
NewTransferNavHost(navController, modifier = Modifier.padding(paddingValues))
}
}

@PreviewMobile
@PreviewTablet
@Composable
private fun NewTransferPreview() {
SwissTransferTheme {
NewTransferScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable

@Composable
fun ImportFilesScreen() {
Text("ImportFilesScreen")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable

@Composable
fun TransferOptionsScreen() {
Text("TransferOptionsScreen")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable

@Composable
fun TransferTypeScreen() {
Text("TransferTypeScreen")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable

@Composable
fun ValidateUserEmailScreen() {
Text("ValidateUserEmailScreen")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.swisstransfer.ui.screen.newtransfer.upload

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable

@Composable
fun UploadProgressScreen() {
Text("UploadProgressScreen")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Infomaniak SwissTransfer - Android
* Copyright (C) 2024 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.swisstransfer.ui.screen.newtransfer.upload

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable

@Composable
fun UploadSuccessScreen() {
Text("UploadSuccessScreen")
}

0 comments on commit 101bdbd

Please sign in to comment.