diff --git a/example/pubspec.lock b/example/pubspec.lock index ede4c46..e395fc9 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -63,7 +63,7 @@ packages: path: ".." relative: true source: path - version: "3.1.0" + version: "3.1.1" crypto: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 4ffacd1..1256715 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -5,7 +5,7 @@ description: Demonstrates how to use the courier_flutter plugin. # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.0.0+11 +version: 1.0.0+12 environment: sdk: '>=2.18.1 <3.0.0' diff --git a/ios/Classes/CourierClientMethodHandler.swift b/ios/Classes/CourierClientMethodHandler.swift index 5de37a5..2b24238 100644 --- a/ios/Classes/CourierClientMethodHandler.swift +++ b/ios/Classes/CourierClientMethodHandler.swift @@ -8,7 +8,7 @@ import Foundation import Courier_iOS -internal class CourierClientMethodHandler: NSObject, FlutterPlugin { +internal class CourierClientMethodHandler: CourierFlutterMethodHandler, FlutterPlugin { static func getChannel(with registrar: FlutterPluginRegistrar) -> FlutterMethodChannel { return FlutterMethodChannel(name: CourierFlutterChannel.client.rawValue, binaryMessenger: registrar.messenger()) diff --git a/ios/Classes/CourierFlutterMethodHandler.swift b/ios/Classes/CourierFlutterMethodHandler.swift new file mode 100644 index 0000000..849d996 --- /dev/null +++ b/ios/Classes/CourierFlutterMethodHandler.swift @@ -0,0 +1,21 @@ +// +// CourierFlutterMethodHandler.swift +// courier_flutter +// +// Created by Michael Miller on 8/16/24. +// + +import Courier_iOS + +public class CourierFlutterMethodHandler: NSObject { + + override init() { + super.init() + + // Set the flutter ios user agent + // This ensures all the requests are tagged with this agent + Courier.agent = CourierAgent.flutter_ios + + } + +} diff --git a/ios/Classes/CourierPlugin.swift b/ios/Classes/CourierPlugin.swift index e6f148d..df92fab 100644 --- a/ios/Classes/CourierPlugin.swift +++ b/ios/Classes/CourierPlugin.swift @@ -4,11 +4,6 @@ import Courier_iOS public class CourierPlugin: NSObject, FlutterPlugin { - public override init() { - super.init() - Courier.agent = CourierAgent.flutter_ios - } - public static func register(with registrar: FlutterPluginRegistrar) { CourierSharedMethodHandler.register(with: registrar) CourierClientMethodHandler.register(with: registrar) diff --git a/ios/Classes/CourierSharedMethodHandler.swift b/ios/Classes/CourierSharedMethodHandler.swift index 885eb91..794c378 100644 --- a/ios/Classes/CourierSharedMethodHandler.swift +++ b/ios/Classes/CourierSharedMethodHandler.swift @@ -7,7 +7,7 @@ import Courier_iOS -internal class CourierSharedMethodHandler: NSObject, FlutterPlugin { +internal class CourierSharedMethodHandler: CourierFlutterMethodHandler, FlutterPlugin { static func getChannel(with registrar: FlutterPluginRegistrar) -> FlutterMethodChannel { return FlutterMethodChannel(name: CourierFlutterChannel.shared.rawValue, binaryMessenger: registrar.messenger()) diff --git a/pubspec.yaml b/pubspec.yaml index 5ed67eb..47e03fe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: courier_flutter description: Inbox, Push Notifications and Preferences for Flutter -version: 3.1.1 +version: 3.1.2 homepage: https://courier.com environment: