[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) {
|
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");
|
String actionKey = action.getString("action");
|
||||||
PendingIntent actionIntent = runInBackground ?
|
PendingIntent actionIntent = showUserInterface ?
|
||||||
createBroadcastIntent(notification, actionKey) :
|
createIntent(intentClass, notification, actionKey) :
|
||||||
createIntent(intentClass, notification, actionKey);
|
createBroadcastIntent(notification, actionKey);
|
||||||
int icon = getIcon(action.getString("icon"));
|
int icon = getIcon(action.getString("icon"));
|
||||||
String title = action.getString("title");
|
String title = action.getString("title");
|
||||||
|
|
||||||
|
|
|
@ -832,7 +832,10 @@ declare module 'react-native-firebase' {
|
||||||
EMAIL_LINK_SIGN_IN_METHOD: string;
|
EMAIL_LINK_SIGN_IN_METHOD: string;
|
||||||
EMAIL_PASSWORD_SIGN_IN_METHOD: string;
|
EMAIL_PASSWORD_SIGN_IN_METHOD: string;
|
||||||
credential: (email: string, password: string) => AuthCredential;
|
credential: (email: string, password: string) => AuthCredential;
|
||||||
credentialWithLink: (email: string, emailLink: string) => AuthCredential;
|
credentialWithLink: (
|
||||||
|
email: string,
|
||||||
|
emailLink: string
|
||||||
|
) => AuthCredential;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Auth {
|
interface Auth {
|
||||||
|
@ -1277,7 +1280,6 @@ declare module 'react-native-firebase' {
|
||||||
semanticAction?: SemanticAction;
|
semanticAction?: SemanticAction;
|
||||||
showUserInterface?: boolean;
|
showUserInterface?: boolean;
|
||||||
title: string;
|
title: string;
|
||||||
runInBackground?: boolean;
|
|
||||||
|
|
||||||
constructor(action: string, icon: string, title: string);
|
constructor(action: string, icon: string, title: string);
|
||||||
|
|
||||||
|
@ -1285,7 +1287,6 @@ declare module 'react-native-firebase' {
|
||||||
setAllowGenerateReplies(allowGeneratedReplies: boolean): Action;
|
setAllowGenerateReplies(allowGeneratedReplies: boolean): Action;
|
||||||
setSemanticAction(semanticAction: SemanticAction): Action;
|
setSemanticAction(semanticAction: SemanticAction): Action;
|
||||||
setShowUserInterface(showUserInterface: boolean): Action;
|
setShowUserInterface(showUserInterface: boolean): Action;
|
||||||
setRunInBackground(runInBackground: boolean): Action;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class RemoteInput {
|
class RemoteInput {
|
||||||
|
|
|
@ -16,12 +16,12 @@ export default class AndroidAction {
|
||||||
_semanticAction: SemanticActionType | void;
|
_semanticAction: SemanticActionType | void;
|
||||||
_showUserInterface: boolean | void;
|
_showUserInterface: boolean | void;
|
||||||
_title: string;
|
_title: string;
|
||||||
_runInBackground: boolean | void;
|
|
||||||
|
|
||||||
constructor(action: string, icon: string, title: string) {
|
constructor(action: string, icon: string, title: string) {
|
||||||
this._action = action;
|
this._action = action;
|
||||||
this._icon = icon;
|
this._icon = icon;
|
||||||
this._remoteInputs = [];
|
this._remoteInputs = [];
|
||||||
|
this._showUserInterface = true;
|
||||||
this._title = title;
|
this._title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,10 +53,6 @@ export default class AndroidAction {
|
||||||
return this._title;
|
return this._title;
|
||||||
}
|
}
|
||||||
|
|
||||||
get runInBackground(): ?boolean {
|
|
||||||
return this._runInBackground;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param remoteInput
|
* @param remoteInput
|
||||||
|
@ -107,16 +103,6 @@ export default class AndroidAction {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param runInBackground
|
|
||||||
* @returns {AndroidAction}
|
|
||||||
*/
|
|
||||||
setRunInBackground(runInBackground: boolean): AndroidAction {
|
|
||||||
this._runInBackground = runInBackground
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
build(): NativeAndroidAction {
|
build(): NativeAndroidAction {
|
||||||
if (!this._action) {
|
if (!this._action) {
|
||||||
throw new Error('AndroidAction: Missing required `action` property');
|
throw new Error('AndroidAction: Missing required `action` property');
|
||||||
|
@ -134,7 +120,6 @@ export default class AndroidAction {
|
||||||
semanticAction: this._semanticAction,
|
semanticAction: this._semanticAction,
|
||||||
showUserInterface: this._showUserInterface,
|
showUserInterface: this._showUserInterface,
|
||||||
title: this._title,
|
title: this._title,
|
||||||
runInBackground: this._runInBackground
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,9 +146,6 @@ export const fromNativeAndroidAction = (
|
||||||
if (nativeAction.showUserInterface) {
|
if (nativeAction.showUserInterface) {
|
||||||
action.setShowUserInterface(nativeAction.showUserInterface);
|
action.setShowUserInterface(nativeAction.showUserInterface);
|
||||||
}
|
}
|
||||||
if (nativeAction.runInBackground) {
|
|
||||||
action.setRunInBackground(nativeAction.runInBackground);
|
|
||||||
}
|
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
};
|
};
|
||||||
|
|
|
@ -136,7 +136,6 @@ export type NativeAndroidAction = {|
|
||||||
semanticAction?: SemanticActionType,
|
semanticAction?: SemanticActionType,
|
||||||
showUserInterface?: boolean,
|
showUserInterface?: boolean,
|
||||||
title: string,
|
title: string,
|
||||||
runInBackground?: boolean,
|
|
||||||
|};
|
|};
|
||||||
|
|
||||||
export type NativeAndroidNotification = {|
|
export type NativeAndroidNotification = {|
|
||||||
|
|
Loading…
Reference in New Issue