Skip to content

Commit

Permalink
remove shortcutbadger from Firebase
Browse files Browse the repository at this point in the history
  • Loading branch information
zeus64 committed Apr 10, 2020
1 parent 6a512ff commit b1d6548
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 53 deletions.
1 change: 0 additions & 1 deletion compilejar.bat
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ mkdir source\output 2> nul
-Xlint:unchecked^
-Xlint:deprecation^
-cp %ANDROID_PLATFORM%\android.jar;%FMX_JAR%;^
lib\jar\me.leolin\shortcutbadger.jar;^
lib\jar\com.android.support\support-core-utils.jar;^
lib\jar\com.android.support\support-compat.jar;^
lib\jar\com.android.support\support-annotations.jar;^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,6 @@
<JavaReference Include="..\..\..\lib\jar\com.google.firebase\firebase-messaging.jar">
<Disabled/>
</JavaReference>
<JavaReference Include="..\..\..\lib\jar\me.leolin\shortcutbadger.jar">
<Disabled/>
</JavaReference>
<JavaReference Include="..\..\..\lib\jar\com.android.support\support-annotations.jar">
<Disabled/>
</JavaReference>
Expand Down
40 changes: 0 additions & 40 deletions demos/ALFirebaseMessagingDemo/_source/AndroidManifest.template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,46 +32,6 @@
<permission android:name="com.ALFirebaseMessagingDemo.app.permission.C2D_MESSAGE" android:protectionLevel="signature"/> <!-- firebase-iid.jar -->
<uses-permission android:name="com.ALFirebaseMessagingDemo.app.permission.C2D_MESSAGE"/> <!-- firebase-iid.jar -->

<!-- shortcutbadger.jar - for android -->
<!-- <uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/> -->
<!-- <uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS"/> -->
<!-- <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> -->
<!-- <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" /> -->

<!-- shortcutbadger.jar - for Samsung -->
<uses-permission android:name="com.sec.android.provider.badge.permission.READ" />
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" />

<!-- shortcutbadger.jar - for htc -->
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT" />

<!-- shortcutbadger.jar - for sony -->
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" />
<uses-permission android:name="com.sonymobile.home.permission.PROVIDER_INSERT_BADGE" />

<!-- shortcutbadger.jar - for apex -->
<uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT" />

<!-- shortcutbadger.jar - for solid -->
<uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE" />

<!-- shortcutbadger.jar - for huawei -->
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
<uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />

<!-- shortcutbadger.jar - for ZUK -->
<uses-permission android:name="android.permission.READ_APP_BADGE" />

<!-- shortcutbadger.jar - for OPPO -->
<uses-permission android:name="com.oppo.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.oppo.launcher.permission.WRITE_SETTINGS" />

<!-- shortcutbadger.jar - for EvMe -->
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_READ" />
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_WRITE" />

<uses-feature android:glEsVersion="0x00020000" android:required="True"/>

<application android:persistent="%persistent%"
Expand Down
1 change: 0 additions & 1 deletion demos/ALFirebaseMessagingDemo/_source/Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ interface
Androidapi.JNI.Support,
Androidapi.JNI.Media,
Androidapi.JNI.JavaTypes,
ALAndroidShortcutBadgerApi,
ALAndroidFirebaseApi,
ALAndroidApi,
ALGraphics,
Expand Down
6 changes: 3 additions & 3 deletions source/ALFirebase.pas
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ implementation
Androidapi.JNI.Os,
FMX.Helpers.Android,
FMX.platform.Android,
ALAndroidShortcutBadgerApi,
{$ELSEIF defined(IOS)}
Macapi.Helpers,
iOSapi.Helpers,
Expand Down Expand Up @@ -705,8 +704,9 @@ procedure TALFirebaseMessagingClient.setBadgeCount(const aNewValue: integer; con

{$REGION ' ANDROID'}
{$IF defined(android)}
If TJShortcutBadger.JavaClass.isBadgeCounterSupported(TAndroidHelper.Context) then
TJShortcutBadger.JavaClass.applyCount(TAndroidHelper.Context, aNewValue);
// It's seam that ShortcutBadger is not maintained anymore so remove this dependancy
// If TJShortcutBadger.JavaClass.isBadgeCounterSupported(TAndroidHelper.Context) then
// TJShortcutBadger.JavaClass.applyCount(TAndroidHelper.Context, aNewValue);
{$ENDIF}
{$ENDREGION}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import android.os.Build;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import me.leolin.shortcutbadger.ShortcutBadger;
import com.embarcadero.firemonkey.FMXNativeActivity;

public class ALFirebaseMessagingService extends FirebaseMessagingService {
Expand Down Expand Up @@ -295,10 +294,11 @@ else if (data.containsKey("notification.number")) {
notificationBuilder = notificationBuilder.setAutoCancel(true);
notificationBuilder = notificationBuilder.setContentIntent(pendingIntent);

if (data.containsKey("notification.badgecount")) {
ShortcutBadger.applyCount(context.getApplicationContext(), Integer.parseInt(data.get("notification.badgecount")));
}

// It's seam that ShortcutBadger is not maintained anymore so remove this dependancy
// if (data.containsKey("notification.badgecount")) {
// ShortcutBadger.applyCount(context.getApplicationContext(), Integer.parseInt(data.get("notification.badgecount")));
// }

NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(data.get("notification.tag"), /* tag String: A string identifier for this notification. May be null. */
0, /* id int: An identifier for this notification. The pair (tag, id) must be unique within your application. */
Expand Down

0 comments on commit b1d6548

Please sign in to comment.