[sword-svn] r3795 - in trunk/bindings/cordova/cordova-plugin-crosswire-sword: src/android src/ios www

scribe at crosswire.org scribe at crosswire.org
Thu Sep 17 08:29:24 EDT 2020


Author: scribe
Date: 2020-09-17 08:29:24 -0400 (Thu, 17 Sep 2020)
New Revision: 3795

Modified:
   trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/android/SWORD.java
   trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/ios/SWORD.swift
   trunk/bindings/cordova/cordova-plugin-crosswire-sword/www/SWORD.js
Log:
cordova plugin: added support for SWMgr::getPrefixPath()


Modified: trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/android/SWORD.java
===================================================================
--- trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/android/SWORD.java	2020-09-17 12:28:03 UTC (rev 3794)
+++ trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/android/SWORD.java	2020-09-17 12:29:24 UTC (rev 3795)
@@ -451,6 +451,10 @@
 			String translated = mgr.translate(text, locale);
 			callbackContext.success(translated);
 		}
+		else if (action.equals("SWMgr_getPrefixPath")) {
+			String prefixPath = mgr.getPrefixPath();
+			callbackContext.success(prefixPath);
+		}
 		else if (action.equals("SWMgr_setGlobalOption")) {
 			String option = args.getString(0);
 			String value = args.getString(1);

Modified: trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/ios/SWORD.swift
===================================================================
--- trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/ios/SWORD.swift	2020-09-17 12:28:03 UTC (rev 3794)
+++ trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/ios/SWORD.swift	2020-09-17 12:29:24 UTC (rev 3795)
@@ -290,7 +290,18 @@
         let retVal = translated == nil ? nil : String(cString:translated!)
         self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
     }
+    
 
+    @objc(SWMgr_getPrefixPath:)
+    func SWMgr_getPrefixPath(command: CDVInvokedUrlCommand) {
+
+        initMgr()
+
+        let prefixPath = org_crosswire_sword_SWMgr_getPrefixPath(mgr)
+        let retVal = prefixPath == nil ? nil : String(cString:prefixPath!)
+        self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+    }
+
     
     @objc(echo:)
     func echo(command: CDVInvokedUrlCommand) {

Modified: trunk/bindings/cordova/cordova-plugin-crosswire-sword/www/SWORD.js
===================================================================
--- trunk/bindings/cordova/cordova-plugin-crosswire-sword/www/SWORD.js	2020-09-17 12:28:03 UTC (rev 3794)
+++ trunk/bindings/cordova/cordova-plugin-crosswire-sword/www/SWORD.js	2020-09-17 12:29:24 UTC (rev 3795)
@@ -413,6 +413,13 @@
 	);
 }
 
+SWMgr.prototype.getPrefixPath = function(callback) {
+	exec(callback?callback:function() {},
+		function(err) { utils.alert('[ERROR] problem: ' + err); },
+		"SWORD", "SWMgr_getPrefixPath", []
+	);
+}
+
 function HTTPUtils() {}
 
 HTTPUtils.prototype.METHOD_GET  =  0;
@@ -431,7 +438,6 @@
 
 
 /*
-	public native String      getPrefixPath();
 	public native String      getConfigPath();
 	public native String      getGlobalOption(String option);
 	public native String      getGlobalOptionTip(String option);



More information about the sword-cvs mailing list