Skip to content

Commit

Permalink
Fix Console module
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsenoid committed Jan 10, 2017
1 parent 171607a commit e3403cd
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 5 deletions.
25 changes: 20 additions & 5 deletions console/src/main/java/com/mirhoseini/marvel/ConsoleModule.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.mirhoseini.marvel;

import com.mirhoseini.marvel.util.ConsoleConstants;
import com.mirhoseini.marvel.util.ConsoleSchedulerProvider;
import com.mirhoseini.marvel.util.Constants;
import com.mirhoseini.marvel.util.SchedulerProvider;
import com.mirhoseini.marvel.util.StateManager;
import com.mirhoseini.marvel.util.StateManagerImpl;

import java.io.File;

Expand Down Expand Up @@ -31,13 +34,13 @@ boolean provideIsDebug() {
@Singleton
@Named("networkTimeoutInSeconds")
int provideNetworkTimeoutInSeconds() {
return Constants.NETWORK_CONNECTION_TIMEOUT;
return ConsoleConstants.NETWORK_CONNECTION_TIMEOUT;
}

@Provides
@Singleton
HttpUrl provideEndpoint() {
return HttpUrl.parse(Constants.BASE_URL);
return HttpUrl.parse(ConsoleConstants.BASE_URL);
}

@Provides
Expand All @@ -50,21 +53,28 @@ SchedulerProvider provideAppScheduler() {
@Singleton
@Named("cacheSize")
long provideCacheSize() {
return Constants.CACHE_SIZE;
return ConsoleConstants.CACHE_SIZE;
}

@Provides
@Singleton
@Named("cacheMaxAge")
int provideCacheMaxAgeMinutes() {
return Constants.CACHE_MAX_AGE;
return ConsoleConstants.CACHE_MAX_AGE;
}

@Provides
@Singleton
@Named("cacheMaxStale")
int provideCacheMaxStaleDays() {
return Constants.CACHE_MAX_STALE;
return ConsoleConstants.CACHE_MAX_STALE;
}

@Provides
@Singleton
@Named("retryCount")
public int provideApiRetryCount() {
return ConsoleConstants.API_RETRY_COUNT;
}

@Provides
Expand All @@ -80,4 +90,9 @@ boolean provideIsConnect() {
return true;
}

@Provides
@Singleton
public StateManager provideStateManager(StateManagerImpl stateManager) {
return stateManager;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.mirhoseini.marvel.util;

/**
* Created by Mohsen on 10/01/2017.
*/
public class ConsoleConstants extends Constants {

public static final int API_RETRY_COUNT = 3;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2016 Karina Inc.
*
* 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.mirhoseini.marvel.util;

import javax.inject.Inject;

/**
* Created by Mohsen on 06/11/2016.
*/

public class StateManagerImpl implements StateManager {


@Inject
public StateManagerImpl() {

}

@Override
public boolean isConnect() {
return true;
}
}

0 comments on commit e3403cd

Please sign in to comment.