// Path: app/src/main/java/com/icecream/snorlax/common/rx/RxBus.java
// @SuppressWarnings({"unused", "WeakerAccess", "FieldCanBeLocal"})
// public final class RxBus {
// 
// 	private static volatile RxBus sInstance = null;
// 
// 	public static RxBus getInstance() {
// 		if (sInstance == null) {
// 			synchronized (RxBus.class) {
// 				if (sInstance == null) {
// 					sInstance = new RxBus();
// 				}
// 			}
// 		}
// 		return sInstance;
// 	}
// 
// 	private final SerializedRelay<Object, Object> mSubject;
// 
// 	private RxBus() {
// 		mSubject = PublishRelay.create().toSerialized();
// 	}
// 
// 	public void post(Object event) {
// 		mSubject.call(event);
// 	}
// 
// 	public <T> Subscription receive(final Class<T> klass, Action1<T> onNext) {
// 		return receive(klass).subscribe(onNext);
// 	}
// 
// 	public <T> Observable<T> receive(final Class<T> klass) {
// 		return receive().ofType(klass);
// 	}
// 
// 	public Observable<Object> receive() {
// 		return mSubject;
// 	}
// }
// 
// Path: app/src/main/java/com/icecream/snorlax/module/feature/mitm/MitmRelay.java
// public final class MitmRelay {
// 
// 	private static volatile MitmRelay sInstance = null;
// 
// 	public static MitmRelay getInstance() {
// 		if (sInstance == null) {
// 			synchronized (MitmRelay.class) {
// 				if (sInstance == null) {
// 					sInstance = new MitmRelay();
// 				}
// 			}
// 		}
// 		return sInstance;
// 	}
// 
// 	private final SerializedRelay<RequestEnvelope, RequestEnvelope> mRelayRequest;
// 	private final SerializedRelay<ResponseEnvelope, ResponseEnvelope> mRelayResponse;
// 	private final Observable<MitmEnvelope> mEnvelope;
// 
// 	private MitmRelay() {
// 		mRelayRequest = PublishRelay.<RequestEnvelope>create().toSerialized();
// 		mRelayResponse = PublishRelay.<ResponseEnvelope>create().toSerialized();
// 
// 		mEnvelope = Observable
// 			.fromEmitter(emitter -> mRelayRequest.asObservable().subscribe(emitter::onNext), Emitter.BackpressureMode.BUFFER)
// 			.cast(RequestEnvelope.class)
// 			.flatMap(request -> Observable
// 				.fromEmitter(emitter -> mRelayResponse.asObservable().subscribe(emitter::onNext), Emitter.BackpressureMode.BUFFER)
// 				.cast(ResponseEnvelope.class)
// 				.filter(response -> Objects.equals(request.getRequestId(), response.getRequestId()))
// 				.map(response -> MitmEnvelope.create(request, response))
// 			)
// 			.share();
// 	}
// 
// 	void call(RequestEnvelope envelope) {
// 		mRelayRequest.call(envelope);
// 	}
// 
// 	void call(ResponseEnvelope envelope) {
// 		mRelayResponse.call(envelope);
// 	}
// 
// 	public Observable<MitmEnvelope> getObservable() {
// 		return mEnvelope;
// 	}
// }


import static POGOProtos.Networking.Requests.RequestOuterClass.Request;
import java.util.List;
import javax.inject.Singleton;
import android.app.Application;
import android.util.LongSparseArray;
import com.icecream.snorlax.common.rx.RxBus;
import com.icecream.snorlax.module.feature.mitm.MitmRelay;
import dagger.Module;
import dagger.Provides;
import de.robv.android.xposed.XSharedPreferences;
/*
 * Copyright (c) 2016. Pedro Diaz <igoticecream@gmail.com>
 *
 * 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.icecream.snorlax.module;







@Module
final class SnorlaxModule {

	private final Application mApplication;
	private final ClassLoader mClassLoader;
	private final XSharedPreferences mXSharedPreferences;

	SnorlaxModule(Application application, ClassLoader classLoader, XSharedPreferences xSharedPreferences) {
		mApplication = application;
		mClassLoader = classLoader;
		mXSharedPreferences = xSharedPreferences;
	}

	@Provides
	ClassLoader provideClassLoader() {
		return mClassLoader;
	}

	@Provides
	XSharedPreferences provideXSharedPreferences() {
		return mXSharedPreferences;
	}

	@Provides
	Application provideAppliction() {
		return mApplication;
	}

	@Provides
	@Singleton
// Path: app/src/main/java/com/icecream/snorlax/common/rx/RxBus.java
// @SuppressWarnings({"unused", "WeakerAccess", "FieldCanBeLocal"})
// public final class RxBus {
// 
// 	private static volatile RxBus sInstance = null;
// 
// 	public static RxBus getInstance() {
// 		if (sInstance == null) {
// 			synchronized (RxBus.class) {
// 				if (sInstance == null) {
// 					sInstance = new RxBus();
// 				}
// 			}
// 		}
// 		return sInstance;
// 	}
// 
// 	private final SerializedRelay<Object, Object> mSubject;
// 
// 	private RxBus() {
// 		mSubject = PublishRelay.create().toSerialized();
// 	}
// 
// 	public void post(Object event) {
// 		mSubject.call(event);
// 	}
// 
// 	public <T> Subscription receive(final Class<T> klass, Action1<T> onNext) {
// 		return receive(klass).subscribe(onNext);
// 	}
// 
// 	public <T> Observable<T> receive(final Class<T> klass) {
// 		return receive().ofType(klass);
// 	}
// 
// 	public Observable<Object> receive() {
// 		return mSubject;
// 	}
// }
// 
// Path: app/src/main/java/com/icecream/snorlax/module/feature/mitm/MitmRelay.java
// public final class MitmRelay {
// 
// 	private static volatile MitmRelay sInstance = null;
// 
// 	public static MitmRelay getInstance() {
// 		if (sInstance == null) {
// 			synchronized (MitmRelay.class) {
// 				if (sInstance == null) {
// 					sInstance = new MitmRelay();
// 				}
// 			}
// 		}
// 		return sInstance;
// 	}
// 
// 	private final SerializedRelay<RequestEnvelope, RequestEnvelope> mRelayRequest;
// 	private final SerializedRelay<ResponseEnvelope, ResponseEnvelope> mRelayResponse;
// 	private final Observable<MitmEnvelope> mEnvelope;
// 
// 	private MitmRelay() {
// 		mRelayRequest = PublishRelay.<RequestEnvelope>create().toSerialized();
// 		mRelayResponse = PublishRelay.<ResponseEnvelope>create().toSerialized();
// 
// 		mEnvelope = Observable
// 			.fromEmitter(emitter -> mRelayRequest.asObservable().subscribe(emitter::onNext), Emitter.BackpressureMode.BUFFER)
// 			.cast(RequestEnvelope.class)
// 			.flatMap(request -> Observable
// 				.fromEmitter(emitter -> mRelayResponse.asObservable().subscribe(emitter::onNext), Emitter.BackpressureMode.BUFFER)
// 				.cast(ResponseEnvelope.class)
// 				.filter(response -> Objects.equals(request.getRequestId(), response.getRequestId()))
// 				.map(response -> MitmEnvelope.create(request, response))
// 			)
// 			.share();
// 	}
// 
// 	void call(RequestEnvelope envelope) {
// 		mRelayRequest.call(envelope);
// 	}
// 
// 	void call(ResponseEnvelope envelope) {
// 		mRelayResponse.call(envelope);
// 	}
// 
// 	public Observable<MitmEnvelope> getObservable() {
// 		return mEnvelope;
// 	}
// }


// Path: app/src/main/java/com/icecream/snorlax/module/SnorlaxModule.java
import static POGOProtos.Networking.Requests.RequestOuterClass.Request;
import java.util.List;
import javax.inject.Singleton;
import android.app.Application;
import android.util.LongSparseArray;
import com.icecream.snorlax.common.rx.RxBus;
import com.icecream.snorlax.module.feature.mitm.MitmRelay;
import dagger.Module;
import dagger.Provides;
import de.robv.android.xposed.XSharedPreferences;

/*
 * Copyright (c) 2016. Pedro Diaz <igoticecream@gmail.com>
 *
 * 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.icecream.snorlax.module;







@Module
final class SnorlaxModule {

	private final Application mApplication;
	private final ClassLoader mClassLoader;
	private final XSharedPreferences mXSharedPreferences;

	SnorlaxModule(Application application, ClassLoader classLoader, XSharedPreferences xSharedPreferences) {
		mApplication = application;
		mClassLoader = classLoader;
		mXSharedPreferences = xSharedPreferences;
	}

	@Provides
	ClassLoader provideClassLoader() {
		return mClassLoader;
	}

	@Provides
	XSharedPreferences provideXSharedPreferences() {
		return mXSharedPreferences;
	}

	@Provides
	Application provideAppliction() {
		return mApplication;
	}

	@Provides
	@Singleton
	MitmRelay provideMitmRelay() {