// Path: app/src/main/java/dynoapps/exchange_rates/alarm/AlarmsRepository.java
// public class AlarmsRepository implements AlarmsDataSource {
// 
//     private static AlarmsRepository INSTANCE = null;
//     /**
//      * Marks the cache as invalid, to force an update the next time data is requested. This variable
//      * has package local visibility so it can be accessed from tests.
//      */
//     boolean mCacheIsDirty = false;
//     /**
//      * This variable has package local visibility so it can be accessed from tests.
//      */
//     Map<Long, Alarm> cachedAlarms;
//     private final AlarmsDataSource localAlarmsDataSource;
//     private Boolean alarmEnabled = null;
// 
// 
//     private AlarmsRepository(AlarmsDataSource localAlarmsDataSource) {
//         this.localAlarmsDataSource = localAlarmsDataSource;
//     }
// 
//     public static AlarmsRepository getInstance(@NonNull Context context) {
//         if (INSTANCE == null) {
//             synchronized (AlarmsRepository.class) {
//                 if (INSTANCE == null) {
//                     INSTANCE = new AlarmsRepository(new LocalAlarmsDataSource(context));
//                 }
//             }
//         }
//         return INSTANCE;
//     }
// 
//     @Override
//     public void getAlarms(final AlarmsLoadCallback callback) {
//         // Respond immediately with cache if available and not dirty
//         if (cachedAlarms != null && !mCacheIsDirty) {
//             callback.onAlarmsLoaded(new ArrayList<>(cachedAlarms.values()));
//             return;
//         }
//         localAlarmsDataSource.getAlarms(alarms -> {
//             refreshCache(alarms);
//             callback.onAlarmsLoaded(new ArrayList<>(cachedAlarms.values()));
//         });
//     }
// 
//     @Override
//     public void saveAlarm(@NonNull Alarm alarm, final AlarmUpdateInsertCallback alarmUpdateInsertCallback) {
//         localAlarmsDataSource.saveAlarm(alarm, alarm1 -> {
//             // Do in memory cache update to keep the app UI up to date
//             if (cachedAlarms == null) {
//                 cachedAlarms = new LinkedHashMap<>();
//             }
//             cachedAlarms.put(alarm1.id, alarm1);
//             if (alarmUpdateInsertCallback != null) {
//                 alarmUpdateInsertCallback.onAlarmUpdate(alarm1);
//             }
//         });
//     }
// 
//     @Override
//     public Single<Alarm> deleteAlarm(@NonNull Alarm alarm) {
//         return localAlarmsDataSource.deleteAlarm(alarm).doAfterSuccess(alarm1 -> {
//             cachedAlarms.remove(alarm1.id);
//         });
//     }
// 
//     @Override
//     public Single<Alarm> updateAlarm(@NonNull Alarm alarm) {
// 
//         return localAlarmsDataSource.updateAlarm(alarm).doAfterSuccess(updatedAlarm -> {
//             // Do in memory cache update to keep the app UI up to date
//             if (cachedAlarms == null) {
//                 cachedAlarms = new LinkedHashMap<>();
//             }
//             cachedAlarms.put(updatedAlarm.id, updatedAlarm);
//         });
//     }
// 
//     @Override
//     public void refreshAlarms() {
//         mCacheIsDirty = true;
//     }
// 
//     private void refreshCache(List<Alarm> alarms) {
//         if (cachedAlarms == null) {
//             cachedAlarms = new LinkedHashMap<>();
//         }
//         cachedAlarms.clear();
//         for (Alarm alarm : alarms) {
//             cachedAlarms.put(alarm.id, alarm);
//         }
//         mCacheIsDirty = false;
//     }
// 
//     public boolean isEnabled() {
//         if (alarmEnabled == null) alarmEnabled = Prefs.isAlarmEnabled();
//         return alarmEnabled;
//     }
// 
//     public void updateEnabled(boolean alarmEnabled) {
//         this.alarmEnabled = alarmEnabled;
//         Prefs.saveAlarmEnabled(alarmEnabled);
//     }
// 
//     public boolean hasAnyActive() {
// 
//         if (!isEnabled()) return false;
//         if (cachedAlarms == null || cachedAlarms.size() < 1) return false;
//         for (Alarm alarm : cachedAlarms.values()) {
//             if (alarm.isEnabled) {
//                 for (CurrencySource source : SourcesManager.getCurrencySources()) {
//                     if (source.isEnabled() && source.getType() == alarm.sourceType) {
//                         return true;
//                     }
//                 }
//             }
//         }
//         return false;
//     }
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/util/L.java
// public class L {
// 
//     private static final String TAG = "ExchangeRates";
// 
//     private static final String LOG_PREFIX = "";
//     private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
//     private static final int MAX_LOG_TAG_LENGTH = 23;
//     private static final int MAX_CHAR_LENGTH = 320;
// 
//     public static String makeLogTag(String str) {
//         if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
//             return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
//         }
// 
//         return LOG_PREFIX + str;
//     }
// 
//     public static void e(String tag, String msg) {
//         Log.e(makeLogTag(tag), msg);
//     }
// 
//     public static void e(String tag, Throwable th) {
//         Log.e(tag, "", th);
//     }
// 
//     public static void i(String tag, String msg) {
//         Log.i(makeLogTag(tag), msg);
//     }
// 
//     public static void ex(Exception ex) {
//         Log.e(TAG, "", ex);
//     }
// 
//     public static void ex(Exception ex, String message) {
//         Log.e(TAG, message, ex);
//     }
// }


import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import androidx.annotation.NonNull;
import dynoapps.exchange_rates.alarm.AlarmsRepository;
import dynoapps.exchange_rates.util.L;
import io.reactivex.plugins.RxJavaPlugins;
package dynoapps.exchange_rates;





/**
 * Created by erdemmac on 21/10/2016.
 */

public class App extends Application {
    private static App appInstance;

    public static App getInstance() {
        return appInstance;
    }

    @NonNull
    public static Context context() {
        return appInstance.getApplicationContext();
    }

// Path: app/src/main/java/dynoapps/exchange_rates/alarm/AlarmsRepository.java
// public class AlarmsRepository implements AlarmsDataSource {
// 
//     private static AlarmsRepository INSTANCE = null;
//     /**
//      * Marks the cache as invalid, to force an update the next time data is requested. This variable
//      * has package local visibility so it can be accessed from tests.
//      */
//     boolean mCacheIsDirty = false;
//     /**
//      * This variable has package local visibility so it can be accessed from tests.
//      */
//     Map<Long, Alarm> cachedAlarms;
//     private final AlarmsDataSource localAlarmsDataSource;
//     private Boolean alarmEnabled = null;
// 
// 
//     private AlarmsRepository(AlarmsDataSource localAlarmsDataSource) {
//         this.localAlarmsDataSource = localAlarmsDataSource;
//     }
// 
//     public static AlarmsRepository getInstance(@NonNull Context context) {
//         if (INSTANCE == null) {
//             synchronized (AlarmsRepository.class) {
//                 if (INSTANCE == null) {
//                     INSTANCE = new AlarmsRepository(new LocalAlarmsDataSource(context));
//                 }
//             }
//         }
//         return INSTANCE;
//     }
// 
//     @Override
//     public void getAlarms(final AlarmsLoadCallback callback) {
//         // Respond immediately with cache if available and not dirty
//         if (cachedAlarms != null && !mCacheIsDirty) {
//             callback.onAlarmsLoaded(new ArrayList<>(cachedAlarms.values()));
//             return;
//         }
//         localAlarmsDataSource.getAlarms(alarms -> {
//             refreshCache(alarms);
//             callback.onAlarmsLoaded(new ArrayList<>(cachedAlarms.values()));
//         });
//     }
// 
//     @Override
//     public void saveAlarm(@NonNull Alarm alarm, final AlarmUpdateInsertCallback alarmUpdateInsertCallback) {
//         localAlarmsDataSource.saveAlarm(alarm, alarm1 -> {
//             // Do in memory cache update to keep the app UI up to date
//             if (cachedAlarms == null) {
//                 cachedAlarms = new LinkedHashMap<>();
//             }
//             cachedAlarms.put(alarm1.id, alarm1);
//             if (alarmUpdateInsertCallback != null) {
//                 alarmUpdateInsertCallback.onAlarmUpdate(alarm1);
//             }
//         });
//     }
// 
//     @Override
//     public Single<Alarm> deleteAlarm(@NonNull Alarm alarm) {
//         return localAlarmsDataSource.deleteAlarm(alarm).doAfterSuccess(alarm1 -> {
//             cachedAlarms.remove(alarm1.id);
//         });
//     }
// 
//     @Override
//     public Single<Alarm> updateAlarm(@NonNull Alarm alarm) {
// 
//         return localAlarmsDataSource.updateAlarm(alarm).doAfterSuccess(updatedAlarm -> {
//             // Do in memory cache update to keep the app UI up to date
//             if (cachedAlarms == null) {
//                 cachedAlarms = new LinkedHashMap<>();
//             }
//             cachedAlarms.put(updatedAlarm.id, updatedAlarm);
//         });
//     }
// 
//     @Override
//     public void refreshAlarms() {
//         mCacheIsDirty = true;
//     }
// 
//     private void refreshCache(List<Alarm> alarms) {
//         if (cachedAlarms == null) {
//             cachedAlarms = new LinkedHashMap<>();
//         }
//         cachedAlarms.clear();
//         for (Alarm alarm : alarms) {
//             cachedAlarms.put(alarm.id, alarm);
//         }
//         mCacheIsDirty = false;
//     }
// 
//     public boolean isEnabled() {
//         if (alarmEnabled == null) alarmEnabled = Prefs.isAlarmEnabled();
//         return alarmEnabled;
//     }
// 
//     public void updateEnabled(boolean alarmEnabled) {
//         this.alarmEnabled = alarmEnabled;
//         Prefs.saveAlarmEnabled(alarmEnabled);
//     }
// 
//     public boolean hasAnyActive() {
// 
//         if (!isEnabled()) return false;
//         if (cachedAlarms == null || cachedAlarms.size() < 1) return false;
//         for (Alarm alarm : cachedAlarms.values()) {
//             if (alarm.isEnabled) {
//                 for (CurrencySource source : SourcesManager.getCurrencySources()) {
//                     if (source.isEnabled() && source.getType() == alarm.sourceType) {
//                         return true;
//                     }
//                 }
//             }
//         }
//         return false;
//     }
// }
// 
// Path: app/src/main/java/dynoapps/exchange_rates/util/L.java
// public class L {
// 
//     private static final String TAG = "ExchangeRates";
// 
//     private static final String LOG_PREFIX = "";
//     private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
//     private static final int MAX_LOG_TAG_LENGTH = 23;
//     private static final int MAX_CHAR_LENGTH = 320;
// 
//     public static String makeLogTag(String str) {
//         if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
//             return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
//         }
// 
//         return LOG_PREFIX + str;
//     }
// 
//     public static void e(String tag, String msg) {
//         Log.e(makeLogTag(tag), msg);
//     }
// 
//     public static void e(String tag, Throwable th) {
//         Log.e(tag, "", th);
//     }
// 
//     public static void i(String tag, String msg) {
//         Log.i(makeLogTag(tag), msg);
//     }
// 
//     public static void ex(Exception ex) {
//         Log.e(TAG, "", ex);
//     }
// 
//     public static void ex(Exception ex, String message) {
//         Log.e(TAG, message, ex);
//     }
// }


// Path: app/src/main/java/dynoapps/exchange_rates/App.java
import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import androidx.annotation.NonNull;
import dynoapps.exchange_rates.alarm.AlarmsRepository;
import dynoapps.exchange_rates.util.L;
import io.reactivex.plugins.RxJavaPlugins;

package dynoapps.exchange_rates;





/**
 * Created by erdemmac on 21/10/2016.
 */

public class App extends Application {
    private static App appInstance;

    public static App getInstance() {
        return appInstance;
    }

    @NonNull
    public static Context context() {
        return appInstance.getApplicationContext();
    }

    public AlarmsRepository provideAlarmsRepository() {