// Path: app/src/main/java/app/domain/foundation/gcm/GcmNotification.java
// @Data public class GcmNotification<T> {
//     private final T data;
//     private final String title, body;
// 
//     public static GcmNotification getMessageFromGcmNotification(Message message) {
//         return getMessageFromGcmNotification(Object.class, message);
//     }
// 
//     public static <T> GcmNotification<T> getMessageFromGcmNotification(Class<T> classData, Message message) {
//         String payload = message.payload().getString("payload");
//         String title = message.payload().getString("title");
//         String body = message.payload().getString("body");
// 
//         Type type = $Gson$Types.newParameterizedTypeWithOwner(null, classData);
//         T data = new Gson().fromJson(payload, type);
// 
//         return new GcmNotification(data, title, body);
//     }
// 
//     public static <T> GcmNotification<List<T>> getMessageArrayListFromGcmNotification(Class<T> classData, Message message) {
//         String payload = message.payload().getString("payload");
//         String title = message.payload().getString("title");
//         String body = message.payload().getString("body");
// 
//         Type typeCollection = $Gson$Types.newParameterizedTypeWithOwner(null, ArrayList.class, classData);
// 
//         List<T> data = new GsonBuilder().create().fromJson(payload, typeCollection);
//         return new GcmNotification(data, title, body);
//     }
// 
//     public static <T> T getDataFromGcmNotification(@Nullable Class<T> classData, Message message) {
//         return getMessageFromGcmNotification(classData, message).getData();
//     }
// 
//     public static <T> List<T> getDataArrayListFromGcmNotification(@Nullable Class<T> classData, Message message) {
//         return getMessageArrayListFromGcmNotification(classData, message).getData();
//     }
// }
// 
// Path: app/src/main/java/app/presentation/foundation/BaseApp.java
// public class BaseApp extends Application {
//     private PresentationComponent presentationComponent;
//     private GoogleAnalytics analytics;
//     private Tracker tracker;
// 
//     @Override public void onCreate() {
//         super.onCreate();
//         initInject();
//         AppCare.YesSir.takeCareOn(this);
//         initGcm();
//         initGoogleAnalytics();
//     }
// 
//     private void initInject() {
//         presentationComponent = DaggerPresentationComponent.builder()
//                 .presentationModule(new PresentationModule(this))
//                 .build();
//     }
// 
//     private void initGcm() {
//         RxGcm.Notifications.register(this, GcmMessageReceiver.class, GcmReceiverBackground.class)
//                 .subscribe(token -> {}, error -> {});
// 
//         RxGcm.Notifications.onRefreshToken(GcmTokenReceiver.class);
//     }
// 
//     private void initGoogleAnalytics() {
//         analytics = GoogleAnalytics.getInstance(this);
// 
//         if(BuildConfig.DEBUG) {
//             // true = for log output, it does not sent data to Google Analytics
//             analytics.setDryRun(true);
//             // To enable debug logging on a device run:
//             // adb shell setprop log.tag.GAv4 DEBUG
//             // adb logcat -s GAv4
//             // true = disable google analytics on the app
// //        analytics.setAppOptOut(true);
//         }
// 
//         tracker = analytics.newTracker(getString(R.string.ga_trackingId));
//         tracker.enableExceptionReporting(true);
//         tracker.enableAdvertisingIdCollection(true);
//         tracker.enableAutoActivityTracking(false);
//     }
// 
//     public Tracker getTracker() {
//         return tracker;
//     }
// 
//     public PresentationComponent getPresentationComponent() {
//         return presentationComponent;
//     }
// 
//     @Nullable public BaseActivity getLiveActivity(){
//         return (BaseActivity) AppCare.YesSir.getLiveActivityOrNull();
//     }
// }


import android.app.Application;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.support.v4.app.NotificationCompat;
import org.base_app_android.R;
import app.domain.foundation.gcm.GcmNotification;
import app.presentation.foundation.BaseApp;
import rx.Observable;
import rx_gcm.GcmReceiverUIBackground;
import rx_gcm.Message;
/*
 * Copyright 2016 FuckBoilerplate
 *
 * 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 app.presentation.foundation.gcm;




public class GcmReceiverBackground implements GcmReceiverUIBackground {

    @Override public void onNotification(Observable<Message> oMessage) {
        oMessage.subscribe(message -> {
            BaseApp baseApp = (BaseApp) message.application();

// Path: app/src/main/java/app/domain/foundation/gcm/GcmNotification.java
// @Data public class GcmNotification<T> {
//     private final T data;
//     private final String title, body;
// 
//     public static GcmNotification getMessageFromGcmNotification(Message message) {
//         return getMessageFromGcmNotification(Object.class, message);
//     }
// 
//     public static <T> GcmNotification<T> getMessageFromGcmNotification(Class<T> classData, Message message) {
//         String payload = message.payload().getString("payload");
//         String title = message.payload().getString("title");
//         String body = message.payload().getString("body");
// 
//         Type type = $Gson$Types.newParameterizedTypeWithOwner(null, classData);
//         T data = new Gson().fromJson(payload, type);
// 
//         return new GcmNotification(data, title, body);
//     }
// 
//     public static <T> GcmNotification<List<T>> getMessageArrayListFromGcmNotification(Class<T> classData, Message message) {
//         String payload = message.payload().getString("payload");
//         String title = message.payload().getString("title");
//         String body = message.payload().getString("body");
// 
//         Type typeCollection = $Gson$Types.newParameterizedTypeWithOwner(null, ArrayList.class, classData);
// 
//         List<T> data = new GsonBuilder().create().fromJson(payload, typeCollection);
//         return new GcmNotification(data, title, body);
//     }
// 
//     public static <T> T getDataFromGcmNotification(@Nullable Class<T> classData, Message message) {
//         return getMessageFromGcmNotification(classData, message).getData();
//     }
// 
//     public static <T> List<T> getDataArrayListFromGcmNotification(@Nullable Class<T> classData, Message message) {
//         return getMessageArrayListFromGcmNotification(classData, message).getData();
//     }
// }
// 
// Path: app/src/main/java/app/presentation/foundation/BaseApp.java
// public class BaseApp extends Application {
//     private PresentationComponent presentationComponent;
//     private GoogleAnalytics analytics;
//     private Tracker tracker;
// 
//     @Override public void onCreate() {
//         super.onCreate();
//         initInject();
//         AppCare.YesSir.takeCareOn(this);
//         initGcm();
//         initGoogleAnalytics();
//     }
// 
//     private void initInject() {
//         presentationComponent = DaggerPresentationComponent.builder()
//                 .presentationModule(new PresentationModule(this))
//                 .build();
//     }
// 
//     private void initGcm() {
//         RxGcm.Notifications.register(this, GcmMessageReceiver.class, GcmReceiverBackground.class)
//                 .subscribe(token -> {}, error -> {});
// 
//         RxGcm.Notifications.onRefreshToken(GcmTokenReceiver.class);
//     }
// 
//     private void initGoogleAnalytics() {
//         analytics = GoogleAnalytics.getInstance(this);
// 
//         if(BuildConfig.DEBUG) {
//             // true = for log output, it does not sent data to Google Analytics
//             analytics.setDryRun(true);
//             // To enable debug logging on a device run:
//             // adb shell setprop log.tag.GAv4 DEBUG
//             // adb logcat -s GAv4
//             // true = disable google analytics on the app
// //        analytics.setAppOptOut(true);
//         }
// 
//         tracker = analytics.newTracker(getString(R.string.ga_trackingId));
//         tracker.enableExceptionReporting(true);
//         tracker.enableAdvertisingIdCollection(true);
//         tracker.enableAutoActivityTracking(false);
//     }
// 
//     public Tracker getTracker() {
//         return tracker;
//     }
// 
//     public PresentationComponent getPresentationComponent() {
//         return presentationComponent;
//     }
// 
//     @Nullable public BaseActivity getLiveActivity(){
//         return (BaseActivity) AppCare.YesSir.getLiveActivityOrNull();
//     }
// }


// Path: app/src/main/java/app/presentation/foundation/gcm/GcmReceiverBackground.java
import android.app.Application;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.support.v4.app.NotificationCompat;
import org.base_app_android.R;
import app.domain.foundation.gcm.GcmNotification;
import app.presentation.foundation.BaseApp;
import rx.Observable;
import rx_gcm.GcmReceiverUIBackground;
import rx_gcm.Message;

/*
 * Copyright 2016 FuckBoilerplate
 *
 * 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 app.presentation.foundation.gcm;




public class GcmReceiverBackground implements GcmReceiverUIBackground {

    @Override public void onNotification(Observable<Message> oMessage) {
        oMessage.subscribe(message -> {
            BaseApp baseApp = (BaseApp) message.application();

            GcmNotification gcmNotification = GcmNotification.getMessageFromGcmNotification(message);