Skip to content

Commit

Permalink
'null checks' must be 'undefined checks' (since tns 2.0.0?)
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed May 6, 2016
1 parent c1838f1 commit 9d96bfd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions calendar.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Calendar._findCalendars = function (filterByName) {
"_id",
"name"
];

var sortOrder = null;
var selections = null;
var selection = "visible=1";
Expand All @@ -99,7 +99,7 @@ Calendar._findCalendars = function (filterByName) {
if (cursor.moveToFirst()) {
do {
var name = cursor.getString(1);
if (!filterByName || name == filterByName) {
if (!filterByName || name == filterByName) {
var calendar = {
id: cursor.getLong(0),
name: name
Expand All @@ -115,7 +115,7 @@ Calendar._findEvents = function(arg) {
var settings = Calendar.merge(arg, Calendar.defaults);

var projection = [
Calendar._fields.EVENT_ID,
Calendar._fields.EVENT_ID,
Calendar._fields.CALENDAR.ID,
Calendar._fields.CALENDAR.NAME,
Calendar._fields.TITLE,
Expand All @@ -125,17 +125,17 @@ Calendar._findEvents = function(arg) {
Calendar._fields.ENDDATE,
Calendar._fields.ALLDAY
];

var sortOrder = android.provider.CalendarContract.Instances.BEGIN + " ASC, " + android.provider.CalendarContract.Instances.END + " ASC";
var selection = "";
var selections = [];

if (settings.title !== null) {
if (settings.title !== undefined) {
selection += Calendar._fields.TITLE + " LIKE ?";
selections.push("%" + settings.title + "%");
}
if (settings.location !== null) {
if (!"".equals(selection)) {
if (settings.location !== undefined) {
if ("" !== selection) {
selection += " AND ";
}
selection += Calendar._fields.LOCATION + " LIKE ?";
Expand Down Expand Up @@ -241,7 +241,7 @@ Calendar.createEvent = function(arg) {
ContentValues.put(Calendar._fields.TIMEZONE, java.util.TimeZone.getDefault().getID());
ContentValues.put(Calendar._fields.STARTDATE, new java.lang.Long(settings.startDate.getTime()));
ContentValues.put(Calendar._fields.ENDDATE, new java.lang.Long(settings.endDate.getTime()));

ContentValues.put(Calendar._fields.TITLE, settings.title);
ContentValues.put(Calendar._fields.LOCATION, settings.location);

Expand Down Expand Up @@ -306,7 +306,7 @@ Calendar.createEvent = function(arg) {
ContentValues.put(Calendar._fields.RRULE, "FREQ=" + settings.recurrence.frequency.toUpperCase() + ";INTERVAL=" + settings.recurrence.interval + ";UNTIL=" + yyyymmdd);
}
}

var eventsUri = android.net.Uri.parse("content://com.android.calendar/events");
var uri = ContentResolver.insert(eventsUri, ContentValues);
var createdEventID = uri.getLastPathSegment();
Expand Down
6 changes: 3 additions & 3 deletions calendar.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ Calendar._findEKEvents = function (arg, calendars) {
}

var predicates = [];
if (arg.title !== null) {
if (arg.title !== undefined) {
predicates.push("title contains[c] '" + arg.title.replace(/'/g, "\\'") + "'");
}
if (arg.location !== null) {
if (arg.location !== undefined) {
predicates.push("location contains[c] '" + arg.location.replace(/'/g, "\\'") + "'");
}
if (arg.notes !== null) {
if (arg.notes !== undefined) {
predicates.push("notes contains[c] '" + arg.notes.replace(/'/g, "\\'") + "'");
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-calendar",
"version": "1.0.4",
"version": "1.0.5",
"description": "Interact with the native calendar. Add, Update, Read, you name it.",
"main": "calendar.js",
"nativescript": {
Expand Down

0 comments on commit 9d96bfd

Please sign in to comment.