├── .gitignore
├── README.md
├── package.json
├── plugin.xml
├── progress.gif
├── src
└── ios
│ ├── KVNProgressView.xib
│ ├── Progress.h
│ ├── Progress.m
│ └── vendor
│ ├── headers
│ ├── KVNProgress.h
│ ├── KVNProgressConfiguration.h
│ ├── UIColor+KVNContrast.h
│ ├── UIImage+KVNEmpty.h
│ └── UIImage+KVNImageEffects.h
│ └── libKVNProgress.a
└── www
└── progress.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Mac crap
2 | .DS_Store
3 |
4 | scripts/*
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Progress Plugin for Apache Cordova [](http://badge.fury.io/js/cordova-plugin-progress)
2 |
3 | **Cordova / PhoneGap Plugin for Progress HUD Notifications via [KVNProgress](https://github.com/kevin-hirsch/KVNProgress).**
4 |
5 | ## Demo
6 |
7 |
8 |
9 | ## Install
10 |
11 | #### Latest published version on npm (with Cordova CLI >= 5.0.0)
12 |
13 | ```
14 | cordova plugin add cordova-plugin-progress
15 | ```
16 |
17 | #### Latest version from GitHub
18 |
19 | ```
20 | cordova plugin add https://github.com/leecrossley/cordova-plugin-progress.git
21 | ```
22 |
23 | You **do not** need to reference any JavaScript, the Cordova plugin architecture will add a `progress` object to your root automatically when you build.
24 |
25 | ## Usage
26 |
27 | ### show
28 |
29 | Show the basic indeterminate progress loader.
30 |
31 | ```js
32 | // with success and error handlers
33 | progress.show(successHandler, errorHandler);
34 |
35 | // without callback functions
36 | progress.show();
37 | ```
38 |
39 | Show the basic indeterminate progress loader, with text. When text is supplied, the loader width is larger.
40 |
41 | ```js
42 | // with success and error handlers
43 | progress.show(successHandler, errorHandler, {"text": "Loading..."});
44 |
45 | // with success and error handlers (shorthand)
46 | progress.show(successHandler, errorHandler, "Loading...");
47 |
48 | // without callback functions
49 | progress.show({"text": "Loading..."});
50 |
51 | // without callback functions (shorthand)
52 | progress.show("Loading...");
53 | ```
54 |
55 | ### update
56 |
57 | Update the loader text on the fly (animated). If the loader was initiated without text, the width will remain smaller than if it was initiated with text.
58 |
59 | ```js
60 | // with success and error handlers
61 | progress.update(successHandler, errorHandler, {"text": "Still loading..."});
62 |
63 | // with success and error handlers (shorthand)
64 | progress.update(successHandler, errorHandler, "Still loading...");
65 |
66 | // without callback functions
67 | progress.update({"text": "Still loading..."});
68 |
69 | // without callback functions (shorthand)
70 | progress.update("Still loading...");
71 | ```
72 |
73 | You can also use the update function to remove any previous text (an empty string is treated the same as omitting the string).
74 |
75 | ```js
76 | // with success and error handlers
77 | progress.update(successHandler, errorHandler);
78 |
79 | // without callback functions
80 | progress.update();
81 | ```
82 |
83 | ### hide
84 |
85 | Hide the loader. Note that the `successHandler` is called after the loader has completely disappeared.
86 |
87 | ```js
88 | // with success and error handlers
89 | progress.hide(successHandler, errorHandler);
90 |
91 | // without callback functions
92 | progress.hide();
93 | ```
94 |
95 | ## Full basic example
96 |
97 | ```js
98 | // after the cordova device ready event has fired
99 | progress.show("Loading...");
100 |
101 | setTimeout(function () {
102 | progress.update("Still loading...");
103 | }, 1500);
104 |
105 | setTimeout(function () {
106 | progress.hide();
107 | }, 3000);
108 | ```
109 |
110 | ## Platforms
111 |
112 | iOS (7+) only.
113 |
114 | ## License
115 |
116 | [MIT License](http://ilee.mit-license.org)
117 |
118 | [KVNProgress](https://github.com/kevin-hirsch/KVNProgress#license)
119 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cordova-plugin-progress",
3 | "version": "0.3.0",
4 | "author": "Lee Crossley (http://ilee.co.uk/)",
5 | "description": "Cordova / PhoneGap Plugin for Progress HUD Notifications via KVNProgress",
6 | "cordova": {
7 | "id": "cordova-plugin-progress",
8 | "platforms": [
9 | "ios"
10 | ]
11 | },
12 | "repository": {
13 | "type": "git",
14 | "url": "git+https://github.com/leecrossley/cordova-plugin-progress.git"
15 | },
16 | "keywords": [
17 | "cordova",
18 | "progress",
19 | "hud",
20 | "notification",
21 | "message",
22 | "toast",
23 | "status",
24 | "overlay",
25 | "loader",
26 | "ecosystem:cordova",
27 | "cordova-ios"
28 | ],
29 | "engines": [
30 | {
31 | "name": "cordova",
32 | "version": ">=3.0.0"
33 | },
34 | {
35 | "name": "apple-ios",
36 | "version": ">=8.2.0"
37 | }
38 | ],
39 | "license": "MIT",
40 | "bugs": {
41 | "url": "https://github.com/leecrossley/cordova-plugin-progress/issues"
42 | },
43 | "homepage": "https://github.com/leecrossley/cordova-plugin-progress#readme"
44 | }
45 |
--------------------------------------------------------------------------------
/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Progress
4 | Lee Crossley (http://ilee.co.uk/)
5 | Cordova / PhoneGap Plugin for Progress HUD Notifications via KVNProgress
6 | cordova, progress, hud, notification, message, toast, status, overlay, loader
7 | MIT
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/progress.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leecrossley/cordova-plugin-progress/62b5b87cc4b184d2a7d59eb85b5df79ae91cfcc1/progress.gif
--------------------------------------------------------------------------------
/src/ios/KVNProgressView.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/src/ios/Progress.h:
--------------------------------------------------------------------------------
1 | //
2 | // Progress.h
3 | // Copyright (c) 2015 Lee Crossley - http://ilee.co.uk
4 | //
5 |
6 | #import "Foundation/Foundation.h"
7 | #import "Cordova/CDV.h"
8 |
9 | @interface Progress : CDVPlugin
10 |
11 | - (void) show:(CDVInvokedUrlCommand*)command;
12 | - (void) update:(CDVInvokedUrlCommand*)command;
13 | - (void) hide:(CDVInvokedUrlCommand*)command;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/src/ios/Progress.m:
--------------------------------------------------------------------------------
1 | //
2 | // Progress.m
3 | // Copyright (c) 2015 Lee Crossley - http://ilee.co.uk
4 | //
5 |
6 | #import "Cordova/CDV.h"
7 | #import "Cordova/CDVViewController.h"
8 | #import "Progress.h"
9 | #import "KVNProgress.h"
10 |
11 | @implementation Progress
12 |
13 | - (void) show:(CDVInvokedUrlCommand*)command;
14 | {
15 | NSMutableDictionary *args = [command.arguments objectAtIndex:0];
16 |
17 | [KVNProgress showWithStatus:[args objectForKey:@"text"]];
18 |
19 | [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] callbackId:command.callbackId];
20 | }
21 |
22 | - (void) update:(CDVInvokedUrlCommand*)command;
23 | {
24 | NSMutableDictionary *args = [command.arguments objectAtIndex:0];
25 |
26 | [KVNProgress updateStatus:[args objectForKey:@"text"]];
27 |
28 | [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] callbackId:command.callbackId];
29 | }
30 |
31 | - (void) hide:(CDVInvokedUrlCommand*)command;
32 | {
33 | [KVNProgress dismissWithCompletion:^{
34 | [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] callbackId:command.callbackId];
35 | }];
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/src/ios/vendor/headers/KVNProgress.h:
--------------------------------------------------------------------------------
1 | //
2 | // KVNProgress.h
3 | // KVNProgress
4 | //
5 | // Created by Kevin Hirsch on 24/05/14.
6 | // Copyright (c) 2014 Pinch. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "KVNProgressConfiguration.h"
12 |
13 | typedef void (^KVNCompletionBlock)(void);
14 |
15 | @interface KVNProgress : UIView
16 |
17 | #pragma mark - Configuration
18 |
19 | /**
20 | Configuration of the KVNProgress UI.
21 | By default, equals to [KVNProgressConfiguration defaultConfiguration].
22 | */
23 | + (KVNProgressConfiguration *)configuration;
24 |
25 | /**
26 | Changes the configuration of the KVNProgress views.
27 | @param newConfiguration The new configuration for KVNProgress.
28 | */
29 | + (void)setConfiguration:(KVNProgressConfiguration *)newConfiguration;
30 |
31 | #pragma mark - Loading
32 |
33 | /** Shows an indeterminate progress view without status. */
34 | + (void)show;
35 |
36 | /**
37 | Shows an indeterminate progress view with the status.
38 | @param status The status to show.
39 | */
40 | + (void)showWithStatus:(NSString *)status;
41 |
42 | /**
43 | Shows an indeterminate progress view added to superview with status.
44 | @param status The status to show.
45 | @param onView The superview on which to add the progress view. Pass nil to add to main window.
46 | */
47 | + (void)showWithStatus:(NSString *)status
48 | onView:(UIView *)superview;
49 |
50 | #pragma mark - Progress
51 |
52 | /**
53 | Shows a progress view with a specified progress and no status.
54 | @param progress The progress to display between 0 and 1.
55 | */
56 | + (void)showProgress:(CGFloat)progress;
57 |
58 | /**
59 | Shows a progress view with a specified progress and status.
60 | @param status The status to show.
61 | */
62 | + (void)showProgress:(CGFloat)progress
63 | status:(NSString*)status;
64 |
65 | /**
66 | Shows a progress view added to superview with a specified progress and status.
67 | @param status The status to show.
68 | @param onView The superview on which to add the progress view. Pass nil to add to main window.
69 | */
70 | + (void)showProgress:(CGFloat)progress
71 | status:(NSString*)status
72 | onView:(UIView *)superview;
73 |
74 | #pragma mark - Success
75 |
76 | /** Shows a success view without status. */
77 | + (void)showSuccess;
78 |
79 | /**
80 | Shows a success view without status.
81 | @param completion The completion handler called after the view is completely dismissed.
82 | */
83 | + (void)showSuccessWithCompletion:(KVNCompletionBlock)completion;
84 |
85 | /**
86 | Shows a success view with status.
87 | @param status The status to show.
88 | */
89 | + (void)showSuccessWithStatus:(NSString *)status;
90 |
91 | /**
92 | Shows a success view with status.
93 | @param status The status to show.
94 | @param completion The completion handler called after the view is completely dismissed.
95 | */
96 | + (void)showSuccessWithStatus:(NSString *)status
97 | completion:(KVNCompletionBlock)completion;
98 |
99 | /**
100 | Shows a success view added to superview with status.
101 | @param status The status to show.
102 | @param onView The superview on which to add the progress view. Pass nil to add to main window.
103 | */
104 | + (void)showSuccessWithStatus:(NSString *)status
105 | onView:(UIView *)superview;
106 |
107 | /**
108 | Shows a success view added to superview with status.
109 | @param status The status to show.
110 | @param onView The superview on which to add the progress view. Pass nil to add to main window.
111 | @param completion The completion handler called after the view is completely dismissed.
112 | */
113 | + (void)showSuccessWithStatus:(NSString *)status
114 | onView:(UIView *)superview
115 | completion:(KVNCompletionBlock)completion;
116 |
117 | #pragma mark - Error
118 |
119 | /** Shows an error view without status. */
120 | + (void)showError;
121 |
122 | /**
123 | Shows an error view without status.
124 | @param completion The completion handler called after the view is completely dismissed.
125 | */
126 | + (void)showErrorWithCompletion:(KVNCompletionBlock)completion;
127 |
128 | /**
129 | Shows an error view with status.
130 | @param status The status to show.
131 | */
132 | + (void)showErrorWithStatus:(NSString *)status;
133 |
134 | /**
135 | Shows an error view with status.
136 | @param status The status to show.
137 | @param completion The completion handler called after the view is completely dismissed.
138 | */
139 | + (void)showErrorWithStatus:(NSString *)status
140 | completion:(KVNCompletionBlock)completion;
141 |
142 | /**
143 | Shows an error view added to superview with status.
144 | @param status The status to show.
145 | @param onView The superview on which to add the progress view. Pass nil to add to main window.
146 | */
147 | + (void)showErrorWithStatus:(NSString *)status
148 | onView:(UIView *)superview;
149 |
150 | /**
151 | Shows an error view added to superview with status.
152 | @param status The status to show.
153 | @param onView The superview on which to add the progress view. Pass nil to add to main window.
154 | @param completion The completion handler called after the view is completely dismissed.
155 | */
156 | + (void)showErrorWithStatus:(NSString *)status
157 | onView:(UIView *)superview
158 | completion:(KVNCompletionBlock)completion;
159 |
160 | #pragma mark - Dimiss
161 |
162 | /**
163 | Dismiss progress view with a fade animation. Does nothing if the progress view is not on screen.
164 |
Remark: You may want to use dismissWithCompletion: if KVNMinimumDisplayTime is greater than zero.
165 | @see dismissWithCompletion:
166 | */
167 | + (void)dismiss;
168 |
169 | /**
170 | Dismiss progress view with a fade animation and call a completion handler when the dismiss process is finished. Does nothing if the progress view is not on screen.
171 |