Code Monkey home page Code Monkey logo

Comments (5)

rlepinski avatar rlepinski commented on June 23, 2024

Working on a major SDK update where I will add this with foreground presentation options.

from airship-flutter.

tomalabaster avatar tomalabaster commented on June 23, 2024

We're facing a similar need here. In our AppDelegate didFinishLaunchingWithOptions method we set our foreground presentation options as appropriate:

NotificationCenter.default.addObserver(forName: Airship.airshipReadyNotification, object: nil, queue: nil) { notification in
    if #available(iOS 14, *) {
        Airship.push.defaultPresentationOptions = [.badge, .banner, .list, .sound]
        Airship.push.notificationOptions = [.badge, .sound]
    } else {
        Airship.push.defaultPresentationOptions = [.alert, .badge, .sound]
        Airship.push.notificationOptions = [.badge, .sound]
    }
}

but we're not auto initialising the Airship SDK and are instead calling takeOff slightly later on from Flutter.

When we call takeOff from Flutter, the platform method handler then calls AirshipAutopilot.attemptTakeOff() (line 184 of SwiftAirshipPlugin.swift) which in turn calls Airship.push.defaultPresentationOptions = [.alert] (line 30 of AirshipAutopilot.swift).

from airship-flutter.

rlepinski avatar rlepinski commented on June 23, 2024

@tomalabaster You may need to delay setting the options til the next run loop by wrapping what you have in

DispatchQueue.main.async {

}

We have a major plugin rewrite coming that will add support for this and potentially be able to set it per notification all through flutter. This PR is the start of it - #161 we are just wrapping up a major native SDK release then we will focus on getting plugins up to date. I am hoping for a new flutter plugin by the end of this month.

from airship-flutter.

tomalabaster avatar tomalabaster commented on June 23, 2024

Thanks @rlepinski will give that a try and keep an eye out 👍

from airship-flutter.

rlepinski avatar rlepinski commented on June 23, 2024

We added support in 7.0.0:
Setting options you want to register for:
Airship.push.iOS.setNotificationOptions([IOSNotificationOption.alert, IOSNotificationOption.badge, ...])

Foreground presentation options:
Airship.push.iOS.setForegroundPresentationOptions([IOSForegroundPresentationOption.list, IOSNotificationOption.banner, ...])

from airship-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.