mirror of
https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
synced 2026-07-31 00:02:14 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95fe5ce19b | ||
|
|
9def9e77f5 |
@@ -160,8 +160,6 @@ The Android code was entirely created by me.
|
||||
For iOS most credits go to this excellent [Toast for iOS project by Charles Scalesse] (https://github.com/scalessec/Toast).
|
||||
|
||||
## 6. CHANGELOG
|
||||
2.0.1: iOS messages are hidden when another one is shown. [Thanks Richie Min!](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin/pull/13)
|
||||
|
||||
2.0: WP8 support
|
||||
|
||||
1.0: initial version supporting Android and iOS
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="nl.x-services.plugins.toast"
|
||||
version="2.0.1">
|
||||
version="2.0">
|
||||
|
||||
<name>Toast</name>
|
||||
|
||||
|
||||
@@ -46,8 +46,6 @@ static const BOOL CSToastHidesOnTap = YES; // excludes activity
|
||||
static const NSString * CSToastTimerKey = @"CSToastTimerKey";
|
||||
static const NSString * CSToastActivityViewKey = @"CSToastActivityViewKey";
|
||||
|
||||
static UIView *prevToast = NULL;
|
||||
|
||||
@interface UIView (ToastPrivate)
|
||||
|
||||
- (void)hideToast:(UIView *)toast;
|
||||
@@ -93,10 +91,6 @@ static UIView *prevToast = NULL;
|
||||
}
|
||||
|
||||
- (void)showToast:(UIView *)toast duration:(NSTimeInterval)duration position:(id)point {
|
||||
if(prevToast){
|
||||
[self hideToast:prevToast];
|
||||
}
|
||||
prevToast = toast;
|
||||
toast.center = [self centerPointForPosition:point withToast:toast];
|
||||
toast.alpha = 0.0;
|
||||
|
||||
|
||||
+4
-18
@@ -82,30 +82,16 @@ namespace WPCordovaClassLib.Cordova.Commands
|
||||
popup.VerticalAlignment = VerticalAlignment.Bottom;
|
||||
popup.VerticalOffset = -100; // TODO can do better
|
||||
}
|
||||
else if ("center".Equals(position))
|
||||
else // center
|
||||
{
|
||||
popup.VerticalAlignment = VerticalAlignment.Center;
|
||||
popup.VerticalOffset = -50; // TODO can do way better
|
||||
}
|
||||
else
|
||||
{
|
||||
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "invalid position. valid options are 'top', 'center' and 'bottom'"));
|
||||
return;
|
||||
}
|
||||
|
||||
int hideDelay = 2800;
|
||||
if ("long".Equals(duration))
|
||||
{
|
||||
hideDelay = 5500;
|
||||
}
|
||||
else if (!"short".Equals(duration))
|
||||
{
|
||||
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "invalid duration. valid options are 'short' and 'long'"));
|
||||
return;
|
||||
}
|
||||
|
||||
grid.Children.Add(popup);
|
||||
popup.IsOpen = true;
|
||||
|
||||
int hideDelay = "long".Equals(duration) ? 5500 : 2800;
|
||||
this.hidePopup(hideDelay);
|
||||
}
|
||||
}
|
||||
@@ -122,4 +108,4 @@ namespace WPCordovaClassLib.Cordova.Commands
|
||||
popup.IsOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-3
@@ -1,11 +1,11 @@
|
||||
exports.defineAutoTests = function() {
|
||||
cordova.define("nl.x-services.plugins.toast.tests", function(require, exports, module) { exports.defineAutoTests = function() {
|
||||
|
||||
var fail = function (done) {
|
||||
expect(true).toBe(false);
|
||||
expect(false).toBe(true);
|
||||
done();
|
||||
},
|
||||
succeed = function (done) {
|
||||
expect(true).toBe(true);
|
||||
expect(false).toBe(false);
|
||||
done();
|
||||
};
|
||||
|
||||
@@ -55,3 +55,5 @@ exports.defineAutoTests = function() {
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user