Amplitude-Flutter icon indicating copy to clipboard operation
Amplitude-Flutter copied to clipboard

Expose setOffline

Open marcotta opened this issue 2 years ago • 0 comments

Summary

Expose setOffline via the flutter plugin

Both objective-c and Kotlin counterparts offer a method 'setOffline'.

/**
     * Sets offline. If offline is true, then the SDK will not upload events to Amplitude servers;
     * however, it will still log events.
     *
     * @param offline whether or not the SDK should be offline
     * @return the AmplitudeClient
     */
    public AmplitudeClient setOffline(boolean offline) {
        this.offline = offline;

        // Try to update to the server once offline mode is disabled.
        if (!offline) {
            uploadEvents();
        }

        return this;
    } 
- (void)setOffline:(BOOL)offline {
    _offline = offline;

    if (!_offline) {
        [self uploadEvents];
    }
}

Motivations

Prevent uploading events to Amplitude server in special conditions.

marcotta avatar Nov 12 '21 17:11 marcotta