Skip to content

Add a completion handler to TelemetryManager.send() #127

@mjalq

Description

@mjalq

A simple escaping completion handler would suffice.

This would be useful if I want the app to send one signal per day at most, while making sure that the signal was received by the server before blocking further attempts.

`

    if lastSignalSentDate != today {
        TelemetryManager.send("appUsed")
        //If the above line fails due to poor internet or an offline launch of the app, we have no way of knowing.
        lastSignalSentDate = today
        
    }

`

Purposed solution

`

    if lastSignalSentDate != today {
        TelemetryManager.send("appUsed") { didFail in
            
            if !didFail {
                lastSignalSentDate = today

            }
        }
        
    }

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions