File tree Expand file tree Collapse file tree 6 files changed +22
-26
lines changed
src/main/kotlin/io/customer/customer_io Expand file tree Collapse file tree 6 files changed +22
-26
lines changed Original file line number Diff line number Diff line change
1
+ distributionBase =GRADLE_USER_HOME
2
+ distributionPath =wrapper/dists
3
+ distributionUrl =https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4
+ zipStoreBase =GRADLE_USER_HOME
5
+ zipStorePath =wrapper/dists
Original file line number Diff line number Diff line change 1
1
package io.customer.customer_io
2
2
3
3
import io.flutter.embedding.engine.plugins.FlutterPlugin
4
+ import io.flutter.plugin.common.MethodChannel
4
5
5
6
/* *
6
7
* Module class corresponds to modules concept in native SDKs. Any module added to native SDKs
7
8
* should be treated as module in Flutter SDK and should be used to hold all relevant methods at
8
9
* single place.
9
10
*/
10
- internal interface CustomerIOPluginModule {
11
+ internal interface CustomerIOPluginModule : MethodChannel . MethodCallHandler {
11
12
/* *
12
13
* Unique name of module to identify between other modules
13
14
*/
14
15
val moduleName: String
15
16
17
+ /* *
18
+ * Flutter communication channel to communicate with Native SDK
19
+ */
20
+ val flutterCommunicationChannel: MethodChannel
21
+
16
22
/* *
17
23
* Called whenever root FlutterPlugin has been associated with a FlutterEngine instance.
18
24
*
19
25
* @see [FlutterPlugin.onAttachedToEngine] for more details
20
26
*/
21
- fun onAttachedToEngine ()
27
+ fun onAttachedToEngine () {
28
+ flutterCommunicationChannel.setMethodCallHandler(this )
29
+ }
22
30
23
31
/* *
24
32
* Called whenever root FlutterPlugin has been removed from a FlutterEngine instance.
25
33
*
26
34
* @see [FlutterPlugin.onDetachedFromEngine] for more details
27
35
*/
28
- fun onDetachedFromEngine ()
36
+ fun onDetachedFromEngine () {
37
+ flutterCommunicationChannel.setMethodCallHandler(null )
38
+ }
29
39
}
Original file line number Diff line number Diff line change @@ -17,17 +17,9 @@ internal class CustomerIOInAppMessaging(
17
17
pluginBinding : FlutterPlugin .FlutterPluginBinding ,
18
18
) : CustomerIOPluginModule, MethodChannel.MethodCallHandler {
19
19
override val moduleName: String = " InAppMessaging"
20
- private val flutterCommunicationChannel: MethodChannel =
20
+ override val flutterCommunicationChannel: MethodChannel =
21
21
MethodChannel (pluginBinding.binaryMessenger, " customer_io_messaging_in_app" )
22
22
23
- override fun onAttachedToEngine () {
24
- flutterCommunicationChannel.setMethodCallHandler(this )
25
- }
26
-
27
- override fun onDetachedFromEngine () {
28
- flutterCommunicationChannel.setMethodCallHandler(null )
29
- }
30
-
31
23
override fun onMethodCall (call : MethodCall , result : MethodChannel .Result ) {
32
24
when (call.method) {
33
25
Keys .Methods .DISMISS_MESSAGE -> {
Original file line number Diff line number Diff line change @@ -23,19 +23,11 @@ internal class CustomerIOPushMessaging(
23
23
) : CustomerIOPluginModule, MethodChannel.MethodCallHandler {
24
24
override val moduleName: String = " PushMessaging"
25
25
private val applicationContext: Context = pluginBinding.applicationContext
26
- private val flutterCommunicationChannel: MethodChannel =
26
+ override val flutterCommunicationChannel: MethodChannel =
27
27
MethodChannel (pluginBinding.binaryMessenger, " customer_io_messaging_push" )
28
28
private val logger: Logger
29
29
get() = CustomerIOShared .instance().diStaticGraph.logger
30
30
31
- override fun onAttachedToEngine () {
32
- flutterCommunicationChannel.setMethodCallHandler(this )
33
- }
34
-
35
- override fun onDetachedFromEngine () {
36
- flutterCommunicationChannel.setMethodCallHandler(null )
37
- }
38
-
39
31
override fun onMethodCall (call : MethodCall , result : MethodChannel .Result ) {
40
32
when (call.method) {
41
33
Keys .Methods .ON_MESSAGE_RECEIVED -> {
Original file line number Diff line number Diff line change @@ -6,16 +6,14 @@ import 'package:customer_io/customer_io_enums.dart';
6
6
import 'package:customer_io/customer_io_inapp.dart' ;
7
7
import 'package:flutter/foundation.dart' ;
8
8
import 'package:flutter/material.dart' ;
9
- import 'package:flutter_dotenv/flutter_dotenv.dart' ;
10
9
11
10
void main () async {
12
11
WidgetsFlutterBinding .ensureInitialized ();
13
12
14
- await dotenv.load (fileName: "credentials.env" );
15
13
await CustomerIO .initialize (
16
14
config: CustomerIOConfig (
17
- siteId: dotenv. get ( 'siteId' , fallback : 'YOUR_SITE_ID' ) ,
18
- apiKey: dotenv. get ( 'apiKey' , fallback : 'YOUR_API_KEY' ) ,
15
+ siteId: "SITE_ID" ,
16
+ apiKey: "API_KEY" ,
19
17
logLevel: CioLogLevel .debug,
20
18
enableInApp: true ,
21
19
autoTrackDeviceAttributes: true ,
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ environment:
17
17
dependencies :
18
18
flutter :
19
19
sdk : flutter
20
- flutter_dotenv : ^5.0.2
21
20
22
21
customer_io :
23
22
# When depending on this package from a real application you should use:
You can’t perform that action at this time.
0 commit comments