<commit_before>/*
 * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
 * See LICENSE in the project root for license information.
 */
package com.microsoft.office365.msgraphsnippetapp;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.microsoft.identity.client.AuthenticationCallback;
import com.microsoft.identity.client.AuthenticationResult;
import com.microsoft.identity.client.IAccount;
import com.microsoft.identity.client.Logger;
import com.microsoft.identity.client.exception.MsalClientException;
import com.microsoft.identity.client.exception.MsalException;
import com.microsoft.identity.client.exception.MsalServiceException;
import com.microsoft.identity.client.exception.MsalUiRequiredException;
import com.microsoft.office365.auth.AuthenticationManager;
import com.microsoft.office365.msgraphsnippetapp.util.SharedPrefsUtil;

import java.net.URI;
import java.util.List;
import java.util.UUID;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static com.microsoft.office365.msgraphsnippetapp.R.id.layout_diagnostics;
import static com.microsoft.office365.msgraphsnippetapp.R.id.o365_signin;
import static com.microsoft.office365.msgraphsnippetapp.R.id.view_diagnosticsdata;
import static com.microsoft.office365.msgraphsnippetapp.R.layout.activity_signin;
import static com.microsoft.office365.msgraphsnippetapp.R.string.signin_err;
import static com.microsoft.office365.msgraphsnippetapp.R.string.warning_clientid_redirecturi_incorrect;

public class SignInActivity
        extends BaseActivity
        implements MSALAuthenticationCallback {

    private boolean mEnablePiiLogging = false;
    private static final String TAG = "SignInActivity";

    @InjectView(layout_diagnostics)
    protected View mDiagnosticsLayout;

    @InjectView(view_diagnosticsdata)
    protected TextView mDiagnosticsTxt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(activity_signin);

        ButterKnife.inject(this);
    }

    @OnClick(o365_signin)
    public void onSignInO365Clicked() {
        try {
            authenticate();
        } catch (IllegalArgumentException e) {
            warnBadClient();
        }
    }

    @Override
    public void onSuccess(AuthenticationResult authenticationResult) {
        // reset anything that may have gone wrong...
        mDiagnosticsLayout.setVisibility(INVISIBLE);
        mDiagnosticsTxt.setText("");

        // get rid of this Activity so that users can't 'back' into it<commit_msg>Using higher version of butterknife<commit_after>/*
 * Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
 * See LICENSE in the project root for license information.
 */
package com.microsoft.office365.msgraphsnippetapp;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
//import com.microsoft.graph.models.extensions.User;
import com.microsoft.office365.auth.AuthenticationManager;
import com.microsoft.office365.auth.MSALAuthenticationCallback;
import com.microsoft.office365.msgraphsnippetapp.util.SharedPrefsUtil;
import com.microsoft.identity.client.AuthenticationResult;
import com.microsoft.identity.client.IAccount;
import com.microsoft.identity.client.Logger;
import com.microsoft.identity.client.exception.MsalClientException;
import com.microsoft.identity.client.exception.MsalException;
import com.microsoft.identity.client.exception.MsalServiceException;
import com.microsoft.identity.client.exception.MsalUiRequiredException;
import java.net.URI;
import java.util.List;
import java.util.UUID;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static com.microsoft.office365.msgraphsnippetapp.R.id.layout_diagnostics;
import static com.microsoft.office365.msgraphsnippetapp.R.id.o365_signin;
import static com.microsoft.office365.msgraphsnippetapp.R.id.view_diagnosticsdata;
import static com.microsoft.office365.msgraphsnippetapp.R.layout.activity_signin;
import static com.microsoft.office365.msgraphsnippetapp.R.string.signin_err;
import static com.microsoft.office365.msgraphsnippetapp.R.string.warning_clientid_redirecturi_incorrect;

public class SignInActivity
        extends BaseActivity
        implements MSALAuthenticationCallback {

    private boolean mEnablePiiLogging = false;
    private static final String TAG = "SignInActivity";

    @BindView(layout_diagnostics)
    protected View mDiagnosticsLayout;

    @BindView(view_diagnosticsdata)
    protected TextView mDiagnosticsTxt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(activity_signin);
        setTitle(R.string.app_name);
        ButterKnife.bind(this);
    }

    @OnClick(o365_signin)
    public void onSignInO365Clicked() {
        try {
            authenticate();
        } catch (IllegalArgumentException e) {
            warnBadClient();
        }
    }

    @Override
    public void onSuccess(AuthenticationResult authenticationResult) {
        // reset anything that may have gone wrong...
        mDiagnosticsLayout.setVisibility(INVISIBLE);
        mDiagnosticsTxt.setText("");

        // get rid of this Activity so that users can't 'back' into it
{'fraction_non_alphanumeric': 0.08268059181897303, 'fraction_numerical': 0.013054830287206266, 'mean_word_length': 4.672260612043435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1467002', 'n_tokens_mistral': 1702, 'n_tokens_neox': 1581, 'n_words': 326}