Skip to content

Commit 814127f

Browse files
Release v0.0.6
1 parent 1c93501 commit 814127f

27 files changed

+2050
-377
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,8 @@ fabric.properties
140140

141141
### AndroidStudio Patch ###
142142

143-
!/gradle/wrapper/gradle-wrapper.jar
143+
!/gradle/wrapper/gradle-wrapper.jar
144+
145+
### Cursor Rules ###
146+
.cursor/
147+
*.mdc

PushEngageSDK/build.gradle

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
plugins {
22
id 'com.android.library'
3+
id 'kotlin-android'
34
}
45

56
android {
6-
compileSdk 31
7-
buildToolsVersion = "30.0.3"
7+
compileSdk 34
8+
buildToolsVersion = "34.0.0"
89

910
defaultConfig {
1011
minSdkVersion 16
11-
targetSdkVersion 31
12-
versionCode 5
13-
versionName "0.0.5"
12+
targetSdkVersion 34
13+
versionCode 6
14+
versionName "0.0.6"
1415
multiDexEnabled true
1516

1617
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -27,10 +28,12 @@ android {
2728
sourceCompatibility JavaVersion.VERSION_11
2829
targetCompatibility JavaVersion.VERSION_11
2930
}
31+
kotlinOptions {
32+
jvmTarget = '11'
33+
}
34+
namespace 'com.pushengage.pushengage'
3035
}
3136

32-
apply plugin: 'kotlin-android'
33-
3437
dependencies {
3538
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
3639
implementation 'androidx.appcompat:appcompat:1.2.0'
@@ -52,4 +55,6 @@ dependencies {
5255
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
5356
implementation 'com.android.support:multidex:1.0.3'
5457
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9")
58+
implementation 'androidx.activity:activity:1.6.1'
59+
implementation 'androidx.fragment:fragment:1.5.5'
5560
}

PushEngageSDK/src/main/AndroidManifest.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
package="com.pushengage.pushengage">
3+
xmlns:tools="http://schemas.android.com/tools">
54

65
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
76
<uses-permission android:name="android.permission.INTERNET" />
@@ -18,6 +17,16 @@
1817
android:excludeFromRecents="true"
1918
android:exported="false" />
2019

20+
<activity
21+
android:name=".permissionhandling.PEPermissionHelperActivity"
22+
android:theme="@android:style/Theme.Translucent.NoTitleBar"
23+
android:noHistory="true"
24+
android:excludeFromRecents="true"
25+
android:exported="false" />
26+
27+
28+
29+
2130
<service
2231
android:name=".core.PEFirebaseMessagingService"
2332
android:exported="true">
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.pushengage.pushengage.Callbacks;
2+
3+
/**
4+
* Callback interface for notification permission requests
5+
*/
6+
public interface PushEngagePermissionCallback {
7+
/**
8+
* Called when the permission request is completed
9+
*
10+
* @param granted true if permission was granted, false otherwise
11+
* @param error any error that occurred during the permission request process
12+
*/
13+
void onPermissionResult(boolean granted, Error error);
14+
}

PushEngageSDK/src/main/java/com/pushengage/pushengage/DataWorker/DailySyncDataWorker.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ public DailySyncDataWorker(@NonNull Context appContext, @NonNull WorkerParameter
3030
public Result doWork() {
3131
prefs = new PEPrefs(getApplicationContext());
3232
try {
33-
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(getApplicationContext());
33+
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat
34+
.from(getApplicationContext());
3435
boolean areNotificationsEnabled = notificationManagerCompat.areNotificationsEnabled();
3536

3637
long longVal = areNotificationsEnabled ? 0 : 1;
3738
if (!(longVal == prefs.isNotificationDisabled())) {
38-
if (areNotificationsEnabled && prefs.isSubscriberDeleted()) {
39+
if (areNotificationsEnabled && prefs.isSubscriberDeleted() && !prefs.isManuallyUnsubscribed()) {
3940
PushEngage.callAddSubscriberAPI();
40-
} else {
41-
UpdateSubscriberStatusRequest updateSubscriberStatusRequest = new UpdateSubscriberStatusRequest(prefs.getSiteId(), prefs.getHash(), longVal, prefs.getDeleteOnNotificationDisable());
41+
} else if (!prefs.isManuallyUnsubscribed()) {
42+
UpdateSubscriberStatusRequest updateSubscriberStatusRequest = new UpdateSubscriberStatusRequest(
43+
prefs.getSiteId(), prefs.getHash(), longVal, prefs.getDeleteOnNotificationDisable());
4244
updateSubscriberStatus(updateSubscriberStatusRequest);
4345
}
4446
}

PushEngageSDK/src/main/java/com/pushengage/pushengage/DataWorker/WeeklySyncDataWorker.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ public void onStopped() {
5757
public void callAndroidSync() {
5858
if (PEUtilities.checkNetworkConnection(getApplicationContext())) {
5959
prefs = new PEPrefs(getApplicationContext());
60-
Call<AndroidSyncResponse> addRecordsResponseCall = RestClient.getBackendCdnClient(getApplicationContext()).androidSync(prefs.getSiteKey());
60+
Call<AndroidSyncResponse> addRecordsResponseCall = RestClient.getBackendCdnClient(getApplicationContext())
61+
.androidSync(prefs.getSiteKey());
6162
addRecordsResponseCall.enqueue(new Callback<AndroidSyncResponse>() {
6263
@Override
63-
public void onResponse(@NonNull Call<AndroidSyncResponse> call, @NonNull Response<AndroidSyncResponse> response) {
64+
public void onResponse(@NonNull Call<AndroidSyncResponse> call,
65+
@NonNull Response<AndroidSyncResponse> response) {
6466
if (response.isSuccessful()) {
6567
AndroidSyncResponse androidSyncResponse = response.body();
6668
if (androidSyncResponse.getData().getSiteStatus().equalsIgnoreCase(PEConstants.ACTIVE)) {
@@ -72,26 +74,30 @@ public void onResponse(@NonNull Call<AndroidSyncResponse> call, @NonNull Respons
7274
prefs.setLoggerUrl(androidSyncResponse.getData().getApi().getLog());
7375
prefs.setSiteId(androidSyncResponse.getData().getSiteId());
7476
prefs.setProjectId(androidSyncResponse.getData().getFirebaseSenderId());
75-
prefs.setDeleteOnNotificationDisable(androidSyncResponse.getData().getDeleteOnNotificationDisable());
77+
prefs.setDeleteOnNotificationDisable(
78+
androidSyncResponse.getData().getDeleteOnNotificationDisable());
7679
prefs.setSiteStatus(androidSyncResponse.getData().getSiteStatus());
7780
prefs.setGeoFetch(androidSyncResponse.getData().getGeoLocationEnabled());
7881
prefs.setEu(androidSyncResponse.getData().getIsEu());
79-
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(getApplicationContext());
82+
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat
83+
.from(getApplicationContext());
8084
boolean areNotificationsEnabled = notificationManagerCompat.areNotificationsEnabled();
8185
long longVal = areNotificationsEnabled ? 0 : 1;
8286
prefs.setIsNotificationDisabled(longVal);
83-
callUpdateSubscriberHash();
87+
if (!prefs.isManuallyUnsubscribed()) {
88+
callUpdateSubscriberHash();
89+
}
8490
} else {
8591
prefs.setIsSubscriberDeleted(true);
8692
}
8793
} else {
88-
// Log.d(TAG, "API Failure");
94+
// Log.d(TAG, "API Failure");
8995
}
9096
}
9197

9298
@Override
9399
public void onFailure(@NonNull Call<AndroidSyncResponse> call, @NonNull Throwable t) {
94-
// Log.d(TAG, "API Failure");
100+
// Log.d(TAG, "API Failure");
95101
}
96102
});
97103
}

0 commit comments

Comments
 (0)