Skip to content

Commit 7281df6

Browse files
authored
Merge pull request #176 from OneSignal/release_2.2.1
Updated for release for 2.3.0
2 parents 380d728 + f00cccd commit 7281df6

File tree

6 files changed

+33
-24
lines changed

6 files changed

+33
-24
lines changed

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group 'com.onesignal.flutter'
2-
version '2.2.0'
2+
version '2.3.0'
33

44
buildscript {
55
repositories {
@@ -34,7 +34,7 @@ android {
3434
}
3535

3636
dependencies {
37-
api 'com.onesignal:OneSignal:3.12.2'
37+
api 'com.onesignal:OneSignal:3.12.3'
3838
}
3939

4040
// Adds required manifestPlaceholders keys to allow mainifest merge gradle step to complete

example/lib/main.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,22 +275,19 @@ class _MyAppState extends State<MyApp> {
275275
// Send a normal outcome and get a reply with the name of the outcome
276276
OneSignal.shared.sendOutcome("normal_1");
277277
OneSignal.shared.sendOutcome("normal_2").then((outcomeEvent) {
278-
var json = outcomeEvent.jsonRepresentation();
279-
print("Successfully sent outcome event: $json");
278+
print(outcomeEvent.jsonRepresentation());
280279
});
281280

282281
// Send a unique outcome and get a reply with the name of the outcome
283282
OneSignal.shared.sendUniqueOutcome("unique_1");
284283
OneSignal.shared.sendUniqueOutcome("unique_2").then((outcomeEvent) {
285-
var json = outcomeEvent.jsonRepresentation();
286-
print("Successfully sent unique outcome event: $json");
284+
print(outcomeEvent.jsonRepresentation());
287285
});
288286

289287
// Send an outcome with a value and get a reply with the name of the outcome
290288
OneSignal.shared.sendOutcomeWithValue("value_1", 3.2);
291289
OneSignal.shared.sendOutcomeWithValue("value_2", 3.9).then((outcomeEvent) {
292-
var json = outcomeEvent.jsonRepresentation();
293-
print("Successfully sent outcome event with value: $json");
290+
print(outcomeEvent.jsonRepresentation());
294291
});
295292
}
296293

ios/Classes/OneSignalPlugin.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
*/
2727

2828
#import "OneSignalPlugin.h"
29-
#import "OneSignalCategories.h"
30-
#import "OneSignalTagsController.h"
31-
#import "OneSignalInAppMessagesController.h"
32-
#import "OneSignalOutcomeEventsController.h"
29+
#import "OSFlutterCategories.h"
30+
#import "OSFlutterTagsController.h"
31+
#import "OSFlutterInAppMessagesController.h"
32+
#import "OSFlutterOutcomeEventsController.h"
3333

3434
@interface OneSignalPlugin ()
3535

@@ -94,9 +94,9 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
9494

9595
[registrar addMethodCallDelegate:OneSignalPlugin.sharedInstance channel:OneSignalPlugin.sharedInstance.channel];
9696

97-
[OneSignalTagsController registerWithRegistrar:registrar];
98-
[OneSignalInAppMessagesController registerWithRegistrar:registrar];
99-
[OneSignalOutcomeEventsController registerWithRegistrar:registrar];
97+
[OSFlutterTagsController registerWithRegistrar:registrar];
98+
[OSFlutterInAppMessagesController registerWithRegistrar:registrar];
99+
[OSFlutterOutcomeEventsController registerWithRegistrar:registrar];
100100
}
101101

102102
- (void)addObservers {

ios/onesignal_flutter.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
Pod::Spec.new do |s|
55
s.name = 'onesignal_flutter'
6-
s.version = '2.2.0'
6+
s.version = '2.3.0'
77
s.summary = 'The OneSignal Flutter SDK'
88
s.description = 'Allows you to easily add OneSignal to your flutter projects, to make sending and handling push notifications easy'
99
s.homepage = 'https://www.onesignal.com'
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
1313
s.source_files = 'Classes/**/*'
1414
s.public_header_files = 'Classes/**/*.h'
1515
s.dependency 'Flutter'
16-
s.dependency 'OneSignal', '2.11.2'
16+
s.dependency 'OneSignal', '2.12.1'
1717
s.ios.deployment_target = '8.0'
1818
s.static_framework = true
1919
end

lib/onesignal_flutter.dart

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,22 +321,34 @@ class OneSignal {
321321
/// Send a normal outcome event for the current session and notifications with the attribution window
322322
/// Counted each time sent successfully, failed ones will be cached and reattempted in future
323323
Future<OSOutcomeEvent> sendOutcome(String name) async {
324-
Map<dynamic, dynamic> json = await _outcomesChannel.invokeMethod("OneSignal#sendOutcome", name);
325-
return new OSOutcomeEvent(json.cast<String, dynamic>());
324+
var json = await _outcomesChannel.invokeMethod("OneSignal#sendOutcome", name);
325+
326+
if (json == null)
327+
return new OSOutcomeEvent();
328+
329+
return new OSOutcomeEvent.fromMap(json.cast<String, dynamic>());
326330
}
327331

328332
/// Send a unique outcome event for the current session and notifications with the attribution window
329333
/// Counted once per notification when sent successfully, failed ones will be cached and reattempted in future
330334
Future<OSOutcomeEvent> sendUniqueOutcome(String name) async {
331-
Map<dynamic, dynamic> json = await _outcomesChannel.invokeMethod("OneSignal#sendUniqueOutcome", name);
332-
return new OSOutcomeEvent(json.cast<String, dynamic>());
335+
var json = await _outcomesChannel.invokeMethod("OneSignal#sendUniqueOutcome", name);
336+
337+
if (json == null)
338+
return new OSOutcomeEvent();
339+
340+
return new OSOutcomeEvent.fromMap(json.cast<String, dynamic>());
333341
}
334342

335343
/// Send an outcome event with a value for the current session and notifications with the attribution window
336344
/// Counted each time sent successfully, failed ones will be cached and reattempted in future
337345
Future<OSOutcomeEvent> sendOutcomeWithValue(String name, double value) async {
338-
Map<dynamic, dynamic> json = await _outcomesChannel.invokeMethod("OneSignal#sendOutcomeWithValue", {"outcome_name" : name, "outcome_value" : value});
339-
return new OSOutcomeEvent(json.cast<String, dynamic>());
346+
var json = await _outcomesChannel.invokeMethod("OneSignal#sendOutcomeWithValue", {"outcome_name" : name, "outcome_value" : value});
347+
348+
if (json == null)
349+
return new OSOutcomeEvent();
350+
351+
return new OSOutcomeEvent.fromMap(json.cast<String, dynamic>());
340352
}
341353

342354
// Private function that gets called by ObjC/Java

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: onesignal_flutter
22
description: OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
3-
version: 2.2.0
3+
version: 2.3.0
44
author: Brad Hesse <brad@onesignal.com>, Josh Kasten <josh@onesignal.com>
55
homepage: https://github.com/OneSignal/OneSignal-Flutter-SDK
66

0 commit comments

Comments
 (0)