适用于 Xamarin 的 OneSignal SDK:没有 inFocusDisplayType 的定义

OneSignal SDK for Xamarin: there is no definition of inFocusDisplayType

https://documentation.onesignal.com/docs/xamarin-sdk-setup 上的 Xamarin.Forms 示例代码(第 2.1A 节)似乎有点过时了。我不得不更改几个包对象,例如 OneSignal.LOG_LEVEL.VERBOSECom.OneSignal.Abstractions.LOG_LEVEL.VERBOSE.

我无法立即转换为当前 SDK 的一行:

OneSignal.inFocusDisplayType = Com.OneSignal.Abstractions.OSInFocusDisplayOption.Notification;

那么 inFocusDisplayType 在 SDK 中移动到了哪里?

完整代码:

public partial class App : Xamarin.Forms.Application
{
    public App ()
    {
        // The root page of your application
        MainPage = new NavigationPage(new MyApp.LoggingInPage());

        //Remove this method to stop OneSignal Debugging  
        OneSignal.Current.SetLogLevel(Com.OneSignal.Abstractions.LOG_LEVEL.VERBOSE, Com.OneSignal.Abstractions.LOG_LEVEL.NONE);

        OneSignal.Current.StartInit("YOUR_ONESIGNAL_APP_ID")
        .Settings(new Dictionary<string, bool>() {
            { Com.OneSignal.Abstractions.IOSSettings.kOSSettingsKeyAutoPrompt, false },
            { Com.OneSignal.Abstractions.IOSSettings.kOSSettingsKeyInAppLaunchURL, false } })
        .EndInit();

        OneSignal.inFocusDisplayType = Com.OneSignal.Abstractions.OSInFocusDisplayOption.Notification;
               // ^^^^^^^^^^^^^^^^^^ ??

        // The promptForPushNotificationsWithUserResponse function will show the iOS push notification prompt. We recommend removing the following code and instead using an In-App Message to prompt for notification permission (See step 7)
        OneSignal.Current.RegisterForPushNotifications();
    }

现在它是这样工作的:

OneSignal.Current.StartInit("YOUR_ONESIGNAL_APP_ID")
    .Settings(new Dictionary<string, bool>() { 
        { Com.OneSignal.Abstractions.IOSSettings.kOSSettingsKeyAutoPrompt, false }, 
        { Com.OneSignal.Abstractions.IOSSettings.kOSSettingsKeyInAppLaunchURL, false }
    })
.InFocusDisplaying(Com.OneSignal.Abstractions.OSInFocusDisplayOption.Notification)  // <-- !
.EndInit();

(感谢 enkaradag,他回复了 GitHub issue