Skip to content

Commit

Permalink
Merge pull request #155 from orgzly-revived/release-1.8.15
Browse files Browse the repository at this point in the history
Release 1.8.15
  • Loading branch information
amberin authored Feb 8, 2024
2 parents 1591bb6 + d28886b commit 9241d43
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 24 deletions.
17 changes: 9 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,30 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'


android {
namespace 'com.orgzly'

compileSdkVersion 32

defaultConfig {
def application_id = "com.orgzlyrevived"
minSdkVersion 21 // Lollipop (5.0)
targetSdkVersion 32 // Android 12L
applicationId "com.orgzlyrevived"
versionCode 183
versionName "1.8.14"
versionCode 188
versionName "1.8.15"
applicationId application_id

testInstrumentationRunner "com.orgzly.android.OrgzlyTestRunner"
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

multiDexEnabled true

buildConfigField "String", "DROPBOX_APP_KEY", gradle.ext.appProperties.getProperty("dropbox.app_key", '""')

resValue "string", "dropbox_app_key_schema", gradle.ext.appProperties.getProperty("dropbox.app_key_schema", '')

resValue "string", "application_id", application_id

javaCompileOptions {
annotationProcessorOptions {
arguments = [
Expand Down Expand Up @@ -183,10 +186,8 @@ dependencies {
exclude group: 'xpp3', module: 'xpp3'
}

constraints {
implementation('com.squareup.okhttp3:okhttp:4.10.0-RC1') {
because 'https://github.com/orgzly/orgzly-android/issues/880'
}
implementation('com.squareup.okhttp3:okhttp:4.10.0-RC1') {
because 'https://github.com/orgzly/orgzly-android/issues/880'
}

implementation "io.github.rburgst:okhttp-digest:$versions.okhttp_digest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import kotlinx.coroutines.flow.Flow
interface AppLogsRepository {
fun log(type: String, str: String)

fun getFlow(type: String): Flow<List<LogEntry>>
fun getFlow(): Flow<List<LogEntry>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class DatabaseAppLogsRepository @Inject constructor(db: OrgzlyDatabase) : AppLog
dbAppLog.insert(entry)
}

override fun getFlow(type: String): Flow<List<LogEntry>> {
return dbAppLog.getFlow(type).map { logEntries ->
override fun getFlow(): Flow<List<LogEntry>> {
return dbAppLog.getFlow().map { logEntries ->
logEntries.map { entry ->
LogEntry(entry.timestamp, entry.name, entry.message)
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/orgzly/android/db/dao/AppLogDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import kotlinx.coroutines.flow.Flow

@Dao
abstract class AppLogDao : BaseDao<AppLog> {
@Query("SELECT * FROM app_logs WHERE name = :name ORDER BY timestamp")
abstract fun getFlow(name: String): Flow<List<AppLog>>
@Query("SELECT * FROM app_logs ORDER BY timestamp")
abstract fun getFlow(): Flow<List<AppLog>>
}
24 changes: 21 additions & 3 deletions app/src/main/java/com/orgzly/android/sync/SyncWorker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import com.orgzly.R
import com.orgzly.android.App
import com.orgzly.android.SharingShortcutsManager
import com.orgzly.android.data.DataRepository
import com.orgzly.android.data.logs.AppLogsRepository
import com.orgzly.android.db.entity.BookAction
import com.orgzly.android.prefs.AppPreferences
import com.orgzly.android.reminders.RemindersScheduler
import com.orgzly.android.repos.*
import com.orgzly.android.ui.notifications.SyncNotifications
import com.orgzly.android.ui.util.haveNetworkConnection
import com.orgzly.android.util.AppPermissions
import com.orgzly.android.util.LogMajorEvents
import com.orgzly.android.util.LogUtils
import com.orgzly.android.widgets.ListWidgetProvider
import kotlinx.coroutines.Dispatchers
Expand All @@ -29,6 +31,9 @@ class SyncWorker(val context: Context, val params: WorkerParameters) :
@Inject
lateinit var dataRepository: DataRepository

@Inject
lateinit var appLogs: AppLogsRepository

override suspend fun doWork(): Result {
App.appComponent.inject(this)

Expand Down Expand Up @@ -84,15 +89,28 @@ class SyncWorker(val context: Context, val params: WorkerParameters) :

checkConditions()?.let { return it }

val syncStartTime = System.currentTimeMillis()

syncRepos()?.let { return it }

RemindersScheduler.notifyDataSetChanged(App.getAppContext())
ListWidgetProvider.notifyDataSetChanged(App.getAppContext())
SharingShortcutsManager().replaceDynamicShortcuts(App.getAppContext())

val syncEndTime = System.currentTimeMillis()

// Save last successful sync time to preferences
val time = System.currentTimeMillis()
AppPreferences.lastSuccessfulSyncTime(context, time)
AppPreferences.lastSuccessfulSyncTime(context, syncEndTime)

if (LogMajorEvents.isEnabled()) {
val syncDuration = (syncEndTime - syncStartTime)
val numberOfRepos = dataRepository.getRepos().size
val numberOfBooks = dataRepository.getBooks().size
appLogs.log(
LogMajorEvents.SYNC,
"Sync took $syncDuration milliseconds. Synced $numberOfBooks books in $numberOfRepos repos."
)
}

return SyncState.getInstance(SyncState.Type.FINISHED)
}
Expand Down Expand Up @@ -275,4 +293,4 @@ class SyncWorker(val context: Context, val params: WorkerParameters) :
companion object {
private val TAG: String = SyncWorker::class.java.name
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.orgzly.android.ui.util.getAlarmManager
import com.orgzly.android.ui.util.sharePlainText
import com.orgzly.android.ui.util.userFriendlyPeriod
import com.orgzly.databinding.ActivityLogsBinding
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import org.joda.time.DateTime
import javax.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import kotlinx.coroutines.flow.map
import java.util.*

class AppLogsViewModel(appLogsRepository: AppLogsRepository) : CommonViewModel() {
val logs = appLogsRepository.getFlow(LogMajorEvents.REMINDERS).map {
val logs = appLogsRepository.getFlow().map {
it.map { logEntry ->
val date = Date(logEntry.time)
val type = logEntry.type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class LogMajorEvents {
companion object {

const val REMINDERS = "reminders"
const val SYNC = "sync"

fun isEnabled(): Boolean {
return AppPreferences.logMajorEvents(App.getAppContext())
Expand Down
25 changes: 25 additions & 0 deletions app/src/main/res/layout/dialog_whats_new.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,31 @@
android:layout_height="wrap_content" />


<TextView
style="@style/WhatsNewVersion"
android:text="v1.8.15"
tools:ignore="HardcodedText" />

<com.orgzly.android.ui.views.WhatsNewChange
style="@style/WhatsNewChange"
app:text="Log sync events to major events app log" />

<com.orgzly.android.ui.views.WhatsNewChange
style="@style/WhatsNewChange"
app:text="Removed forced Light theme for splash screen" />

<com.orgzly.android.ui.views.WhatsNewChange
style="@style/WhatsNewChange"
app:text="Turkish translation updated" />

<com.orgzly.android.ui.views.WhatsNewChange
style="@style/WhatsNewChange"
app:text="Disable Git repos below API 24" />

<com.orgzly.android.ui.views.WhatsNewChange
style="@style/WhatsNewChange"
app:text="Add a public receiver for Tasker, Automate, etc." />

<TextView
style="@style/WhatsNewVersion"
android:text="v1.8.14"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-tr-rTR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@
<string name="git_verifying_settings">Depo ayarlarının çalışacağından emin ol.</string>
<string name="git_url_hint">Uzak Bağlantı (örn. [email protected]:orgzly/orgzly-android.git)</string>
<string name="git_directory_hint">Dizin konumu (örn. \"/sdcard/orgzly\")</string>
<string name="git_ssh_key_hint">SSH anahtar konumu (örn. \"/sdcard/id_rsa\")</string>
<string name="git_https_username_hint">Kullanıcı adı</string>
<string name="git_https_password_hint">Parola</string>
<string name="git_author_hint">Yazar (örn. Sarı Çizmeli Mehmet)</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/prefs_screen_developer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
android:title="@string/logs">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.orgzlyrevived"
android:targetPackage="@string/application_id"
android:targetClass="com.orgzly.android.ui.logs.AppLogsActivity"/>
</Preference>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/prefs_screen_reminders.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
android:summary="@string/notification_channel_settings_summary">
<intent android:action="android.settings.CHANNEL_NOTIFICATION_SETTINGS">
<extra android:name="android.provider.extra.CHANNEL_ID" android:value="reminders" />
<extra android:name="android.provider.extra.APP_PACKAGE" android:value="com.orgzlyrevived" />
<extra android:name="android.provider.extra.APP_PACKAGE" android:value="@string/application_id" />
</intent>
</androidx.preference.PreferenceScreen>

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/xml/prefs_screen_sync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:summary="@string/repos_preference_summary">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.orgzlyrevived"
android:targetPackage="@string/application_id"
android:targetClass="com.orgzly.android.ui.repos.ReposActivity"/>
</Preference>

Expand All @@ -27,7 +27,7 @@
android:summary="@string/ssh_keygen_preference_summary">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.orgzlyrevived"
android:targetPackage="@string/application_id"
android:targetClass="com.orgzly.android.ui.SshKeygenActivity"/>
</Preference>

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/xml/shortcuts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
android:shortcutShortLabel="@string/new_note">
<intent
android:action="android.intent.action.SEND"
android:targetPackage="com.orgzlyrevived"
android:targetPackage="@string/application_id"
android:targetClass="com.orgzly.android.ui.share.ShareActivity" />
</shortcut>

Expand All @@ -23,7 +23,7 @@
android:shortcutShortLabel="@string/sync">
<intent
android:action="com.orgzly.intent.action.SYNC_START"
android:targetPackage="com.orgzlyrevived"
android:targetPackage="@string/application_id"
android:targetClass="com.orgzly.android.ui.SyncShortcutActivity" />
</shortcut>

Expand Down

0 comments on commit 9241d43

Please sign in to comment.