Skip to content

Commit

Permalink
feat: transfor android and ios with necessary base
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Oct 24, 2021
1 parent 7f70a1c commit 1080808
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

public class CapacitorUpdater {

public String echo(String value) {
Log.i("Echo", value);
return value;
public String updateApp(String url) {
Log.i("updateApp", url);
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public class CapacitorUpdaterPlugin extends Plugin {

@PluginMethod
public void echo(PluginCall call) {
String value = call.getString("value");
String url = call.getString("url");

JSObject ret = new JSObject();
ret.put("value", implementation.echo(value));
ret.put("done", implementation.updateApp(url));
call.resolve(ret);
}
}
6 changes: 3 additions & 3 deletions ios/Plugin/CapacitorUpdater.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Foundation

@objc public class CapacitorUpdater: NSObject {
@objc public func echo(_ value: String) -> String {
print(value)
return value
@objc public func updateApp(_ url: String) -> String {
print(url)
return false
}
}
2 changes: 1 addition & 1 deletion ios/Plugin/CapacitorUpdaterPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
// Define the plugin using the CAP_PLUGIN Macro, and
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
CAP_PLUGIN(CapacitorUpdaterPlugin, "CapacitorUpdater",
CAP_PLUGIN_METHOD(echo, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(updateApp, CAPPluginReturnPromise);
)
6 changes: 3 additions & 3 deletions ios/Plugin/CapacitorUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import Capacitor
public class CapacitorUpdaterPlugin: CAPPlugin {
private let implementation = CapacitorUpdater()

@objc func echo(_ call: CAPPluginCall) {
let value = call.getString("value") ?? ""
@objc func updateApp(_ call: CAPPluginCall) {
let url = call.getString("url") ?? ""
call.resolve([
"value": implementation.echo(value)
"done": implementation.updateApp(url)
])
}
}
1 change: 1 addition & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ end

target 'Plugin' do
capacitor_pods
pod 'SSZipArchive'
end

target 'PluginTests' do
Expand Down

0 comments on commit 1080808

Please sign in to comment.