aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/macOS/AppStorePrivacyNotice.swift
blob: 15aeb8d0f480f529ac2788f16c388be4ce567075 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: MIT
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.

import Cocoa

class AppStorePrivacyNotice {
    // The App Store Review Board does not comprehend the fact that this application
    // is not a service and does not have any servers of its own. They therefore require
    // us to give a notice regarding collection of user data using our non-existent
    // servers. This demand is obviously impossible to fulfill, since it doesn't make sense,
    // but we do our best here to show something in that category.
    static func show(from sourceVC: NSViewController?, into tunnelsManager: TunnelsManager, _ callback: @escaping () -> Void) {
        if tunnelsManager.numberOfTunnels() > 0 {
            callback()
            return
        }
        let alert = NSAlert()

        alert.messageText = tr("macPrivacyNoticeMessage")
        alert.informativeText = tr("macPrivacyNoticeInfo")
        alert.alertStyle = NSAlert.Style.warning
        if let window = sourceVC?.view.window {
            alert.beginSheetModal(for: window) { _ in callback() }
        } else {
            alert.runModal()
            callback()
        }
    }
}