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

Move shortcuts implementation into feature module #159

Merged
merged 1 commit into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ dependencies {
api project(':feature-users')
api project(':feature-settings')
api project(':feature-about')
api project(':feature-shortcuts')

implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Expand Down
13 changes: 0 additions & 13 deletions client/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,6 @@
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts"/>
</activity>
<activity android:name=".ui.ShortcutHandlerActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>

<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>

<data
android:host="github.com"
android:pathPattern="/.*"
android:scheme="clientgithubjraskacom"/>
</intent-filter>
</activity>
</application>

</manifest>
2 changes: 2 additions & 0 deletions client/src/main/java/com/jraska/github/client/AppComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.jraska.github.client.identity.IdentityModule
import com.jraska.github.client.logging.CrashReporter
import com.jraska.github.client.push.PushModule
import com.jraska.github.client.settings.SettingsModule
import com.jraska.github.client.shortcuts.ShortcutsModule
import com.jraska.github.client.users.UsersModule
import dagger.BindsInstance
import dagger.Component
Expand All @@ -26,6 +27,7 @@ import retrofit2.Retrofit
PushModule::class, AppModule::class,
SettingsModule::class, AboutModule::class,
IdentityModule::class,
ShortcutsModule::class,
HttpComponentModule::class, CoreComponentModule::class]
)
interface AppComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.jraska.github.client.core.android.LinkLauncher
import com.jraska.github.client.core.android.RealDeepLinkLauncher
import com.jraska.github.client.core.android.TopActivityProvider
import com.jraska.github.client.core.android.UriHandlerViewModel
import com.jraska.github.client.ui.ShortcutHandlerModel
import dagger.Module
import dagger.Provides
import dagger.multibindings.ClassKey
Expand Down Expand Up @@ -41,12 +40,4 @@ object NavigationModule {
fun uriHandlerViewModel(viewModel: UriHandlerViewModel): ViewModel {
return viewModel
}

@JvmStatic
@Provides
@IntoMap
@ClassKey(ShortcutHandlerModel::class)
fun uriShortcutViewModel(viewModel: ShortcutHandlerModel): ViewModel {
return viewModel
}
}
1 change: 1 addition & 0 deletions feature-shortcuts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
24 changes: 24 additions & 0 deletions feature-shortcuts/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
api project(':core')
api project(':core-android')

kapt 'com.google.dagger:dagger-compiler:2.24'
api 'com.google.dagger:dagger:2.24'
}
20 changes: 20 additions & 0 deletions feature-shortcuts/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jraska.github.client.shortcuts">

<application>
<activity android:name=".ShortcutHandlerActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>

<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>

<data
android:host="github.com"
android:pathPattern="/.*"
android:scheme="clientgithubjraskacom"/>
</intent-filter>
</activity>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.jraska.github.client.ui
package com.jraska.github.client.shortcuts

import android.os.Bundle
import com.jraska.github.client.core.android.BaseActivity
import com.jraska.github.client.core.android.inputUrl
import com.jraska.github.client.core.android.viewModel

class ShortcutHandlerActivity : BaseActivity() {
internal class ShortcutHandlerActivity : BaseActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jraska.github.client.ui
package com.jraska.github.client.shortcuts

import androidx.lifecycle.ViewModel
import com.jraska.github.client.DeepLinkHandler
Expand All @@ -9,7 +9,7 @@ import com.jraska.github.client.analytics.EventAnalytics
import okhttp3.HttpUrl
import javax.inject.Inject

class ShortcutHandlerModel @Inject constructor(
internal class ShortcutHandlerModel @Inject constructor(
private val deepLinkHandler: DeepLinkHandler,
private val eventAnalytics: EventAnalytics
) : ViewModel() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.jraska.github.client.shortcuts

import androidx.lifecycle.ViewModel
import dagger.Module
import dagger.Provides
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap

@Module
object ShortcutsModule {
@JvmStatic
@Provides
@IntoMap
@ClassKey(com.jraska.github.client.shortcuts.ShortcutHandlerModel::class)
internal fun uriShortcutViewModel(viewModel: ShortcutHandlerModel): ViewModel {
return viewModel
}
}
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ include ':client',
':feature-users',
':feature-push',
':feature-settings',
':feature-about'
':feature-about',
':feature-shortcuts'