Permalink
Browse files

reorganise libraries

  • Loading branch information...
kar committed Feb 16, 2018
1 parent cb99b03 commit 86dfed4da80025f94a741c2ae587c74920237e2f
Showing 307 changed files with 190 additions and 792 deletions.
View
@@ -1,6 +1,7 @@
*.iml
.gradle
/version.gradle
/paths.gradle
.idea
.DS_Store
*.aar
View
@@ -10,6 +10,7 @@ android {
targetSdkVersion 27
versionCode extVersionCode
versionName extVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -53,21 +54,39 @@ android {
}
dependencies {
// The UI Blokada library
implementation project(':libui')
// Core library for kar.gs projects
implementation project(':gscore')
// Android support libraries
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:design:27.0.2'
// Kotlin and its dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.github.salomonbrys.kodein:kodein:4.1.0'
implementation 'nl.komponents.kovenant:kovenant-core:3.3.0'
implementation 'nl.komponents.kovenant:kovenant-android:3.3.0'
// Proxy
implementation 'org.pcap4j:pcap4j-core:1.7.0'
implementation 'org.pcap4j:pcap4j-packetfactory-propertiesbased:1.7.0'
implementation 'dnsjava:dnsjava:2.1.8'
// UI libraries
implementation ('com.github.ozodrukh:CircularReveal:2.0.1@aar') {
transitive = true
}
// Analytics and debugging
firebaseImplementation 'com.google.firebase:firebase-core:11.8.0'
firebaseImplementation 'com.google.firebase:firebase-crash:11.8.0'
// Test dependencies
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
repositories {
View
@@ -29,4 +29,11 @@
-assumenosideeffects class org.slf4j.Logger {
public void debug(...);
public void trace(...);
}
}
# blokada
-keep class org.blokada.** { *; }
-keepclassmembers class * {
private <fields>;
}
@@ -4,6 +4,7 @@ import android.app.Application
import com.github.salomonbrys.kodein.Kodein
import com.github.salomonbrys.kodein.KodeinAware
import com.github.salomonbrys.kodein.lazy
import gs.environment.newGscoreModule
import org.blokada.app.newAppModule
import org.blokada.ui.app.android.newAndroidAppUiModule
import org.blokada.ui.app.newAppUiModule
@@ -13,6 +14,7 @@ import org.blokada.ui.app.newAppUiModule
*/
class MainApplication: Application(), KodeinAware {
override val kodein by Kodein.lazy {
import(newGscoreModule(this@MainApplication))
import(newAppModule())
import(newAndroidAppModule(this@MainApplication))
import(newAndroidAppDummyConfigModule())
@@ -4,7 +4,7 @@ import android.content.Context
import com.github.salomonbrys.kodein.instance
import org.blokada.app.android.FirebaseState
import org.blokada.framework.android.di
import org.blokada.lib.ui.R
import org.blokada.R
import org.blokada.ui.app.Dash
val DASH_ID_FIREBASE = "firebase_on"
@@ -32,4 +32,4 @@ class FirebaseDashOn(
checked = fState.enabled()
}
}
}
}
@@ -3,6 +3,13 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<application
android:name=".app.android.MainApplication"
android:allowBackup="true"
@@ -11,6 +18,72 @@
android:supportsRtl="true"
android:theme="@style/BlokadaColors.Main.NoActionBar"
tools:replace="android:label">
<activity
android:name="org.blokada.ui.app.android.MainActivity"
android:label="@string/branding_app_name"
android:launchMode="singleTask"
android:theme="@style/BlokadaColors.Main.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<service
android:name="org.blokada.ui.app.android.ANotificationsOffService">
</service>
<service
android:name="org.blokada.ui.app.android.ANotificationsWhitelistService">
</service>
<service
android:name="org.blokada.ui.app.android.AQuickSettingsService"
android:label="@string/main_quicksettings_toggle"
android:icon="@drawable/ic_blokada"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
<service
android:name="org.blokada.app.android.ATunnelService"
android:permission="android.permission.BIND_VPN_SERVICE">
<intent-filter>
<action android:name="android.net.VpnService"/>
</intent-filter>
</service>
<service
android:name="org.blokada.app.android.AKeepAliveService">
</service>
<receiver
android:name="org.blokada.app.android.ABootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<receiver
android:name="org.blokada.app.android.AConnectivityReceiver">
<intent-filter>
<action android:name="android.net.wifi.STATE_CHANGE"/>
<action android:name="android.net.wifi.WIFI_AP_STATE_CHANGED"/>
<action android:name="android.net.conn.TETHER_STATE_CHANGED"/>
</intent-filter>
</receiver>
<receiver
android:name="org.blokada.app.android.AScreenOnReceiver">
<intent-filter>
<action android:name="android.intent.action.SCREEN_ON"/>
<action android:name="org.blokada.keepAlive"/>
</intent-filter>
</receiver>
<receiver
android:name="org.blokada.app.android.ALocaleReceiver">
<intent-filter>
<action android:name="android.intent.action.LOCALE_CHANGED"/>
</intent-filter>
</receiver>
</application>
</manifest>
@@ -1,13 +1,14 @@
package org.blokada.app.android
import android.app.Activity
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.net.VpnService
import com.github.salomonbrys.kodein.Kodein
import com.github.salomonbrys.kodein.bind
import com.github.salomonbrys.kodein.instance
import com.github.salomonbrys.kodein.singleton
import com.github.salomonbrys.kodein.*
import gs.environment.AActivityProvider
import gs.property.Welcome
import gs.property.WelcomeImpl
import org.blokada.BuildConfig
import org.blokada.R
import org.blokada.app.*
@@ -39,8 +40,8 @@ fun newAndroidAppConfigModule(ctx: Context): Kodein.Module {
appName = ctx.getString(R.string.branding_app_name),
appVersion = BuildConfig.VERSION_NAME,
appVersionCode = BuildConfig.VERSION_CODE,
coreVersion = org.blokada.lib.BuildConfig.VERSION_NAME,
uiVersion = org.blokada.lib.ui.BuildConfig.VERSION_NAME
coreVersion = org.blokada.BuildConfig.VERSION_NAME,
uiVersion = org.blokada.BuildConfig.VERSION_NAME
) }
bind<TunnelConfig>(overrides = true) with singleton { TunnelConfig(defaultEngine = "lollipop") }
bind<List<Engine>>(overrides = true) with singleton { listOf(Engine(
@@ -72,5 +73,13 @@ fun newAndroidAppConfigModule(ctx: Context): Kodein.Module {
}
}
}
bind<Welcome>() with singleton {
val w = WelcomeImpl(w = with("welcome").instance(), xx = instance())
w.introUrl %= URL("http://blokada.org/content/en/contribute.html")
w.guideUrl %= URL("http://blokada.org/content/en/help.html")
w
}
bind<AActivityProvider<Activity>>() with singleton { AActivityProvider<Activity>() }
}
}
@@ -15,6 +15,12 @@ fun newAppModule(): Kodein.Module {
bind<KContext>() with multiton { it: String ->
newSingleThreadedKContext(j = instance(), prefix = it)
}
bind<KContext>(2) with multiton { it: String ->
newSingleThreadedKContext(j = instance(), prefix = it)
}
bind<KContext>(3) with multiton { it: String ->
newSingleThreadedKContext(j = instance(), prefix = it)
}
bind<KContext>(10) with multiton { it: String ->
newConcurrentKContext(j = instance(), prefix = it, tasks = 1)
}
@@ -19,27 +19,6 @@ import org.blokada.framework.android.AEnvironment
fun newAndroidAppModule(ctx: Context): Kodein.Module {
return Kodein.Module {
// Android components for easier access
bind<Context>() with singleton { ctx }
bind<ConnectivityManager>() with singleton {
ctx.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
}
bind<WifiManager>() with singleton {
ctx.getSystemService(Context.WIFI_SERVICE) as WifiManager
}
bind<DownloadManager>() with singleton {
ctx.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
}
bind<AlarmManager>() with singleton {
ctx.getSystemService(Context.ALARM_SERVICE) as AlarmManager
}
bind<NotificationManager>() with singleton {
ctx.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
}
bind<PowerManager>() with singleton {
ctx.getSystemService(Context.POWER_SERVICE) as PowerManager
}
// The main state
bind<State>() with singleton {
AState(ctx, kctx = with("state").instance(10))
@@ -10,7 +10,7 @@ import org.blokada.framework.IEnvironment
import org.blokada.framework.IJournal
import org.blokada.framework.IWhen
import org.blokada.framework.android.AActivityContext
import org.blokada.lib.ui.R
import org.blokada.R
import org.blokada.ui.app.Info
import org.blokada.ui.app.InfoType
import org.blokada.ui.app.UiState
@@ -8,7 +8,7 @@ import org.blokada.app.android.FilterSourceApp
import org.blokada.app.android.FilterSourceLink
import org.blokada.app.android.FilterSourceUri
import org.blokada.framework.IEnvironment
import org.blokada.lib.ui.R
import org.blokada.R
import java.util.*
@@ -2,7 +2,7 @@ package org.blokada.ui.app.android
import android.content.Context
import android.util.AttributeSet
import org.blokada.lib.ui.R
import org.blokada.R
import org.blokada.ui.framework.android.doAfter
@@ -8,7 +8,7 @@ import android.view.ViewGroup
import com.github.salomonbrys.kodein.instance
import org.blokada.app.Events
import org.blokada.framework.IJournal
import org.blokada.lib.ui.R
import org.blokada.R
import org.blokada.app.State
import org.blokada.framework.android.di
@@ -4,7 +4,7 @@ import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.github.salomonbrys.kodein.instance
import org.blokada.lib.ui.R
import org.blokada.R
import org.blokada.framework.android.AActivityContext
import org.blokada.app.State
import org.blokada.framework.android.di
@@ -5,7 +5,7 @@ import android.support.v7.widget.StaggeredGridLayoutManager
import android.widget.FrameLayout
import android.content.Context
import android.util.AttributeSet
import org.blokada.lib.ui.R
import org.blokada.R
import org.blokada.ui.framework.android.Spacing
class AEngineGridView(
@@ -8,7 +8,7 @@ import org.blokada.framework.IJournal
import org.blokada.app.IEnabledStateActorListener
import org.blokada.app.State
import org.blokada.framework.android.di
import org.blokada.lib.ui.R
import org.blokada.R
/**
*
@@ -10,7 +10,7 @@ import org.blokada.app.FilterSourceSingle
import org.blokada.app.State
import org.blokada.app.android.FilterSourceApp
import org.blokada.framework.android.di
import org.blokada.lib.ui.R
import org.blokada.R
class AFilterActor(
@@ -88,4 +88,4 @@ class AFilterActor(
}
}
}
}
}
@@ -13,7 +13,7 @@ import org.blokada.framework.android.AActivityContext
import org.blokada.app.android.FilterSourceLink
import org.blokada.app.android.FilterSourceUri
import org.blokada.app.Filter
import org.blokada.lib.ui.R
import org.blokada.R
import org.blokada.framework.nullIfEmpty
import org.blokada.app.FilterSourceSingle
import org.blokada.app.IFilterSource
@@ -7,7 +7,7 @@ import com.github.salomonbrys.kodein.instance
import com.github.salomonbrys.kodein.provider
import com.github.salomonbrys.kodein.with
import nl.komponents.kovenant.task
import org.blokada.lib.ui.R
import org.blokada.R
import org.blokada.framework.android.AActivityContext
import org.blokada.app.Filter
import org.blokada.app.State
@@ -11,7 +11,7 @@ import org.blokada.app.LocalisedFilter
import org.blokada.app.State
import org.blokada.framework.android.AActivityContext
import org.blokada.framework.android.di
import org.blokada.lib.ui.R
import org.blokada.R
class AFilterGenerateDialog(
private val ctx: Context,
@@ -2,7 +2,7 @@ package org.blokada.ui.app.android
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.StaggeredGridLayoutManager
import org.blokada.lib.ui.R
import org.blokada.R
import org.blokada.app.Filter
import org.blokada.ui.framework.android.Spacing
import android.util.AttributeSet
@@ -12,7 +12,7 @@ import android.view.animation.AccelerateDecelerateInterpolator
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import org.blokada.lib.ui.R
import org.blokada.R
import org.blokada.ui.framework.android.doAfter
Oops, something went wrong.

0 comments on commit 86dfed4

Please sign in to comment.