// Path: opfpush/src/main/java/org/onepf/opfpush/OPFPush.java
// public final class OPFPush {
// 
//     private static volatile OPFPushHelper helper;
// 
//     private OPFPush() {
//         throw new UnsupportedOperationException();
//     }
// 
//     /**
//      * Returns the {@link org.onepf.opfpush.OPFPushHelper} instance.
//      *
//      * @return The {@link org.onepf.opfpush.OPFPushHelper} instance.
//      * @throws org.onepf.opfutils.exception.InitException If {@code OPFPush} wasn't initialized.
//      */
//     @NonNull
//     public static OPFPushHelper getHelper() {
//         OPFLog.logMethod();
//         if (helper == null) {
//             throw new InitException(false);
//         }
//         return helper;
//     }
// 
//     /**
//      * Initializes the OPFPush library and creates the {@link org.onepf.opfpush.OPFPushHelper} singleton instance.
//      *
//      * @param context       The {@link android.content.Context} instance.
//      * @param configuration The {@link org.onepf.opfpush.configuration.Configuration} instance.
//      * @throws org.onepf.opfutils.exception.WrongThreadException If this method is not called from the main thread.
//      * @throws org.onepf.opfutils.exception.InitException        If the {@code OPFPush} has already been initialized.
//      */
//     public static void init(@NonNull final Context context,
//                             @NonNull final Configuration configuration) {
//         OPFLog.logMethod(context, configuration);
//         OPFChecks.checkThread(true);
// 
//         if (helper != null) {
//             throw new InitException(true);
//         }
// 
//         if (OPFUtils.isMainProcess(context)) {
//             OPFLog.i("Init in main process");
//             final OPFPushHelper newHelper = new OPFPushHelperImpl(context);
//             newHelper.init(configuration);
//             helper = newHelper;
//         } else {
//             OPFLog.i("Init in not main process");
//             helper = new OPFPushHelperStub();
//         }
//     }
// }


import com.google.android.gms.iid.InstanceIDListenerService;
import org.onepf.opfpush.OPFPush;
import org.onepf.opfutils.OPFLog;
/*
 * Copyright 2012-2015 One Platform Foundation
 *
 * 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 org.onepf.opfpush.gcm;


/**
 * It performs reregistration of the GCMProvider in the implementation of the {@code onTokenRefresh()} method.
 *
 * @author Roman Savin
 * @since 16.06.2015
 */
public class GCMInstanceIDListenerService extends InstanceIDListenerService {

    @Override
// Path: opfpush/src/main/java/org/onepf/opfpush/OPFPush.java
// public final class OPFPush {
// 
//     private static volatile OPFPushHelper helper;
// 
//     private OPFPush() {
//         throw new UnsupportedOperationException();
//     }
// 
//     /**
//      * Returns the {@link org.onepf.opfpush.OPFPushHelper} instance.
//      *
//      * @return The {@link org.onepf.opfpush.OPFPushHelper} instance.
//      * @throws org.onepf.opfutils.exception.InitException If {@code OPFPush} wasn't initialized.
//      */
//     @NonNull
//     public static OPFPushHelper getHelper() {
//         OPFLog.logMethod();
//         if (helper == null) {
//             throw new InitException(false);
//         }
//         return helper;
//     }
// 
//     /**
//      * Initializes the OPFPush library and creates the {@link org.onepf.opfpush.OPFPushHelper} singleton instance.
//      *
//      * @param context       The {@link android.content.Context} instance.
//      * @param configuration The {@link org.onepf.opfpush.configuration.Configuration} instance.
//      * @throws org.onepf.opfutils.exception.WrongThreadException If this method is not called from the main thread.
//      * @throws org.onepf.opfutils.exception.InitException        If the {@code OPFPush} has already been initialized.
//      */
//     public static void init(@NonNull final Context context,
//                             @NonNull final Configuration configuration) {
//         OPFLog.logMethod(context, configuration);
//         OPFChecks.checkThread(true);
// 
//         if (helper != null) {
//             throw new InitException(true);
//         }
// 
//         if (OPFUtils.isMainProcess(context)) {
//             OPFLog.i("Init in main process");
//             final OPFPushHelper newHelper = new OPFPushHelperImpl(context);
//             newHelper.init(configuration);
//             helper = newHelper;
//         } else {
//             OPFLog.i("Init in not main process");
//             helper = new OPFPushHelperStub();
//         }
//     }
// }


// Path: opfpush-providers/gcm/src/main/java/org/onepf/opfpush/gcm/GCMInstanceIDListenerService.java
import com.google.android.gms.iid.InstanceIDListenerService;
import org.onepf.opfpush.OPFPush;
import org.onepf.opfutils.OPFLog;

/*
 * Copyright 2012-2015 One Platform Foundation
 *
 * 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 org.onepf.opfpush.gcm;


/**
 * It performs reregistration of the GCMProvider in the implementation of the {@code onTokenRefresh()} method.
 *
 * @author Roman Savin
 * @since 16.06.2015
 */
public class GCMInstanceIDListenerService extends InstanceIDListenerService {

    @Override
    public void onTokenRefresh() {