mirror of
https://github.com/XFox111/GUTSchedule.git
synced 2026-04-22 06:58:01 +03:00
Added Internet permission, fixed release package crash (caused by invalid calendars retrieval), 30 minutes issue is not fixed (#FuckAndroid)
This commit is contained in:
@@ -70,7 +70,8 @@ namespace GUT.Schedule
|
||||
ActivityCompat.RequestPermissions(this, new[]
|
||||
{
|
||||
Manifest.Permission.ReadCalendar,
|
||||
Manifest.Permission.WriteCalendar
|
||||
Manifest.Permission.WriteCalendar,
|
||||
Manifest.Permission.Internet
|
||||
}, 76); // IDK why I need requestCode value to be set (instead of 76 there can be any other number. Anyway it doesn't affect anything)
|
||||
|
||||
private void ShowDialog()
|
||||
|
||||
@@ -3,7 +3,6 @@ using Android.App;
|
||||
using Android.Database;
|
||||
using Android.Net;
|
||||
using Android.Provider;
|
||||
using Android.Support.V4.Content;
|
||||
using GUT.Schedule.Models;
|
||||
using Java.Util;
|
||||
|
||||
@@ -34,8 +33,7 @@ namespace GUT.Schedule
|
||||
};
|
||||
|
||||
// Retrieving calendars data
|
||||
using CursorLoader loader = new CursorLoader(Application.Context, calendarsUri, calendarsProjection, null, null, null);
|
||||
ICursor cursor = (ICursor)loader.LoadInBackground();
|
||||
ICursor cursor = Application.Context.ContentResolver.Query(calendarsUri, calendarsProjection, null, null);
|
||||
|
||||
cursor.MoveToNext();
|
||||
for (int i = 0; i < cursor.Count; i++)
|
||||
@@ -75,14 +73,15 @@ namespace GUT.Schedule
|
||||
|
||||
eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, TimeZone.Default.ID);
|
||||
eventValues.Put(CalendarContract.Events.InterfaceConsts.EventEndTimezone, TimeZone.Default.ID);
|
||||
eventValues.Put(CalendarContract.Reminders.InterfaceConsts.CustomAppPackage, "bonch.schedule");
|
||||
|
||||
Uri response = Application.Context.ContentResolver.Insert(CalendarContract.Events.ContentUri, eventValues);
|
||||
|
||||
Android.Content.ContentValues reminderValues = new Android.Content.ContentValues();
|
||||
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.EventId, long.Parse(response.LastPathSegment));
|
||||
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Method, 1);
|
||||
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.CustomAppPackage, "bonch.schedule");
|
||||
|
||||
// Since Android fucks around and creates 30 minute reminder if I don't set any I just override that reminder with invalid one. Fuck Android!
|
||||
// Fuck Android!
|
||||
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Minutes, data.Reminder?.ToString());
|
||||
// P.S. I mean fuck Android!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user