diff --git a/app/build.gradle b/app/build.gradle index 0f0262caa..7d5fb0373 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" diff --git a/app/src/main/java/org/openedx/app/di/AppModule.kt b/app/src/main/java/org/openedx/app/di/AppModule.kt index e43179344..39f392543 100644 --- a/app/src/main/java/org/openedx/app/di/AppModule.kt +++ b/app/src/main/java/org/openedx/app/di/AppModule.kt @@ -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 @@ -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 @@ -204,6 +206,8 @@ val appModule = module { single { get() } single { get() } + single { get() } + factory { AgreementProvider(get(), get()) } factory { FacebookAuthHelper() } factory { GoogleAuthHelper(get()) } diff --git a/core/src/main/java/org/openedx/core/system/PushGlobalManager.kt b/core/src/main/java/org/openedx/core/system/PushGlobalManager.kt new file mode 100644 index 000000000..861e0882b --- /dev/null +++ b/core/src/main/java/org/openedx/core/system/PushGlobalManager.kt @@ -0,0 +1,3 @@ +package org.openedx.core.system + +interface PushGlobalManager diff --git a/notifications/.gitignore b/notifications/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/notifications/.gitignore @@ -0,0 +1 @@ +/build diff --git a/notifications/build.gradle.kts b/notifications/build.gradle.kts new file mode 100644 index 000000000..373d2e2bb --- /dev/null +++ b/notifications/build.gradle.kts @@ -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") +} diff --git a/notifications/consumer-rules.pro b/notifications/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/notifications/proguard-rules.pro b/notifications/proguard-rules.pro new file mode 100644 index 000000000..f1b424510 --- /dev/null +++ b/notifications/proguard-rules.pro @@ -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 diff --git a/notifications/src/androidTest/java/org/openedx/mobile/notifications/ExampleInstrumentedTest.kt b/notifications/src/androidTest/java/org/openedx/mobile/notifications/ExampleInstrumentedTest.kt new file mode 100644 index 000000000..8e9d5279b --- /dev/null +++ b/notifications/src/androidTest/java/org/openedx/mobile/notifications/ExampleInstrumentedTest.kt @@ -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) + } +} diff --git a/notifications/src/main/AndroidManifest.xml b/notifications/src/main/AndroidManifest.xml new file mode 100644 index 000000000..e10007615 --- /dev/null +++ b/notifications/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/notifications/src/main/java/org/openedx/notifications/PushManager.kt b/notifications/src/main/java/org/openedx/notifications/PushManager.kt new file mode 100644 index 000000000..d4a6059cd --- /dev/null +++ b/notifications/src/main/java/org/openedx/notifications/PushManager.kt @@ -0,0 +1,5 @@ +package org.openedx.notifications + +import org.openedx.core.system.PushGlobalManager + +class PushManager : PushGlobalManager diff --git a/notifications/src/main/java/org/openedx/notifications/data/api/NotificationsApi.kt b/notifications/src/main/java/org/openedx/notifications/data/api/NotificationsApi.kt new file mode 100644 index 000000000..5abe2c311 --- /dev/null +++ b/notifications/src/main/java/org/openedx/notifications/data/api/NotificationsApi.kt @@ -0,0 +1 @@ +package org.openedx.notifications.data.api \ No newline at end of file diff --git a/notifications/src/main/java/org/openedx/notifications/data/model/delete_me.kt b/notifications/src/main/java/org/openedx/notifications/data/model/delete_me.kt new file mode 100644 index 000000000..b38cd0b61 --- /dev/null +++ b/notifications/src/main/java/org/openedx/notifications/data/model/delete_me.kt @@ -0,0 +1 @@ +package org.openedx.notifications.data.model \ No newline at end of file diff --git a/notifications/src/main/java/org/openedx/notifications/data/repository/delete_me.kt b/notifications/src/main/java/org/openedx/notifications/data/repository/delete_me.kt new file mode 100644 index 000000000..1934872aa --- /dev/null +++ b/notifications/src/main/java/org/openedx/notifications/data/repository/delete_me.kt @@ -0,0 +1 @@ +package org.openedx.notifications.data.repository \ No newline at end of file diff --git a/notifications/src/main/java/org/openedx/notifications/data/storage/NotificationsPreferences.kt b/notifications/src/main/java/org/openedx/notifications/data/storage/NotificationsPreferences.kt new file mode 100644 index 000000000..d47c8850b --- /dev/null +++ b/notifications/src/main/java/org/openedx/notifications/data/storage/NotificationsPreferences.kt @@ -0,0 +1,2 @@ +package org.openedx.notifications.data.storage + diff --git a/notifications/src/main/java/org/openedx/notifications/domain/interactor/Notificationsinteractor.kt b/notifications/src/main/java/org/openedx/notifications/domain/interactor/Notificationsinteractor.kt new file mode 100644 index 000000000..4e2e1ff5a --- /dev/null +++ b/notifications/src/main/java/org/openedx/notifications/domain/interactor/Notificationsinteractor.kt @@ -0,0 +1,2 @@ +package org.openedx.notifications.domain.interactor + diff --git a/notifications/src/main/java/org/openedx/notifications/domain/model/NotificationsSettings.kt b/notifications/src/main/java/org/openedx/notifications/domain/model/NotificationsSettings.kt new file mode 100644 index 000000000..dd10c8bc7 --- /dev/null +++ b/notifications/src/main/java/org/openedx/notifications/domain/model/NotificationsSettings.kt @@ -0,0 +1,2 @@ +package org.openedx.notifications.domain.model + diff --git a/notifications/src/main/java/org/openedx/notifications/presentation/NotificationsAnalytics.kt b/notifications/src/main/java/org/openedx/notifications/presentation/NotificationsAnalytics.kt new file mode 100644 index 000000000..92a2b4ba9 --- /dev/null +++ b/notifications/src/main/java/org/openedx/notifications/presentation/NotificationsAnalytics.kt @@ -0,0 +1,2 @@ +package org.openedx.notifications.presentation + diff --git a/notifications/src/main/java/org/openedx/notifications/presentation/NotificationsSettingsFragment.kt b/notifications/src/main/java/org/openedx/notifications/presentation/NotificationsSettingsFragment.kt new file mode 100644 index 000000000..92a2b4ba9 --- /dev/null +++ b/notifications/src/main/java/org/openedx/notifications/presentation/NotificationsSettingsFragment.kt @@ -0,0 +1,2 @@ +package org.openedx.notifications.presentation + diff --git a/notifications/src/main/java/org/openedx/notifications/presentation/NotificationsSettingsViewModel.kt b/notifications/src/main/java/org/openedx/notifications/presentation/NotificationsSettingsViewModel.kt new file mode 100644 index 000000000..92a2b4ba9 --- /dev/null +++ b/notifications/src/main/java/org/openedx/notifications/presentation/NotificationsSettingsViewModel.kt @@ -0,0 +1,2 @@ +package org.openedx.notifications.presentation + diff --git a/notifications/src/main/res/values/strings.xml b/notifications/src/main/res/values/strings.xml new file mode 100644 index 000000000..f11f7450a --- /dev/null +++ b/notifications/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/notifications/src/test/java/org/openedx/mobile/notifications/ExampleUnitTest.kt b/notifications/src/test/java/org/openedx/mobile/notifications/ExampleUnitTest.kt new file mode 100644 index 000000000..9aa5d63ce --- /dev/null +++ b/notifications/src/test/java/org/openedx/mobile/notifications/ExampleUnitTest.kt @@ -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) + } +} diff --git a/settings.gradle b/settings.gradle index 2e2262fff..d737de379 100644 --- a/settings.gradle +++ b/settings.gradle @@ -51,3 +51,4 @@ include ':discovery' include ':profile' include ':discussion' include ':whatsnew' +include ':notifications'