-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: aao notices on ios to use safari and improve watchos implementation
- Loading branch information
1 parent
ab1c46e
commit 83f5bea
Showing
13 changed files
with
289 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// WatchConnectivity.swift | ||
// nano Extension | ||
// | ||
// Created by Kavin Zhao on 2021/7/3. | ||
// | ||
|
||
import Foundation | ||
import WatchConnectivity | ||
import SwiftUI | ||
|
||
class wcDelegate: NSObject, WCSessionDelegate, ObservableObject { | ||
let session = WCSession.default; | ||
@Published var token = "" | ||
|
||
override init() { | ||
super.init() | ||
token = getFduholeToken() | ||
session.delegate = self | ||
session.activate() | ||
} | ||
|
||
|
||
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { | ||
|
||
} | ||
|
||
func sendString(text: String) -> Bool { | ||
if(session.isReachable){ | ||
DispatchQueue.main.async { | ||
self.session.sendMessage(["fduhole": text], replyHandler: nil, errorHandler: {error -> Void in | ||
print(error) | ||
}) | ||
} | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
func session(_ session: WCSession, didReceiveMessage message: [String : Any]) { | ||
DispatchQueue.main.async { | ||
self.token = message["fduhole_token"] as! String | ||
} | ||
setFduholeToken(token: message["fduhole_token"] as! String) | ||
} | ||
|
||
let defaults = UserDefaults.standard | ||
func setFduholeToken(token: String) -> Void { | ||
defaults.set(token, forKey: "fduhole_token") | ||
} | ||
|
||
func getFduholeToken() -> String { | ||
return defaults.string(forKey: "fduhole_token") ?? "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.