// Path: app/src/main/java/com/microsoft/o365_android_onenote_rest/application/SnippetApp.java
// public class SnippetApp extends Application {
//     /**
//      * The {@link dagger.ObjectGraph} used by Dagger to fulfill <code>@inject</code> annotations
//      *
//      * @see javax.inject.Inject
//      * @see dagger.Provides
//      * @see javax.inject.Singleton
//      */
//     public ObjectGraph mObjectGraph;
// 
//     private static SnippetApp sSnippetApp;
// 
//     @Inject
//     protected String endpoint;
// 
//     @Inject
//     protected Converter converter;
// 
//     @Inject
//     protected RestAdapter.LogLevel logLevel;
// 
//     @Inject
//     protected RequestInterceptor requestInterceptor;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         sSnippetApp = this;
//         mObjectGraph = ObjectGraph.create(new AppModule());
//         mObjectGraph.inject(this);
//         if (BuildConfig.DEBUG) {
//             Timber.plant(new Timber.DebugTree());
//         }
//     }
// 
//     public static SnippetApp getApp() {
//         return sSnippetApp;
//     }
// 
//     public RestAdapter getRestAdapter() {
//         return new RestAdapter.Builder()
//                 .setEndpoint(endpoint)
//                 .setLogLevel(logLevel)
//                 .setConverter(converter)
//                 .setRequestInterceptor(requestInterceptor)
//                 .build();
//     }
// }
// 
// Path: app/src/main/java/com/microsoft/o365_android_onenote_rest/conf/ServiceConstants.java
// public class ServiceConstants {
// 
//     // MSA
//     public static final String MSA_CLIENT_ID = "<Your MSA CLIENT ID>";
//     public static final String ONENOTE_API = "https://www.onenote.com/api";
//     // Org
//     public static final String AUTHENTICATION_RESOURCE_ID = "https://onenote.com";
//     public static final String AUTHORITY_URL = "https://login.microsoftonline.com/common";
//     public static final String REDIRECT_URI = "<Your REDIRECT URI HERE>";
//     public static final String CLIENT_ID = "<Your CLIENT ID HERE>";
// }
// 
// Path: app/src/main/java/com/microsoft/o365_android_onenote_rest/util/SharedPrefsUtil.java
// public class SharedPrefsUtil {
// 
//     public static final String PREF_AUTH_TOKEN = "PREF_AUTH_TOKEN";
// 
//     public static SharedPreferences getSharedPreferences() {
//         return SnippetApp.getApp().getSharedPreferences(AppModule.PREFS, Context.MODE_PRIVATE);
//     }
// 
//     public static void persistAuthToken(AuthenticationResult result) {
//         setAccessToken(result.getAccessToken());
//         User.isOrg(true);
//     }
// 
//     public static void persistAuthToken(LiveConnectSession session) {
//         setAccessToken(session.getAccessToken());
//         User.isMsa(true);
//     }
// 
//     private static void setAccessToken(String accessToken) {
//         getSharedPreferences().edit().putString(PREF_AUTH_TOKEN, accessToken).commit();
//     }
// }


import android.content.Context;
import android.content.SharedPreferences;
import com.microsoft.live.LiveAuthClient;
import com.microsoft.o365_android_onenote_rest.application.SnippetApp;
import com.microsoft.o365_android_onenote_rest.conf.ServiceConstants;
import com.microsoft.o365_android_onenote_rest.util.SharedPrefsUtil;
import com.microsoft.onenoteapi.service.GsonDateTime;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.converter.Converter;
import retrofit.converter.GsonConverter;
/*
*  Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
*/

package com.microsoft.o365_android_onenote_rest.inject;





@Module(library = true,
        injects = {
                SnippetApp.class
        }
)
public class AppModule {

    public static final String PREFS = "com.microsoft.o365_android_onenote_rest";

    @Provides
    public String providesRestEndpoint() {
        return ServiceConstants.ONENOTE_API;
    }

    @Provides
    public RestAdapter.LogLevel providesLogLevel() {
        return RestAdapter.LogLevel.FULL;
    }

// Path: app/src/main/java/com/microsoft/o365_android_onenote_rest/application/SnippetApp.java
// public class SnippetApp extends Application {
//     /**
//      * The {@link dagger.ObjectGraph} used by Dagger to fulfill <code>@inject</code> annotations
//      *
//      * @see javax.inject.Inject
//      * @see dagger.Provides
//      * @see javax.inject.Singleton
//      */
//     public ObjectGraph mObjectGraph;
// 
//     private static SnippetApp sSnippetApp;
// 
//     @Inject
//     protected String endpoint;
// 
//     @Inject
//     protected Converter converter;
// 
//     @Inject
//     protected RestAdapter.LogLevel logLevel;
// 
//     @Inject
//     protected RequestInterceptor requestInterceptor;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         sSnippetApp = this;
//         mObjectGraph = ObjectGraph.create(new AppModule());
//         mObjectGraph.inject(this);
//         if (BuildConfig.DEBUG) {
//             Timber.plant(new Timber.DebugTree());
//         }
//     }
// 
//     public static SnippetApp getApp() {
//         return sSnippetApp;
//     }
// 
//     public RestAdapter getRestAdapter() {
//         return new RestAdapter.Builder()
//                 .setEndpoint(endpoint)
//                 .setLogLevel(logLevel)
//                 .setConverter(converter)
//                 .setRequestInterceptor(requestInterceptor)
//                 .build();
//     }
// }
// 
// Path: app/src/main/java/com/microsoft/o365_android_onenote_rest/conf/ServiceConstants.java
// public class ServiceConstants {
// 
//     // MSA
//     public static final String MSA_CLIENT_ID = "<Your MSA CLIENT ID>";
//     public static final String ONENOTE_API = "https://www.onenote.com/api";
//     // Org
//     public static final String AUTHENTICATION_RESOURCE_ID = "https://onenote.com";
//     public static final String AUTHORITY_URL = "https://login.microsoftonline.com/common";
//     public static final String REDIRECT_URI = "<Your REDIRECT URI HERE>";
//     public static final String CLIENT_ID = "<Your CLIENT ID HERE>";
// }
// 
// Path: app/src/main/java/com/microsoft/o365_android_onenote_rest/util/SharedPrefsUtil.java
// public class SharedPrefsUtil {
// 
//     public static final String PREF_AUTH_TOKEN = "PREF_AUTH_TOKEN";
// 
//     public static SharedPreferences getSharedPreferences() {
//         return SnippetApp.getApp().getSharedPreferences(AppModule.PREFS, Context.MODE_PRIVATE);
//     }
// 
//     public static void persistAuthToken(AuthenticationResult result) {
//         setAccessToken(result.getAccessToken());
//         User.isOrg(true);
//     }
// 
//     public static void persistAuthToken(LiveConnectSession session) {
//         setAccessToken(session.getAccessToken());
//         User.isMsa(true);
//     }
// 
//     private static void setAccessToken(String accessToken) {
//         getSharedPreferences().edit().putString(PREF_AUTH_TOKEN, accessToken).commit();
//     }
// }


// Path: app/src/main/java/com/microsoft/o365_android_onenote_rest/inject/AppModule.java
import android.content.Context;
import android.content.SharedPreferences;
import com.microsoft.live.LiveAuthClient;
import com.microsoft.o365_android_onenote_rest.application.SnippetApp;
import com.microsoft.o365_android_onenote_rest.conf.ServiceConstants;
import com.microsoft.o365_android_onenote_rest.util.SharedPrefsUtil;
import com.microsoft.onenoteapi.service.GsonDateTime;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.converter.Converter;
import retrofit.converter.GsonConverter;

/*
*  Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See full license at the bottom of this file.
*/

package com.microsoft.o365_android_onenote_rest.inject;





@Module(library = true,
        injects = {
                SnippetApp.class
        }
)
public class AppModule {

    public static final String PREFS = "com.microsoft.o365_android_onenote_rest";

    @Provides
    public String providesRestEndpoint() {
        return ServiceConstants.ONENOTE_API;
    }

    @Provides
    public RestAdapter.LogLevel providesLogLevel() {
        return RestAdapter.LogLevel.FULL;
    }

    @Provides