Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aperauch committed Mar 15, 2022
1 parent 910a309 commit 11c1628
Show file tree
Hide file tree
Showing 43 changed files with 1,284 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added app/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
41 changes: 41 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
plugins {
id 'com.android.application'
}

android {
compileSdk 31

defaultConfig {
applicationId "com.aron.webdemo"
minSdk 28
targetSdk 31
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.browser:browser:1.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

// WS1 Intelligence SDK (compile directive is deprecated; use implementation instead)
implementation 'com.crittercism:crittercism-android-agent:+'
}
29 changes: 29 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# WS1 Intelligence
-dontwarn com.crittercism.**
-keep public class com.crittercism.**
-keepclassmembers public class com.crittercism.**
{
*;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.aron.webdemo;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.aron.webdemo", appContext.getPackageName());
}
}
47 changes: 47 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.aron.webdemo">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.WebDemo">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".WebViewActivity"
android:label="@string/title_activity_webview"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
</application>

</manifest>
59 changes: 59 additions & 0 deletions app/src/main/java/com/aron/webdemo/AppConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.aron.webdemo;

import android.content.Context;
import android.content.RestrictionsManager;
import android.os.Bundle;


public class AppConfig {
private static final String INTELLIGENCE_APP_ID = "INTELLIGENCE_APP_ID";
private static final String INTELLIGENCE_APP_LOGGING_LEVEL = "INTELLIGENCE_APP_LOGGING_LEVEL";
private static final String ENROLLMENT_USERNAME = "ENROLLMENT_USERNAME";
private static final String URL = "URL";

private String intelligenceAppId;
private String intelligenceAppLoggingLevel;
private String enrollmentUsername;
private String url;


public AppConfig(Context context) {
RestrictionsManager restrictionsManager = (RestrictionsManager) context.getSystemService(Context.RESTRICTIONS_SERVICE);
Bundle appRestrictions = restrictionsManager.getApplicationRestrictions();
getApplicationRestrictions(appRestrictions);
}

private void getApplicationRestrictions(Bundle appRestrictions) {
if (appRestrictions.containsKey(INTELLIGENCE_APP_ID)) {
intelligenceAppId = appRestrictions.getString(INTELLIGENCE_APP_ID);
}

if (appRestrictions.containsKey(INTELLIGENCE_APP_LOGGING_LEVEL)) {
intelligenceAppLoggingLevel = appRestrictions.getString(INTELLIGENCE_APP_LOGGING_LEVEL);
}

if (appRestrictions.containsKey(ENROLLMENT_USERNAME)) {
enrollmentUsername = appRestrictions.getString(ENROLLMENT_USERNAME);
}

if (appRestrictions.containsKey(URL)) {
url = appRestrictions.getString(URL);
}
}

public String getIntelligenceAppId() {
return intelligenceAppId;
}

public String getIntelligenceAppLoggingLevel() {
return intelligenceAppLoggingLevel;
}

public String getEnrollmentUsername() {
return enrollmentUsername;
}

public String getUrl() {
return url;
}
}
Loading

0 comments on commit 11c1628

Please sign in to comment.