Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android actions fixes #1 #835

Merged
merged 1 commit into from
Mar 6, 2018
Merged

Android actions fixes #1 #835

merged 1 commit into from
Mar 6, 2018

Conversation

SergChr
Copy link
Contributor

@SergChr SergChr commented Mar 6, 2018

Fixes

  • Changed IntentClass => IntentClassName.
  • Added ability to send android_actions as an array, for example:
{
 "to" : "fcm_token",
 "data" : {
     "custom_notification": {
     	  "android_actions": ["First action", "Second action"],
	      "color":"#00ACD4",
	      "priority":"max"
    }
 }
}
  • As android_actions is an ArrayList so the bundle can't correctly be parsed, I have added bundle.remove("android_actions"); to avoid any parsing errors (we will not use this field further so it is unnecessary). Any workarounds for this or it's OK?

String actionValue = actions[a].trim();
Intent actionIntent = new Intent(mContext, intentClass);
List<String> actions = bundle.getStringArrayList("android_actions");
bundle.remove("android_actions");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep the bundle as is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evollu okay, so what the way to keep android_actions and don't come across parsing error? It happened when parsing the Intent in FIRMessagingModule.java: it can't parse ArrayList.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm..ok

@evollu evollu merged commit aaf3c5e into evollu:master Mar 6, 2018
@evollu
Copy link
Owner

evollu commented Mar 6, 2018

Intent actionIntent = new Intent(mContext, intentClass); is still failing

@SergChr
Copy link
Contributor Author

SergChr commented Mar 6, 2018

@evollu in this PR it was changed to

Intent actionIntent = new Intent();
actionIntent.setClassName(mContext, intentClassName);

thus it shouldn't failing

@evollu
Copy link
Owner

evollu commented Mar 6, 2018

I've published the change.
The field is changed to take a JSON string config.

@SergChr
Copy link
Contributor Author

SergChr commented Mar 7, 2018

@evollu thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants