Skip to content
This repository was archived by the owner on Dec 19, 2021. It is now read-only.

Commit eed98f2

Browse files
authored
Merge pull request #29 from nstudio/issue/27
Fix iOS pod changes
2 parents 497a562 + 01f6c78 commit eed98f2

File tree

5 files changed

+50
-87
lines changed

5 files changed

+50
-87
lines changed

demo/app/main-view-model.ts

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ export class LoadingTest extends Observable {
137137
color: '#fff000',
138138
mode: Mode.Determinate
139139
});
140-
this.demoProgress('#fff000');
140+
141+
setTimeout(() => {
142+
this.indicator.hide();
143+
}, 3500);
141144
}
142145

143146
public showLoaderAnnularDeterminate() {
@@ -147,17 +150,42 @@ export class LoadingTest extends Observable {
147150
backgroundColor: '#000',
148151
mode: Mode.AnnularDeterminate
149152
});
150-
this.demoProgress('#38ef7d');
153+
154+
setTimeout(() => {
155+
this.indicator.hide();
156+
}, 3500);
151157
}
152158

153159
public showLoaderDeterminateHorizontalBar() {
160+
const mode = Mode.DeterminateHorizontalBar;
161+
const color = '#FF0099';
162+
154163
this.indicator.show({
155164
message: 'Determinate Horizontal Bar Mode',
156-
color: '#FF0099',
165+
color,
157166
backgroundColor: '#240b36',
158-
mode: Mode.DeterminateHorizontalBar
167+
mode
159168
});
160-
this.demoProgress('#FF0099');
169+
170+
setTimeout(() => {
171+
this.indicator.show({ progress: 0.15, color, mode });
172+
}, 500);
173+
setTimeout(() => {
174+
this.indicator.show({ progress: 0.35, color, mode });
175+
}, 1500);
176+
setTimeout(() => {
177+
this.indicator.show({ progress: 0.65, color, mode });
178+
}, 2500);
179+
setTimeout(() => {
180+
this.indicator.show({ progress: 0.85, color, mode });
181+
}, 3000);
182+
setTimeout(() => {
183+
this.indicator.show({ progress: 0.99, color, mode });
184+
}, 3750);
185+
setTimeout(() => {
186+
this.indicator.show({ progress: 1, color, mode });
187+
this.indicator.hide();
188+
}, 4500);
161189
}
162190

163191
public showLoaderModeText() {

src/loading-indicator.ios.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class LoadingIndicator {
2525

2626
// options
2727
if (options.message) {
28-
this._hud.labelText = options.message;
28+
this._hud.label.text = options.message;
2929
}
3030

3131
if (options.progress) {
@@ -38,29 +38,35 @@ export class LoadingIndicator {
3838
(this._hud as any).mode = Mode.Indeterminate;
3939
}
4040

41-
if (options.dimBackground) this._hud.dimBackground = options.dimBackground;
41+
if (options.dimBackground) {
42+
this._hud.backgroundView.style = MBProgressHUDBackgroundStyle.SolidColor;
43+
this._hud.backgroundView.color = new Color('#000').ios;
44+
this._hud.backgroundView.alpha = 0.3;
45+
}
4246

4347
if (options.margin) this._hud.margin = options.margin;
4448

4549
if (options.userInteractionEnabled)
4650
this._hud.userInteractionEnabled = options.userInteractionEnabled;
4751

4852
if (options.backgroundColor) {
49-
this._hud.color = new Color(options.backgroundColor).ios;
53+
this._hud.bezelView.blurEffectStyle = UIBlurEffectStyle.Regular;
54+
this._hud.bezelView.backgroundColor = new Color(
55+
options.backgroundColor
56+
).ios;
5057
}
5158

5259
if (options.color) {
5360
// make activity and main label same color
54-
this._hud.activityIndicatorColor = new Color(options.color).ios;
5561
this._hud.contentColor = new Color(options.color).ios; // setting this seems to enforce coloring the activity indicator correctly
56-
this._hud.labelColor = new Color(options.color).ios;
62+
this._hud.label.textColor = new Color(options.color).ios;
5763
}
5864

5965
if (options.details) {
60-
this._hud.detailsLabelText = options.details;
66+
this._hud.detailsLabel.text = options.details;
6167
// detail label same color with 80% opacity of that color
6268
// TODO: allow specific control
63-
this._hud.detailsLabelColor =
69+
this._hud.detailsLabel.textColor =
6470
options && options.color
6571
? new Color(options.color).ios
6672
: new Color('#333').ios;

src/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nstudio/nativescript-loading-indicator",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "A NativeScript plugin for showing an overlayed loading indicator.",
55
"main": "loading-indicator",
66
"typings": "index.d.ts",
@@ -29,7 +29,8 @@
2929
"plugin.prepare": "npm run build && cd ../demo && tns plugin remove nativescript-loading-indicator && tns plugin add ../src",
3030
"clean": "npm run demo.reset && npx rimraf -- node_modules package-lock.json && npm i",
3131
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**' --exclude '**/platforms/**' --exclude '**/typings/**'",
32-
"prepack": "npm run build.native"
32+
"prepack": "npm run build.native",
33+
"generate.typings.ios": "cd ../demo && TNS_DEBUG_METADATA_PATH=\"$(pwd)/metadata\" tns build ios && TNS_TYPESCRIPT_DECLARATIONS_PATH=\"$(pwd)/typings\" tns build ios && echo 'Now look for your library typings in demo/typings!'"
3334
},
3435
"lint-staged": {
3536
"**/*.{js, css, ts, json, scss, html, xml, md}": [

src/platforms/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pod 'MBProgressHUD'
1+
pod 'MBProgressHUD', '~> 1.2.0'

src/typings/objc!MBProgressHUD.d.ts

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ declare class MBBarProgressView extends UIView {
7575
declare class MBProgressHUD extends UIView {
7676
static HUDForView(view: UIView): MBProgressHUD;
7777

78-
static allHUDsForView(view: UIView): NSArray<any>;
79-
8078
static alloc(): MBProgressHUD; // inherited from NSObject
8179

8280
static appearance(): MBProgressHUD; // inherited from UIAppearance
@@ -101,16 +99,12 @@ declare class MBProgressHUD extends UIView {
10199
containerTypes: NSArray<typeof NSObject> | typeof NSObject[]
102100
): MBProgressHUD; // inherited from UIAppearance
103101

104-
static hideAllHUDsForViewAnimated(view: UIView, animated: boolean): number;
105-
106102
static hideHUDForViewAnimated(view: UIView, animated: boolean): boolean;
107103

108104
static new(): MBProgressHUD; // inherited from NSObject
109105

110106
static showHUDAddedToAnimated(view: UIView, animated: boolean): MBProgressHUD;
111107

112-
activityIndicatorColor: UIColor;
113-
114108
animationType: MBProgressHUDAnimation;
115109

116110
readonly backgroundView: MBBackgroundView;
@@ -119,14 +113,10 @@ declare class MBProgressHUD extends UIView {
119113

120114
readonly button: UIButton;
121115

122-
color: UIColor;
123-
124116
completionBlock: () => void;
125117

126118
contentColor: UIColor;
127119

128-
cornerRadius: number;
129-
130120
customView: UIView;
131121

132122
defaultMotionEffectsEnabled: boolean;
@@ -135,24 +125,10 @@ declare class MBProgressHUD extends UIView {
135125

136126
readonly detailsLabel: UILabel;
137127

138-
detailsLabelColor: UIColor;
139-
140-
detailsLabelFont: UIFont;
141-
142-
detailsLabelText: string;
143-
144-
dimBackground: boolean;
145-
146128
graceTime: number;
147129

148130
readonly label: UILabel;
149131

150-
labelColor: UIColor;
151-
152-
labelFont: UIFont;
153-
154-
labelText: string;
155-
156132
margin: number;
157133

158134
minShowTime: number;
@@ -163,71 +139,23 @@ declare class MBProgressHUD extends UIView {
163139

164140
offset: CGPoint;
165141

166-
opacity: number;
167-
168142
progress: number;
169143

170144
progressObject: NSProgress;
171145

172146
removeFromSuperViewOnHide: boolean;
173147

174-
readonly size: CGSize;
175-
176148
square: boolean;
177149

178-
taskInProgress: boolean;
179-
180-
xOffset: number;
181-
182-
yOffset: number;
183-
184150
constructor(o: { view: UIView });
185151

186-
constructor(o: { window: UIWindow });
187-
188-
hide(animated: boolean): void;
189-
190-
hideAfterDelay(animated: boolean, delay: number): void;
191-
192152
hideAnimated(animated: boolean): void;
193153

194154
hideAnimatedAfterDelay(animated: boolean, delay: number): void;
195155

196156
initWithView(view: UIView): this;
197157

198-
initWithWindow(window: UIWindow): this;
199-
200-
show(animated: boolean): void;
201-
202158
showAnimated(animated: boolean): void;
203-
204-
showAnimatedWhileExecutingBlock(animated: boolean, block: () => void): void;
205-
206-
showAnimatedWhileExecutingBlockCompletionBlock(
207-
animated: boolean,
208-
block: () => void,
209-
completion: () => void
210-
): void;
211-
212-
showAnimatedWhileExecutingBlockOnQueue(
213-
animated: boolean,
214-
block: () => void,
215-
queue: NSObject
216-
): void;
217-
218-
showAnimatedWhileExecutingBlockOnQueueCompletionBlock(
219-
animated: boolean,
220-
block: () => void,
221-
queue: NSObject,
222-
completion: () => void
223-
): void;
224-
225-
showWhileExecutingOnTargetWithObjectAnimated(
226-
method: string,
227-
target: any,
228-
object: any,
229-
animated: boolean
230-
): void;
231159
}
232160

233161
declare const enum MBProgressHUDAnimation {

0 commit comments

Comments
 (0)