Skip to content

Commit

Permalink
Merge branch 'development' into cristhian/update-app-version
Browse files Browse the repository at this point in the history
  • Loading branch information
cristhianescobar authored Sep 25, 2024
2 parents 3cee750 + 3bf592d commit 0c59f0f
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android-preview-branch-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
env:
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: apk
path: ${{steps.sign_app.outputs.signedReleaseFile}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,27 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.material.Divider
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.MaterialTheme
import androidx.compose.material.ModalBottomSheetLayout
import androidx.compose.material.ModalBottomSheetState
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import io.newm.BuildConfig
import io.newm.core.resources.R
import io.newm.core.theme.Black90
import io.newm.core.theme.Gray400
import io.newm.core.ui.buttons.PrimaryButton
import io.newm.core.ui.buttons.SecondaryButton
import io.newm.core.ui.text.versionTextStyle
import io.newm.shared.public.analytics.NewmAppEventLogger
import io.newm.shared.public.analytics.events.AppScreens

Expand Down Expand Up @@ -71,11 +77,34 @@ fun ProfileBottomSheetLayout(
text = stringResource(id = R.string.user_account_logout),
onClick = onLogout
)
Spacer(modifier = Modifier.height(32.dp))
Spacer(modifier = Modifier.height(16.dp))
AppVersion()
}
}
},
scrimColor = Black90,
content = content
)
}

@Composable
private fun AppVersion(){
Column {
Text(
modifier = Modifier
.padding(horizontal = 16.dp, vertical = 8.dp)
.fillMaxWidth()
.wrapContentWidth(Alignment.CenterHorizontally),
text = "Version " + BuildConfig.VERSION_NAME,
style = versionTextStyle.copy(fontWeight = FontWeight.Bold)
)
Text(
modifier = Modifier
.padding(horizontal = 16.dp)
.fillMaxWidth()
.wrapContentWidth(Alignment.CenterHorizontally),
text = "Build: " + BuildConfig.VERSION_CODE,
style = versionTextStyle
)
}
}
16 changes: 16 additions & 0 deletions android/core/resources/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@
<string name="reset_password_new_password">Your new password</string>
<string name="search">Search</string>
<string name="second_fragment_label">Second Fragment</string>
<string name="share_call_to_action">👉 Tap in and discover what you\'re missing: https://newm.io</string>
<string name="share_phrase_1">🚀 Vibing to %1$s by %2$s on the Newm App! 🎧 Don\'t miss out!</string>
<string name="share_phrase_2">🎶 Can\'t stop grooving to %1$s by %2$s. Catch the beat on Newm! 🔥</string>
<string name="share_phrase_3">🎧 Jammin\' to %1$s by %2$s on repeat! Newm\'s got the tunes! 🚀</string>
<string name="share_phrase_4">🎉 Just found my new anthem: %1$s by %2$s! Discover yours on Newm! 🎶</string>
<string name="share_phrase_5">🔥 Turn it up! %1$s by %2$s is a whole vibe on Newm App! 🎶</string>
<string name="share_phrase_6">🌟 If you\'re not listening to %1$s by %2$s on Newm, you\'re missing out! 🎧</string>
<string name="share_phrase_7">🎶 Locked into the rhythm of %1$s by %2$s on Newm App. Check it out! 🔥</string>
<string name="share_phrase_8">🚀 Fueling my day with %1$s by %2$s. Newm App has all the jams! 🎧</string>
<string name="share_phrase_9">🎉 Newm App’s playlist on fire with %1$s by %2$s. Ready to vibe? 🔥</string>
<string name="share_phrase_10">🎧 Tuning into the best beats with %1$s by %2$s on Newm! 🚀</string>
<string name="share_phrase_11">🔥 Crank up %1$s by %2$s on Newm App. The track is lit! 🎶</string>
<string name="share_phrase_12">🎉 Found my groove with %1$s by %2$s. Discover fresh beats on Newm! 🚀</string>
<string name="share_phrase_13">🎧 You NEED to hear %1$s by %2$s! Now playing on Newm App! 🔥</string>
<string name="share_phrase_14">🎶 Feeling the rhythm of %1$s by %2$s. Newm App = non-stop vibes! 🚀</string>
<string name="share_phrase_15">🔥 Plug into the sound of %1$s by %2$s on Newm App. Your new favorite jam awaits! 🎧</string>
<string name="stars">Stars</string>
<string name="subtitle_this_week_earnings">Earnings</string>
<string name="subtitle_this_week_followers">Followers this week</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ val formEmailStyle = TextStyle(
color = Gray100
)

val versionTextStyle = TextStyle(
fontSize = 12.sp,
fontFamily = inter,
fontWeight = FontWeight.Light,
color = Gray100
)

object TextFieldWithLabelDefaults {
object KeyboardOptions {
@Stable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.newm.feature.musicplayer

import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.drawable.BitmapDrawable
import androidx.compose.animation.animateColorAsState
Expand Down Expand Up @@ -47,7 +49,6 @@ import io.newm.core.resources.R
import io.newm.core.theme.Black
import io.newm.core.theme.DarkPink
import io.newm.core.theme.DarkViolet
import io.newm.core.theme.Gray23
import io.newm.core.theme.Gray500
import io.newm.core.theme.GraySuit
import io.newm.core.theme.White
Expand All @@ -61,6 +62,8 @@ import io.newm.feature.musicplayer.models.PlaybackRepeatMode
import io.newm.feature.musicplayer.models.PlaybackState
import io.newm.feature.musicplayer.models.PlaybackStatus
import io.newm.feature.musicplayer.models.Track
import io.newm.feature.musicplayer.share.ShareButton
import io.newm.feature.musicplayer.share.getRandomSharePhrase
import io.newm.feature.musicplayer.viewmodel.PlaybackUiEvent
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -254,8 +257,10 @@ fun PlaybackControlPanel(
modifier = Modifier.padding(horizontal = 12.dp),
onClick = { onEvent(PlaybackUiEvent.Next) })
Spacer(modifier = Modifier.weight(1f))
// TODO: Implement share functionality
//ShareButton(onClick = {})
ShareButton(
songTitle = playbackStatus.track?.title,
songArtist = playbackStatus.track?.artist
)
}
}
}
Expand Down Expand Up @@ -338,16 +343,6 @@ fun NextTrackButton(onClick: () -> Unit, modifier: Modifier = Modifier) {
}
}

@Composable
fun ShareButton(onClick: () -> Unit, modifier: Modifier = Modifier) {
IconButton(modifier = modifier, onClick = onClick) {
Icon(
painter = painterResource(id = R.drawable.ic_share),
contentDescription = "Share Song",
tint = Color.White
)
}
}

@Composable
fun RepeatButton(
Expand All @@ -364,7 +359,7 @@ fun RepeatButton(
Icon(
painter = painterResource(id = imageRes),
contentDescription = "Repeat",
tint = if (repeatMode == PlaybackRepeatMode.REPEAT_OFF) Gray23 else White
tint = if (repeatMode == PlaybackRepeatMode.REPEAT_OFF) White else DarkViolet
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.newm.feature.musicplayer.share

import android.content.Context
import io.newm.core.resources.R

fun Context.getRandomSharePhrase(songTitle: String, songArtist: String): String {
val phraseIds = listOf(
R.string.share_phrase_1,
R.string.share_phrase_2,
R.string.share_phrase_3,
R.string.share_phrase_4,
R.string.share_phrase_5,
R.string.share_phrase_6,
R.string.share_phrase_7,
R.string.share_phrase_8,
R.string.share_phrase_9,
R.string.share_phrase_10,
R.string.share_phrase_11,
R.string.share_phrase_12,
R.string.share_phrase_13,
R.string.share_phrase_14,
R.string.share_phrase_15
)
return this.getString( phraseIds.random(), songTitle, songArtist)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package io.newm.feature.musicplayer.share

import android.content.Context
import android.content.Intent
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import io.newm.core.resources.R

@Composable
fun ShareButton(
modifier: Modifier = Modifier,
songTitle: String? = null,
songArtist: String? = null,
) {
if (songTitle.isNullOrBlank() || songArtist.isNullOrBlank()) return
val context = LocalContext.current
IconButton(modifier = modifier, onClick = {
shareSong(context, songTitle, songArtist)
}) {
Icon(
painter = painterResource(id = R.drawable.ic_share),
contentDescription = "Share Song",
tint = Color.White
)
}
}

fun shareSong(context: Context, songTitle: String, songArtist: String) {
val randomPhrase = context.getRandomSharePhrase(songTitle, songArtist)
val callToAction = context.getString(R.string.share_call_to_action)
val shareText = """
$randomPhrase
$callToAction
""".trimIndent()

val shareIntent = Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TEXT, shareText)
type = "text/plain"
}
val chooser = Intent.createChooser(shareIntent, "Share song via")
context.startActivity(chooser)
}

0 comments on commit 0c59f0f

Please sign in to comment.