Skip to content

Commit

Permalink
[feature][SDK-88] Add flag to disable summary notification
Browse files Browse the repository at this point in the history
  • Loading branch information
wfhm committed Jun 9, 2023
1 parent 8e44e46 commit b1e38d3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
<meta-data
android:name="com.pushwoosh.notification_factory"
android:value="com.pushwoosh.unityplugin.UnityNotificationFactory" />
<meta-data
android:name="com.pushwoosh.summary_notification_factory"
android:value="com.pushwoosh.unityplugin.UnitySummaryNotificationFactory" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.pushwoosh.unityplugin;

import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;

import com.pushwoosh.internal.utils.PWLog;
import com.pushwoosh.notification.PushwooshSummaryNotificationFactory;

public class UnitySummaryNotificationFactory extends PushwooshSummaryNotificationFactory {
private boolean shouldGenerateSummary;
@Override
public boolean shouldGenerateSummaryNotification() {
try {
String packageName = getApplicationContext().getPackageName();
ApplicationInfo ai = getApplicationContext().getPackageManager().getApplicationInfo(packageName, PackageManager.GET_META_DATA);

if (ai.metaData != null) {
shouldGenerateSummary = ai.metaData.getBoolean("PW_GENERATE_SUMMARY", true);
}
} catch (Exception e) {
PWLog.exception(e);
}

PWLog.debug(PushwooshProxy.TAG, "shouldGenerateSummary = " + shouldGenerateSummary);
return shouldGenerateSummary;
}
}

0 comments on commit b1e38d3

Please sign in to comment.