@@ -38,9 +38,15 @@ swift!(pub fn run_plugin_method(
3838 data: * const c_void,
3939 callback: PluginMessageCallback
4040) ) ;
41+ swift ! ( pub fn register_plugin(
42+ name: & SRString ,
43+ plugin: * const c_void,
44+ config: * const c_void,
45+ webview: * const c_void
46+ ) ) ;
4147swift ! ( pub fn on_webview_created( webview: * const c_void, controller: * const c_void) ) ;
4248
43- pub fn json_to_dictionary ( json : JsonValue ) -> id {
49+ pub fn json_to_dictionary ( json : & JsonValue ) -> id {
4450 if let serde_json:: Value :: Object ( map) = json {
4551 unsafe {
4652 let dictionary: id = msg_send ! [ class!( NSMutableDictionary ) , alloc] ;
@@ -78,14 +84,14 @@ impl NSString {
7884 }
7985}
8086
81- unsafe fn add_json_value_to_array ( array : id , value : JsonValue ) {
87+ unsafe fn add_json_value_to_array ( array : id , value : & JsonValue ) {
8288 match value {
8389 JsonValue :: Null => {
8490 let null: id = msg_send ! [ class!( NSNull ) , null] ;
8591 let ( ) = msg_send ! [ array, addObject: null] ;
8692 }
8793 JsonValue :: Bool ( val) => {
88- let value = if val { YES } else { NO } ;
94+ let value = if * val { YES } else { NO } ;
8995 let v: id = msg_send ! [ class!( NSNumber ) , numberWithBool: value] ;
9096 let ( ) = msg_send ! [ array, addObject: v] ;
9197 }
@@ -123,15 +129,15 @@ unsafe fn add_json_value_to_array(array: id, value: JsonValue) {
123129 }
124130}
125131
126- unsafe fn add_json_entry_to_dictionary ( data : id , key : String , value : JsonValue ) {
132+ unsafe fn add_json_entry_to_dictionary ( data : id , key : & str , value : & JsonValue ) {
127133 let key = NSString :: new ( & key) ;
128134 match value {
129135 JsonValue :: Null => {
130136 let null: id = msg_send ! [ class!( NSNull ) , null] ;
131137 let ( ) = msg_send ! [ data, setObject: null forKey: key] ;
132138 }
133139 JsonValue :: Bool ( val) => {
134- let flag = if val { YES } else { NO } ;
140+ let flag = if * val { YES } else { NO } ;
135141 let value: id = msg_send ! [ class!( NSNumber ) , numberWithBool: flag] ;
136142 let ( ) = msg_send ! [ data, setObject: value forKey: key] ;
137143 }
0 commit comments