Skip to content

Commit a70e450

Browse files
committed
Bump
1 parent 2484ff2 commit a70e450

File tree

11 files changed

+86
-18
lines changed

11 files changed

+86
-18
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ android {
5050
}
5151

5252
dependencies {
53-
api 'com.github.trycourier:courier-android:2.3.3'
53+
api 'com.github.trycourier:courier-android:2.5.0'
5454
api 'com.google.firebase:firebase-messaging-ktx:23.1.0'
5555
}

android/src/main/kotlin/com/courier/courier_flutter/CourierFlutterPlugin.kt

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,29 +151,63 @@ internal class CourierFlutterPlugin : FlutterPlugin, MethodCallHandler {
151151

152152
}
153153

154-
"readMessage" -> {
154+
"clickMessage" -> {
155155

156156
val id = params?.get("id") as? String
157157

158158
id?.let {
159159

160-
Courier.shared.readMessage(it)
160+
Courier.shared.clickMessage(
161+
it,
162+
onSuccess = {
163+
result.success(null)
164+
},
165+
onFailure = { error ->
166+
result.error(COURIER_ERROR_TAG, error.message, error)
167+
}
168+
)
161169

162170
result.success(null)
163171

164172
}
165173

166174
}
167175

168-
"unreadMessage" -> {
176+
"readMessage" -> {
169177

170178
val id = params?.get("id") as? String
171179

172180
id?.let {
173181

174-
Courier.shared.unreadMessage(it)
182+
Courier.shared.readMessage(
183+
it,
184+
onSuccess = {
185+
result.success(null)
186+
},
187+
onFailure = { error ->
188+
result.error(COURIER_ERROR_TAG, error.message, error)
189+
}
190+
)
175191

176-
result.success(null)
192+
}
193+
194+
}
195+
196+
"unreadMessage" -> {
197+
198+
val id = params?.get("id") as? String
199+
200+
id?.let {
201+
202+
Courier.shared.unreadMessage(
203+
it,
204+
onSuccess = {
205+
result.success(null)
206+
},
207+
onFailure = { error ->
208+
result.error(COURIER_ERROR_TAG, error.message, error)
209+
}
210+
)
177211

178212
}
179213

example/ios/Podfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PODS:
22
- courier_flutter (0.0.1):
3-
- Courier_iOS (= 2.7.6)
3+
- Courier_iOS (= 2.9.0)
44
- Flutter
5-
- Courier_iOS (2.7.6)
5+
- Courier_iOS (2.9.0)
66
- Firebase/CoreOnly (10.16.0):
77
- FirebaseCore (= 10.16.0)
88
- Firebase/Messaging (10.16.0):
@@ -19,9 +19,9 @@ PODS:
1919
- FirebaseCoreInternal (~> 10.0)
2020
- GoogleUtilities/Environment (~> 7.8)
2121
- GoogleUtilities/Logger (~> 7.8)
22-
- FirebaseCoreInternal (10.19.0):
22+
- FirebaseCoreInternal (10.21.0):
2323
- "GoogleUtilities/NSData+zlib (~> 7.8)"
24-
- FirebaseInstallations (10.19.0):
24+
- FirebaseInstallations (10.21.0):
2525
- FirebaseCore (~> 10.0)
2626
- GoogleUtilities/Environment (~> 7.8)
2727
- GoogleUtilities/UserDefaults (~> 7.8)
@@ -106,14 +106,14 @@ EXTERNAL SOURCES:
106106
:path: ".symlinks/plugins/url_launcher_ios/ios"
107107

108108
SPEC CHECKSUMS:
109-
courier_flutter: 0b0a19f6aa3135ced4993b101500a8dcc2428a6d
110-
Courier_iOS: fadb2a4794fa53242b63d55be52c492e999ea7bd
109+
courier_flutter: dabf6f301aa188135533de8c5424c2e59f567561
110+
Courier_iOS: 9d33a68bb91157576ec963a9521139fe7ff39af6
111111
Firebase: 25899099b77d255a636e3579c3d9dce10ec150d5
112112
firebase_core: 68027ba03585e3efe1608e35d3ab2777a64eabe9
113113
firebase_messaging: e11ea61b449e6e39741b8a309ddab803ef1eb5cd
114114
FirebaseCore: 65a801af84cca84361ef9eac3fd868656968a53b
115-
FirebaseCoreInternal: b444828ea7cfd594fca83046b95db98a2be4f290
116-
FirebaseInstallations: 033d199474164db20c8350736842a94fe717b960
115+
FirebaseCoreInternal: 43c1788eaeee9d1b97caaa751af567ce11010d00
116+
FirebaseInstallations: 390ea1d10a4d02b20c965cbfd527ee9b3b412acb
117117
FirebaseMessaging: 80b4a086d20ed4fd385a702f4bfa920e14f5064d
118118
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
119119
GoogleDataTransport: 57c22343ab29bc686febbf7cbb13bad167c2d8fe

ios/Classes/SwiftCourierFlutterPlugin.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,22 @@ public class SwiftCourierFlutterPlugin: NSObject, FlutterPlugin {
112112
}
113113
)
114114

115+
case "clickMessage":
116+
117+
if let id = params?["id"] as? String {
118+
119+
Courier.shared.clickMessage(
120+
messageId: id,
121+
onSuccess: {
122+
result(nil)
123+
},
124+
onFailure: { error in
125+
result(FlutterError.init(code: SwiftCourierFlutterPlugin.COURIER_ERROR_TAG, message: String(describing: error), details: nil))
126+
}
127+
)
128+
129+
}
130+
115131
case "readMessage":
116132

117133
if let id = params?["id"] as? String {

ios/courier_flutter.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ A new Flutter plugin project.
1616
s.source = { :path => '.' }
1717
s.source_files = 'Classes/**/*'
1818
s.dependency 'Flutter'
19-
s.dependency 'Courier_iOS', '2.7.6'
19+
s.dependency 'Courier_iOS', '2.9.0'
2020
s.platform = :ios, '13.0'
2121

2222
# Flutter.framework does not contain a i386 slice.

lib/channels/core_method_channel.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@ class CoreChannelCourierFlutter extends CourierFlutterCorePlatform {
152152
return inboxMessages;
153153
}
154154

155+
@override
156+
Future clickMessage({ required String id }) async {
157+
return await coreChannel.invokeMethod('clickMessage', {
158+
'id': id,
159+
});
160+
}
161+
155162
@override
156163
Future readMessage({ required String id }) async {
157164
return await coreChannel.invokeMethod('readMessage', {

lib/channels/core_platform_interface.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ abstract class CourierFlutterCorePlatform extends PlatformInterface {
6464
throw UnimplementedError('fetchNextPageOfMessages() has not been implemented.');
6565
}
6666

67+
Future clickMessage({ required String id }) {
68+
throw UnimplementedError('clickMessage() has not been implemented.');
69+
}
70+
6771
Future readMessage({ required String id }) {
6872
throw UnimplementedError('readMessage() has not been implemented.');
6973
}

lib/courier_flutter.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ class Courier {
137137
return CourierFlutterCorePlatform.instance.fetchNextPageOfMessages();
138138
}
139139

140+
Future clickMessage({ required String id }) {
141+
return CourierFlutterCorePlatform.instance.clickMessage(id: id);
142+
}
143+
140144
Future readMessage({ required String id }) {
141145
return CourierFlutterCorePlatform.instance.readMessage(id: id);
142146
}

lib/inbox/courier_inbox.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ class CourierInboxState extends State<CourierInbox> with AutomaticKeepAliveClien
194194
return CourierInboxListItem(
195195
theme: getTheme(isDarkMode),
196196
message: message,
197-
onMessageClick: (message) => widget.onMessageClick != null ? widget.onMessageClick!(message, index) : null,
197+
onMessageClick: (message) {
198+
message.markAsClicked();
199+
widget.onMessageClick != null ? widget.onMessageClick!(message, index) : null;
200+
},
198201
onActionClick: (action) => widget.onActionClick != null ? widget.onActionClick!(action, message, index) : null,
199202
);
200203
} else {

lib/models/inbox_message.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class InboxMessage {
8787
}
8888

8989
extension InboxMessageExtensions on InboxMessage {
90+
Future markAsClicked() => Courier.shared.clickMessage(id: messageId);
9091
Future markAsRead() => Courier.shared.readMessage(id: messageId);
91-
9292
Future markAsUnread() => Courier.shared.unreadMessage(id: messageId);
9393
}

0 commit comments

Comments
 (0)