Loading app/core/src/main/java/com/fsck/k9/Clock.javadeleted 100644 → 0 +0 −32 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.fsck.k9; /** * A class provide the current time (like {@link System#currentTimeMillis()}). * It's intended to be mocked out for unit tests. */ public class Clock { public static final Clock INSTANCE = new Clock(); protected Clock() { } public long getTime() { return System.currentTimeMillis(); } } app/core/src/main/java/com/fsck/k9/Clock.kt 0 → 100644 +14 −0 Original line number Diff line number Diff line package com.fsck.k9 /*** * An interface to provide the current time. */ interface Clock { val time: Long } internal class RealClock : Clock { override val time: Long get() = System.currentTimeMillis() } No newline at end of file app/core/src/main/java/com/fsck/k9/K9.kt +2 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,8 @@ object K9 : EarlyInit { return false } val quietTimeChecker = QuietTimeChecker(Clock.INSTANCE, quietTimeStarts, quietTimeEnds) val clock = DI.get<Clock>() val quietTimeChecker = QuietTimeChecker(clock, quietTimeStarts, quietTimeEnds)) return quietTimeChecker.isQuietTime } Loading app/core/src/main/java/com/fsck/k9/KoinModule.kt +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ val mainModule = module { single { TrustManagerFactory.createInstance(get()) } single { LocalKeyStoreManager(get()) } single<TrustedSocketFactory> { DefaultTrustedSocketFactory(get(), get()) } single { Clock.INSTANCE } single<Clock> { RealClock() } factory { ServerNameSuggester() } factory { EmailAddressValidator() } factory { ServerSettingsSerializer() } Loading app/core/src/main/java/com/fsck/k9/job/KoinModule.kt +2 −2 Original line number Diff line number Diff line Loading @@ -9,5 +9,5 @@ val jobModule = module { single<WorkerFactory> { K9WorkerFactory(get(), get()) } single { get<WorkManagerProvider>().getWorkManager() } single { K9JobManager(get(), get(), get()) } factory { MailSyncWorkerManager(get(), Clock.INSTANCE) } factory { MailSyncWorkerManager(workManager = get(), clock = get()) } } No newline at end of file Loading
app/core/src/main/java/com/fsck/k9/Clock.javadeleted 100644 → 0 +0 −32 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.fsck.k9; /** * A class provide the current time (like {@link System#currentTimeMillis()}). * It's intended to be mocked out for unit tests. */ public class Clock { public static final Clock INSTANCE = new Clock(); protected Clock() { } public long getTime() { return System.currentTimeMillis(); } }
app/core/src/main/java/com/fsck/k9/Clock.kt 0 → 100644 +14 −0 Original line number Diff line number Diff line package com.fsck.k9 /*** * An interface to provide the current time. */ interface Clock { val time: Long } internal class RealClock : Clock { override val time: Long get() = System.currentTimeMillis() } No newline at end of file
app/core/src/main/java/com/fsck/k9/K9.kt +2 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,8 @@ object K9 : EarlyInit { return false } val quietTimeChecker = QuietTimeChecker(Clock.INSTANCE, quietTimeStarts, quietTimeEnds) val clock = DI.get<Clock>() val quietTimeChecker = QuietTimeChecker(clock, quietTimeStarts, quietTimeEnds)) return quietTimeChecker.isQuietTime } Loading
app/core/src/main/java/com/fsck/k9/KoinModule.kt +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ val mainModule = module { single { TrustManagerFactory.createInstance(get()) } single { LocalKeyStoreManager(get()) } single<TrustedSocketFactory> { DefaultTrustedSocketFactory(get(), get()) } single { Clock.INSTANCE } single<Clock> { RealClock() } factory { ServerNameSuggester() } factory { EmailAddressValidator() } factory { ServerSettingsSerializer() } Loading
app/core/src/main/java/com/fsck/k9/job/KoinModule.kt +2 −2 Original line number Diff line number Diff line Loading @@ -9,5 +9,5 @@ val jobModule = module { single<WorkerFactory> { K9WorkerFactory(get(), get()) } single { get<WorkManagerProvider>().getWorkManager() } single { K9JobManager(get(), get(), get()) } factory { MailSyncWorkerManager(get(), Clock.INSTANCE) } factory { MailSyncWorkerManager(workManager = get(), clock = get()) } } No newline at end of file