Skip to content
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

Feat/push notification #73

Merged
merged 49 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
083ef07
feat: Added notification logo and configure manifests
DanielGreenEngineer Nov 1, 2024
bc69448
feat: Added notification custom view
DanielGreenEngineer Nov 2, 2024
a57eb14
feat: Added actual sizes and loading image also radius for notification
DanielGreenEngineer Nov 2, 2024
bf41538
feat: Added rounded image view
DanielGreenEngineer Nov 5, 2024
380dc76
feat: Getting sizes from dimens
DanielGreenEngineer Nov 5, 2024
5a6f8bb
feat: Added click handling and sending params to receiver
DanielGreenEngineer Nov 5, 2024
4aafee0
feat: Added handling actions and switching images
DanielGreenEngineer Nov 5, 2024
47138c3
refactor: Separate creating notification function
DanielGreenEngineer Nov 5, 2024
621add3
feat: Handle views visibility
DanielGreenEngineer Nov 5, 2024
94b8513
feat: Added sending debug push notification
DanielGreenEngineer Nov 5, 2024
05283ad
feat: Added modular notification handling according to FSD structure
DanielGreenEngineer Nov 6, 2024
33dc11b
feat: Separate helper and get id from constructor
DanielGreenEngineer Nov 7, 2024
d33fc1e
feat: Added async loading bitmaps
DanielGreenEngineer Nov 7, 2024
eb5f76d
feat: Added notification model also change sending params
DanielGreenEngineer Nov 7, 2024
e0dffa3
feat: Added view helper
DanielGreenEngineer Nov 7, 2024
ee6c30d
feat: Added navigation helper
DanielGreenEngineer Nov 7, 2024
acc1b96
feat: Separate constants from helpers
DanielGreenEngineer Nov 7, 2024
5e6f082
chore: Optimized imports for constants
DanielGreenEngineer Nov 7, 2024
587c9ac
feat: Separate notification handler
DanielGreenEngineer Nov 7, 2024
2cb3258
feat: Added mapper and click handler
DanielGreenEngineer Nov 7, 2024
48b8929
feat: Remove useless provider
DanielGreenEngineer Nov 7, 2024
966a397
feat: Change worker builder to OneTimeWorkRequestBuilder
DanielGreenEngineer Nov 7, 2024
62ae417
feat: Added loading images with async await
DanielGreenEngineer Nov 7, 2024
6c2b88e
feat: Added resource object
DanielGreenEngineer Nov 7, 2024
5ed55d3
feat: Added AtomicInteger request code generator
DanielGreenEngineer Nov 7, 2024
9a7ee38
refactor: Remove useless resources
DanielGreenEngineer Nov 7, 2024
6b207f6
feat: Added action and empty field error
DanielGreenEngineer Nov 11, 2024
18a60f0
feat: Added network error
DanielGreenEngineer Nov 11, 2024
162666f
feat: Added resource, network and json errors
DanielGreenEngineer Nov 11, 2024
b722f0d
feat: Remove core module and separate handler from feature
DanielGreenEngineer Nov 11, 2024
4bd7969
chore: Moved data mapper to another package
DanielGreenEngineer Nov 11, 2024
f871c82
feat: Switch receiver to service
DanielGreenEngineer Nov 12, 2024
11acf01
chore: Remove debug logs
DanielGreenEngineer Nov 12, 2024
572b170
feat: Added progress container
DanielGreenEngineer Nov 12, 2024
9005094
feat: Added errors localization
DanielGreenEngineer Nov 12, 2024
c42cff0
feat: Getting errors from resources
DanielGreenEngineer Nov 12, 2024
d3298b0
feat: Added constant resources
DanielGreenEngineer Nov 12, 2024
e97734d
feat: Added progress indicator
DanielGreenEngineer Nov 12, 2024
b3dc61e
feat: Added DI integration notification manager
DanielGreenEngineer Nov 13, 2024
b5db422
feat: Added injection manager and initialization
DanielGreenEngineer Nov 13, 2024
eeb6fd2
feat: Added unique notification id
DanielGreenEngineer Nov 13, 2024
0fd6ddb
chore: Remove useless id
DanielGreenEngineer Nov 13, 2024
a4bfc40
feat: Change mutableMap to NotificationData
DanielGreenEngineer Nov 13, 2024
638ca7e
feat: Separate click handler to data sender and extractor
DanielGreenEngineer Nov 13, 2024
5078a9c
feat: Added handling error
DanielGreenEngineer Nov 13, 2024
24afa92
feat: Added handling error when image is loading
DanielGreenEngineer Nov 14, 2024
8f3ad53
feat: Separate navigation functions
DanielGreenEngineer Nov 14, 2024
16ab660
feat: Added notification data extension
DanielGreenEngineer Nov 14, 2024
81c8e3e
style: Reformat code and optimized imports, also add empty last lines
DanielGreenEngineer Nov 14, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
SIGNING_KEY_FILE_AS_BASE64_STRING: ${{ secrets.SIGNING_KEY_FILE_AS_BASE64_STRING }}

release:
needs: [publish-rees, version]
needs: [ publish-rees, version ]
uses: rees46/workflow/.github/workflows/reusable-android-release.yaml@master
permissions: write-all
with:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ This SDK can be used to integrate in your own app for Android in few steps.

## Documentation

For detailed information on methods, please refer to the documentation available at the following link:
For detailed information on methods, please refer to the documentation available at the following
link:

[Official API references](https://reference.api.rees46.com/?kotlin#introduction)

Expand Down
40 changes: 20 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
buildscript {
ext.kotlin_version = '2.0.0'
repositories {
google()
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.5.2'
classpath "com.google.gms:google-services:4.4.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
ext.kotlin_version = '2.0.0'
repositories {
google()
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.5.2'
classpath "com.google.gms:google-services:4.4.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

plugins {
id 'ru.vyarus.pom' version '2.2.2'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
id 'ru.vyarus.pom' version '2.2.2'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
}

allprojects {
repositories {
google()
mavenCentral()
mavenLocal()
}
repositories {
google()
mavenCentral()
mavenLocal()
}
}

tasks.register('clean', Delete) {
delete rootProject.buildDir
delete rootProject.buildDir
}
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand Down
238 changes: 119 additions & 119 deletions personalization-sdk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,160 +1,160 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'maven-publish'
id 'signing'
id 'kotlin-kapt'
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'maven-publish'
id 'signing'
id 'kotlin-kapt'
}

version='2.0.36'
version = '2.0.36'

android {
compileSdkVersion 34
flavorDimensions += 'default'
viewBinding {
enabled = true
}
dataBinding {
enabled = true
}
defaultConfig {
minSdkVersion 19
targetSdkVersion 34
buildConfigField "String", "VERSION_NAME", "\"" + version + "\""
multiDexEnabled true
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_20
targetCompatibility JavaVersion.VERSION_20
}

kotlinOptions {
jvmTarget = '20'
}

sourceSets {
main {
main.java.srcDirs = ['src/main/kotlin']
}
}

productFlavors {
rees46 {
dimension 'default'
ext.set("group", "com.rees46")
ext.set("libraryName", "com.rees46.sdk")
ext.set("webSite", "https://rees46.com")
ext.set("vcsUrl", "https://github.com/rees46/android-sdk")
}
personaclick {
dimension 'default'
ext.set("group", "com.personaclick")
ext.set("libraryName", "com.personaclick.sdk")
ext.set("webSite", "https://personaclick.com")
ext.set("vcsUrl", "https://github.com/PersonaClick/android-sdk")
}
}

testFixtures {
enable = false
}

namespace 'com.personalization'
compileSdkVersion 34
flavorDimensions += 'default'
viewBinding {
enabled = true
}
dataBinding {
enabled = true
}
defaultConfig {
minSdkVersion 19
targetSdkVersion 34
buildConfigField "String", "VERSION_NAME", "\"" + version + "\""
multiDexEnabled true
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_20
targetCompatibility JavaVersion.VERSION_20
}

kotlinOptions {
jvmTarget = '20'
}

sourceSets {
main {
main.java.srcDirs = ['src/main/kotlin']
}
}

productFlavors {
rees46 {
dimension 'default'
ext.set("group", "com.rees46")
ext.set("libraryName", "com.rees46.sdk")
ext.set("webSite", "https://rees46.com")
ext.set("vcsUrl", "https://github.com/rees46/android-sdk")
}
personaclick {
dimension 'default'
ext.set("group", "com.personaclick")
ext.set("libraryName", "com.personaclick.sdk")
ext.set("webSite", "https://personaclick.com")
ext.set("vcsUrl", "https://github.com/PersonaClick/android-sdk")
}
}

testFixtures {
enable = false
}

namespace 'com.personalization'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'com.google.android.material:material:1.12.0'
implementation 'org.jetbrains:annotations:24.1.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.work:work-runtime-ktx:2.9.1'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'

implementation platform('com.google.firebase:firebase-bom:32.7.0')
implementation 'com.google.firebase:firebase-messaging:23.4.1'
implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation 'androidx.media3:media3-exoplayer:1.4.1'
implementation 'androidx.media3:media3-ui:1.4.1'
implementation 'com.google.dagger:dagger:2.51.1'
kapt 'com.google.dagger:dagger-compiler:2.48'
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'com.google.android.material:material:1.12.0'
implementation 'org.jetbrains:annotations:24.1.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.work:work-runtime-ktx:2.9.1'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'

implementation platform('com.google.firebase:firebase-bom:32.7.0')
implementation 'com.google.firebase:firebase-messaging:23.4.1'
implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation 'androidx.media3:media3-exoplayer:1.4.1'
implementation 'androidx.media3:media3-ui:1.4.1'
implementation 'com.google.dagger:dagger:2.51.1'
kapt 'com.google.dagger:dagger-compiler:2.48'
}

configurations {
rees46Debug
rees46Release
personaclickDebug
personaclickRelease
rees46Debug
rees46Release
personaclickDebug
personaclickRelease
}

group = 'com.personalization'

apply from: '../publish.gradle'

tasks.register('sourcesJar', Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}

tasks.register('javadoc', Javadoc) {
source = fileTree(dir: 'src/main/kotlin', include: '**/*.kt')
classpath += files("${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
failOnError false
options.encoding = 'UTF-8'
options.charSet('UTF-8')
options.links("http://docs.oracle.com/javase/7/docs/api/")
options.links("http://d.android.com/reference/")
destinationDir = file("${buildDir}/docs/javadoc")
source = fileTree(dir: 'src/main/kotlin', include: '**/*.kt')
classpath += files("${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
failOnError false
options.encoding = 'UTF-8'
options.charSet('UTF-8')
options.links("http://docs.oracle.com/javase/7/docs/api/")
options.links("http://d.android.com/reference/")
destinationDir = file("${buildDir}/docs/javadoc")
}

tasks.register('javadocJar', Jar) {
dependsOn javadoc
archiveClassifier.set('javadoc')
from javadoc.destinationDir
dependsOn javadoc
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}

tasks.register('printVersionName') {
doLast {
println version
}
doLast {
println version
}
}

tasks.register('increaseVersionCode') {
doLast {
def (major, minor, patch) = version.tokenize('.')
major = major.toInteger()
minor = minor.toInteger()
patch = patch.toInteger()
doLast {
def (major, minor, patch) = version.tokenize('.')
major = major.toInteger()
minor = minor.toInteger()
patch = patch.toInteger()

Integer newPatch = patch + 1
Integer newPatch = patch + 1

String result = "$major.$minor.$newPatch"
String result = "$major.$minor.$newPatch"

String s = buildFile.getText().replaceFirst("version='$version'", "version='$result'")
String s = buildFile.getText().replaceFirst("version='$version'", "version='$result'")

buildFile.setText(s)
}
buildFile.setText(s)
}
}

artifacts {
archives javadocJar
archives sourcesJar
archives javadocJar
archives sourcesJar
}

afterEvaluate {
tasks.javadoc.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompileProvider.get().classpath
})
tasks.javadoc.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompileProvider.get().classpath
})
}
11 changes: 2 additions & 9 deletions personalization-sdk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver
android:name=".notification.NotificationBroadcastReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="ACTION_NEXT_IMAGE" />
<action android:name="ACTION_PREVIOUS_IMAGE" />
</intent-filter>
</receiver>
<service android:name=".features.notification.data.service.NotificationService" />

</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.personalization

import com.personalization.features.notification.domain.model.NotificationData

fun interface OnMessageListener {
fun onMessage(data: Map<String, String>)
fun onMessage(data: NotificationData)
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class RegisterManager @Inject constructor(
try {
val params = JSONObject()
params.put("tz", (TimeZone.getDefault().rawOffset / 3600000.0).toInt().toString())
Log.i(TAG,"Sending init request with params: $params")
Log.i(TAG, "Sending init request with params: $params")
sendNetworkMethodUseCase.get("init", params, object : OnApiCallbackListener() {
@Volatile
private var attempt = 0
Expand Down
Loading
Loading