urbanairship / airship-flutter

Flutter integration
Other
17 stars 16 forks source link

a #73

Closed tnarik closed 3 years ago

tnarik commented 3 years ago

❗For how-to inquiries involving Airship functionality or use cases, please contact (support)[https://support.airship.com/].

Preliminary Info

What Airship dependencies are you using?

airship_flutter: ^4.1.1

What are the versions of any relevant development tools you are using?

Flutter 1.26.0-17.6.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision a29104a69b (11 days ago) • 2021-02-16 09:26:56 -0800 Engine • revision 21fa8bb99e Tools • Dart 2.12.0 (build 2.12.0-259.12.beta)

Report

What unexpected behavior are you seeing?

notificationChannel in airshipconfig.properties as documented in README.md is wrong (or the properties parser implementation is wrong). The example is using quotes but if quotes are used the following error would be displayed when no notification_channel is indicated in the Send a Push API request.

This is because in properties files quotes or double quotes are considered part of the string.

What is the expected behavior?

That the sample configuration provided works when a customChannel notification channel is created and no notification_channel used in the request. I believe this is just a documentation issue (do not think it was intended to divert from the .properties format... although it is not really a standard). Expected behaviour is to either align the documentation, which should propagate to pub.dev et al. Otherwise, modify the implementation so that double quotes are not considered part of the strings when reading airshipconfig.properties.

What are the steps to reproduce the unexpected behavior?

  1. Start simple flutter project.
  2. Add airship_flutter, an airshipconfig.properties configuration as per the README.md (including a valid key and secret).
  3. Create a custom notification channel named customChannel (for example via flutter_local_notifications):
import 'package:flutter_local_notifications/flutter_local_notifications.dart';

 // Create notification channels (via Flutter)
  const AndroidNotificationChannel androidNotificationChannel = AndroidNotificationChannel(
    'customChannel',
    'Important notifications',
    'The Notification Channel for urgent/pop up stuff',
    importance: Importance.max,
  );

  final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
  await flutterLocalNotificationsPlugin
      .resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()
      ?.createNotificationChannel(androidNotificationChannel);
  1. Send a Push without indicating notification_channel.

Do you have logging for the issue?

E/startup_namer - UALib(12299): Notification channel "customChannel" does not exist. Falling back to com.urbanairship.default

marc-scig commented 3 years ago

Hi @tnarik,

So it is, thank you for letting us know. I think the author just meant to imply that "customChannel' is just placeholder text, but I agree it's confusing. I'll make a ticket to fix this in the README and the docs.