Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite dependency injection to use Dagger #214

Merged
merged 26 commits into from Dec 29, 2019
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
da8cade
Add Dagger dependencies
msfjarvis Dec 18, 2019
52f2d07
Add AppComponent and InjectorProvider
msfjarvis Dec 28, 2019
5612393
AppComponent: Remove JvmStatic annotation
msfjarvis Dec 19, 2019
8d297f5
Annotate class constructors with Inject@
msfjarvis Dec 28, 2019
b077c80
Remove provided definitions that are unneeded
msfjarvis Dec 28, 2019
ca5dfdc
Remove useless qualifier
msfjarvis Dec 28, 2019
1050e2c
Annotate classes with Reusable
msfjarvis Dec 28, 2019
7af43ef
Start using Dagger for some injection
msfjarvis Dec 29, 2019
9eb5325
Cleanup injection in Tunnel and TunnelManager
msfjarvis Dec 29, 2019
3108ecd
Migrate fragments to Dagger
msfjarvis Dec 29, 2019
b8d4db3
Migrate activities to Dagger
msfjarvis Dec 29, 2019
35c6a2a
Migrate preferences to Dagger
msfjarvis Dec 29, 2019
b78b8e5
Migrate contentproviders to Dagger
msfjarvis Dec 29, 2019
f04e5e1
Update Detekt baseline
msfjarvis Dec 29, 2019
8cec1a8
Update detekt
msfjarvis Dec 29, 2019
b08f384
Migrate services and broadcastreceivers to Dagger
msfjarvis Dec 29, 2019
e23f878
Migrate TunnelRestoreWorker to Dagger
msfjarvis Dec 29, 2019
9b7e809
Remove all unused Koin extensions
msfjarvis Dec 29, 2019
3ac858d
Unpair config package from android dependencies
msfjarvis Dec 29, 2019
daabc64
Remove Koin from ConfigTest
msfjarvis Dec 29, 2019
9d576ea
Wire exclusions directly into WgQuickBackend
msfjarvis Dec 29, 2019
a463f9f
Fix and use Backend factory in AppComponent
msfjarvis Dec 29, 2019
40b0d15
Remove Koin from ConfigStoreTest
msfjarvis Dec 29, 2019
fc54ec6
Cleanup Koin remanants
msfjarvis Dec 29, 2019
c34e0f9
Remove Koin dependencies
msfjarvis Dec 29, 2019
ce4f753
Remove leftover KoinComponent
msfjarvis Dec 29, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Cleanup Koin remanants

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
  • Loading branch information
msfjarvis committed Dec 29, 2019
commit fc54ec6bb8e99ec639c6617765e814e12d91ea1a
@@ -7,18 +7,16 @@ package com.wireguard.android

import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.os.Build
import android.os.StrictMode
import androidx.annotation.RequiresApi
import androidx.core.content.getSystemService
import com.wireguard.android.di.AppComponent
import com.wireguard.android.di.DaggerAppComponent
import com.wireguard.android.di.InjectorProvider
import com.wireguard.android.di.appModule
import com.wireguard.android.model.TunnelManager
import com.wireguard.android.util.updateAppTheme
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin
import timber.log.Timber

@Suppress("Unused")
@@ -46,11 +44,7 @@ class Application : android.app.Application(), InjectorProvider {

override fun onCreate() {
super.onCreate()

startKoin {
androidContext(this@Application)
modules(appModule)
}
INSTANCE = this

if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
@@ -67,4 +61,8 @@ class Application : android.app.Application(), InjectorProvider {
createNotificationChannel()
}
}

companion object {
lateinit var INSTANCE: Context
}
}

This file was deleted.

This file was deleted.

This file was deleted.

@@ -6,8 +6,8 @@
package com.wireguard.android.util

import android.content.res.Resources
import com.wireguard.android.Application
import com.wireguard.android.R
import com.wireguard.android.di.ext.getContext
import com.wireguard.config.BadConfigException
import com.wireguard.config.BadConfigException.Reason
import com.wireguard.config.InetEndpoint
@@ -51,7 +51,7 @@ object ErrorMessages : KoinComponent {
)

operator fun get(throwable: Throwable?): String {
val resources = getContext().resources
val resources = Application.INSTANCE.resources
if (throwable == null) {
return resources.getString(R.string.unknown_error)
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.