Skip to content

Commit

Permalink
chore: Add Notifications Module (#74)
Browse files Browse the repository at this point in the history
This module will serve as the foundational structure for all notification-related tasks and will facilitate its transition into a plugin in the future.
  • Loading branch information
farhan-arshad-dev authored Dec 24, 2024
1 parent 530219f commit 4ce0e6e
Show file tree
Hide file tree
Showing 22 changed files with 165 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ dependencies {
implementation project(path: ':profile')
implementation project(path: ':discussion')
implementation project(path: ':whatsnew')
implementation project(path: ':notifications')

kapt "androidx.room:room-compiler:$room_version"

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/org/openedx/app/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.google.android.play.core.review.ReviewManagerFactory
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import kotlinx.coroutines.Dispatchers
import org.openedx.notifications.PushManager
import org.koin.android.ext.koin.androidApplication
import org.koin.core.qualifier.named
import org.koin.dsl.module
Expand Down Expand Up @@ -46,6 +47,7 @@ import org.openedx.core.presentation.global.WhatsNewGlobalManager
import org.openedx.core.presentation.global.app_upgrade.AppUpgradeRouter
import org.openedx.core.system.AppCookieManager
import org.openedx.core.system.CalendarManager
import org.openedx.core.system.PushGlobalManager
import org.openedx.core.system.ResourceManager
import org.openedx.core.system.connection.NetworkConnection
import org.openedx.core.system.notifier.CourseNotifier
Expand Down Expand Up @@ -204,6 +206,8 @@ val appModule = module {
single<WhatsNewAnalytics> { get<AnalyticsManager>() }
single<IAPAnalytics> { get<AnalyticsManager>() }

single<PushGlobalManager> { get<PushManager>() }

factory { AgreementProvider(get(), get()) }
factory { FacebookAuthHelper() }
factory { GoogleAuthHelper(get()) }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package org.openedx.core.system

interface PushGlobalManager
1 change: 1 addition & 0 deletions notifications/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
66 changes: 66 additions & 0 deletions notifications/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("kotlin-parcelize")
}

android {
namespace = "org.openedx.notifications"
compileSdk = 34

defaultConfig {
minSdk = 24

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs += listOf("-Xstring-concat=inline")
}

buildFeatures {
viewBinding = true
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = rootProject.extra["compose_compiler_version"].toString()
}

flavorDimensions.add("env") // Define the flavor dimension
productFlavors {
create("prod") {
dimension = "env"
}
create("develop") {
dimension = "env"
}
create("stage") {
dimension = "env"
}
}
}

dependencies {
implementation(project(":core"))

testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
}
Empty file.
21 changes: 21 additions & 0 deletions notifications/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.openedx.mobile.notifications

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("org.edx.mobile.notifications.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions notifications/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.openedx.notifications

import org.openedx.core.system.PushGlobalManager

class PushManager : PushGlobalManager
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package org.openedx.notifications.data.api
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package org.openedx.notifications.data.model
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package org.openedx.notifications.data.repository
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package org.openedx.notifications.data.storage

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package org.openedx.notifications.domain.interactor

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package org.openedx.notifications.domain.model

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package org.openedx.notifications.presentation

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package org.openedx.notifications.presentation

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package org.openedx.notifications.presentation

3 changes: 3 additions & 0 deletions notifications/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>

</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.openedx.mobile.notifications

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ include ':discovery'
include ':profile'
include ':discussion'
include ':whatsnew'
include ':notifications'

0 comments on commit 4ce0e6e

Please sign in to comment.