pbernasconi / cordova-progressindicator Goto Github PK
View Code? Open in Web Editor NEWNative Progress-Indicator for Cordova
Home Page: pbernasconi.github.io/cordova-progressIndicator/
License: Apache License 2.0
Native Progress-Indicator for Cordova
Home Page: pbernasconi.github.io/cordova-progressIndicator/
License: Apache License 2.0
When a determinate progress dialog is closed before it ends and another determinate dialog is opened then the two threads fight to control the progress meter.
Proposed Patch:
diff --git a/src/ios/ProgressIndicator.h b/src/ios/ProgressIndicator.h
index 8f7c28a..2270937 100644
--- a/src/ios/ProgressIndicator.h
+++ b/src/ios/ProgressIndicator.h
@@ -4,7 +4,7 @@
@interface ProgressIndicator: CDVPlugin {
}
-@property (nonatomic, assign) MBProgressHUD* progressIndicator;
+@property (nonatomic, weak) MBProgressHUD* progressIndicator;
-@end
\ No newline at end of file
+@end
diff --git a/src/ios/ProgressIndicator.m b/src/ios/ProgressIndicator.m
index 550b53a..17475ad 100644
--- a/src/ios/ProgressIndicator.m
+++ b/src/ios/ProgressIndicator.m
@@ -399,19 +399,24 @@ - (void)showMultiple:(CDVInvokedUrlCommand*)command {
- (void)hide:(CDVInvokedUrlCommand*)command
{
- if (!self.progressIndicator) {
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- return;
- }
- [self.progressIndicator hide:YES];
+ if (!self.progressIndicator) {
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ return;
+ }
+
+ if ( self.progressIndicator.taskInProgress == YES )
+ self.progressIndicator.taskInProgress = NO;
+ else
+ [self.progressIndicator hide:YES];
+
self.progressIndicator = nil;
+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@""];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
-
/**
* PROGRESS TASK EVENT
*/
@@ -420,11 +425,15 @@ - (void)progressTask:(NSNumber *)increment{
// get increment value
int _increment = [increment intValue];
+
+ MBProgressHUD* progressIndicator = self.progressIndicator;
float progress = 0.0f;
while (progress < 1.0f) {
+ if ( progressIndicator.taskInProgress == NO ) break;
+
progress += 0.01f;
- self.progressIndicator.progress = progress;
+ progressIndicator.progress = progress;
// increment in microseconds (100000mms = 1s)
usleep(_increment);
I am getting an error from SVN while trying to commit my project due to this plugin. It is pointing to a file that is incredibly deep in the directory.
...../plugins/org.pbernasconi.progressindicator/demo/plugins/org.pbernasconi.progressIndicator/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/build/CordovaLib.build/Debug-iphonesimulator/CordovaLib.build/build-state.dat
None of the other plugins I'm using have a repeating structure like this and just wanted to point it out if anyone is able to clean this up a bit.
First of all, thanks for the plugin.
It's working great on iOS but there's one issue on Android.
Currently, an Android device has the ability to 'dismiss' or 'hide' the loading spinner.
We want to stop this from happening since we're using the spinner for crucial operations.
Is there any way of accomplishing this?
It happens when tapping outside of the ProgressIndicator on Android.
Thanks in advance.
Please could you consider allowing the passing of a custom image to the progress indicator? This would be similar to how the ProgressIndicator.showSuccess(false) currently displays the "tick"
Hi
if a progressbar is shown that needs hide() it would be nice to be able to update the label and/or detail without needing to call hide() inbetween, it causes a lot of flickering.
Thank you for this plugin, good stuff! ๐
For now, Android is not supported.
Apparently Android already has native dialog / progress indicators, which can be seen in these docs. Therefore it should be easy (in theory) to add support.
Sometimes when calling hide()
after a indicator has already been hidden an EXC_BAD_ACCESS
can occur.
It occurs on line 402 on the first if block check of the hide
method:
- (void)hide:(CDVInvokedUrlCommand*)command
{
if (!self.progressIndicator) {
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
return;
}
[self.progressIndicator hide:YES];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@""];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
It would be nice if multiple calls to hide()
didn't cause a crash.
i found out that in your plugin.xml stated src/android/ProgressIndicator.java as below
<!-- Android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="ProgressIndicator">
<param name="android-package" value="org.apache.cordova.plugin.ProgressIndicator"/>
</feature>
</config-file>
<source-file src="src/android/ProgressIndicator.java" target-dir="src/org/apache/cordova/plugin"/>
</platform>
but in /src/android/ folder only have ActivityIndicator.java file
Maybe it would be simpler to have something like
ProgressIndicator.show('type', true, 'label', 'description')
rather than
ProgressIndicator.showSimpleWithLabel(true, 'label', 'description')
Moved from : ionic-team/ng-cordova#356
The original cordova plugin allows a custom text success label to be passed as a parameter. It would be great if the ngCordova wrapper allowed this to be passed through as well.
Hi
Is this plugin compatible now? ProgressIndicator.showSimple(true); doent work as expected. It doesn;t show the activity indicator. None of them works.
Simple
Determinate
Annular
Bar
Success
Simple Text
I see that the source code is 2 years old. Do you plan to fix these issues?
THanks, Manju
I encountered this error when I tried to add it into a new Cordova project.
C:\testp>cordova plugin add https://github.com/pbernasconi/cordova-progressIndic
ator.git
Fetching plugin "https://github.com/pbernasconi/cordova-progressIndicator.git" v
ia git clone
Error: Command failed: Cloning into 'C:\Users\User\AppData\Local\Temp\git\143502
3689671'...
Checking out files: 23% (407/1729)
Checking out files: 24% (415/1729)
Checking out files: 24% (420/1729)
Checking out files: 25% (433/1729)
Checking out files: 26% (450/1729)
error: unable to create file demo/plugins/org.pbernasconi.progressIndicator/demo
/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Cordova
Lib.xcodeproj/xcuserdata/paolob.xcuserdatad/xcschemes/xcschememanagement.plist (
Filename too long)
error: unable to create file demo/plugins/org.pbernasconi.progressIndicator/demo
/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/build/C
ordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Cordova-all-target-header
s.hmap (Filename too long)
error: unable to create file demo/plugins/org.pbernasconi.progressIndicator/demo
/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/build/C
ordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Cordova-generated-files.h
map (Filename too long)
error: unable to create file demo/plugins/org.pbernasconi.progressIndicator/demo
/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/build/C
ordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Cordova-own-target-header
s.hmap (Filename too long)
error: unable to create file demo/plugins/org.pbernasconi.progressIndicator/demo
/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/build/C
ordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Cordova-project-headers.h
map (Filename too long)
fatal: cannot create directory at 'demo/plugins/org.pbernasconi.progressIndicato
r/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/b
uild/CordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Objects-normal': Fi
lename too long
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'
at ChildProcess.exithandler (child_process.js:658:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
I had tried to use this plugin in Supersonic Appgyver app along with ngCordova, but it does not display any dialog, I'd then tried to use it on pure Cordova project, and I get the error above. Is there any way to fix it?
Cordova 5.3.3
IONIC 1.6.4
It is not working please help
hi @pbernasconi
I am using your latest npm version
https://www.npmjs.com/package/cordova-plugin-progressindicator
all work perfect in iOS
but particular when using "center" position
ProgressIndicator.showText(true, 'title', 'top'); //the mask will show
ProgressIndicator.showText(true, 'title', 'center'); //the mask "will not" show
ProgressIndicator.showText(true, 'title', 'bottom'); //the mask will show
It doesn't show in android .
There's a pretty serious bug in this library that causes the app to crash when hiding the indicator. There have been two PRs to fix this already and you haven't responded to either.
Given that there are obviously people, like myself, depending on this library, I think it's for everyone's betterment you do something to make the state of the project clear to everyone, by either adding another maintainer, starting to respond to PRs, marking it as unmaintained, etc.
hi @pbernasconi
I am using PGB 3.7 (build.phonegap.com) with your latest plugin 1.1.0 version
http://plugins.cordova.io/#/package/org.pbernasconi.progressindicator
but when I use you plugin
it will build fail that only in iOS (Android and winphone build ok)
there is some error log message
CpResource jQuerytestMobileforPhoneGapEdition/Resources/ProgressIndicator.bundle build/jQuerytestMobileforPhoneGapEdition.app/ProgressIndicator.bundle
cd /project
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -strip-debug-symbols -strip-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -resolve-src-symlinks /project/jQuerytestMobileforPhoneGapEdition/Resources/ProgressIndicator.bundle /project/build/jQuerytestMobileforPhoneGapEdition.app
error: /project/jQuerytestMobileforPhoneGapEdition/Resources/ProgressIndicator.bundle: No such file or directory
The following build commands failed:
CpResource jQuerytestMobileforPhoneGapEdition/Resources/ProgressIndicator.bundle build/jQuerytestMobileforPhoneGapEdition.app/ProgressIndicator.bundle
(1 failure)
look like the point is...
error: /project/jQuerytestMobileforPhoneGapEdition/Resources/ProgressIndicator.bundle: No such file or directory
Hello,
ProgressIndicator.* works all indicators good
ProgressIndicator.hide(); not hiding any indicators
i am using cordova 3.3
If the user touch the indicator, a callback should be called.
Useful for things like "tap to stop" when uploading or other long process
I would want to use your plugin with phonegap build to deploy an ios without mac, so I would want to know if the source code is under MIT or Apache License, which are the conditions to be submited to the 3rd party plugin Library on build.phonegap.com
Hello there,
Thank you so much for this awesome plugin. Works flawlessly.
I just have a little issue.
I'm using Meteor framework to build a mobile app. All cordova plugins download and install in seconds (most of them are below 1MB).
This particular plugin takes a long time to download. Upon closer inspection, I realized there's a demo folder which is downloaded along with the tarball which is main reason for the long download time. This is around 63MB. Deleting this immediately speeded up things, and ofcourse it didn't effect the install. The actual source of this plugin is only around 120Kb, which is really sweet.
Unfortunately, Meteor checks and downloads all Cordova plugins on a clean compile. So I'm left with no option but to wait until the entire 63MB demo folder is downloaded along with the source and then delete it.
I'm not sure how this can be fixed, but if you could take a look, that would be of great help.
Thanks!
Hi there,
Is it possible to change the text of the simple label while it is displayed? For instance, I want to show my users which process is happening in the background while they are waiting.
Thanks!
First of all, great work!
I'm using iOS 8 simulator (Xcode last available).
The .showSuccess doesn't show the check mark but only the text.
Cross posted from ionic-team/ng-cordova#357
The iOS bundle including the "tick" image for the Progress Indicator plugin is not referenced in the plugin.xml so it is not copied to the platforms/ios/Resources folder when the plugin is installed and therefore the "tick" image is not displayed when calling ProgressIndicator.showSuccess(false);
Manually copying this over to the platforms/ios/Resources folder is a temporoary fix, but really it should be added to plugin.xml:
<!-- iOS -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="ProgressIndicator">
<param name="ios-package" value="ProgressIndicator"/>
</feature>
</config-file>
<header-file src="src/ios/MBProgressHUD.h"/>
<source-file src="src/ios/MBProgressHUD.m"/>
<header-file src="src/ios/ProgressIndicator.h"/>
<source-file src="src/ios/ProgressIndicator.m"/>
<resource-file src="src/ios/ProgressIndicator.bundle"/>
</platform>
hi @pbernasconi
I saw there is a new version 1.2.0 recently
https://github.com/pbernasconi/cordova-progressIndicator/releases/tag/1.2.0
but in the npm seem like a old version 0.3.0
could you try to update the npm ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.