-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from mughalasim/feature/version-checker
- App checks for latest version automatically and notifies the user - Members can be searched by name
- Loading branch information
Showing
22 changed files
with
344 additions
and
173 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
75 changes: 75 additions & 0 deletions
75
app/src/main/kotlin/com/ndemi/garden/gym/ui/screens/main/NewVersionScreen.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,75 @@ | ||
package com.ndemi.garden.gym.ui.screens.main | ||
|
||
import android.net.Uri | ||
import android.util.Log | ||
import android.widget.Toast | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.platform.LocalUriHandler | ||
import androidx.compose.ui.res.stringResource | ||
import com.ndemi.garden.gym.R | ||
import com.ndemi.garden.gym.ui.theme.AppThemeComposable | ||
import com.ndemi.garden.gym.ui.theme.padding_screen | ||
import com.ndemi.garden.gym.ui.utils.AppPreview | ||
import com.ndemi.garden.gym.ui.widgets.ButtonWidget | ||
import com.ndemi.garden.gym.ui.widgets.TextRegular | ||
import com.ndemi.garden.gym.ui.widgets.TextRegularBold | ||
|
||
@Composable | ||
fun NewVersionScreen( | ||
url: String, | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(padding_screen), | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
val uriHandler = LocalUriHandler.current | ||
val context = LocalContext.current | ||
TextRegularBold( | ||
text = stringResource(R.string.txt_app_update_title) | ||
) | ||
TextRegular( | ||
modifier = Modifier.padding(top = padding_screen), | ||
text = | ||
stringResource(R.string.txt_app_update_desc) | ||
) | ||
ButtonWidget(title = stringResource(R.string.txt_download)) { | ||
if (isValidUri(url)) { | ||
uriHandler.openUri(url) | ||
} else { | ||
Toast.makeText( | ||
context, | ||
context.getString(R.string.error_failed_to_open_link), Toast.LENGTH_LONG | ||
).show() | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Suppress("TooGenericExceptionCaught") | ||
fun isValidUri(uriString: String): Boolean { | ||
return try { | ||
val uri = Uri.parse(uriString) | ||
uri.scheme != null && uri.host != null | ||
} catch (e: Exception) { | ||
Log.e("isValidUri", e.message?: "IllegalArgumentException") | ||
false | ||
} | ||
} | ||
|
||
@AppPreview | ||
@Composable | ||
fun NewVersionScreenPreview() { | ||
AppThemeComposable { | ||
NewVersionScreen(url = "SampleUrl") | ||
} | ||
} |
51 changes: 0 additions & 51 deletions
51
app/src/main/kotlin/com/ndemi/garden/gym/ui/screens/members/MembersListScreen.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.