Skip to content

Commit

Permalink
fix: allowModifyUrl issue
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Mar 26, 2024
1 parent 60c9ab9 commit 8236331
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ public void notifyDownload(final String id, final int percent) {
@PluginMethod
public void setUpdateUrl(final PluginCall call) {
if (!this.getConfig().getBoolean("allowModifyUrl", false)) {
Log.e(CapacitorUpdater.TAG, "setUpdateUrl not allowed");
Log.e(
CapacitorUpdater.TAG,
"setUpdateUrl not allowed set allowModifyUrl in your config to true to allow it"
);
call.reject("setUpdateUrl not allowed");
return;
}
Expand All @@ -383,7 +386,10 @@ public void setUpdateUrl(final PluginCall call) {
@PluginMethod
public void setStatsUrl(final PluginCall call) {
if (!this.getConfig().getBoolean("allowModifyUrl", false)) {
Log.e(CapacitorUpdater.TAG, "setStatsUrl not allowed");
Log.e(
CapacitorUpdater.TAG,
"setStatsUrl not allowed set allowModifyUrl in your config to true to allow it"
);
call.reject("setStatsUrl not allowed");
return;
}
Expand All @@ -400,7 +406,10 @@ public void setStatsUrl(final PluginCall call) {
@PluginMethod
public void setChannelUrl(final PluginCall call) {
if (!this.getConfig().getBoolean("allowModifyUrl", false)) {
Log.e(CapacitorUpdater.TAG, "setChannelUrl not allowed");
Log.e(
CapacitorUpdater.TAG,
"setChannelUrl not allowed set allowModifyUrl in your config to true to allow it"
);
call.reject("setChannelUrl not allowed");
return;
}
Expand Down
12 changes: 6 additions & 6 deletions ios/Plugin/CapacitorUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
}

@objc func setUpdateUrl(_ call: CAPPluginCall) {
if !call.getBool("allowModifyUrl", false) {
if !getConfig().getBoolean("allowModifyUrl", false) {
print("\(self.implementation.TAG) setUpdateUrl called without allowModifyUrl")
call.reject("setUpdateUrl called without allowModifyUrl")
call.reject("setUpdateUrl called without allowModifyUrl set allowModifyUrl in your config to true to allow it")
return
}
guard let url = call.getString("url") else {
Expand All @@ -158,9 +158,9 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
}

@objc func setStatsUrl(_ call: CAPPluginCall) {
if !call.getBool("allowModifyUrl", false) {
if !getConfig().getBoolean("allowModifyUrl", false) {
print("\(self.implementation.TAG) setStatsUrl called without allowModifyUrl")
call.reject("setStatsUrl called without allowModifyUrl")
call.reject("setStatsUrl called without allowModifyUrl set allowModifyUrl in your config to true to allow it")
return
}
guard let url = call.getString("url") else {
Expand All @@ -173,9 +173,9 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
}

@objc func setChannelUrl(_ call: CAPPluginCall) {
if !call.getBool("allowModifyUrl", false) {
if !getConfig().getBoolean("allowModifyUrl", false) {
print("\(self.implementation.TAG) setChannelUrl called without allowModifyUrl")
call.reject("setChannelUrl called without allowModifyUrl")
call.reject("setChannelUrl called without allowModifyUrl set allowModifyUrl in your config to true to allow it")
return
}
guard let url = call.getString("url") else {
Expand Down

0 comments on commit 8236331

Please sign in to comment.