Skip to content

Commit

Permalink
Merge pull request #73 from rees46/feat/push-notification
Browse files Browse the repository at this point in the history
Feat/push notification
  • Loading branch information
TorinAsakura authored Nov 14, 2024
2 parents 90e3169 + 81c8e3e commit 0004a16
Show file tree
Hide file tree
Showing 115 changed files with 1,890 additions and 1,069 deletions.
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

0 comments on commit 0004a16

Please sign in to comment.