forked from arnesson/cordova-plugin-firebase
-
-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Android implementation to get/set badge number as it doesn't w…
…ork on Android 8+. Resolves #124.
- Loading branch information
Showing
3 changed files
with
13 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,13 +125,7 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo | |
} else if (action.equals("hasPermission")) { | ||
this.hasPermission(callbackContext); | ||
return true; | ||
} else if (action.equals("setBadgeNumber")) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dpa99c
Author
Owner
|
||
this.setBadgeNumber(callbackContext, args.getInt(0)); | ||
return true; | ||
} else if (action.equals("getBadgeNumber")) { | ||
this.getBadgeNumber(callbackContext); | ||
return true; | ||
} else if (action.equals("subscribe")) { | ||
}else if (action.equals("subscribe")) { | ||
this.subscribe(callbackContext, args.getString(0)); | ||
return true; | ||
} else if (action.equals("unsubscribe")) { | ||
|
@@ -231,7 +225,11 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo | |
} else if (action.equals("setDefaultChannel")) { | ||
this.setDefaultChannel(callbackContext, args.getJSONObject(0)); | ||
return true; | ||
} else if (action.equals("grantPermission")) { | ||
} else if (action.equals("grantPermission") | ||
|| action.equals("setBadgeNumber") | ||
|| action.equals("getBadgeNumber") | ||
) { | ||
// Stubs for other platform methods | ||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, true)); | ||
return true; | ||
} | ||
|
@@ -414,36 +412,6 @@ public void run() { | |
}); | ||
} | ||
|
||
private void setBadgeNumber(final CallbackContext callbackContext, final int number) { | ||
This comment has been minimized.
Sorry, something went wrong.
sagrawal31
Collaborator
|
||
cordova.getThreadPool().execute(new Runnable() { | ||
public void run() { | ||
try { | ||
SharedPreferences.Editor editor = cordovaActivity.getSharedPreferences(KEY, Context.MODE_PRIVATE).edit(); | ||
editor.putInt(KEY, number); | ||
editor.apply(); | ||
ShortcutBadger.applyCount(cordovaActivity, number); | ||
callbackContext.success(); | ||
} catch (Exception e) { | ||
handleExceptionWithContext(e, callbackContext); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
private void getBadgeNumber(final CallbackContext callbackContext) { | ||
cordova.getThreadPool().execute(new Runnable() { | ||
public void run() { | ||
try { | ||
SharedPreferences settings = cordovaActivity.getSharedPreferences(KEY, Context.MODE_PRIVATE); | ||
int number = settings.getInt(KEY, 0); | ||
callbackContext.success(number); | ||
} catch (Exception e) { | ||
handleExceptionWithContext(e, callbackContext); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
private void subscribe(final CallbackContext callbackContext, final String topic) { | ||
cordova.getThreadPool().execute(new Runnable() { | ||
public void run() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@dpa99c not really sure but do we still need
me.leolin:ShortcutBadger:$ANDROID_SHORTCUTBADGER_VERSION
?