瀏覽代碼

change naming

master
munir ishak 5 年之前
父節點
當前提交
d0ee32309e
共有 8 個檔案被更改,包括 41 行新增41 行删除
  1. 4
    4
      README.md
  2. 1
    1
      package.json
  3. 14
    14
      plugin.xml
  4. 6
    6
      src/android/Base64SaveImage.java
  5. 3
    3
      src/ios/Base64SaveImage.h
  6. 5
    5
      src/ios/Base64SaveImage.m
  7. 2
    2
      src/wp8/Base64SaveImage.cs
  8. 6
    6
      www/Base64SaveImage.js

+ 4
- 4
README.md 查看文件

@@ -1,21 +1,21 @@
1
-Base64ImageSaverPlugin
1
+Base64SaveImage
2 2
 ============
3 3
 
4 4
 This plugin(based on devgeeks/Canvas2ImagePlugin) allows you to save BASE64 data to the iOS Photo Library, Android Gallery or WindowsPhone 8 Photo Album from your app.
5 5
 
6
-This plugin fork from solderzzc/Base64ImageSaverPlugin
6
+This plugin fork from solderzzc/Base64SaveImage
7 7
 
8 8
 Usage:
9 9
 ------
10 10
 
11
-Call the `window.Base64ImageSaverPlugin.saveImageDataToLibrary()` method using success and error callbacks and the id attribute or the element object of the canvas to save:
11
+Call the `window.Base64SaveImage.saveImageDataToLibrary()` method using success and error callbacks and the id attribute or the element object of the canvas to save:
12 12
 
13 13
 ### Example
14 14
 
15 15
 ```javascript
16 16
 function onDeviceReady()
17 17
 {
18
-	window.Base64ImageSaverPlugin.saveImageDataToLibrary(
18
+	window.Base64SaveImage.saveImageDataToLibrary(
19 19
         function(msg){
20 20
             console.log(msg);
21 21
         },

+ 1
- 1
package.json 查看文件

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "cordova-mirtech-plugin-base64saveimage",
3
-  "version": "0.0.2",
3
+  "version": "0.0.5",
4 4
   "description": "This plugin allows you to save the contents of an HTML canvas tag to the iOS Photo Library, or Android Gallery from your app.",
5 5
   "cordova": {
6 6
     "id": "com.mirfalahtech.base64saveimage",

+ 14
- 14
plugin.xml 查看文件

@@ -1,7 +1,7 @@
1 1
 <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
2 2
     xmlns:android="http://schemas.android.com/apk/res/android"
3 3
     id="com.mirfalahtech.base64saveimage"
4
-    version="0.0.1">
4
+    version="0.0.5">
5 5
 
6 6
     <name>base64saveimage</name>
7 7
 
@@ -15,22 +15,22 @@
15 15
 
16 16
     <license></license>
17 17
 
18
-    <js-module src="www/Base64ImageSaverPlugin.js" name="Base64ImageSaverPlugin">
19
-        <clobbers target="window.Base64ImageSaverPlugin" />
18
+    <js-module src="www/Base64SaveImage.js" name="Base64SaveImage">
19
+        <clobbers target="window.Base64SaveImage" />
20 20
     </js-module>
21 21
 
22 22
     <!-- ios -->
23 23
     <platform name="ios">
24 24
         <config-file target="config.xml" parent="/*">
25
-            <feature name="Base64ImageSaverPlugin">
26
-                <param name="ios-package" value="Base64ImageSaverPlugin"/>
25
+            <feature name="Base64SaveImage">
26
+                <param name="ios-package" value="Base64SaveImage"/>
27 27
                 <param name="onload" value="true" />
28 28
             </feature>
29 29
         </config-file>
30 30
 
31
-        <header-file src="src/ios/Base64ImageSaverPlugin.h" />
31
+        <header-file src="src/ios/Base64SaveImage.h" />
32 32
 
33
-        <source-file src="src/ios/Base64ImageSaverPlugin.m"
33
+        <source-file src="src/ios/Base64SaveImage.m"
34 34
             compiler-flags="-fno-objc-arc" />
35 35
     </platform>
36 36
 
@@ -42,21 +42,21 @@
42 42
         </config-file>
43 43
 
44 44
         <config-file target="res/xml/config.xml" parent="/*">
45
-          <feature name="Base64ImageSaverPlugin" >
46
-            <param name="android-package" value="org.solderzzc.Base64ImageSaverPlugin.Base64ImageSaverPlugin"/>
45
+          <feature name="Base64SaveImage" >
46
+            <param name="android-package" value="org.solderzzc.Base64SaveImage.Base64SaveImage"/>
47 47
           </feature>
48 48
         </config-file>
49 49
 
50
-        <source-file src="src/android/Base64ImageSaverPlugin.java" 
51
-            target-dir="src/org/solderzzc/Base64ImageSaverPlugin" />
50
+        <source-file src="src/android/Base64SaveImage.java" 
51
+            target-dir="src/org/solderzzc/Base64SaveImage" />
52 52
 
53 53
     </platform>
54 54
 
55 55
     <!-- wp8 -->
56 56
     <platform name="wp8">
57 57
         <config-file target="config.xml" parent="/*">
58
-            <feature name="Base64ImageSaverPlugin">
59
-                <param name="wp-package" value="Base64ImageSaverPlugin"/>
58
+            <feature name="Base64SaveImage">
59
+                <param name="wp-package" value="Base64SaveImage"/>
60 60
                 <param name="onload" value="true" />
61 61
             </feature>
62 62
         </config-file>
@@ -65,6 +65,6 @@
65 65
             <Capability Name="ID_CAP_MEDIALIB_PHOTO" />
66 66
         </config-file>
67 67
 
68
-        <source-file src="src/wp8/Base64ImageSaverPlugin.cs" />
68
+        <source-file src="src/wp8/Base64SaveImage.cs" />
69 69
     </platform>
70 70
 </plugin>

src/android/Base64ImageSaverPlugin.java → src/android/Base64SaveImage.java 查看文件

@@ -1,4 +1,4 @@
1
-package org.solderzzc.Base64ImageSaverPlugin;
1
+package org.solderzzc.Base64SaveImage;
2 2
 
3 3
 import java.io.File;
4 4
 import java.io.FileOutputStream;
@@ -20,15 +20,15 @@ import android.util.Base64;
20 20
 import android.util.Log;
21 21
 
22 22
 /**
23
- * Base64ImageSaverPlugin.java
23
+ * Base64SaveImage.java
24 24
  *
25
- * Android implementation of the Base64ImageSaverPlugin for iOS.
25
+ * Android implementation of the Base64SaveImage for iOS.
26 26
  * Inspirated by Joseph's "Save HTML5 Canvas Image to Gallery" plugin
27 27
  * http://jbkflex.wordpress.com/2013/06/19/save-html5-canvas-image-to-gallery-phonegap-android-plugin/
28 28
  *
29 29
  * @author Vegard Løkken <vegard@headspin.no>
30 30
  */
31
-public class Base64ImageSaverPlugin extends CordovaPlugin {
31
+public class Base64SaveImage extends CordovaPlugin {
32 32
 	public static final String ACTION = "saveImageDataToLibrary";
33 33
 
34 34
 	@Override
@@ -79,7 +79,7 @@ public class Base64ImageSaverPlugin extends CordovaPlugin {
79 79
 					+ c.get(Calendar.SECOND);
80 80
 
81 81
 			String deviceVersion = Build.VERSION.RELEASE;
82
-			Log.i("Base64ImageSaverPlugin", "Android version " + deviceVersion);
82
+			Log.i("Base64SaveImage", "Android version " + deviceVersion);
83 83
 			int check = deviceVersion.compareTo("2.3.3");
84 84
 
85 85
 			File folder;
@@ -108,7 +108,7 @@ public class Base64ImageSaverPlugin extends CordovaPlugin {
108 108
 
109 109
 			retVal = imageFile;
110 110
 		} catch (Exception e) {
111
-			Log.e("Base64ImageSaverPlugin", "An exception occured while saving image: "
111
+			Log.e("Base64SaveImage", "An exception occured while saving image: "
112 112
 					+ e.toString());
113 113
 		}
114 114
 		return retVal;

src/ios/Base64ImageSaverPlugin.h → src/ios/Base64SaveImage.h 查看文件

@@ -1,6 +1,6 @@
1 1
 //
2
-//  Base64ImageSaverPlugin.h
3
-//  Base64ImageSaverPlugin PhoneGap/Cordova plugin
2
+//  Base64SaveImage.h
3
+//  Base64SaveImage PhoneGap/Cordova plugin
4 4
 //
5 5
 //  Created by Tommy-Carlos Williams on 29/03/12.
6 6
 //  Copyright (c) 2012 Tommy-Carlos Williams. All rights reserved.
@@ -10,7 +10,7 @@
10 10
 
11 11
 #import <Cordova/CDVPlugin.h>
12 12
 
13
-@interface Base64ImageSaverPlugin : CDVPlugin
13
+@interface Base64SaveImage : CDVPlugin
14 14
 {
15 15
 	NSString* callbackId;
16 16
 }

src/ios/Base64ImageSaverPlugin.m → src/ios/Base64SaveImage.m 查看文件

@@ -1,21 +1,21 @@
1 1
 //
2
-//  Base64ImageSaverPlugin.m
3
-//  Base64ImageSaverPlugin PhoneGap/Cordova plugin
2
+//  Base64SaveImage.m
3
+//  Base64SaveImage PhoneGap/Cordova plugin
4 4
 //
5 5
 //  Created by Tommy-Carlos Williams on 29/03/12.
6 6
 //  Copyright (c) 2012 Tommy-Carlos Williams. All rights reserved.
7 7
 //  MIT Licensed
8 8
 //
9 9
 
10
-#import "Base64ImageSaverPlugin.h"
10
+#import "Base64SaveImage.h"
11 11
 #import <Cordova/CDV.h>
12 12
 
13
-@implementation Base64ImageSaverPlugin
13
+@implementation Base64SaveImage
14 14
 @synthesize callbackId;
15 15
 
16 16
 //-(CDVPlugin*) initWithWebView:(UIWebView*)theWebView
17 17
 //{
18
-//    self = (Base64ImageSaverPlugin*)[super initWithWebView:theWebView];
18
+//    self = (Base64SaveImage*)[super initWithWebView:theWebView];
19 19
 //    return self;
20 20
 //}
21 21
 

src/wp8/Base64ImageSaverPlugin.cs → src/wp8/Base64SaveImage.cs 查看文件

@@ -6,9 +6,9 @@ using WPCordovaClassLib.Cordova;
6 6
 using WPCordovaClassLib.Cordova.Commands;
7 7
 using WPCordovaClassLib.Cordova.JSON;
8 8
 
9
-public class Base64ImageSaverPlugin : BaseCommand
9
+public class Base64SaveImage : BaseCommand
10 10
 {
11
-    public Base64ImageSaverPlugin()
11
+    public Base64SaveImage()
12 12
 	{
13 13
 	}
14 14
 

www/Base64ImageSaverPlugin.js → www/Base64SaveImage.js 查看文件

@@ -1,6 +1,6 @@
1 1
 //
2
-//  Base64ImageSaverPlugin.js
3
-//  Base64ImageSaverPlugin PhoneGap/Cordova plugin
2
+//  Base64SaveImage.js
3
+//  Base64SaveImage PhoneGap/Cordova plugin
4 4
 //
5 5
 //  Created by Tommy-Carlos Williams on 29/03/12.
6 6
 //  Modified by Simba Zhang on 09/10/2015
@@ -13,17 +13,17 @@
13 13
     saveImageDataToLibrary:function(successCallback, failureCallback, base64Data) {
14 14
         // successCallback required
15 15
         if (typeof successCallback != "function") {
16
-            console.log("Base64ImageSaverPlugin Error: successCallback is not a function");
16
+            console.log("Base64SaveImage Error: successCallback is not a function");
17 17
         }
18 18
         else if (typeof failureCallback != "function") {
19
-            console.log("Base64ImageSaverPlugin Error: failureCallback is not a function");
19
+            console.log("Base64SaveImage Error: failureCallback is not a function");
20 20
         }
21 21
         else if (typeof base64Data != "string") {
22
-            console.log("Base64ImageSaverPlugin Error: base64Data is not a string");
22
+            console.log("Base64SaveImage Error: base64Data is not a string");
23 23
         }
24 24
         else {
25 25
             var imageData = base64Data.replace(/data:image\/png;base64,/,'');
26
-            return cordova.exec(successCallback, failureCallback, "Base64ImageSaverPlugin","saveImageDataToLibrary",[imageData]);
26
+            return cordova.exec(successCallback, failureCallback, "Base64SaveImage","saveImageDataToLibrary",[imageData]);
27 27
         }
28 28
     }
29 29
   };

Loading…
取消
儲存