<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;

using Newtonsoft.Json.Linq;

using KidoZen;

#if __IOS__
using Kidozen.Client.iOS;
#else
using KidoZen.Client.Android;
using Android.Content;
#endif

namespace Todo
{
	public class TodoItemDatabase 
	{
		static object locker = new object ();
		KZApplication kidozenApplication;
		Storage database;
		DataSource queryDataSource, saveDataSource;

		public TodoItemDatabase()
		{
			this.kidozenApplication = new KZApplication (Settings.Marketplace, Settings.Application, Settings.Key);
		}

		public void Login(KZApplication.OnEventHandler onAuthFinish) {
			#if __ANDROID__
			this.kidozenApplication.Authenticate (App.AndroidContext, onAuthFinish);
			#else
			this.kidozenApplication.Authenticate (onAuthFinish);
			#endif
			database = kidozenApplication.Storage["todo"];
			queryDataSource = kidozenApplication.DataSource["QueryTodo"];
			saveDataSource = kidozenApplication.DataSource["AddTodo"];

		}

		public IEnumerable<TodoItem> GetItemsNotDone ()
		{
			lock (locker) {
				return  database.Query<TodoItem>(@"{""Done"":false}").Result.Data;
			}
		}

		public void DeleteItem(string id)
		{
			lock (locker) {
				database.Delete(id).RunSynchronously();
			}
		}

		public IEnumerable<TodoItem> GetItems ()
		{<commit_msg>fix delete task<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;

using Newtonsoft.Json.Linq;

using KidoZen;

#if __IOS__
using Kidozen.Client.iOS;
#else
using KidoZen.Client.Android;
using Android.Content;
#endif

namespace Todo
{
	public class TodoItemDatabase 
	{
		static object locker = new object ();
		KZApplication kidozenApplication;
		Storage database;
		DataSource queryDataSource, saveDataSource;

		public TodoItemDatabase()
		{
			this.kidozenApplication = new KZApplication (Settings.Marketplace, Settings.Application, Settings.Key);
		}

		public void Login(KZApplication.OnEventHandler onAuthFinish) {
			#if __ANDROID__
			this.kidozenApplication.Authenticate (App.AndroidContext, onAuthFinish);
			#else
			this.kidozenApplication.Authenticate (onAuthFinish);
			#endif
			database = kidozenApplication.Storage["todo"];
			queryDataSource = kidozenApplication.DataSource["QueryTodo"];
			saveDataSource = kidozenApplication.DataSource["AddTodo"];

		}

		public IEnumerable<TodoItem> GetItemsNotDone ()
		{
			lock (locker) {
				return  database.Query<TodoItem>(@"{""Done"":false}").Result.Data;
			}
		}

		public void DeleteItem(string id)
		{
			lock (locker) {
				var deleted = database.Delete (id).Result;
			}
		}

		public IEnumerable<TodoItem> GetItems ()
		{
{'fraction_non_alphanumeric': 0.10445526020217147, 'fraction_numerical': 0.0, 'mean_word_length': 4.746236559139785, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3007811', 'n_tokens_mistral': 965, 'n_tokens_neox': 844, 'n_words': 171}