Skip to content

Initial Launch Branch (Do not merge) #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: launch_branch
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6119e0b
Enable notifications and add log statements
BenHarris4848 Oct 26, 2022
1cd92bb
Merge branch 'main' of https://github.com/cuappdev/volume-android-arc…
BenHarris4848 Nov 2, 2022
226bdbc
Merge branch 'main' of https://github.com/cuappdev/volume-android-arc…
BenHarris4848 Nov 3, 2022
d0feda1
Change notifications to strictly be data notifications
ckdesir Nov 3, 2022
f727685
Add transitions to OPEN_MAGAZINE
ckdesir Nov 3, 2022
b968fef
Delete pendingIntent.send()
ckdesir Nov 3, 2022
9b7da53
Change from "Saved" to "Bookmarks"
ckdesir Nov 4, 2022
77bbfb8
Merge branch 'main' into ben/notifications
ckdesir Nov 4, 2022
e6d79e1
Finalize Notifications and formatting
ckdesir Nov 4, 2022
c772fc8
Delete Log
ckdesir Nov 4, 2022
230878d
Remove comment
ckdesir Nov 4, 2022
4442674
Add notification support for Android 13+
ckdesir Nov 7, 2022
6ca4628
Remove Log
ckdesir Nov 7, 2022
32db9ed
Add Notification support for API 33
ckdesir Nov 16, 2022
d7a81cb
Merge pull request #20 from cuappdev/ben/notifications
BenHarris4848 Nov 16, 2022
fe1d4b7
added the content type
emilyhu8 Nov 16, 2022
3c56a59
Remove instances of debrief and magazines
BenHarris4848 Nov 16, 2022
8663ec3
Merge branch 'emily-content-type' into ben/Launch/DoNotMerge
BenHarris4848 Nov 16, 2022
ac8fd02
Hide Magazine Publications
BenHarris4848 Nov 16, 2022
0c0ee42
Refactor content type to an enum class
BenHarris4848 Nov 17, 2022
ea1066a
Merge branch 'emily-content-type' into ben/Launch/DoNotMerge
BenHarris4848 Nov 17, 2022
44a779e
Adjust publication filtering to respect content type refactor
BenHarris4848 Nov 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ android {
defaultConfig {
applicationId "com.cornellappdev.volume"
minSdk 27
targetSdk 32
targetSdk 33
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "PROD_ENDPOINT", secretsProperties['PROD_ENDPOINT'])
buildConfigField("String", "DEV_ENDPOINT", secretsProperties['DEV_ENDPOINT'])
buildConfigField("String", "FEEDBACK_FORM", secretsProperties['FEEDBACK_FORM'])
buildConfigField("String", "WEBSITE", secretsProperties['WEBSITE'])

Expand All @@ -39,9 +37,11 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "false")
buildConfigField("String", "ENDPOINT", secretsProperties['PROD_ENDPOINT'])
}
debug {
resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "true")
buildConfigField("String", "ENDPOINT", secretsProperties['DEV_ENDPOINT'])
}
}

Expand Down Expand Up @@ -107,11 +107,12 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'

// Firebase
implementation platform('com.google.firebase:firebase-bom:27.0.0')
implementation platform('com.google.firebase:firebase-bom:31.0.2')
implementation 'com.google.firebase:firebase-inappmessaging-display-ktx'
implementation 'com.vmadalin:easypermissions-ktx:1.0.0'
implementation 'com.google.accompanist:accompanist-permissions:0.27.0'
implementation 'com.google.firebase:firebase-messaging-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-installations:17.0.2'

// Accompanist
implementation 'com.google.accompanist:accompanist-pager:0.26.2-beta'
Expand Down
17 changes: 16 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<application
android:name=".VolumeApplication"
Expand All @@ -13,6 +14,10 @@
android:supportsRtl="true"
android:theme="@style/Theme.Volumeandroidrevamp">

<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />

<meta-data
android:name="firebase_analytics_collection_deactivated"
android:value="@bool/FIREBASE_ANALYTICS_DEACTIVATED" />
Expand All @@ -27,7 +32,6 @@

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

Expand All @@ -46,6 +50,17 @@
android:host="weekly_debrief"
android:scheme="volume" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="open_magazine"
android:scheme="volume" />
</intent-filter>
</activity>

<service
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/graphql/com/cornellappdev/volume/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ query AllArticles ($limit: Float) {
rssURL
slug
shoutouts
contentTypes
websiteURL
numArticles
socials {
Expand Down Expand Up @@ -48,6 +49,7 @@ query AllPublications {
shoutouts
websiteURL
numArticles
contentTypes
socials {
social
url:URL
Expand Down Expand Up @@ -75,6 +77,7 @@ query PublicationBySlug($slug: String!) {
slug
shoutouts
websiteURL
contentTypes
numArticles
socials {
social
Expand Down Expand Up @@ -105,6 +108,7 @@ query TrendingArticles ($limit: Float) {
rssURL
slug
shoutouts
contentTypes
numArticles
websiteURL
socials {
Expand Down Expand Up @@ -144,6 +148,7 @@ query ArticlesByPublicationSlug($slug: String!) {
rssURL
slug
shoutouts
contentTypes
websiteURL
numArticles
socials {
Expand Down Expand Up @@ -180,6 +185,7 @@ query ArticlesByIDs($ids:[String!]!) {
rssURL
slug
shoutouts
contentTypes
websiteURL
numArticles
socials {
Expand Down Expand Up @@ -217,6 +223,7 @@ query ArticleByID($id: String!) {
rssURL
slug
shoutouts
contentTypes
websiteURL
numArticles
socials {
Expand Down Expand Up @@ -256,6 +263,7 @@ query ArticlesByPublicationSlugs($slugs: [String!]!) {
rssURL
slug
shoutouts
contentTypes
numArticles
websiteURL
socials {
Expand Down Expand Up @@ -296,6 +304,7 @@ query ArticlesAfterDate($since: String!) {
rssURL
slug
shoutouts
contentTypes
numArticles
websiteURL
socials {
Expand Down
13 changes: 12 additions & 1 deletion app/src/main/java/com/cornellappdev/volume/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.cornellappdev.volume

import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
Expand All @@ -18,11 +21,19 @@ class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

val onboardingCompleted = runBlocking {
return@runBlocking userPreferences.fetchOnboardingCompleted()
}

val channelId = getString((R.string.default_notification_channel_id))
(getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).createNotificationChannel(
NotificationChannel(
channelId,
packageName,
NotificationManager.IMPORTANCE_DEFAULT
)
)

setContent {
MaterialTheme(
colors = LightColors,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package com.cornellappdev.volume.data.models
* @property slug
* @property shoutouts
* @property websiteURL
* @property contentTypes
* @property mostRecentArticle
* @property socials
*/
Expand All @@ -25,7 +26,12 @@ data class Publication(
val slug: String,
val shoutouts: Double,
val websiteURL: String,
val contentTypes: List<ContentType>,
val numArticles: Double,
val mostRecentArticle: Article? = null,
val socials: List<Social>
)

enum class ContentType{
MAGAZINES, ARTICLES
}
16 changes: 15 additions & 1 deletion app/src/main/java/com/cornellappdev/volume/data/models/Social.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.cornellappdev.volume.data.models

import com.cornellappdev.volume.R

/**
* Model class for Socials on Volume
*
Expand All @@ -9,4 +11,16 @@ package com.cornellappdev.volume.data.models
data class Social(
val social: String,
val url: String
)
) {
companion object {
val formattedSocialNameMap = mapOf(
"insta" to "Instagram",
"facebook" to "Facebook",
"linkedin" to "LinkedIn",
"twitter" to "Twitter",
"youtube" to "YouTube"
)
val socialLogoMap =
mapOf("Instagram" to R.drawable.ic_instagram, "Facebook" to R.drawable.ic_facebook)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.cornellappdev.volume.data.repositories
import com.cornellappdev.volume.*
import com.cornellappdev.volume.data.NetworkApi
import com.cornellappdev.volume.data.models.Article
import com.cornellappdev.volume.data.models.ContentType
import com.cornellappdev.volume.data.models.Publication
import com.cornellappdev.volume.data.models.Social
import javax.inject.Inject
Expand Down Expand Up @@ -55,12 +56,16 @@ class ArticleRepository @Inject constructor(private val networkApi: NetworkApi)
rssURL = publication.rssURL,
slug = publication.slug,
shoutouts = publication.shoutouts,
contentTypes = publication.contentTypes.map {
ContentType.valueOf(it.uppercase())
},
websiteURL = publication.websiteURL,
numArticles = publication.numArticles,
socials = publication.socials
.map { Social(it.social, it.url) }
),
shoutouts = articleData.shoutouts,

nsfw = articleData.nsfw
)
}
Expand All @@ -84,6 +89,9 @@ class ArticleRepository @Inject constructor(private val networkApi: NetworkApi)
rssURL = publication.rssURL,
slug = publication.slug,
shoutouts = publication.shoutouts,
contentTypes = publication.contentTypes.map {
ContentType.valueOf(it.uppercase())
},
numArticles = publication.numArticles,
websiteURL = publication.websiteURL,
socials = publication.socials
Expand Down Expand Up @@ -113,6 +121,9 @@ class ArticleRepository @Inject constructor(private val networkApi: NetworkApi)
rssURL = publication.rssURL,
slug = publication.slug,
shoutouts = publication.shoutouts,
contentTypes = publication.contentTypes.map {
ContentType.valueOf(it.uppercase())
},
numArticles = publication.numArticles,
websiteURL = publication.websiteURL,
socials = publication.socials
Expand Down Expand Up @@ -142,6 +153,9 @@ class ArticleRepository @Inject constructor(private val networkApi: NetworkApi)
rssURL = publication.rssURL,
slug = publication.slug,
shoutouts = publication.shoutouts,
contentTypes = publication.contentTypes.map {
ContentType.valueOf(it.uppercase())
},
numArticles = publication.numArticles,
websiteURL = publication.websiteURL,
socials = publication.socials
Expand Down Expand Up @@ -171,6 +185,9 @@ class ArticleRepository @Inject constructor(private val networkApi: NetworkApi)
rssURL = publication.rssURL,
slug = publication.slug,
shoutouts = publication.shoutouts,
contentTypes = publication.contentTypes.map {
ContentType.valueOf(it.uppercase())
},
numArticles = publication.numArticles,
websiteURL = publication.websiteURL,
socials = publication.socials
Expand Down Expand Up @@ -200,6 +217,9 @@ class ArticleRepository @Inject constructor(private val networkApi: NetworkApi)
rssURL = publication.rssURL,
slug = publication.slug,
shoutouts = publication.shoutouts,
contentTypes = publication.contentTypes.map {
ContentType.valueOf(it.uppercase())
},
websiteURL = publication.websiteURL,
numArticles = publication.numArticles,
socials = publication.socials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.cornellappdev.volume.AllPublicationsQuery
import com.cornellappdev.volume.PublicationBySlugQuery
import com.cornellappdev.volume.data.NetworkApi
import com.cornellappdev.volume.data.models.Article
import com.cornellappdev.volume.data.models.ContentType
import com.cornellappdev.volume.data.models.Publication
import com.cornellappdev.volume.data.models.Social
import javax.inject.Inject
Expand Down Expand Up @@ -43,6 +44,9 @@ class PublicationRepository @Inject constructor(private val networkApi: NetworkA
slug = publicationData.slug,
shoutouts = publicationData.shoutouts,
numArticles = publicationData.numArticles,
contentTypes = publicationData.contentTypes.map {
ContentType.valueOf(it.uppercase())
},
websiteURL = publicationData.websiteURL,
mostRecentArticle = publicationData.mostRecentArticle?.nsfw?.let { isNSFW ->
Article(
Expand All @@ -60,6 +64,9 @@ class PublicationRepository @Inject constructor(private val networkApi: NetworkA
slug = publicationData.slug,
shoutouts = publicationData.shoutouts,
numArticles = publicationData.numArticles,
contentTypes = publicationData.contentTypes.map {
ContentType.valueOf(it.uppercase())
},
websiteURL = publicationData.websiteURL,
socials = publicationData.socials
.map { Social(it.social, it.url) }),
Expand All @@ -85,6 +92,9 @@ class PublicationRepository @Inject constructor(private val networkApi: NetworkA
rssURL = publicationData.rssURL,
slug = publicationData.slug,
shoutouts = publicationData.shoutouts,
contentTypes = publicationData.contentTypes.map {
ContentType.valueOf(it.uppercase())
},
numArticles = publicationData.numArticles,
websiteURL = publicationData.websiteURL,
mostRecentArticle = publicationData.mostRecentArticle?.nsfw?.let { isNSFW ->
Expand All @@ -103,6 +113,9 @@ class PublicationRepository @Inject constructor(private val networkApi: NetworkA
rssURL = publicationData.rssURL,
slug = publicationData.slug,
shoutouts = publicationData.shoutouts,
contentTypes = publicationData.contentTypes.map {
ContentType.valueOf(it.uppercase())
},
websiteURL = publicationData.websiteURL,
numArticles = publicationData.numArticles,
socials = publicationData.socials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class UserPreferencesRepository @Inject constructor(
}
}

suspend fun updateNotificationFlowStatus(value: Boolean) {
userPreferencesStore.updateData { currentPreferences ->
currentPreferences.toBuilder().setNotificationFlowCompleted(value).build()
}
}

suspend fun addBookmarkedArticle(articleId: String) {
userPreferencesStore.updateData { currentPreferences ->
val currentBookmarks = currentPreferences.bookmarkedArticlesList.toHashSet()
Expand Down Expand Up @@ -78,4 +84,7 @@ class UserPreferencesRepository @Inject constructor(

suspend fun fetchShoutoutCount(articleId: String): Int =
userPreferencesFlow.first().shoutoutMap.getOrDefault(articleId, 0)

suspend fun fetchNotificationFlowStatus(): Boolean =
userPreferencesFlow.first().notificationFlowCompleted
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import javax.inject.Singleton
@InstallIn(SingletonComponent::class)
object NetworkModule {

private const val ENDPOINT = BuildConfig.DEV_ENDPOINT
private const val ENDPOINT = BuildConfig.ENDPOINT

@Singleton
@Provides
Expand Down
Loading