diff --git a/app/build.gradle b/app/build.gradle index 9e58d7055..f0b6ca817 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.11.2' + implementation 'com.simplemobiletools:commons:3.12.5' implementation 'joda-time:joda-time:2.9.9' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.android.support:multidex:1.0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt index 41c540e9e..f7fb1815b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt @@ -8,9 +8,8 @@ import com.simplemobiletools.calendar.dialogs.CustomEventRepeatIntervalDialog import com.simplemobiletools.calendar.helpers.* import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.dialogs.RadioGroupDialog -import com.simplemobiletools.commons.extensions.getFilePublicUri import com.simplemobiletools.commons.extensions.hideKeyboard -import com.simplemobiletools.commons.extensions.shareUri +import com.simplemobiletools.commons.extensions.sharePathIntent import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.models.RadioItem import java.io.File @@ -27,8 +26,7 @@ fun BaseSimpleActivity.shareEvents(ids: List) { val events = dbHelper.getEventsWithIds(ids) IcsExporter().exportEvents(this, file, events) { if (it == IcsExporter.ExportResult.EXPORT_OK) { - val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID) - shareUri(uri, BuildConfig.APPLICATION_ID) + sharePathIntent(file.absolutePath, BuildConfig.APPLICATION_ID) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt index f40001cbe..99ae0a221 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt @@ -226,9 +226,9 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont } fun update(event: Event, updateAtCalDAV: Boolean, callback: (() -> Unit)? = null) { - val selectionArgs = arrayOf(event.id.toString()) val values = fillEventValues(event) val selection = "$COL_ID = ?" + val selectionArgs = arrayOf(event.id.toString()) mDb.update(MAIN_TABLE_NAME, values, selection, selectionArgs) if (event.repeatInterval == 0) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsExporter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsExporter.kt index ced60e82e..b5f72072b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsExporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsExporter.kt @@ -6,6 +6,7 @@ import com.simplemobiletools.calendar.models.Event import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.extensions.getFileOutputStream import com.simplemobiletools.commons.extensions.writeLn +import com.simplemobiletools.commons.models.FileDirItem import java.io.BufferedWriter import java.io.File @@ -18,7 +19,8 @@ class IcsExporter { private var eventsFailed = 0 fun exportEvents(activity: BaseSimpleActivity, file: File, events: ArrayList, callback: (result: ExportResult) -> Unit) { - activity.getFileOutputStream(file) { + val fileDirItem = FileDirItem(file.absolutePath, file.name) + activity.getFileOutputStream(fileDirItem) { if (it == null) { callback(EXPORT_FAIL) return@getFileOutputStream