diff --git a/.github/workflows/android-preview-branch-merge.yml b/.github/workflows/android-preview-branch-merge.yml
index 3bf7cd6f..0e4b9d3f 100644
--- a/.github/workflows/android-preview-branch-merge.yml
+++ b/.github/workflows/android-preview-branch-merge.yml
@@ -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}}
diff --git a/android/app-newm/src/main/java/io/newm/screens/profile/ProfileBottomSheetLayout.kt b/android/app-newm/src/main/java/io/newm/screens/profile/ProfileBottomSheetLayout.kt
index a2f92a1b..8f29f116 100644
--- a/android/app-newm/src/main/java/io/newm/screens/profile/ProfileBottomSheetLayout.kt
+++ b/android/app-newm/src/main/java/io/newm/screens/profile/ProfileBottomSheetLayout.kt
@@ -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
@@ -71,7 +77,8 @@ 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()
}
}
},
@@ -79,3 +86,25 @@ fun ProfileBottomSheetLayout(
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
+ )
+ }
+}
diff --git a/android/core/resources/src/main/res/values/strings.xml b/android/core/resources/src/main/res/values/strings.xml
index 195eef51..7b081afc 100644
--- a/android/core/resources/src/main/res/values/strings.xml
+++ b/android/core/resources/src/main/res/values/strings.xml
@@ -79,6 +79,22 @@
Your new password
Search
Second Fragment
+ 👉 Tap in and discover what you\'re missing: https://newm.io
+ 🚀 Vibing to %1$s by %2$s on the Newm App! 🎧 Don\'t miss out!
+ 🎶 Can\'t stop grooving to %1$s by %2$s. Catch the beat on Newm! 🔥
+ 🎧 Jammin\' to %1$s by %2$s on repeat! Newm\'s got the tunes! 🚀
+ 🎉 Just found my new anthem: %1$s by %2$s! Discover yours on Newm! 🎶
+ 🔥 Turn it up! %1$s by %2$s is a whole vibe on Newm App! 🎶
+ 🌟 If you\'re not listening to %1$s by %2$s on Newm, you\'re missing out! 🎧
+ 🎶 Locked into the rhythm of %1$s by %2$s on Newm App. Check it out! 🔥
+ 🚀 Fueling my day with %1$s by %2$s. Newm App has all the jams! 🎧
+ 🎉 Newm App’s playlist on fire with %1$s by %2$s. Ready to vibe? 🔥
+ 🎧 Tuning into the best beats with %1$s by %2$s on Newm! 🚀
+ 🔥 Crank up %1$s by %2$s on Newm App. The track is lit! 🎶
+ 🎉 Found my groove with %1$s by %2$s. Discover fresh beats on Newm! 🚀
+ 🎧 You NEED to hear %1$s by %2$s! Now playing on Newm App! 🔥
+ 🎶 Feeling the rhythm of %1$s by %2$s. Newm App = non-stop vibes! 🚀
+ 🔥 Plug into the sound of %1$s by %2$s on Newm App. Your new favorite jam awaits! 🎧
Stars
Earnings
Followers this week
diff --git a/android/core/ui-utils/src/main/java/io/newm/core/ui/text/TextFields.kt b/android/core/ui-utils/src/main/java/io/newm/core/ui/text/TextFields.kt
index a6b54f98..5aa4bee8 100644
--- a/android/core/ui-utils/src/main/java/io/newm/core/ui/text/TextFields.kt
+++ b/android/core/ui-utils/src/main/java/io/newm/core/ui/text/TextFields.kt
@@ -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
diff --git a/android/features/music-player/src/main/java/io/newm/feature/musicplayer/MusicPlayerViewer.kt b/android/features/music-player/src/main/java/io/newm/feature/musicplayer/MusicPlayerViewer.kt
index 7d50ac72..0de4d7eb 100644
--- a/android/features/music-player/src/main/java/io/newm/feature/musicplayer/MusicPlayerViewer.kt
+++ b/android/features/music-player/src/main/java/io/newm/feature/musicplayer/MusicPlayerViewer.kt
@@ -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
@@ -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
@@ -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
@@ -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
+ )
}
}
}
@@ -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(
@@ -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
)
}
}
diff --git a/android/features/music-player/src/main/java/io/newm/feature/musicplayer/share/RandomPhraseGenerator.kt b/android/features/music-player/src/main/java/io/newm/feature/musicplayer/share/RandomPhraseGenerator.kt
new file mode 100644
index 00000000..4714a927
--- /dev/null
+++ b/android/features/music-player/src/main/java/io/newm/feature/musicplayer/share/RandomPhraseGenerator.kt
@@ -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)
+}
\ No newline at end of file
diff --git a/android/features/music-player/src/main/java/io/newm/feature/musicplayer/share/ShareButton.kt b/android/features/music-player/src/main/java/io/newm/feature/musicplayer/share/ShareButton.kt
new file mode 100644
index 00000000..c5137e27
--- /dev/null
+++ b/android/features/music-player/src/main/java/io/newm/feature/musicplayer/share/ShareButton.kt
@@ -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)
+}
\ No newline at end of file