Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25888] Android: getEventsBetweenDates() crashes #9949

Merged
merged 3 commits into from Apr 20, 2018

Conversation

ypbnv
Copy link
Contributor

@ypbnv ypbnv commented Mar 20, 2018

JIRA: https://jira.appcelerator.org/browse/TIMOB-25888

Description:
Handle weekly recurring events without BYDAY rule.

Test case:
app.js

var calendarName = "<Calendar with weekly recurring event.>";
var win = Ti.UI.createWindow();
var button = Ti.UI.createButton();

button.addEventListener('click', doClick);
win.add(button);
win.open();

function doClick(e) {
	if (!Ti.Calendar.hasCalendarPermissions()) {
		Ti.Calendar.requestCalendarPermissions(function(args) {
			if (args.success) {
				showCalendars();
			}
		});
	} else {
		showCalendars();
	}
}

function showCalendars() {
	console.log("In showCalendars");
	var calendars = Ti.Calendar.allCalendars;
	for (var i = 0; i < calendars.length; i++) {
		var cal = calendars[i];
		if (cal.name === calendarName) {
			console.log("Try to show weekly events from calendar " + calendarName);
			var now = new Date();
			try {
				var events = cal.getEventsBetweenDates(new Date(now.getFullYear() - 1, now.getMonth(), now.getDate()), now);
				console.log("I have " + events.length + " events");
				events.forEach(function(event) {
					console.log("Event " + event.title);
				});
			} catch (ex) {
				console.error(ex);
			}
			return;
		}
	}
}

@ypbnv ypbnv added this to the 7.2.0 milestone Mar 20, 2018
@ypbnv ypbnv requested a review from garymathews March 20, 2018 16:46
@build build added the android label Mar 20, 2018
@build
Copy link
Contributor

build commented Mar 20, 2018

Messages
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: PASS

@build build added the android label Apr 12, 2018
@lokeshchdhry
Copy link
Contributor

FR Passed.

getEventsBetweenDates() does not crash for events which repeat weekly.

Studio Ver: 5.0.0.201712081732
SDK Ver: 7.2.0 local build
OS Ver: 10.13.4
Xcode Ver: Xcode 9.3
Appc NPM: 4.2.13-2
Appc CLI: 7.0.3-master.39
Daemon Ver: 1.1.1
Ti CLI Ver: 5.1.0
Alloy Ver: 1.12.0
Node Ver: 8.9.1
NPM Ver: 5.5.1
Java Ver: 1.8.0_131
Devices: ⇨ google Nexus 5 --- Android 6.0.1
⇨ google Nexus 6P --- Android 8.0.0

@lokeshchdhry lokeshchdhry merged commit 8c76648 into tidev:master Apr 20, 2018
@sgtcoolguy sgtcoolguy modified the milestones: 7.2.0, 7.3.0 May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants