File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Original file line number Diff line number Diff line change 1
1
// ignore_for_file: avoid_classes_with_only_static_members
2
2
3
3
import 'dart:async' ;
4
- import 'dart:io' show Platform;
5
4
6
5
import 'package:flutter/services.dart' ;
6
+ import 'package:instabug_flutter/utils/platform_manager.dart' ;
7
7
8
8
class Replies {
9
9
static Function ? _hasChatsCallback;
@@ -78,7 +78,7 @@ class Replies {
78
78
/// [isEnabled] A boolean to set whether notifications sound should be played.
79
79
/// @android ONLY
80
80
static Future <void > setInAppNotificationSound (bool isEnabled) async {
81
- if (Platform . isAndroid) {
81
+ if (PlatformManager .instance. isAndroid () ) {
82
82
final List <dynamic > params = < dynamic > [isEnabled];
83
83
await _channel.invokeMethod <Object >(
84
84
'setEnableInAppNotificationSound:' , params);
Original file line number Diff line number Diff line change @@ -770,6 +770,21 @@ void main() {
770
770
]);
771
771
});
772
772
773
+ test ('setInAppNotificationSound: Test' , () async {
774
+ const isEnabled = false ;
775
+ final List <dynamic > args = < dynamic > [isEnabled];
776
+
777
+ when (mockPlatform.isAndroid ()).thenAnswer ((_) => true );
778
+
779
+ Replies .setInAppNotificationSound (isEnabled);
780
+ expect (log, < Matcher > [
781
+ isMethodCall (
782
+ 'setEnableInAppNotificationSound:' ,
783
+ arguments: args,
784
+ )
785
+ ]);
786
+ });
787
+
773
788
test ('showReplies Test' , () async {
774
789
Replies .show ();
775
790
expect (log, < Matcher > [isMethodCall ('showReplies' , arguments: null )]);
@@ -844,17 +859,4 @@ void main() {
844
859
]);
845
860
}
846
861
});
847
-
848
- ///Since the below method only runs on android and has the [Platform.isAndroid] condition in it, it will fail when running outside android,
849
- /// therefore its commented.
850
- // test('setEnableInAppNotificationSound: Test', () async {
851
- // bool isEnabled = false;
852
- // final List<dynamic> args = <dynamic>[isEnabled];
853
- // Replies.setInAppNotificationSound(isEnabled);
854
- // expect(log, <Matcher>[
855
- // isMethodCall('setEnableInAppNotificationSound:',
856
- // arguments: args,
857
- // )
858
- // ]);
859
- // });
860
862
}
You can’t perform that action at this time.
0 commit comments