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

Fixing lifecycle methods for Scene based Applications #714

Merged
merged 5 commits into from
Aug 11, 2020

Conversation

emawby
Copy link
Contributor

@emawby emawby commented Aug 4, 2020

This development fixes issue #647

Previously

The SDK was swizzling App Delegate lifecycle methods to add behavior for features like

  • Session counts
  • Session time
  • IAM triggers
  • Updating push permission status

This behavior was broken for Scene based applications since the following App Delegate methods are not called:

  • applicationDidBecomeActive
  • applicationWillResignActive
  • applicationDidEnterBackground
  • applicationWillEnterForeground

Now

The SDK does not swizzle the App Delegate lifecycle methods and instead listens for equivalent the NSNotificationCenter lifecycle notifications. If it is a scene based App we listen for:

  • UISceneDidEnterBackgroundNotification
  • UISceneDidActivateNotification
  • UISceneWillDeactivateNotification

If it is not a scene based App we listen for:

  • UIApplicationDidEnterBackgroundNotification
  • UIApplicationDidBecomeActiveNotification
  • UIApplicationWillResignActiveNotification

Dev Project and Unit Test Changes

When doing development I made the development App Scene based, but I did not commit the change since we would not be able to run it on versions less than iOS 13. To make the App scene based:

  1. Add the SceneDelegate.h and SceneDelegate.m files
    image

  2. Update the App's info.plist to include the following entries
    image

By listening for Notifications instead of Swizzling the App Delegate I needed to change our UnitTests in the following ways

  • Change foregroundApp and backgroundApp in UnitTestCommonMethods to post a notification instead of calling the lifecycle method on the appDelegate
  • Add a new common method useSceneLifecycle:(BOOL)sceneLifecycle that adds the "UIApplicationSceneManifest" key to the mock info.plist dictionary, meaning that we will listen for scene notifications instead of app notifications
  • Add an overrider for OSInAppMessagingViewController to fix an internalInconsistency crash when running unit tests since the class was listening for lifecycle notifications and updating UI
  • Add a new unit test that validates the scene lifecycle observers are working properly

This change is Reviewable

@emawby emawby force-pushed the fix/scene_delegate_lifecycle_handlers branch 2 times, most recently from b303699 to 94b8408 Compare August 4, 2020 19:45
Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

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

Also test are failing on travis due to many log entries, seeing a lot of messages like this.

2020-08-04 19:49:41.865439+0000 xctest[3230:7617] VERBOSE: application/scene didBecomeActiv

I think we need to change the log level, maybe set it to debug or info.

Also just to confirm, we tested both with both UIScene and non-UIScene projects on a real iOS device to ensure the focus events are working still?

@emawby emawby force-pushed the fix/scene_delegate_lifecycle_handlers branch from 94b8408 to 9d4afb4 Compare August 4, 2020 20:27
@emawby emawby requested a review from jkasten2 August 4, 2020 21:11
@emawby emawby force-pushed the fix/scene_delegate_lifecycle_handlers branch 4 times, most recently from 424068c to c7f150a Compare August 10, 2020 18:30
@emawby emawby force-pushed the fix/scene_delegate_lifecycle_handlers branch from c7f150a to fa73b22 Compare August 10, 2020 18:32
Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

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

Found a bug with a SceneUI app.

If you prompt for notifications from AppDelegate didFinishLaunchingWithOptions then the app always thinks it is in the background and won't display IAMs.

To repo create a new SceneUI project and use the example code noted here:
https://documentation.onesignal.com/docs/ios-sdk-setup#step-5---add-the-onesignal-initialization-code

Log:

2020-08-10 15:46:25.727410-0700 OneSignalUISceneTesting[562:183472] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
2020-08-10 15:46:25.732105-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Called init with app ID: 99015f5e-87b1-462e-a75b-f99bf7c2822e
2020-08-10 15:46:25.733974-0700 OneSignalUISceneTesting[562:183472] DEBUG: Migrating OSIndirectNotification from version: 0
2020-08-10 15:46:25.734544-0700 OneSignalUISceneTesting[562:183472] DEBUG: Migrating OSUniqueOutcomeNotification from version: 0
2020-08-10 15:46:25.747746-0700 OneSignalUISceneTesting[562:183472] DEBUG: Downloading iOS parameters for this application
2020-08-10 15:46:25.769472-0700 OneSignalUISceneTesting[562:183472] DEBUG: OneSignal SessionManager initSessionFromCache
2020-08-10 15:46:25.769738-0700 OneSignalUISceneTesting[562:183472] DEBUG: InAppMessageTracker initInfluencedTypeFromCache: OSChannelTracker tag: iam_id influenceType: UNATTRIBUTED indirectIds: (null) directIds: (null)
2020-08-10 15:46:25.769828-0700 OneSignalUISceneTesting[562:183472] DEBUG: NotificationTracker initInfluencedTypeFromCache: OSChannelTracker tag: notification_id influenceType: UNATTRIBUTED indirectIds: (null) directIds: (null)
2020-08-10 15:46:25.769997-0700 OneSignalUISceneTesting[562:183472] DEBUG: SessionManager restored from cache with influences: (
    "OSInfluence channel: IN_APP_MESSAGE influenceType: DISABLED ids:(null)",
    "OSInfluence channel: NOTIFICATION influenceType: DISABLED ids:(null)"
)
2020-08-10 15:46:25.772665-0700 OneSignalUISceneTesting[562:183472] VERBOSE: registering for Scene Lifecycle notifications
2020-08-10 15:46:25.772849-0700 OneSignalUISceneTesting[562:183472] VERBOSE: registerForPushNotifications Called:waitingForApnsResponse: 0
2020-08-10 15:46:25.839352-0700 OneSignalUISceneTesting[562:183472] VERBOSE: application/scene didBecomeActive
2020-08-10 15:46:25.839499-0700 OneSignalUISceneTesting[562:183472] DEBUG: Application Foregrounded started
2020-08-10 15:46:25.840132-0700 OneSignalUISceneTesting[562:183472] DEBUG: cancelFocusCall of {
}
2020-08-10 15:46:25.841775-0700 OneSignalUISceneTesting[562:183648] DEBUG: Outcomes cleared for current session
2020-08-10 15:46:25.842713-0700 OneSignalUISceneTesting[562:183472] VERBOSE: init redisplayedInAppMessages with: {
}
2020-08-10 15:46:25.864628-0700 OneSignalUISceneTesting[562:183472] VERBOSE: application/scene willResignActive
2020-08-10 15:46:25.865155-0700 OneSignalUISceneTesting[562:183472] DEBUG: Application Backgrounded started
2020-08-10 15:46:25.866070-0700 OneSignalUISceneTesting[562:183472] DEBUG: TimeProcessor <OSUnattributedFocusTimeProcessor: 0x2827542a0> for session attributed 0
2020-08-10 15:46:25.866185-0700 OneSignalUISceneTesting[562:183472] DEBUG: sendOnFocusCall unattributed with totalTimeActive -1.000000
2020-08-10 15:46:25.876920-0700 OneSignalUISceneTesting[562:183472] DEBUG: OSBaseFocusTimeProcessor hasMinSyncTime getMinSessionTime: 60 activeTime: -1.000000
2020-08-10 15:46:25.876999-0700 OneSignalUISceneTesting[562:183472] DEBUG: unattributed influence saveUnsentActiveTime -1.000000
2020-08-10 15:46:25.869088-0700 OneSignalUISceneTesting[562:183648] DEBUG: OneSignal SessionManager restartSessionIfNeeded with entryAction:: 2 channelTrackers: (
)
2020-08-10 15:46:25.880670-0700 OneSignalUISceneTesting[562:183648] DEBUG: OneSignal SessionManager sendSessionEndingWithInfluences with influences: (
)
2020-08-10 15:46:25.886567-0700 OneSignalUISceneTesting[562:183648] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1
2020-08-10 15:46:25.899046-0700 OneSignalUISceneTesting[562:183648] DEBUG: provision: {
    AppIDName = "XC Wildcard";
    ApplicationIdentifierPrefix =     (
        99SW8E36CT
    );
    CreationDate = "2020-07-24 23:28:40 +0000";
    DeveloperCertificates =     (
        {length = 1439, bytes = 0x3082059b 30820483 a0030201 02020820 ... 9c7cabb8 f756fdb1 },
        {length = 1444, bytes = 0x308205a0 30820488 a0030201 0202080d ... a2dfceba 4cfb2402 },
        {length = 1440, bytes = 0x3082059c 30820484 a0030201 02020810 ... 7f15c844 d52f7266 },
        {length = 1440, bytes = 0x3082059c 30820484 a0030201 0202087f ... f8bba2cb 0d999225 },
        {length = 1437, bytes = 0x30820599 30820481 a0030201 02020827 ... 37de3ee5 aa695460 },
        {length = 1458, bytes = 0x308205ae 30820496 a0030201 0202085b ... f352d21f 97427dbc },
        {length = 1456, bytes = 0x308205ac 30820494 a0030201 02020825 ... 99156500 bd2b81d3 },
        {length = 1461, bytes = 0x308205b1 30820499 a0030201 02020832 ... 371ac101 81657367 },
        {length = 1461, bytes = 0x308205b1 30820499 a0030201 0202082d ... 4a5a4e17 39f02751 },
        {length = 1461, bytes = 0x308205b1 30820499 a0030201 0202082e ... 9ee441fc fac1570b },
        {length = 1461, bytes = 0x308205b1 30820499 a0030201 02020806 ... c1fdc281 ffce2b17 },
        {length = 1466, bytes = 0x308205b6 3082049e a0030201 0202084f ... 34930b83 07c8e464 },
        {length = 1462, bytes = 0x308205b2 3082049a a0030201 02020849 ... 17b50455 84ec4578 },
        {length = 1462, bytes = 0x308205b2 3082049a a0030201 02020862 ... 428081a9 503c5f89 },
        {length = 1462, bytes = 0x308205b2 3082049a a0030201 0202082e ... 6cf4d6a5 ff38a862 },
        {length = 1462, bytes = 0x308205b2 3082049a a0030201 02020840 ... 48a3c211 e0c2d475 },
        {length = 1459, bytes = 0x308205af 30820497 a0030201 02020848 ... d20d4ac7 1b548ab4 },
        {length = 1456, bytes = 0x308205ac 30820494 a0030201 02020823 ... 93ae3a2b b019af23 },
        {length = 1455, bytes = 0x308205ab 30820493 a0030201 02020806 ... 3e510ee6 d55290c7 },
        {length = 1457, bytes = 0x308205ad 30820495 a0030201 02020864 ... bb62b606 1be7a640 }
    );
    Entitlements =     {
        "application-identifier" = "99SW8E36CT.*";
        "com.apple.developer.team-identifier" = 99SW8E36CT;
        "get-task-allow" = 1;
        "keychain-access-groups" =         (
            "99SW8E36CT.*",
            "com.apple.token"
        );
    };
    ExpirationDate = "2021-07-24 23:28:40 +0000";
    IsXcodeManaged = 1;
    Name = "iOS Team Provisioning Profile: *";
    Platform =     (
        iOS
    );
    ProvisionedDevices =     (
        2c631c34ed5d1758cd05d89fcdbb5a8b5fd1a531,
        ed370ec412eb766bd62f188999deaad1af06d2bc,
        a5da8c600aeb37d83bc09b0bdf314363fac58934,
        aeba9e2ea71fd42beaecfaa93a011a52d922e147,
        21e61a87ad3beb52dac46a054441838d891f36f7,
        54a97a85ed3d6c27c097f0379bcf7a05f3c3c771,
        b6919830893bbebc2a1705cabad4318d3e649a73,
        d77f0ef40af3a4cec925bc1775f8c352770ff9c9,
        20df4300571ee4c4d7071a2a7626b3cddecd0312,
        aff9fdb6fcfe7a26c6980c556c0593f52fb58518,
        18b70e0d849b3f74970a70ffa0bcd3cb10cb3727,
        "00008020-000219660C02002E",
        "00008030-001471883EF0802E",
        891bdde1adde01c64739596f4a01d53a66cc0c03,
        b5cc0fb30de36f14b08e202d1050001c085b0a1f,
        "00008020-0001204C21D9002E",
        1b39e33ba2f1ff11be24d3418eaf573daaa4b373,
        d71c53ee3871c2ae0507a336bf8a7fc121d3d49e,
        91d2e919577017f927b3c007f307e5232807a50c,
        ea1a7a4e055df8168b88373774e6be1af0f70a96,
        07b444f282a18effa14918d9464934117a686d91,
        8501fce2714cfa68544b37b7fc90a1f9e18ef3b2,
        687a6197cf1248d997052f314b157a63b79d6bfb,
        16d4b76ec51439cc4d8d2e565dd3e8d5429d854f,
        b561712d90b6ff599107e46117478ead246de336,
        c976d8eed2b563546db4296903b2b0c18c46abaa,
        7b2e4c8a84e9ee7bc960b12c1042e3ec59d26420,
        20c3f56e2c965f6f16c900c94af890888eef0b21,
        5d6ec549d00e554cfb48c81ddcbce870f23f4f63,
        0b0eaab9f9d2709c52ea9395a26028cbf4588b93,
        93cffbbe21d5e44772a4267469a54c5d662be773,
        210c5f5423042b5a0a7ff0be37fbd3031644d1f7,
        b4e84f4820a043b355d5f3d0f919f6bb1f2eb230,
        2abbfb02b4216febb9f0bc22553ede73e2657c9b,
        f2689e4e533370c482ba76c4d41822718b8c41b4,
        4102e8a95678383cc2eed75e5df41baac62d876a,
        6315b087cfea8d755452890a5ff05adb736c9d37,
        8f0d265c92c86e517c983c497a5f031c10e43976,
        bd48bafb27ff9cad452049e65be0475866a64896,
        64aee7fe8ae603fe5ef317302b4778a5553834b0,
        0f162a857ae2b7495f6bbf609240bb29ddc5b86c,
        49b432cdce7cd19256b0137d07c8c90125035d95,
        fe025a60edf1f636ad441ffe50219257ae76bb6c,
        fb039fca76778aeeb5952c4f818e388dae680773,
        "00008020-0003243202F8002E",
        "00008020-001E6D203E90003A",
        "00008030-000659D8228A802E",
        787d4242b3a179253633a5896b9324834a925b64,
        5091e64f51dca3ba45dc1b90338c45aa8ccad412,
        834c90359f11360360c892417ed3510b6420f5e7,
        1b01c4fdfb64847ddd5e5d432bb8e5f079b03169,
        304b76d7d328ee6b70604081739f2d22d1014726,
        22133fef1bfb4fdb0df1e509c7d2e0c4a62804fb,
        1cf741a7036fb20bdaffebe11187438c6728c3cf,
        624b40ffbd2dc9a45c45bc47932413dde8965303,
        b46fcacc32935373140fdee3ad940153c5887f82,
        "00008030-000A6CA80198802E",
        9b9b9b780326e152ad1c6fc4aeb56d63b1e83c68,
        f5eb2b86b4392f4ab2448d67cfde94e0b13efdde,
        1ef5a820320af69579c931a579ff627c2390cad0,
        "00008030-000D14492E22802E",
        "00008020-0000241E3C30003A",
        "471D1E73-9A81-51C6-B53C-005A3D33DA47",
        "F8EBF80D-3214-5DE3-8BE9-87C4073269FA",
        "564D1A25-7CBF-8CAC-F98E-46D4B0E34EC0",
        "48093FD7-1243-57B6-A6A8-59FD120B803E",
        "6AE9E277-D5B4-58B5-810E-44E00D250162",
        "C788ADB3-1CB5-55AF-9D48-02D0F59C28CC",
        "02B69927-5538-50E3-AFA7-2D6BEE59850D",
        "2966C26A-73C6-5B2F-BEE9-109948AE964A"
    );
    TeamIdentifier =     (
        99SW8E36CT
    );
    TeamName = "Lilomi Inc.";
    TimeToLive = 365;
    UUID = "211f7660-964c-469c-88fc-95c4bed82f10";
    Version = 1;
}
2020-08-10 15:46:25.904314-0700 OneSignalUISceneTesting[562:183648] VERBOSE: Calling OneSignal create/on_session
2020-08-10 15:46:25.904375-0700 OneSignalUISceneTesting[562:183648] VERBOSE: Not sending location with 'on_session' request payload, setLocationShared is false or lastLocation is null
2020-08-10 15:46:25.904864-0700 OneSignalUISceneTesting[562:183657] VERBOSE: HTTP Request (OSRequestRegisterUser) with URL: https://api.onesignal.com/players, with parameters: {
  "app_id" : "99015f5e-87b1-462e-a75b-f99bf7c2822e",
  "net_type" : 0,
  "ios_bundle" : "com.onesignal.OneSignalUISceneTesting",
  "device_type" : 0,
  "sdk_type" : "native",
  "sdk" : "021502",
  "language" : "en-US",
  "device_os" : "13.6",
  "game_version" : "1",
  "timezone" : -25200,
  "ad_id" : "3A37081C-D691-461B-955A-C4023B26383B",
  "notification_types" : -19,
  "device_model" : "iPad6,7"
}
2020-08-10 15:46:25.968789-0700 OneSignalUISceneTesting[562:183643] VERBOSE: network response (OSRequestGetIosParams): {
    outcomes =     {
        direct =         {
            enabled = 1;
        };
        indirect =         {
            enabled = 1;
            "notification_attribution" =             {
                limit = 10;
                "minutes_since_displayed" = 60;
            };
        };
        unattributed =         {
            enabled = 1;
        };
    };
    "receive_receipts_enable" = 1;
    "uses_provisional_auth" = 0;
}
2020-08-10 15:46:26.168361-0700 OneSignalUISceneTesting[562:183642] VERBOSE: network response (OSRequestRegisterUser): {
    id = "ac03f6e1-5c36-4933-ab43-308e0c9eff68";
    "in_app_messages" =     (
                {
            id = "51d428be-7b9e-4a78-b543-2986023b496f";
            triggers =             (
            );
            variants =             {
                all =                 {
                    default = "aee7909a-4d5c-4b2a-b81e-a6370af52453";
                };
            };
        },
                {
            id = "78659862-b615-4a91-8614-57279d311f40";
            triggers =             (
                                (
                )
            );
            variants =             {
                all =                 {
                    default = "97222e5c-d8d7-4da8-a95e-84c6a2663fd4";
                };
            };
        }
    );
    success = 1;
}
2020-08-10 15:46:26.168588-0700 OneSignalUISceneTesting[562:183642] Request <OSRequestRegisterUser: 0x282843930> success result {
    id = "ac03f6e1-5c36-4933-ab43-308e0c9eff68";
    "in_app_messages" =     (
                {
            id = "51d428be-7b9e-4a78-b543-2986023b496f";
            triggers =             (
            );
            variants =             {
                all =                 {
                    default = "aee7909a-4d5c-4b2a-b81e-a6370af52453";
                };
            };
        },
                {
            id = "78659862-b615-4a91-8614-57279d311f40";
            triggers =             (
                                (
                )
            );
            variants =             {
                all =                 {
                    default = "97222e5c-d8d7-4da8-a95e-84c6a2663fd4";
                };
            };
        }
    );
    success = 1;
}
2020-08-10 15:46:26.169089-0700 OneSignalUISceneTesting[562:183472] VERBOSE: on_session result: {
    push =     {
        id = "ac03f6e1-5c36-4933-ab43-308e0c9eff68";
        "in_app_messages" =         (
                        {
                id = "51d428be-7b9e-4a78-b543-2986023b496f";
                triggers =                 (
                );
                variants =                 {
                    all =                     {
                        default = "aee7909a-4d5c-4b2a-b81e-a6370af52453";
                    };
                };
            },
                        {
                id = "78659862-b615-4a91-8614-57279d311f40";
                triggers =                 (
                                        (
                    )
                );
                variants =                 {
                    all =                     {
                        default = "97222e5c-d8d7-4da8-a95e-84c6a2663fd4";
                    };
                };
            }
        );
        success = 1;
    };
}
2020-08-10 15:46:26.170632-0700 OneSignalUISceneTesting[562:183472] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1
2020-08-10 15:46:26.170812-0700 OneSignalUISceneTesting[562:183472] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1
2020-08-10 15:46:26.171035-0700 OneSignalUISceneTesting[562:183472] VERBOSE: updateInAppMessagesFromOnSession
2020-08-10 15:46:26.171763-0700 OneSignalUISceneTesting[562:183472] VERBOSE: resetRedisplayMessagesBySession with redisplayedInAppMessages: {
}
2020-08-10 15:46:26.171822-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Evaluating in app messages
2020-08-10 15:46:26.172108-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Pause IAMs display due to app inactivity
2020-08-10 15:46:26.172174-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Pause IAMs display due to app inactivity




------ Native Notification Permission prompt shown here and accepted -------





2020-08-10 15:46:35.225135-0700 OneSignalUISceneTesting[562:183472] VERBOSE: updateNotificationTypes called: 15
2020-08-10 15:46:35.228052-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Firing registerForRemoteNotifications
2020-08-10 15:46:35.228176-0700 OneSignalUISceneTesting[562:183472] VERBOSE: startedRegister: 1
2020-08-10 15:46:35.228300-0700 OneSignalUISceneTesting[562:183472] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1
2020-08-10 15:46:35.228424-0700 OneSignalUISceneTesting[562:183472] VERBOSE: getNotificationTypes:mSubscriptionStatus: -1
User accepted notifications: true
2020-08-10 15:46:35.233071-0700 OneSignalUISceneTesting[562:183472] VERBOSE: oneSignalDidFailRegisterForRemoteNotification:error:
2020-08-10 15:46:35.233203-0700 OneSignalUISceneTesting[562:183472] VERBOSE: setSubscriptionErrorStatus: -17
2020-08-10 15:46:35.233309-0700 OneSignalUISceneTesting[562:183472] VERBOSE: getNotificationTypes:mSubscriptionStatus: -17
2020-08-10 15:46:35.233411-0700 OneSignalUISceneTesting[562:183472] VERBOSE: getNotificationTypes:mSubscriptionStatus: -17
2020-08-10 15:46:35.236431-0700 OneSignalUISceneTesting[562:183472] VERBOSE: getNotificationTypes:mSubscriptionStatus: -17
2020-08-10 15:46:35.236524-0700 OneSignalUISceneTesting[562:183472] VERBOSE: getNotificationTypes:mSubscriptionStatus: -17
2020-08-10 15:46:35.237165-0700 OneSignalUISceneTesting[562:183472] VERBOSE: HTTP Request (OSRequestUpdateNotificationTypes) with URL: https://api.onesignal.com/players/ac03f6e1-5c36-4933-ab43-308e0c9eff68, with parameters: {
  "notification_types" : -17,
  "app_id" : "99015f5e-87b1-462e-a75b-f99bf7c2822e"
}
2020-08-10 15:46:35.237657-0700 OneSignalUISceneTesting[562:183472] ERROR: ERROR! Unknown 3000 error returned from APNs when getting a push token: Error Domain=NSCocoaErrorDomain Code=3000 "no valid “aps-environment” entitlement string found for application" UserInfo={NSLocalizedDescription=no valid “aps-environment” entitlement string found for application}
2020-08-10 15:46:35.401081-0700 OneSignalUISceneTesting[562:183640] VERBOSE: network response (OSRequestUpdateNotificationTypes): {
    success = 1;
}
2020-08-10 15:46:35.619675-0700 OneSignalUISceneTesting[562:183472] VERBOSE: application/scene didBecomeActive
2020-08-10 15:46:35.619976-0700 OneSignalUISceneTesting[562:183472] DEBUG: Application Foregrounded started
2020-08-10 15:46:35.620174-0700 OneSignalUISceneTesting[562:183472] DEBUG: cancelFocusCall of {
    "NOT_ATTRIBUTED" = "<OSUnattributedFocusTimeProcessor: 0x2827542a0>";
}
2020-08-10 15:46:35.620412-0700 OneSignalUISceneTesting[562:183472] VERBOSE: getNotificationTypes:mSubscriptionStatus: -17
2020-08-10 15:46:35.620532-0700 OneSignalUISceneTesting[562:183472] VERBOSE: getNotificationTypes:mSubscriptionStatus: -17
2020-08-10 15:46:35.620651-0700 OneSignalUISceneTesting[562:183472] DEBUG: OneSignal SessionManager attemptSessionUpgrade with entryAction: 1
2020-08-10 15:46:35.620868-0700 OneSignalUISceneTesting[562:183472] DEBUG: OneSignal SessionManager attemptSessionUpgrade try UNATTRIBUTED to INDIRECT upgrade
2020-08-10 15:46:35.622680-0700 OneSignalUISceneTesting[562:183472] DEBUG: OSChannelTracker for: notification_id lastChannelObjectReceived: (null)
2020-08-10 15:46:35.623092-0700 OneSignalUISceneTesting[562:183472] DEBUG: OSChannelTracker for: iam_id lastChannelObjectReceived: (null)
2020-08-10 15:46:35.623311-0700 OneSignalUISceneTesting[562:183472] DEBUG: Trackers after update attempt: (
    "OSChannelTracker tag: notification_id influenceType: UNATTRIBUTED indirectIds: (null) directIds: (null)",
    "OSChannelTracker tag: iam_id influenceType: UNATTRIBUTED indirectIds: (null) directIds: (null)"
)
2020-08-10 15:46:35.623442-0700 OneSignalUISceneTesting[562:183472] DEBUG: OneSignal SessionManager sendSessionEndingWithInfluences with influences: (
)
2020-08-10 15:46:35.623940-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Evaluating in app messages
2020-08-10 15:46:35.624133-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Pause IAMs display due to app inactivity
2020-08-10 15:46:35.625153-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Pause IAMs display due to app inactivity
2020-08-10 15:46:35.634826-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Evaluating messages due to inactive app
2020-08-10 15:46:35.634949-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Evaluating in app messages
2020-08-10 15:46:35.635091-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Pause IAMs display due to app inactivity
2020-08-10 15:46:35.635729-0700 OneSignalUISceneTesting[562:183472] VERBOSE: Pause IAMs display due to app inactivity

@emawby emawby force-pushed the fix/scene_delegate_lifecycle_handlers branch from c91e12b to 477911b Compare August 11, 2020 01:00
@emawby emawby force-pushed the fix/scene_delegate_lifecycle_handlers branch from 477911b to 880ec47 Compare August 11, 2020 01:35
iOS_SDK/OneSignalSDK/Source/OneSignalHelper.h Show resolved Hide resolved
iOS_SDK/OneSignalSDK/Source/OneSignalLifecycleObserver.m Outdated Show resolved Hide resolved
@@ -41,7 +41,7 @@ @implementation OneSignalNotificationServiceExtensionHandler
+ (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest*)request
withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent {
// Set default log level of NSE to VERBOSE so we get all logs from NSE logic
[OneSignal setLogLevel:ONE_S_LL_VERBOSE visualLevel:ONE_S_LL_NONE];
//[OneSignal setLogLevel:ONE_S_LL_VERBOSE visualLevel:ONE_S_LL_NONE];
Copy link
Contributor

Choose a reason for hiding this comment

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

is this ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to do this or the unit tests print too much and break CircleCI

Copy link
Contributor

Choose a reason for hiding this comment

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

gotcha, but I think we want to keep this setLogLevel, Travis will print verbose not debug, so if there are logs that were added maybe change to debug?

Copy link
Member

@jkasten2 jkasten2 Aug 11, 2020

Choose a reason for hiding this comment

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

This is the line where we are setting the log level for the tests.

[OneSignal setLogLevel:ONE_S_LL_INFO visualLevel:ONE_S_LL_NONE];

The line noted in this specific comment is in the NSE, which depending on the run order of the tests would turn up the log level.

At first I thought this was our dev app but this is our SDK source. Let's remove this line and the comment above it. I think log level setting should be moved to the NSE code snipit in our setup guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this line and updated the verbose message below it. Also updated the iOS setup

@emawby emawby force-pushed the fix/scene_delegate_lifecycle_handlers branch from 880ec47 to c333215 Compare August 11, 2020 18:10
@emawby emawby force-pushed the fix/scene_delegate_lifecycle_handlers branch from c333215 to 93268c1 Compare August 11, 2020 18:16
@emawby emawby force-pushed the fix/scene_delegate_lifecycle_handlers branch from 93268c1 to 87da90e Compare August 11, 2020 21:33
@emawby emawby merged commit ec15fa8 into master Aug 11, 2020
@emawby emawby deleted the fix/scene_delegate_lifecycle_handlers branch August 11, 2020 22:20
@emawby emawby mentioned this pull request Aug 13, 2020
@emawby emawby linked an issue Aug 13, 2020 that may be closed by this pull request
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.

UIScene / SwiftUI Compatibility - SceneDelegate
3 participants