@@ -11,7 +11,7 @@ public class SegmentPlugin: CAPPlugin {
1111 private let implementation = Segment ( )
1212
1313 @objc func initialize( _ call: CAPPluginCall ) {
14- if ( initialized == true ) {
14+ if initialized == true {
1515 call. resolve ( )
1616 return
1717 }
@@ -24,58 +24,58 @@ public class SegmentPlugin: CAPPlugin {
2424 initialized = true
2525 call. resolve ( )
2626 }
27-
27+
2828 @objc func identify( _ call: CAPPluginCall ) {
29- if ( initialized != true ) {
29+ if initialized != true {
3030 call. reject ( " Segment is not initialized " )
3131 return
3232 }
3333 guard let userId = call. getString ( " userId " ) else {
3434 call. reject ( " User ID is required for 'identify' but not supplied " )
3535 return
3636 }
37-
37+
3838 let traits : Dictionary = call. getObject ( " traits " ) ?? [ : ]
3939 implementation. identify ( userId: userId, traits: traits)
4040 call. resolve ( )
4141 }
42-
42+
4343 @objc func track( _ call: CAPPluginCall ) {
44- if ( initialized != true ) {
44+ if initialized != true {
4545 call. reject ( " Segment is not initialized " )
4646 return
4747 }
4848 guard let eventName = call. getString ( " eventName " ) else {
4949 call. reject ( " Event name is not supplied " )
5050 return
5151 }
52-
52+
5353 let properties : Dictionary = call. getObject ( " properties " ) ?? [ : ]
5454 let options : Dictionary = call. getObject ( " options " ) ?? [ : ]
5555 implementation. track ( eventName: eventName, properties: properties, options: options)
5656 call. resolve ( )
5757 }
5858
5959 @objc func page( _ call: CAPPluginCall ) {
60- if ( initialized != true ) {
60+ if initialized != true {
6161 call. reject ( " Segment is not initialized " )
6262 return
6363 }
6464 guard let pathname = call. getString ( " pathname " ) else {
6565 call. reject ( " Pathname was not supplied " )
6666 return
6767 }
68-
68+
6969 implementation. page ( pathname: pathname)
7070 call. resolve ( )
7171 }
72-
72+
7373 @objc func reset( _ call: CAPPluginCall ) {
74- if ( initialized != true ) {
74+ if initialized != true {
7575 call. reject ( " Segment is not initialized " )
7676 return
7777 }
78-
78+
7979 implementation. reset ( )
8080 call. resolve ( )
8181 }
0 commit comments