-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fetch registered device token (#171)
- Loading branch information
Showing
10 changed files
with
86 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import CioDataPipelines | ||
import Flutter | ||
import Foundation | ||
|
||
public class CustomerIOMessagingPush: NSObject, FlutterPlugin { | ||
private let channelName: String = "customer_io_messaging_push" | ||
|
||
public static func register(with registrar: FlutterPluginRegistrar) { | ||
} | ||
|
||
private var methodChannel: FlutterMethodChannel? | ||
|
||
init(with registrar: FlutterPluginRegistrar) { | ||
super.init() | ||
|
||
methodChannel = FlutterMethodChannel( | ||
name: channelName, binaryMessenger: registrar.messenger()) | ||
guard let methodChannel = methodChannel else { | ||
print("\(channelName) methodChannel is nil") | ||
return | ||
} | ||
|
||
registrar.addMethodCallDelegate(self, channel: methodChannel) | ||
} | ||
|
||
deinit { | ||
detachFromEngine() | ||
} | ||
|
||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { | ||
// Handle method calls for this method channel | ||
switch call.method { | ||
case Keys.Methods.getRegisteredDeviceToken: | ||
result(CustomerIO.shared.registeredDeviceToken) | ||
|
||
default: | ||
result(FlutterMethodNotImplemented) | ||
} | ||
} | ||
|
||
func detachFromEngine() { | ||
methodChannel?.setMethodCallHandler(nil) | ||
methodChannel = nil | ||
} | ||
} |
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