[android][notifications] Change actions `runInBackground` to use `showUserInterface` instead
This commit is contained in:
parent
7b81731239
commit
88b1cad8c4
|
@ -294,11 +294,11 @@ public class DisplayNotificationTask extends AsyncTask<Void, Void, Void> {
|
|||
}
|
||||
|
||||
private NotificationCompat.Action createAction(Bundle action, Class intentClass, Bundle notification) {
|
||||
boolean runInBackground = action.containsKey("runInBackground") && action.getBoolean("runInBackground");
|
||||
boolean showUserInterface = action.containsKey("showUserInterface") && action.getBoolean("showUserInterface");
|
||||
String actionKey = action.getString("action");
|
||||
PendingIntent actionIntent = runInBackground ?
|
||||
createBroadcastIntent(notification, actionKey) :
|
||||
createIntent(intentClass, notification, actionKey);
|
||||
PendingIntent actionIntent = showUserInterface ?
|
||||
createIntent(intentClass, notification, actionKey) :
|
||||
createBroadcastIntent(notification, actionKey);
|
||||
int icon = getIcon(action.getString("icon"));
|
||||
String title = action.getString("title");
|
||||
|
||||
|
|
|
@ -832,7 +832,10 @@ declare module 'react-native-firebase' {
|
|||
EMAIL_LINK_SIGN_IN_METHOD: string;
|
||||
EMAIL_PASSWORD_SIGN_IN_METHOD: string;
|
||||
credential: (email: string, password: string) => AuthCredential;
|
||||
credentialWithLink: (email: string, emailLink: string) => AuthCredential;
|
||||
credentialWithLink: (
|
||||
email: string,
|
||||
emailLink: string
|
||||
) => AuthCredential;
|
||||
};
|
||||
|
||||
interface Auth {
|
||||
|
@ -1277,7 +1280,6 @@ declare module 'react-native-firebase' {
|
|||
semanticAction?: SemanticAction;
|
||||
showUserInterface?: boolean;
|
||||
title: string;
|
||||
runInBackground?: boolean;
|
||||
|
||||
constructor(action: string, icon: string, title: string);
|
||||
|
||||
|
@ -1285,7 +1287,6 @@ declare module 'react-native-firebase' {
|
|||
setAllowGenerateReplies(allowGeneratedReplies: boolean): Action;
|
||||
setSemanticAction(semanticAction: SemanticAction): Action;
|
||||
setShowUserInterface(showUserInterface: boolean): Action;
|
||||
setRunInBackground(runInBackground: boolean): Action;
|
||||
}
|
||||
|
||||
class RemoteInput {
|
||||
|
|
|
@ -16,12 +16,12 @@ export default class AndroidAction {
|
|||
_semanticAction: SemanticActionType | void;
|
||||
_showUserInterface: boolean | void;
|
||||
_title: string;
|
||||
_runInBackground: boolean | void;
|
||||
|
||||
constructor(action: string, icon: string, title: string) {
|
||||
this._action = action;
|
||||
this._icon = icon;
|
||||
this._remoteInputs = [];
|
||||
this._showUserInterface = true;
|
||||
this._title = title;
|
||||
}
|
||||
|
||||
|
@ -53,10 +53,6 @@ export default class AndroidAction {
|
|||
return this._title;
|
||||
}
|
||||
|
||||
get runInBackground(): ?boolean {
|
||||
return this._runInBackground;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param remoteInput
|
||||
|
@ -107,16 +103,6 @@ export default class AndroidAction {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param runInBackground
|
||||
* @returns {AndroidAction}
|
||||
*/
|
||||
setRunInBackground(runInBackground: boolean): AndroidAction {
|
||||
this._runInBackground = runInBackground
|
||||
return this;
|
||||
}
|
||||
|
||||
build(): NativeAndroidAction {
|
||||
if (!this._action) {
|
||||
throw new Error('AndroidAction: Missing required `action` property');
|
||||
|
@ -134,7 +120,6 @@ export default class AndroidAction {
|
|||
semanticAction: this._semanticAction,
|
||||
showUserInterface: this._showUserInterface,
|
||||
title: this._title,
|
||||
runInBackground: this._runInBackground
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -161,9 +146,6 @@ export const fromNativeAndroidAction = (
|
|||
if (nativeAction.showUserInterface) {
|
||||
action.setShowUserInterface(nativeAction.showUserInterface);
|
||||
}
|
||||
if (nativeAction.runInBackground) {
|
||||
action.setRunInBackground(nativeAction.runInBackground);
|
||||
}
|
||||
|
||||
return action;
|
||||
};
|
||||
|
|
|
@ -136,7 +136,6 @@ export type NativeAndroidAction = {|
|
|||
semanticAction?: SemanticActionType,
|
||||
showUserInterface?: boolean,
|
||||
title: string,
|
||||
runInBackground?: boolean,
|
||||
|};
|
||||
|
||||
export type NativeAndroidNotification = {|
|
||||
|
|
Loading…
Reference in New Issue