Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Threema/ThreemaFramework/Business/   (Social Medium ©)  Datei vom 26.9.2026 mit Größe 1 kB image not shown  

Quelle  ReachabilityWrapper.swift   Sprache: JAVA

 

import CocoaLumberjack
import Foundation
import Reachability

final class ReachabilityWrapper: NSObject {
    
    private let reachability = try! Reachability()
    private var lastConnectionType: Reachability.Connection
    
    override init() {
        do {
            try reachability.startNotifier()
            self.lastConnectionType = reachability.connection
        }
        catch {
            DDLogNotice("Reachability init failed due to error: \(error.localizedDescription)")
            self.lastConnectionType = .unavailable
        }
        
        super.init()
    }
    
    deinit {
        reachability.stopNotifier()
    }
    
    @objc func isReachabilityUnavailable() -> Bool {
        lastConnectionType == .unavailable
    }
    
    @objc func didLastConnectionTypeChange() -> Bool {
        let newConnectionType = reachability.connection
        
        switch newConnectionType {
        case .unavailable:
            DDLogNotice("Internet is not reachable")
        case .wifi:
            DDLogNotice("Internet is reachable via WiFi")
        case .cellular:
            DDLogNotice("Internet is reachable via cellular")
        }
        
        if newConnectionType != lastConnectionType {
            lastConnectionType = newConnectionType
            return true
        }
        
        return false
    }
}

Messung
CHZG
869410093

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-11-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.