-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of github.com:projectNEWM/newm-mobile into…
… MOBILE-330 * 'development' of github.com:projectNEWM/newm-mobile: Record Store Integration (#335) Fixes (#339) # Conflicts: # iosApp/Modules/Helpers/Logging/SentryErrorReporter.swift
- Loading branch information
Showing
21 changed files
with
260 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
android/app-newm/src/main/java/io/newm/screens/recordstore/RecordStorePresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package io.newm.screens.recordstore | ||
|
||
import android.content.Context | ||
import android.net.ConnectivityManager | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.collectAsState | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.runtime.snapshotFlow | ||
import androidx.compose.ui.platform.LocalContext | ||
import com.slack.circuit.runtime.Navigator | ||
import com.slack.circuit.runtime.presenter.Presenter | ||
import io.newm.screens.profile.view.ProfileUiState | ||
import io.newm.shared.public.analytics.NewmAppEventLogger | ||
import io.newm.shared.public.analytics.events.AppScreens | ||
import io.newm.shared.public.usecases.HasWalletConnectionsUseCase | ||
import io.newm.shared.public.usecases.UserDetailsUseCase | ||
import kotlinx.coroutines.flow.distinctUntilChanged | ||
|
||
class RecordStorePresenter( | ||
private val navigator: Navigator, | ||
private val eventLogger: NewmAppEventLogger | ||
) : Presenter<RecordStoreState> { | ||
@Composable | ||
override fun present(): RecordStoreState { | ||
val context = LocalContext.current | ||
val connectivityManager = remember { | ||
context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | ||
} | ||
val isNetworkAvailable by remember { | ||
mutableStateOf(connectivityManager.activeNetwork != null) | ||
} | ||
return when { | ||
!isNetworkAvailable -> RecordStoreState.Error | ||
else -> { | ||
eventLogger.logPageLoad(AppScreens.RecordStoreScreen.name) | ||
RecordStoreState.Content( | ||
eventSink = {} | ||
) | ||
} | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
android/app-newm/src/main/java/io/newm/screens/recordstore/RecordStoreScreenUi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package io.newm.screens.recordstore | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.statusBarsPadding | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.platform.testTag | ||
import io.newm.core.ui.LoadingScreen | ||
import io.newm.core.ui.utils.ErrorScreen | ||
import io.newm.core.ui.webview.FullScreenWebView | ||
import io.newm.screens.library.TAG_NFT_LIBRARY_SCREEN | ||
import io.newm.shared.public.analytics.NewmAppEventLogger | ||
import io.newm.shared.public.analytics.events.AppScreens | ||
|
||
private const val RECORD_STORE_URL = "https://recordstore.newm.io/" | ||
|
||
@Composable | ||
fun RecordStoreScreenUi( | ||
modifier: Modifier = Modifier, | ||
state: RecordStoreState, | ||
eventLogger: NewmAppEventLogger | ||
) { | ||
val context = LocalContext.current | ||
Column( | ||
modifier = modifier | ||
.fillMaxSize() | ||
.statusBarsPadding() | ||
.testTag(TAG_NFT_LIBRARY_SCREEN), | ||
) { | ||
when (state) { | ||
is RecordStoreState.Content -> { | ||
FullScreenWebView(context, RECORD_STORE_URL) | ||
} | ||
|
||
RecordStoreState.Loading -> { | ||
LaunchedEffect(Unit) { | ||
eventLogger.logPageLoad(AppScreens.LoadingScreen.name) | ||
} | ||
LoadingScreen() | ||
} | ||
|
||
RecordStoreState.Error -> { | ||
ErrorScreen( | ||
title = "Connection Lost", | ||
message = "It looks like you're not connected to the internet. Please check your connection and try again." | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
android/app-newm/src/main/java/io/newm/screens/recordstore/RecordStoreState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.newm.screens.recordstore | ||
|
||
import com.slack.circuit.runtime.CircuitUiState | ||
|
||
|
||
sealed class RecordStoreState : CircuitUiState { | ||
data object Loading : RecordStoreState() | ||
data class Content( | ||
val eventSink: (RecordStoreUiEvent) -> Unit, | ||
) : RecordStoreState() | ||
data object Error : RecordStoreState() | ||
} |
5 changes: 5 additions & 0 deletions
5
android/app-newm/src/main/java/io/newm/screens/recordstore/RecordStoreUiEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package io.newm.screens.recordstore | ||
|
||
import com.slack.circuit.runtime.CircuitUiEvent | ||
|
||
sealed interface RecordStoreUiEvent : CircuitUiEvent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
android/core/resources/src/main/res/drawable/ic_recordstore_active.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<vector xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android" android:alpha="0.9" android:autoMirrored="true" android:height="24dp" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp"> | ||
|
||
<group> | ||
|
||
<clip-path android:pathData="M0,0h24v24h-24z"/> | ||
|
||
<path android:pathData="M4,3H20C20.265,3 20.52,3.105 20.707,3.293C20.895,3.48 21,3.735 21,4V20C21,20.265 20.895,20.52 20.707,20.707C20.52,20.895 20.265,21 20,21H4C3.735,21 3.48,20.895 3.293,20.707C3.105,20.52 3,20.265 3,20V4C3,3.735 3.105,3.48 3.293,3.293C3.48,3.105 3.735,3 4,3ZM12,17C10.674,17 9.402,16.473 8.464,15.535C7.527,14.598 7,13.326 7,12C7,10.674 7.527,9.402 8.464,8.464C9.402,7.527 10.674,7 12,7C13.326,7 14.598,7.527 15.535,8.464C16.473,9.402 17,10.674 17,12C17,13.326 16.473,14.598 15.535,15.535C14.598,16.473 13.326,17 12,17ZM12,19C12.919,19 13.83,18.819 14.679,18.467C15.528,18.115 16.3,17.6 16.95,16.95C17.6,16.3 18.115,15.528 18.467,14.679C18.819,13.83 19,12.919 19,12C19,11.081 18.819,10.17 18.467,9.321C18.115,8.472 17.6,7.7 16.95,7.05C16.3,6.4 15.528,5.885 14.679,5.533C13.83,5.181 12.919,5 12,5C10.144,5 8.363,5.738 7.05,7.05C5.738,8.363 5,10.144 5,12C5,13.856 5.738,15.637 7.05,16.95C8.363,18.263 10.144,19 12,19ZM12,14C12.53,14 13.039,13.789 13.414,13.414C13.789,13.039 14,12.53 14,12C14,11.47 13.789,10.961 13.414,10.586C13.039,10.211 12.53,10 12,10C11.47,10 10.961,10.211 10.586,10.586C10.211,10.961 10,11.47 10,12C10,12.53 10.211,13.039 10.586,13.414C10.961,13.789 11.47,14 12,14Z"> | ||
|
||
<aapt:attr name="android:fillColor"> | ||
|
||
<gradient android:endX="23.235" android:endY="6.018" android:startX="3" android:startY="21" android:type="linear"> | ||
|
||
<item android:color="#FFF53C69" android:offset="0"/> | ||
|
||
<item android:color="#FFFF6E32" android:offset="1"/> | ||
|
||
</gradient> | ||
|
||
</aapt:attr> | ||
|
||
</path> | ||
|
||
</group> | ||
|
||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.