Compare commits
No commits in common. "master" and "mixer" have entirely different histories.
|
@ -16,23 +16,3 @@ out
|
||||||
*.db
|
*.db
|
||||||
*.sql
|
*.sql
|
||||||
.arcconfig
|
.arcconfig
|
||||||
/meerkat_election_params_tempfile.dat
|
|
||||||
/meerkat_booth_system_messages.dat
|
|
||||||
local.properties
|
|
||||||
# Angular junk
|
|
||||||
*/tmp
|
|
||||||
*/dist
|
|
||||||
*/out-tsc
|
|
||||||
*/node_modules
|
|
||||||
*/e2e/*.js
|
|
||||||
*/e2e/*.map
|
|
||||||
*/.sass-cache
|
|
||||||
*/connect.lock
|
|
||||||
*/coverage
|
|
||||||
*/libpeerconnection.log
|
|
||||||
npm-debug.log
|
|
||||||
testem.log
|
|
||||||
*/typings
|
|
||||||
bundle.js
|
|
||||||
bundle.d.ts
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
This file describes Wombat Code & Documentation Conventions:
|
|
||||||
|
|
||||||
Code Conventions:
|
|
||||||
* Code- The good old classic java code conventions
|
|
||||||
camelCase convention, constants should be capital letters with underscore etc...
|
|
||||||
|
|
||||||
Documentation Conventions:
|
|
||||||
* Comments- The good old classic java code documentation, Block Comments (to describe
|
|
||||||
method/class/interface etc...) // comments too describe complex code
|
|
||||||
(only if the code block complicated)
|
|
|
@ -1,82 +0,0 @@
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
|
||||||
// in the individual module build.gradle files
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 26
|
|
||||||
buildToolsVersion "26.0.0"
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "com.meerkat.laura.fakescannerapp"
|
|
||||||
minSdkVersion 14
|
|
||||||
targetSdkVersion 26
|
|
||||||
versionCode 1
|
|
||||||
versionName "1.0"
|
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
||||||
|
|
||||||
// Enabling multidex support.
|
|
||||||
multiDexEnabled true
|
|
||||||
vectorDrawables.useSupportLibrary = true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
debug {
|
|
||||||
debuggable true
|
|
||||||
}
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
configurations.all {
|
|
||||||
resolutionStrategy.dependencySubstitution {
|
|
||||||
// Avoid Android compilation error caused by two different javax.inject dependencies.
|
|
||||||
substitute module('org.glassfish.hk2.external:javax.inject:2.4.0-b34') with module('javax.inject:javax.inject:1')
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exclude non-android logback modules
|
|
||||||
exclude group:"ch.qos.logback", module:"logback-core"
|
|
||||||
exclude group:"ch.qos.logback", module:"logback-classic"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
|
|
||||||
compile project(':meerkat-common')
|
|
||||||
compile project(':scanner-api-common')
|
|
||||||
|
|
||||||
compile 'com.android.support:appcompat-v7:26.0.+'
|
|
||||||
compile 'com.google.protobuf:protobuf-java:3.+'
|
|
||||||
compile 'com.android.support:support-v4:26.0.+'
|
|
||||||
compile 'com.android.support:support-vector-drawable:26.0.+'
|
|
||||||
testCompile 'junit:junit:4.12'
|
|
||||||
|
|
||||||
// Android logging
|
|
||||||
compile 'com.github.tony19:logback-android-core:1.1.1-6'
|
|
||||||
compile('com.github.tony19:logback-android-classic:1.1.1-6') {
|
|
||||||
// workaround issue #73
|
|
||||||
exclude group: 'com.google.android', module: 'android'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
|
|
||||||
jcenter()
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
../gradlew
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<lint>
|
|
||||||
<issue id="InvalidPackage">
|
|
||||||
<!-- Ignore javax.mail from logback https://github.com/tony19/logback-android/issues/140-->
|
|
||||||
<ignore regexp="javax.mail"/>
|
|
||||||
</issue>
|
|
||||||
</lint>
|
|
|
@ -1,13 +0,0 @@
|
||||||
package com.meerkat.laura.fakescannerapp;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.test.ApplicationTestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
|
||||||
*/
|
|
||||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
|
||||||
public ApplicationTest() {
|
|
||||||
super(Application.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="com.meerkat.laura.fakescannerapp">
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
android:theme="@style/AppTheme">
|
|
||||||
<activity android:name=".MainActivity">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
<activity
|
|
||||||
android:name=".SettingsActivity"
|
|
||||||
android:label="@string/title_activity_settings">
|
|
||||||
</activity>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
|
|
||||||
<tagEncoder>
|
|
||||||
<pattern>%logger{12}</pattern>
|
|
||||||
</tagEncoder>
|
|
||||||
<encoder>
|
|
||||||
<pattern>[%-20thread] %msg</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root level="DEBUG">
|
|
||||||
<appender-ref ref="logcat" />
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
|
@ -1,508 +0,0 @@
|
||||||
package com.google.zxing.integration.android;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2009 ZXing authors
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.content.ActivityNotFoundException;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.pm.ResolveInfo;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>A utility class which helps ease integration with Barcode Scanner via {@link Intent}s. This is a simple
|
|
||||||
* way to invoke barcode scanning and receive the result, without any need to integrate, modify, or learn the
|
|
||||||
* project's source code.</p>
|
|
||||||
*
|
|
||||||
* <h2>Initiating a barcode scan</h2>
|
|
||||||
*
|
|
||||||
* <p>To integrate, create an instance of {@code IntentIntegrator} and call {@link #initiateScan()} and wait
|
|
||||||
* for the result in your app.</p>
|
|
||||||
*
|
|
||||||
* <p>It does require that the Barcode Scanner (or work-alike) application is installed. The
|
|
||||||
* {@link #initiateScan()} method will prompt the user to download the application, if needed.</p>
|
|
||||||
*
|
|
||||||
* <p>There are a few steps to using this integration. First, your {@link Activity} must implement
|
|
||||||
* the method {@link Activity#onActivityResult(int, int, Intent)} and include a line of code like this:</p>
|
|
||||||
*
|
|
||||||
* <pre>{@code
|
|
||||||
* public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
|
||||||
* IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
|
|
||||||
* if (scanResult != null) {
|
|
||||||
* // handle scan result
|
|
||||||
* }
|
|
||||||
* // else continue with any other code you need in the method
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* }</pre>
|
|
||||||
*
|
|
||||||
* <p>This is where you will handle a scan result.</p>
|
|
||||||
*
|
|
||||||
* <p>Second, just call this in response to a user action somewhere to begin the scan process:</p>
|
|
||||||
*
|
|
||||||
* <pre>{@code
|
|
||||||
* IntentIntegrator integrator = new IntentIntegrator(yourActivity);
|
|
||||||
* integrator.initiateScan();
|
|
||||||
* }</pre>
|
|
||||||
*
|
|
||||||
* <p>Note that {@link #initiateScan()} returns an {@link AlertDialog} which is non-null if the
|
|
||||||
* user was prompted to download the application. This lets the calling app potentially manage the dialog.
|
|
||||||
* In particular, ideally, the app dismisses the dialog if it's still active in its {@link Activity#onPause()}
|
|
||||||
* method.</p>
|
|
||||||
*
|
|
||||||
* <p>You can use {@link #setTitle(String)} to customize the title of this download prompt dialog (or, use
|
|
||||||
* {@link #setTitleByID(int)} to set the title by string resource ID.) Likewise, the prompt message, and
|
|
||||||
* yes/no button labels can be changed.</p>
|
|
||||||
*
|
|
||||||
* <p>Finally, you can use {@link #addExtra(String, Object)} to add more parameters to the Intent used
|
|
||||||
* to invoke the scanner. This can be used to set additional options not directly exposed by this
|
|
||||||
* simplified API.</p>
|
|
||||||
*
|
|
||||||
* <p>By default, this will only allow applications that are known to respond to this intent correctly
|
|
||||||
* do so. The apps that are allowed to response can be set with {@link #setTargetApplications(List)}.
|
|
||||||
* For example, set to {@link #TARGET_BARCODE_SCANNER_ONLY} to only target the Barcode Scanner app itself.</p>
|
|
||||||
*
|
|
||||||
* <h2>Sharing text via barcode</h2>
|
|
||||||
*
|
|
||||||
* <p>To share text, encoded as a QR Code on-screen, similarly, see {@link #shareText(CharSequence)}.</p>
|
|
||||||
*
|
|
||||||
* <p>Some code, particularly download integration, was contributed from the Anobiit application.</p>
|
|
||||||
*
|
|
||||||
* <h2>Enabling experimental barcode formats</h2>
|
|
||||||
*
|
|
||||||
* <p>Some formats are not enabled by default even when scanning with {@link #ALL_CODE_TYPES}, such as
|
|
||||||
* PDF417. Use {@link #initiateScan(Collection)} with
|
|
||||||
* a collection containing the names of formats to scan for explicitly, like "PDF_417", to use such
|
|
||||||
* formats.</p>
|
|
||||||
*
|
|
||||||
* @author Sean Owen
|
|
||||||
* @author Fred Lin
|
|
||||||
* @author Isaac Potoczny-Jones
|
|
||||||
* @author Brad Drehmer
|
|
||||||
* @author gcstang
|
|
||||||
*/
|
|
||||||
public class IntentIntegrator {
|
|
||||||
|
|
||||||
public static final int REQUEST_CODE = 0x0000c0de; // Only use bottom 16 bits
|
|
||||||
private static final String TAG = IntentIntegrator.class.getSimpleName();
|
|
||||||
|
|
||||||
public static final String DEFAULT_TITLE = "Install Barcode Scanner?";
|
|
||||||
public static final String DEFAULT_MESSAGE =
|
|
||||||
"This application requires Barcode Scanner. Would you like to install it?";
|
|
||||||
public static final String DEFAULT_YES = "Yes";
|
|
||||||
public static final String DEFAULT_NO = "No";
|
|
||||||
|
|
||||||
private static final String BS_PACKAGE = "com.google.zxing.client.android";
|
|
||||||
private static final String BSPLUS_PACKAGE = "com.srowen.bs.android";
|
|
||||||
|
|
||||||
// supported barcode formats
|
|
||||||
public static final Collection<String> PRODUCT_CODE_TYPES = list("UPC_A", "UPC_E", "EAN_8", "EAN_13", "RSS_14");
|
|
||||||
public static final Collection<String> ONE_D_CODE_TYPES =
|
|
||||||
list("UPC_A", "UPC_E", "EAN_8", "EAN_13", "CODE_39", "CODE_93", "CODE_128",
|
|
||||||
"ITF", "RSS_14", "RSS_EXPANDED");
|
|
||||||
public static final Collection<String> QR_CODE_TYPES = Collections.singleton("QR_CODE");
|
|
||||||
public static final Collection<String> DATA_MATRIX_TYPES = Collections.singleton("DATA_MATRIX");
|
|
||||||
|
|
||||||
public static final Collection<String> ALL_CODE_TYPES = null;
|
|
||||||
|
|
||||||
public static final List<String> TARGET_BARCODE_SCANNER_ONLY = Collections.singletonList(BS_PACKAGE);
|
|
||||||
public static final List<String> TARGET_ALL_KNOWN = list(
|
|
||||||
BSPLUS_PACKAGE, // Barcode Scanner+
|
|
||||||
BSPLUS_PACKAGE + ".simple", // Barcode Scanner+ Simple
|
|
||||||
BS_PACKAGE // Barcode Scanner
|
|
||||||
// What else supports this intent?
|
|
||||||
);
|
|
||||||
|
|
||||||
private final Activity activity;
|
|
||||||
private final Fragment fragment;
|
|
||||||
|
|
||||||
private String title;
|
|
||||||
private String message;
|
|
||||||
private String buttonYes;
|
|
||||||
private String buttonNo;
|
|
||||||
private List<String> targetApplications;
|
|
||||||
private final Map<String,Object> moreExtras = new HashMap<String,Object>(3);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param activity {@link Activity} invoking the integration
|
|
||||||
*/
|
|
||||||
public IntentIntegrator(Activity activity) {
|
|
||||||
this.activity = activity;
|
|
||||||
this.fragment = null;
|
|
||||||
initializeConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param fragment {@link Fragment} invoking the integration.
|
|
||||||
* {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead
|
|
||||||
* of an {@link Activity}
|
|
||||||
*/
|
|
||||||
public IntentIntegrator(Fragment fragment) {
|
|
||||||
this.activity = fragment.getActivity();
|
|
||||||
this.fragment = fragment;
|
|
||||||
initializeConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeConfiguration() {
|
|
||||||
title = DEFAULT_TITLE;
|
|
||||||
message = DEFAULT_MESSAGE;
|
|
||||||
buttonYes = DEFAULT_YES;
|
|
||||||
buttonNo = DEFAULT_NO;
|
|
||||||
targetApplications = TARGET_ALL_KNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitleByID(int titleID) {
|
|
||||||
title = activity.getString(titleID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageByID(int messageID) {
|
|
||||||
message = activity.getString(messageID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getButtonYes() {
|
|
||||||
return buttonYes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setButtonYes(String buttonYes) {
|
|
||||||
this.buttonYes = buttonYes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setButtonYesByID(int buttonYesID) {
|
|
||||||
buttonYes = activity.getString(buttonYesID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getButtonNo() {
|
|
||||||
return buttonNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setButtonNo(String buttonNo) {
|
|
||||||
this.buttonNo = buttonNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setButtonNoByID(int buttonNoID) {
|
|
||||||
buttonNo = activity.getString(buttonNoID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<String> getTargetApplications() {
|
|
||||||
return targetApplications;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void setTargetApplications(List<String> targetApplications) {
|
|
||||||
if (targetApplications.isEmpty()) {
|
|
||||||
throw new IllegalArgumentException("No target applications");
|
|
||||||
}
|
|
||||||
this.targetApplications = targetApplications;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSingleTargetApplication(String targetApplication) {
|
|
||||||
this.targetApplications = Collections.singletonList(targetApplication);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,?> getMoreExtras() {
|
|
||||||
return moreExtras;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void addExtra(String key, Object value) {
|
|
||||||
moreExtras.put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiates a scan for all known barcode types with the default camera.
|
|
||||||
*
|
|
||||||
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
|
||||||
* if a prompt was needed, or null otherwise.
|
|
||||||
*/
|
|
||||||
public final AlertDialog initiateScan() {
|
|
||||||
return initiateScan(ALL_CODE_TYPES, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiates a scan for all known barcode types with the specified camera.
|
|
||||||
*
|
|
||||||
* @param cameraId camera ID of the camera to use. A negative value means "no preference".
|
|
||||||
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
|
||||||
* if a prompt was needed, or null otherwise.
|
|
||||||
*/
|
|
||||||
public final AlertDialog initiateScan(int cameraId) {
|
|
||||||
return initiateScan(ALL_CODE_TYPES, cameraId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiates a scan, using the default camera, only for a certain set of barcode types, given as strings corresponding
|
|
||||||
* to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants
|
|
||||||
* like {@link #PRODUCT_CODE_TYPES} for example.
|
|
||||||
*
|
|
||||||
* @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for
|
|
||||||
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
|
||||||
* if a prompt was needed, or null otherwise.
|
|
||||||
*/
|
|
||||||
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats) {
|
|
||||||
return initiateScan(desiredBarcodeFormats, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiates a scan, using the specified camera, only for a certain set of barcode types, given as strings corresponding
|
|
||||||
* to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants
|
|
||||||
* like {@link #PRODUCT_CODE_TYPES} for example.
|
|
||||||
*
|
|
||||||
* @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for
|
|
||||||
* @param cameraId camera ID of the camera to use. A negative value means "no preference".
|
|
||||||
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
|
||||||
* if a prompt was needed, or null otherwise
|
|
||||||
*/
|
|
||||||
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats, int cameraId) {
|
|
||||||
Intent intentScan = new Intent(BS_PACKAGE + ".SCAN");
|
|
||||||
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
|
|
||||||
|
|
||||||
// check which types of codes to scan for
|
|
||||||
if (desiredBarcodeFormats != null) {
|
|
||||||
// set the desired barcode types
|
|
||||||
StringBuilder joinedByComma = new StringBuilder();
|
|
||||||
for (String format : desiredBarcodeFormats) {
|
|
||||||
if (joinedByComma.length() > 0) {
|
|
||||||
joinedByComma.append(',');
|
|
||||||
}
|
|
||||||
joinedByComma.append(format);
|
|
||||||
}
|
|
||||||
intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// check requested camera ID
|
|
||||||
if (cameraId >= 0) {
|
|
||||||
intentScan.putExtra("SCAN_CAMERA_ID", cameraId);
|
|
||||||
}
|
|
||||||
|
|
||||||
String targetAppPackage = findTargetAppPackage(intentScan);
|
|
||||||
if (targetAppPackage == null) {
|
|
||||||
return showDownloadDialog();
|
|
||||||
}
|
|
||||||
intentScan.setPackage(targetAppPackage);
|
|
||||||
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
||||||
attachMoreExtras(intentScan);
|
|
||||||
startActivityForResult(intentScan, REQUEST_CODE);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start an activity. This method is defined to allow different methods of activity starting for
|
|
||||||
* newer versions of Android and for compatibility library.
|
|
||||||
*
|
|
||||||
* @param intent Intent to start.
|
|
||||||
* @param code Request code for the activity
|
|
||||||
* @see Activity#startActivityForResult(Intent, int)
|
|
||||||
* @see Fragment#startActivityForResult(Intent, int)
|
|
||||||
*/
|
|
||||||
protected void startActivityForResult(Intent intent, int code) {
|
|
||||||
if (fragment == null) {
|
|
||||||
activity.startActivityForResult(intent, code);
|
|
||||||
} else {
|
|
||||||
fragment.startActivityForResult(intent, code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String findTargetAppPackage(Intent intent) {
|
|
||||||
PackageManager pm = activity.getPackageManager();
|
|
||||||
List<ResolveInfo> availableApps = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
|
||||||
if (availableApps != null) {
|
|
||||||
for (String targetApp : targetApplications) {
|
|
||||||
if (contains(availableApps, targetApp)) {
|
|
||||||
return targetApp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean contains(Iterable<ResolveInfo> availableApps, String targetApp) {
|
|
||||||
for (ResolveInfo availableApp : availableApps) {
|
|
||||||
String packageName = availableApp.activityInfo.packageName;
|
|
||||||
if (targetApp.equals(packageName)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private AlertDialog showDownloadDialog() {
|
|
||||||
AlertDialog.Builder downloadDialog = new AlertDialog.Builder(activity);
|
|
||||||
downloadDialog.setTitle(title);
|
|
||||||
downloadDialog.setMessage(message);
|
|
||||||
downloadDialog.setPositiveButton(buttonYes, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
String packageName;
|
|
||||||
if (targetApplications.contains(BS_PACKAGE)) {
|
|
||||||
// Prefer to suggest download of BS if it's anywhere in the list
|
|
||||||
packageName = BS_PACKAGE;
|
|
||||||
} else {
|
|
||||||
// Otherwise, first option:
|
|
||||||
packageName = targetApplications.get(0);
|
|
||||||
}
|
|
||||||
Uri uri = Uri.parse("market://details?id=" + packageName);
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
|
||||||
try {
|
|
||||||
if (fragment == null) {
|
|
||||||
activity.startActivity(intent);
|
|
||||||
} else {
|
|
||||||
fragment.startActivity(intent);
|
|
||||||
}
|
|
||||||
} catch (ActivityNotFoundException anfe) {
|
|
||||||
// Hmm, market is not installed
|
|
||||||
Log.w(TAG, "Google Play is not installed; cannot install " + packageName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
downloadDialog.setNegativeButton(buttonNo, null);
|
|
||||||
downloadDialog.setCancelable(true);
|
|
||||||
return downloadDialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Call this from your {@link Activity}'s
|
|
||||||
* {@link Activity#onActivityResult(int, int, Intent)} method.</p>
|
|
||||||
*
|
|
||||||
* @param requestCode request code from {@code onActivityResult()}
|
|
||||||
* @param resultCode result code from {@code onActivityResult()}
|
|
||||||
* @param intent {@link Intent} from {@code onActivityResult()}
|
|
||||||
* @return null if the event handled here was not related to this class, or
|
|
||||||
* else an {@link IntentResult} containing the result of the scan. If the user cancelled scanning,
|
|
||||||
* the fields will be null.
|
|
||||||
*/
|
|
||||||
public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) {
|
|
||||||
if (requestCode == REQUEST_CODE) {
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
String contents = intent.getStringExtra("SCAN_RESULT");
|
|
||||||
String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT");
|
|
||||||
byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES");
|
|
||||||
int intentOrientation = intent.getIntExtra("SCAN_RESULT_ORIENTATION", Integer.MIN_VALUE);
|
|
||||||
Integer orientation = intentOrientation == Integer.MIN_VALUE ? null : intentOrientation;
|
|
||||||
String errorCorrectionLevel = intent.getStringExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL");
|
|
||||||
return new IntentResult(contents,
|
|
||||||
formatName,
|
|
||||||
rawBytes,
|
|
||||||
orientation,
|
|
||||||
errorCorrectionLevel);
|
|
||||||
}
|
|
||||||
return new IntentResult();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Defaults to type "TEXT_TYPE".
|
|
||||||
*
|
|
||||||
* @param text the text string to encode as a barcode
|
|
||||||
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
|
||||||
* if a prompt was needed, or null otherwise
|
|
||||||
* @see #shareText(CharSequence, CharSequence)
|
|
||||||
*/
|
|
||||||
public final AlertDialog shareText(CharSequence text) {
|
|
||||||
return shareText(text, "TEXT_TYPE");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shares the given text by encoding it as a barcode, such that another user can
|
|
||||||
* scan the text off the screen of the device.
|
|
||||||
*
|
|
||||||
* @param text the text string to encode as a barcode
|
|
||||||
* @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants.
|
|
||||||
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
|
|
||||||
* if a prompt was needed, or null otherwise
|
|
||||||
*/
|
|
||||||
public final AlertDialog shareText(CharSequence text, CharSequence type) {
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
|
||||||
intent.setAction(BS_PACKAGE + ".ENCODE");
|
|
||||||
intent.putExtra("ENCODE_TYPE", type);
|
|
||||||
intent.putExtra("ENCODE_DATA", text);
|
|
||||||
String targetAppPackage = findTargetAppPackage(intent);
|
|
||||||
if (targetAppPackage == null) {
|
|
||||||
return showDownloadDialog();
|
|
||||||
}
|
|
||||||
intent.setPackage(targetAppPackage);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
||||||
attachMoreExtras(intent);
|
|
||||||
if (fragment == null) {
|
|
||||||
activity.startActivity(intent);
|
|
||||||
} else {
|
|
||||||
fragment.startActivity(intent);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<String> list(String... values) {
|
|
||||||
return Collections.unmodifiableList(Arrays.asList(values));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void attachMoreExtras(Intent intent) {
|
|
||||||
for (Map.Entry<String,Object> entry : moreExtras.entrySet()) {
|
|
||||||
String key = entry.getKey();
|
|
||||||
Object value = entry.getValue();
|
|
||||||
// Kind of hacky
|
|
||||||
if (value instanceof Integer) {
|
|
||||||
intent.putExtra(key, (Integer) value);
|
|
||||||
} else if (value instanceof Long) {
|
|
||||||
intent.putExtra(key, (Long) value);
|
|
||||||
} else if (value instanceof Boolean) {
|
|
||||||
intent.putExtra(key, (Boolean) value);
|
|
||||||
} else if (value instanceof Double) {
|
|
||||||
intent.putExtra(key, (Double) value);
|
|
||||||
} else if (value instanceof Float) {
|
|
||||||
intent.putExtra(key, (Float) value);
|
|
||||||
} else if (value instanceof Bundle) {
|
|
||||||
intent.putExtra(key, (Bundle) value);
|
|
||||||
} else {
|
|
||||||
intent.putExtra(key, value.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2009 ZXing authors
|
|
||||||
*
|
|
||||||
* 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 com.google.zxing.integration.android;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Encapsulates the result of a barcode scan invoked through {@link IntentIntegrator}.</p>
|
|
||||||
*
|
|
||||||
* @author Sean Owen
|
|
||||||
*/
|
|
||||||
public final class IntentResult {
|
|
||||||
|
|
||||||
private final String contents;
|
|
||||||
private final String formatName;
|
|
||||||
private final byte[] rawBytes;
|
|
||||||
private final Integer orientation;
|
|
||||||
private final String errorCorrectionLevel;
|
|
||||||
|
|
||||||
IntentResult() {
|
|
||||||
this(null, null, null, null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
IntentResult(String contents,
|
|
||||||
String formatName,
|
|
||||||
byte[] rawBytes,
|
|
||||||
Integer orientation,
|
|
||||||
String errorCorrectionLevel) {
|
|
||||||
this.contents = contents;
|
|
||||||
this.formatName = formatName;
|
|
||||||
this.rawBytes = rawBytes;
|
|
||||||
this.orientation = orientation;
|
|
||||||
this.errorCorrectionLevel = errorCorrectionLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return raw content of barcode
|
|
||||||
*/
|
|
||||||
public String getContents() {
|
|
||||||
return contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return name of format, like "QR_CODE", "UPC_A". See {@code BarcodeFormat} for more format names.
|
|
||||||
*/
|
|
||||||
public String getFormatName() {
|
|
||||||
return formatName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return raw bytes of the barcode content, if applicable, or null otherwise
|
|
||||||
*/
|
|
||||||
public byte[] getRawBytes() {
|
|
||||||
return rawBytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return rotation of the image, in degrees, which resulted in a successful scan. May be null.
|
|
||||||
*/
|
|
||||||
public Integer getOrientation() {
|
|
||||||
return orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return name of the error correction level used in the barcode, if applicable
|
|
||||||
*/
|
|
||||||
public String getErrorCorrectionLevel() {
|
|
||||||
return errorCorrectionLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
int rawBytesLength = rawBytes == null ? 0 : rawBytes.length;
|
|
||||||
return "Format: " + formatName + '\n' +
|
|
||||||
"Contents: " + contents + '\n' +
|
|
||||||
"Raw bytes: (" + rawBytesLength + " bytes)\n" +
|
|
||||||
"Orientation: " + orientation + '\n' +
|
|
||||||
"EC level: " + errorCorrectionLevel + '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,109 +0,0 @@
|
||||||
package com.meerkat.laura.fakescannerapp;
|
|
||||||
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
import android.support.annotation.LayoutRes;
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v7.app.ActionBar;
|
|
||||||
import android.support.v7.app.AppCompatDelegate;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.MenuInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
|
||||||
* to be used with AppCompat.
|
|
||||||
*/
|
|
||||||
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
|
||||||
|
|
||||||
private AppCompatDelegate mDelegate;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
getDelegate().installViewFactory();
|
|
||||||
getDelegate().onCreate(savedInstanceState);
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
|
||||||
super.onPostCreate(savedInstanceState);
|
|
||||||
getDelegate().onPostCreate(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionBar getSupportActionBar() {
|
|
||||||
return getDelegate().getSupportActionBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSupportActionBar(@Nullable Toolbar toolbar) {
|
|
||||||
getDelegate().setSupportActionBar(toolbar);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MenuInflater getMenuInflater() {
|
|
||||||
return getDelegate().getMenuInflater();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setContentView(@LayoutRes int layoutResID) {
|
|
||||||
getDelegate().setContentView(layoutResID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setContentView(View view) {
|
|
||||||
getDelegate().setContentView(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
|
||||||
getDelegate().setContentView(view, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
|
||||||
getDelegate().addContentView(view, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostResume() {
|
|
||||||
super.onPostResume();
|
|
||||||
getDelegate().onPostResume();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onTitleChanged(CharSequence title, int color) {
|
|
||||||
super.onTitleChanged(title, color);
|
|
||||||
getDelegate().setTitle(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
|
||||||
super.onConfigurationChanged(newConfig);
|
|
||||||
getDelegate().onConfigurationChanged(newConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
getDelegate().onStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
getDelegate().onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void invalidateOptionsMenu() {
|
|
||||||
getDelegate().invalidateOptionsMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
private AppCompatDelegate getDelegate() {
|
|
||||||
if (mDelegate == null) {
|
|
||||||
mDelegate = AppCompatDelegate.create(this, null);
|
|
||||||
}
|
|
||||||
return mDelegate;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,252 +0,0 @@
|
||||||
package com.meerkat.laura.fakescannerapp;
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.util.Base64;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuInflater;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
import ch.qos.logback.classic.android.BasicLogcatConfigurator;
|
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
|
||||||
import com.google.protobuf.Message;
|
|
||||||
import com.google.zxing.integration.android.IntentIntegrator;
|
|
||||||
import com.google.zxing.integration.android.IntentResult;
|
|
||||||
import meerkat.crypto.DigitalSignatureGenerator;
|
|
||||||
import meerkat.crypto.concrete.ECDSADeterministicSignature;
|
|
||||||
import meerkat.pollingstation.PollingStationScanner;
|
|
||||||
import meerkat.pollingstation.ScannerClientAPI;
|
|
||||||
import meerkat.protobuf.PollingStation;
|
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import static com.meerkat.laura.fakescannerapp.R.xml.preferences;
|
|
||||||
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
|
||||||
|
|
||||||
static {
|
|
||||||
BasicLogcatConfigurator.configureDefaultContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
final public static String SCANNER_NAME = "AndroidScanner";
|
|
||||||
SharedPreferences sharedPref;
|
|
||||||
|
|
||||||
Button scanBtn;
|
|
||||||
TextView formatTxt, contentTxt, responseTxt, serverStatus;
|
|
||||||
PollingStationScanner.ScannerClient scannerClient;
|
|
||||||
DigitalSignatureGenerator signer;
|
|
||||||
|
|
||||||
class AsyncScanConnect extends AsyncTask<Void, Void, Boolean> {
|
|
||||||
PollingStation.ConnectionServerData serverData;
|
|
||||||
|
|
||||||
public AsyncScanConnect(PollingStation.ConnectionServerData connectionServerData) {
|
|
||||||
this.serverData = connectionServerData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPreExecute() {
|
|
||||||
super.onPreExecute();
|
|
||||||
serverStatus.setTextColor(Color.BLUE);
|
|
||||||
serverStatus.setText("Connecting to " + serverData.getServerUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean doInBackground(Void... foo) {
|
|
||||||
try {
|
|
||||||
return scannerClient.connect(serverData);
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
Log.e("MainActivity", "Exception during connect: " + e.toString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(Boolean res) {
|
|
||||||
super.onPostExecute(res);
|
|
||||||
if (res) {
|
|
||||||
serverStatus.setTextColor(Color.GREEN);
|
|
||||||
serverStatus.setText("Connected to " + serverData.getServerUrl());
|
|
||||||
} else {
|
|
||||||
serverStatus.setTextColor(Color.RED);
|
|
||||||
serverStatus.setText("Connection failed: " + serverData.getServerUrl());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AsyncScanSend extends AsyncTask<Void, Void, Boolean> {
|
|
||||||
Message data;
|
|
||||||
|
|
||||||
public AsyncScanSend(Message data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPreExecute() {
|
|
||||||
super.onPreExecute();
|
|
||||||
serverStatus.setTextColor(Color.BLUE);
|
|
||||||
serverStatus.setText("Sending to server...");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Boolean doInBackground(Void... foo) {
|
|
||||||
try {
|
|
||||||
if (data instanceof PollingStation.ScannedBallot) {
|
|
||||||
return scannerClient.newScan((PollingStation.ScannedBallot) data);
|
|
||||||
} else if (data instanceof PollingStation.ScanError) {
|
|
||||||
return scannerClient.reportError((PollingStation.ScanError) data);
|
|
||||||
} else {
|
|
||||||
Log.e("MainActivity", "Trying to send invalid message to scanner");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
Log.e("MainActivity", "Exception during send: " + e.toString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(Boolean res) {
|
|
||||||
super.onPostExecute(res);
|
|
||||||
if (res) {
|
|
||||||
serverStatus.setTextColor(Color.GREEN);
|
|
||||||
serverStatus.setText("Sent successfully");
|
|
||||||
Log.i("MainActivity", "post submitted to API.");
|
|
||||||
} else {
|
|
||||||
serverStatus.setTextColor(Color.RED);
|
|
||||||
serverStatus.setText("Send failed");
|
|
||||||
Log.e("MainActivity", "Unable to submit post to API.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
MenuInflater inflater = getMenuInflater();
|
|
||||||
inflater.inflate(R.menu.options_menu, menu);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
// Handle item selection
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case R.id.action_settings:
|
|
||||||
Intent i = new Intent(this, SettingsActivity.class);
|
|
||||||
startActivity(i);
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setNewScannerClientAPI(SharedPreferences sharedPref) {
|
|
||||||
String pscUrlString = sharedPref.getString(SettingsFragment.PSC_URL, "");
|
|
||||||
long nonce = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
nonce = Long.parseLong(sharedPref.getString(SettingsFragment.PSC_NONCE, "0"));
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pscUrlString.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
PollingStation.ConnectionServerData serverData = PollingStation.ConnectionServerData.newBuilder()
|
|
||||||
.setServerUrl(pscUrlString)
|
|
||||||
.setNonce(nonce)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
new AsyncScanConnect(serverData).execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
|
|
||||||
signer = new ECDSADeterministicSignature();
|
|
||||||
signer.generateSigningCertificate(BigInteger.ONE, new Date(System.currentTimeMillis()),
|
|
||||||
new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 365), SCANNER_NAME);
|
|
||||||
scannerClient = new ScannerClientAPI(signer);
|
|
||||||
|
|
||||||
PreferenceManager.setDefaultValues(this, preferences, false);
|
|
||||||
sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
sharedPref.registerOnSharedPreferenceChangeListener(this);
|
|
||||||
|
|
||||||
scanBtn = (Button) findViewById(R.id.scan_button);
|
|
||||||
formatTxt = (TextView) findViewById(R.id.scan_format);
|
|
||||||
contentTxt = (TextView) findViewById(R.id.scan_content);
|
|
||||||
responseTxt = (TextView) findViewById(R.id.server_response);
|
|
||||||
serverStatus = (TextView) findViewById(R.id.serverStatus);
|
|
||||||
|
|
||||||
setNewScannerClientAPI(sharedPref);
|
|
||||||
scanBtn.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (v.getId() == R.id.scan_button) {
|
|
||||||
IntentIntegrator scanIntegrator = new IntentIntegrator(this);
|
|
||||||
formatTxt.setText("Initiating scan...");
|
|
||||||
scanIntegrator.initiateScan();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
|
||||||
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
|
|
||||||
if (scanningResult != null) {
|
|
||||||
String scanContent = scanningResult.getContents();
|
|
||||||
byte[] rawBytes = scanningResult.getRawBytes();
|
|
||||||
String scanFormat = scanningResult.getFormatName();
|
|
||||||
formatTxt.setText("FORMAT: " + scanFormat);
|
|
||||||
contentTxt.setText("CONTENT: " + scanContent + "sending data to server...");
|
|
||||||
// sendPost(rawBytes);
|
|
||||||
sendPost(scanContent);
|
|
||||||
} else {
|
|
||||||
Toast toast = Toast.makeText(getApplicationContext(),
|
|
||||||
"No scan data received!", Toast.LENGTH_SHORT);
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// public void sendPost(byte[] body) {
|
|
||||||
public void sendPost(String scanContent) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
PollingStation.ScannedBallot scannedBallot = PollingStation.ScannedBallot.parseFrom(Base64.decode(scanContent.getBytes(), Base64.DEFAULT));
|
|
||||||
//
|
|
||||||
// PollingStation.ScannedData scannedData = PollingStation.ScannedData.newBuilder()
|
|
||||||
// .setChannel(ByteString.copyFrom(body))
|
|
||||||
// .build();
|
|
||||||
|
|
||||||
new AsyncScanSend(scannedBallot).execute();
|
|
||||||
} catch (InvalidProtocolBufferException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showResponse(String response) {
|
|
||||||
responseTxt.setText(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key){
|
|
||||||
setNewScannerClientAPI(sharedPreferences);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
package com.meerkat.laura.fakescannerapp;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by talm on 25/06/17.
|
|
||||||
*/
|
|
||||||
public class SettingsActivity extends Activity {
|
|
||||||
SettingsFragment settings;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
settings = new SettingsFragment();
|
|
||||||
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(settings);
|
|
||||||
|
|
||||||
// Display the fragment as the main content.
|
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(android.R.id.content, settings)
|
|
||||||
.commit();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
package com.meerkat.laura.fakescannerapp;
|
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
import android.preference.PreferenceFragment;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
|
|
||||||
public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
|
||||||
public final static String PSC_URL = "psc_url";
|
|
||||||
public final static String PSC_NONCE = "psc_nonce";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
addPreferencesFromResource(R.xml.preferences);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
|
||||||
Preference pref = findPreference(key);
|
|
||||||
if (pref == null)
|
|
||||||
return;
|
|
||||||
switch(key) {
|
|
||||||
case SettingsFragment.PSC_URL:
|
|
||||||
pref.setSummary(sharedPreferences.getString(key, ""));
|
|
||||||
break;
|
|
||||||
case SettingsFragment.PSC_NONCE:
|
|
||||||
pref.setSummary(sharedPreferences.getString(key, ""));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zm1,15h-2v-6h2v6zm0,-8h-2V7h2v2z"/>
|
|
||||||
</vector>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M11.5,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zm6.5,-6v-5.5c0,-3.07 -2.13,-5.64 -5,-6.32V3.5c0,-0.83 -0.67,-1.5 -1.5,-1.5S10,2.67 10,3.5v0.68c-2.87,0.68 -5,3.25 -5,6.32V16l-2,2v1h17v-1l-2,-2z"/>
|
|
||||||
</vector>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01,-.25 1.97,-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0,-4.42,-3.58,-8,-8,-8zm0 14c-3.31 0,-6,-2.69,-6,-6 0,-1.01.25,-1.97.7,-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4,-4,-4,-4v3z"/>
|
|
||||||
</vector>
|
|
|
@ -1,58 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
tools:context=".MainActivity">
|
|
||||||
|
|
||||||
<TextView android:text="@string/instructions" android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/textView" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/button_txt"
|
|
||||||
android:id="@+id/scan_button"
|
|
||||||
android:layout_below="@+id/textView"
|
|
||||||
android:layout_centerHorizontal="true" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:id="@+id/scan_format"
|
|
||||||
android:layout_below="@+id/scan_button"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginTop="44dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:id="@+id/scan_content"
|
|
||||||
android:layout_below="@+id/scan_format"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginTop="32dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/server_response"
|
|
||||||
android:layout_below="@+id/scan_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginTop="44dp" />
|
|
||||||
<TextView
|
|
||||||
android:text="Not Connected"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" android:id="@+id/serverStatus"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
|
|
||||||
android:layout_alignParentLeft="true" android:layout_alignParentStart="true"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
||||||
|
|
||||||
<!-- Settings, should always be in the overflow -->
|
|
||||||
<item android:id="@+id/action_settings"
|
|
||||||
android:title="@string/action_settings"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
</menu>
|
|
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 10 KiB |
|
@ -1,6 +0,0 @@
|
||||||
<resources>
|
|
||||||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
|
||||||
(such as screen margins) for screens with more than 820dp of available width. This
|
|
||||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
|
||||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
|
||||||
</resources>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="colorPrimary">#3F51B5</color>
|
|
||||||
<color name="colorPrimaryDark">#303F9F</color>
|
|
||||||
<color name="colorAccent">#FF4081</color>
|
|
||||||
</resources>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<resources>
|
|
||||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
|
||||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
|
||||||
</resources>
|
|
|
@ -1,80 +0,0 @@
|
||||||
<resources>
|
|
||||||
<string name="app_name">FakeScannerApp</string>
|
|
||||||
<string name="button_txt">SCAN</string>
|
|
||||||
<string name="instructions">Please, press the button below to scan the vote receipt.</string>
|
|
||||||
<string name="title_activity_settings">Settings</string>
|
|
||||||
|
|
||||||
<!-- Strings related to Settings -->
|
|
||||||
<string name="action_settings">Settings</string>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Example General settings -->
|
|
||||||
<string name="pref_header_general">General</string>
|
|
||||||
|
|
||||||
<string name="pref_title_social_recommendations">Enable social recommendations</string>
|
|
||||||
<string name="pref_description_social_recommendations">Recommendations for people to contact based on your message
|
|
||||||
history
|
|
||||||
</string>
|
|
||||||
|
|
||||||
<string name="pref_title_psc_url">Scanner Service URL</string>
|
|
||||||
<string name="pref_default_psc_url">http://192.168.70.10:8880/scan</string>
|
|
||||||
|
|
||||||
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
|
|
||||||
<string-array name="pref_example_list_titles">
|
|
||||||
<item>Always</item>
|
|
||||||
<item>When possible</item>
|
|
||||||
<item>Never</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="pref_example_list_values">
|
|
||||||
<item>1</item>
|
|
||||||
<item>0</item>
|
|
||||||
<item>-1</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<!-- Example settings for Data & Sync -->
|
|
||||||
<string name="pref_header_data_sync">Data & sync</string>
|
|
||||||
|
|
||||||
<string name="pref_title_sync_frequency">Sync frequency</string>
|
|
||||||
<string-array name="pref_sync_frequency_titles">
|
|
||||||
<item>15 minutes</item>
|
|
||||||
<item>30 minutes</item>
|
|
||||||
<item>1 hour</item>
|
|
||||||
<item>3 hours</item>
|
|
||||||
<item>6 hours</item>
|
|
||||||
<item>Never</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="pref_sync_frequency_values">
|
|
||||||
<item>15</item>
|
|
||||||
<item>30</item>
|
|
||||||
<item>60</item>
|
|
||||||
<item>180</item>
|
|
||||||
<item>360</item>
|
|
||||||
<item>-1</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="list_preference_entries">
|
|
||||||
<item>Entry 1</item>
|
|
||||||
<item>Entry 2</item>
|
|
||||||
<item>Entry 3</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="list_preference_entry_values">
|
|
||||||
<item>1</item>
|
|
||||||
<item>2</item>
|
|
||||||
<item>3</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="multi_select_list_preference_default_value"/>
|
|
||||||
|
|
||||||
<string name="pref_title_system_sync_settings">System sync settings</string>
|
|
||||||
|
|
||||||
<!-- Example settings for Notifications -->
|
|
||||||
<string name="pref_header_notifications">Notifications</string>
|
|
||||||
|
|
||||||
<string name="pref_title_new_message_notifications">New message notifications</string>
|
|
||||||
|
|
||||||
<string name="pref_title_ringtone">Ringtone</string>
|
|
||||||
<string name="pref_ringtone_silent">Silent</string>
|
|
||||||
|
|
||||||
<string name="pref_title_vibrate">Vibrate</string>
|
|
||||||
</resources>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<resources>
|
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<PreferenceScreen xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<!-- NOTE: EditTextPreference accepts EditText attributes. -->
|
|
||||||
<!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
|
|
||||||
<EditTextPreference
|
|
||||||
android:key="psc_url"
|
|
||||||
android:title="@string/pref_title_psc_url"
|
|
||||||
android:defaultValue="@string/pref_default_psc_url"
|
|
||||||
android:selectAllOnFocus="true"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:inputType="textUri" />
|
|
||||||
|
|
||||||
<EditTextPreference
|
|
||||||
android:key="psc_nonce"
|
|
||||||
android:title="Nonce"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:selectAllOnFocus="true"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:inputType="number"/>
|
|
||||||
|
|
||||||
<!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
|
|
||||||
dismiss it. -->
|
|
||||||
<!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.meerkat.laura.fakescannerapp;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To work on unit tests, switch the Test Artifact in the Build Variants view.
|
|
||||||
*/
|
|
||||||
public class ExampleUnitTest {
|
|
||||||
@Test
|
|
||||||
public void addition_isCorrect() throws Exception {
|
|
||||||
assertEquals(4, 2 + 2);
|
|
||||||
}
|
|
||||||
}
|
|
14
build.gradle
|
@ -1,15 +1,13 @@
|
||||||
apply plugin: com.google.gradle.osdetector.OsDetectorPlugin
|
plugins {
|
||||||
|
id "com.google.osdetector" version "1.4.0"
|
||||||
|
}
|
||||||
|
|
||||||
subprojects { proj ->
|
subprojects { proj ->
|
||||||
proj.afterEvaluate {
|
proj.afterEvaluate {
|
||||||
// Used to generate initial maven-dir layout
|
// Used to generate initial maven-dir layout
|
||||||
task "create-dirs" {
|
task "create-dirs" { description = "Create default maven directory structure" } << {
|
||||||
description = "Create default maven directory structure"
|
sourceSets*.java.srcDirs*.each { it.mkdirs() }
|
||||||
doLast {
|
sourceSets*.resources.srcDirs*.each { it.mkdirs() }
|
||||||
sourceSets*.java.srcDirs*.each { it.mkdirs() }
|
|
||||||
sourceSets*.resources.srcDirs*.each { it.mkdirs() }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "us.kirchmeier.capsule" version "1.0.2"
|
id "us.kirchmeier.capsule" version "1.0.2"
|
||||||
id 'com.google.protobuf' version '0.8.1'
|
id 'com.google.protobuf' version '0.8.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
@ -25,11 +25,8 @@ ext {
|
||||||
|
|
||||||
// Credentials for IDC nexus repositories (needed only for using unstable repositories and publishing)
|
// Credentials for IDC nexus repositories (needed only for using unstable repositories and publishing)
|
||||||
// Should be set in ${HOME}/.gradle/gradle.properties
|
// Should be set in ${HOME}/.gradle/gradle.properties
|
||||||
|
nexusUser = project.hasProperty('nexusUser') ? project.property('nexusUser') : ""
|
||||||
// Credentials for publishing repositories
|
nexusPassword = project.hasProperty('nexusPassword') ? project.property('nexusPassword') : ""
|
||||||
publishRepository = "https://cs.idc.ac.il/nexus/content/repositories/${project.isSnapshot ? 'snapshots' : 'releases'}"
|
|
||||||
publishUser = project.hasProperty('publishUser') ? project.property('publishUser') : ""
|
|
||||||
publishPassword = project.hasProperty('publishPassword') ? project.property('publishPassword') : ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "TODO: Add a description"
|
description = "TODO: Add a description"
|
||||||
|
@ -134,19 +131,17 @@ if (project.hasProperty('mainClassName') && (mainClassName != null)) {
|
||||||
|
|
||||||
destinationDir = buildDir
|
destinationDir = buildDir
|
||||||
|
|
||||||
def fatMain
|
def fatMain = hasProperty('fatmain') ? fatmain : mainClassName
|
||||||
|
|
||||||
if (this.hasProperty('fatmain')) {
|
|
||||||
fatMain = fatmain
|
|
||||||
appendix = "fat-${fatMain}"
|
|
||||||
} else {
|
|
||||||
fatMain = mainClassName
|
|
||||||
appendix = "fat"
|
|
||||||
}
|
|
||||||
|
|
||||||
applicationClass fatMain
|
applicationClass fatMain
|
||||||
|
|
||||||
def testJar = this.hasProperty('test')
|
def testJar = hasProperty('test')
|
||||||
|
|
||||||
|
if (hasProperty('fatmain')) {
|
||||||
|
appendix = "fat-${fatMain}"
|
||||||
|
} else {
|
||||||
|
appendix = "fat"
|
||||||
|
}
|
||||||
|
|
||||||
if (testJar) {
|
if (testJar) {
|
||||||
from sourceSets.test.output
|
from sourceSets.test.output
|
||||||
|
@ -160,6 +155,21 @@ if (project.hasProperty('mainClassName') && (mainClassName != null)) {
|
||||||
*===================================*/
|
*===================================*/
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
||||||
|
// Prefer the local nexus repository (it may have 3rd party artifacts not found in mavenCentral)
|
||||||
|
maven {
|
||||||
|
url nexusRepository
|
||||||
|
|
||||||
|
if (isSnapshot) {
|
||||||
|
credentials { username
|
||||||
|
password
|
||||||
|
|
||||||
|
username nexusUser
|
||||||
|
password nexusPassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Use local maven repository
|
// Use local maven repository
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
|
||||||
|
@ -167,15 +177,13 @@ repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
task "info" {
|
task "info" << {
|
||||||
doLast {
|
|
||||||
println "Project: ${project.name}"
|
println "Project: ${project.name}"
|
||||||
println "Description: ${project.description}"
|
println "Description: ${project.description}"
|
||||||
println "--------------------------"
|
println "--------------------------"
|
||||||
println "GroupId: $groupId"
|
println "GroupId: $groupId"
|
||||||
println "Version: $version (${isSnapshot ? 'snapshot' : 'release'})"
|
println "Version: $version (${isSnapshot ? 'snapshot' : 'release'})"
|
||||||
println ""
|
println ""
|
||||||
}
|
|
||||||
}
|
}
|
||||||
info.description 'Print some information about project parameters'
|
info.description 'Print some information about project parameters'
|
||||||
|
|
||||||
|
@ -197,12 +205,12 @@ publishing {
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url publishRepository
|
url "https://cs.idc.ac.il/nexus/content/repositories/${project.isSnapshot ? 'snapshots' : 'releases'}"
|
||||||
credentials { username
|
credentials { username
|
||||||
password
|
password
|
||||||
|
|
||||||
username publishUser
|
username nexusUser
|
||||||
password publishPassword
|
password nexusPassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
apply plugin: 'groovy'
|
|
||||||
|
|
||||||
description = 'A Gradle plugin that detects the OS name and architecture, providing a uniform\
|
|
||||||
classifier to be used in the names of native artifacts.'
|
|
||||||
group = 'com.google.gradle'
|
|
||||||
|
|
||||||
// The major and minor versions are aligned with the Maven plugin's.
|
|
||||||
version = '1.5.0-SNAPSHOT'
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile gradleApi(),
|
|
||||||
localGroovy(),
|
|
||||||
'kr.motd.maven:os-maven-plugin:1.5.0.Final'
|
|
||||||
// Newer versions of gradle conflict with the default guava 10. dependency of the maven
|
|
||||||
// plugin.
|
|
||||||
compile("com.google.guava:guava:19.0") {
|
|
||||||
force = true
|
|
||||||
}
|
|
||||||
testCompile 'junit:junit:4.12'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
../gradlew
|
|
|
@ -1,25 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2015 Google Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* 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 com.google.gradle.osdetector
|
|
||||||
|
|
||||||
import org.gradle.api.Plugin
|
|
||||||
import org.gradle.api.Project
|
|
||||||
|
|
||||||
class OsDetectorPlugin implements Plugin<Project> {
|
|
||||||
void apply(final Project project) {
|
|
||||||
project.extensions.create('osdetector', OsDetector)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,120 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2015 Google Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* 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 com.google.gradle.osdetector;
|
|
||||||
|
|
||||||
import kr.motd.maven.os.Detector;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class OsDetector {
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(OsDetector.class.getName());
|
|
||||||
|
|
||||||
private final List<String> classifierWithLikes = new ArrayList<String>();
|
|
||||||
private Impl impl;
|
|
||||||
|
|
||||||
public String getOs() {
|
|
||||||
return (String) getImpl().detectedProperties.get(Detector.DETECTED_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getArch() {
|
|
||||||
return (String) getImpl().detectedProperties.get(Detector.DETECTED_ARCH);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClassifier() {
|
|
||||||
return (String) getImpl().detectedProperties.get(Detector.DETECTED_CLASSIFIER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Release getRelease() {
|
|
||||||
Impl impl = getImpl();
|
|
||||||
Object releaseId = impl.detectedProperties.get(Detector.DETECTED_RELEASE);
|
|
||||||
if (releaseId == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new Release(impl);
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void setClassifierWithLikes(List<String> classifierWithLikes) {
|
|
||||||
if (impl != null) {
|
|
||||||
throw new IllegalStateException("classifierWithLikes must be set before osdetector is read.");
|
|
||||||
}
|
|
||||||
this.classifierWithLikes.clear();
|
|
||||||
this.classifierWithLikes.addAll(classifierWithLikes);
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized Impl getImpl() {
|
|
||||||
if (impl == null) {
|
|
||||||
impl = new Impl(classifierWithLikes);
|
|
||||||
}
|
|
||||||
return impl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Accessor to information about the current OS release.
|
|
||||||
*/
|
|
||||||
public static class Release {
|
|
||||||
private final Impl impl;
|
|
||||||
|
|
||||||
private Release(Impl impl) {
|
|
||||||
this.impl = impl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the release ID.
|
|
||||||
*/
|
|
||||||
public String getId() {
|
|
||||||
return (String) impl.detectedProperties.get(Detector.DETECTED_RELEASE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the version ID.
|
|
||||||
*/
|
|
||||||
public String getVersion() {
|
|
||||||
return (String) impl.detectedProperties.get(Detector.DETECTED_RELEASE_VERSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns {@code true} if this release is a variant of the given base release (for example,
|
|
||||||
* ubuntu is "like" debian).
|
|
||||||
*/
|
|
||||||
public boolean isLike(String baseRelease) {
|
|
||||||
return impl.detectedProperties.containsKey(
|
|
||||||
Detector.DETECTED_RELEASE_LIKE_PREFIX + baseRelease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class Impl extends Detector {
|
|
||||||
final Properties detectedProperties = System.getProperties();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void log(String message) {
|
|
||||||
logger.info(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void logProperty(String name, String value) {
|
|
||||||
logger.info(name + "=" + value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Impl(List<String> classifierWithLikes) {
|
|
||||||
detect(detectedProperties, classifierWithLikes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
implementation-class=com.google.gradle.osdetector.OsDetectorPlugin
|
|
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2015 Google Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* 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 com.google.gradle.osdetector
|
|
||||||
|
|
||||||
import org.gradle.testfixtures.ProjectBuilder
|
|
||||||
import org.gradle.api.Project
|
|
||||||
import org.junit.Test
|
|
||||||
import static org.junit.Assert.assertEquals
|
|
||||||
import static org.junit.Assert.assertNotNull
|
|
||||||
import static org.junit.Assert.fail
|
|
||||||
|
|
||||||
class OsDetectorPluginTest {
|
|
||||||
@Test
|
|
||||||
public void pluginAddsExtensionToProject() {
|
|
||||||
Project project = ProjectBuilder.builder().build()
|
|
||||||
project.apply plugin: 'com.google.osdetector'
|
|
||||||
assertNotNull(project.osdetector)
|
|
||||||
assertNotNull(project.osdetector.os)
|
|
||||||
assertNotNull(project.osdetector.arch)
|
|
||||||
assertEquals(project.osdetector.os + '-' + project.osdetector.arch,
|
|
||||||
project.osdetector.classifier)
|
|
||||||
System.err.println('classifier=' + project.osdetector.classifier)
|
|
||||||
if (project.osdetector.os == 'linux') {
|
|
||||||
assertNotNull(project.osdetector.release.id)
|
|
||||||
assertNotNull(project.osdetector.release.version)
|
|
||||||
System.err.println('release.id=' + project.osdetector.release.id)
|
|
||||||
System.err.println('release.version=' + project.osdetector.release.version)
|
|
||||||
System.err.println('release.isLike(debian)=' + project.osdetector.release.isLike('debian'))
|
|
||||||
System.err.println('release.isLike(redhat)=' + project.osdetector.release.isLike('redhat'))
|
|
||||||
} else if (project.osdetector.release) {
|
|
||||||
fail("Should be null")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void setClassifierWithLikes() {
|
|
||||||
Project project = ProjectBuilder.builder().build()
|
|
||||||
project.apply plugin: 'com.google.osdetector'
|
|
||||||
project.osdetector.classifierWithLikes = ['debian', 'fedora']
|
|
||||||
assertNotNull(project.osdetector.os)
|
|
||||||
assertNotNull(project.osdetector.arch)
|
|
||||||
System.err.println('classifier=' + project.osdetector.classifier)
|
|
||||||
try {
|
|
||||||
project.osdetector.classifierWithLikes = ['debian']
|
|
||||||
fail("Should throw IllegalStateException")
|
|
||||||
} catch (IllegalStateException expected) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Main-Class: meerkat.voting.gui.configuration.Converter
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "us.kirchmeier.capsule" version '1.0.2'
|
id "us.kirchmeier.capsule" version '1.0.2'
|
||||||
id 'com.google.protobuf' version '0.8.1'
|
id 'com.google.protobuf' version '0.8.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
@ -16,17 +16,18 @@ ext { isSnapshot = false }
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
groupId = 'org.factcenter.meerkat'
|
groupId = 'org.factcenter.meerkat'
|
||||||
|
nexusRepository = "https://cs.idc.ac.il/nexus/content/groups/${isSnapshot ? 'unstable' : 'public'}/"
|
||||||
|
|
||||||
// Credentials for publishing repositories
|
// Credentials for IDC nexus repositories (needed only for using unstable repositories and publishing)
|
||||||
publishRepository = "https://cs.idc.ac.il/nexus/content/repositories/${project.isSnapshot ? 'snapshots' : 'releases'}"
|
// Should be set in ${HOME}/.gradle/gradle.properties
|
||||||
publishUser = project.hasProperty('publishUser') ? project.property('publishUser') : ""
|
nexusUser = project.hasProperty('nexusUser') ? project.property('nexusUser') : ""
|
||||||
publishPassword = project.hasProperty('publishPassword') ? project.property('publishPassword') : ""
|
nexusPassword = project.hasProperty('nexusPassword') ? project.property('nexusPassword') : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "Meerkat Voting Common Library"
|
description = "Meerkat Voting Common Library"
|
||||||
|
|
||||||
// Your project version
|
// Your project version
|
||||||
version = "0.1"
|
version = "0.0"
|
||||||
|
|
||||||
version += "${isSnapshot ? '-SNAPSHOT' : ''}"
|
version += "${isSnapshot ? '-SNAPSHOT' : ''}"
|
||||||
|
|
||||||
|
@ -37,10 +38,23 @@ dependencies {
|
||||||
compile project(':meerkat-common')
|
compile project(':meerkat-common')
|
||||||
compile project(':restful-api-common')
|
compile project(':restful-api-common')
|
||||||
|
|
||||||
|
// Jersey for RESTful API
|
||||||
// Databases
|
compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.22.+'
|
||||||
compile 'org.xerial:sqlite-jdbc:3.7.+'
|
compile 'org.xerial:sqlite-jdbc:3.7.+'
|
||||||
|
|
||||||
|
// Logging
|
||||||
|
compile 'org.slf4j:slf4j-api:1.7.7'
|
||||||
|
runtime 'ch.qos.logback:logback-classic:1.1.2'
|
||||||
|
runtime 'ch.qos.logback:logback-core:1.1.2'
|
||||||
|
|
||||||
|
// Google protobufs
|
||||||
|
compile 'com.google.protobuf:protobuf-java:3.+'
|
||||||
|
|
||||||
|
// Crypto
|
||||||
|
compile 'org.factcenter.qilin:qilin:1.1+'
|
||||||
|
compile 'org.bouncycastle:bcprov-jdk15on:1.53'
|
||||||
|
compile 'org.bouncycastle:bcpkix-jdk15on:1.53'
|
||||||
|
|
||||||
// Depend on test resources from meerkat-common
|
// Depend on test resources from meerkat-common
|
||||||
testCompile project(path: ':meerkat-common', configuration: 'testOutput')
|
testCompile project(path: ':meerkat-common', configuration: 'testOutput')
|
||||||
|
|
||||||
|
@ -49,6 +63,8 @@ dependencies {
|
||||||
|
|
||||||
testCompile 'junit:junit:4.+'
|
testCompile 'junit:junit:4.+'
|
||||||
testCompile 'org.hamcrest:hamcrest-all:1.3'
|
testCompile 'org.hamcrest:hamcrest-all:1.3'
|
||||||
|
|
||||||
|
runtime 'org.codehaus.groovy:groovy:2.4.+'
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
@ -162,22 +178,34 @@ if (project.hasProperty('mainClassName') && (mainClassName != null)) {
|
||||||
*===================================*/
|
*===================================*/
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Use local repo if possible
|
|
||||||
mavenLocal();
|
mavenLocal();
|
||||||
|
|
||||||
|
// Prefer the local nexus repository (it may have 3rd party artifacts not found in mavenCentral)
|
||||||
|
maven {
|
||||||
|
url nexusRepository
|
||||||
|
|
||||||
|
if (isSnapshot) {
|
||||||
|
credentials { username
|
||||||
|
password
|
||||||
|
|
||||||
|
username nexusUser
|
||||||
|
password nexusPassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Use 'maven central' for other dependencies.
|
// Use 'maven central' for other dependencies.
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
task "info" {
|
task "info" << {
|
||||||
doLast {
|
println "Project: ${project.name}"
|
||||||
println "Project: ${project.name}"
|
println "Description: ${project.description}"
|
||||||
println "Description: ${project.description}"
|
println "--------------------------"
|
||||||
println "--------------------------"
|
println "GroupId: $groupId"
|
||||||
println "GroupId: $groupId"
|
println "Version: $version (${isSnapshot ? 'snapshot' : 'release'})"
|
||||||
println "Version: $version (${isSnapshot ? 'snapshot' : 'release'})"
|
println ""
|
||||||
println ""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
info.description 'Print some information about project parameters'
|
info.description 'Print some information about project parameters'
|
||||||
|
|
||||||
|
@ -199,12 +227,12 @@ publishing {
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
url publishRepository
|
url "https://cs.idc.ac.il/nexus/content/repositories/${project.isSnapshot ? 'snapshots' : 'releases'}"
|
||||||
credentials { username
|
credentials { username
|
||||||
password
|
password
|
||||||
|
|
||||||
username publishUser
|
username nexusUser
|
||||||
password publishPassword
|
password nexusPassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
../gradlew
|
|
|
@ -1,6 +1,6 @@
|
||||||
package meerkat.bulletinboard;
|
package meerkat.bulletinboard;
|
||||||
|
|
||||||
import meerkat.protobuf.BulletinBoardApi.BatchChunk;
|
import meerkat.protobuf.BulletinBoardAPI.BatchChunk;
|
||||||
import meerkat.bulletinboard.AsyncBulletinBoardClient.BatchIdentifier;
|
import meerkat.bulletinboard.AsyncBulletinBoardClient.BatchIdentifier;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package meerkat.bulletinboard;
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.protobuf.Timestamp;
|
import com.google.protobuf.Timestamp;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Crypto.Signature;
|
import meerkat.protobuf.Crypto.Signature;
|
||||||
import meerkat.protobuf.Voting.*;
|
import meerkat.protobuf.Voting.*;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import meerkat.comm.MessageInputStream;
|
||||||
import meerkat.comm.MessageInputStream.MessageInputStreamFactory;
|
import meerkat.comm.MessageInputStream.MessageInputStreamFactory;
|
||||||
import meerkat.comm.MessageOutputStream;
|
import meerkat.comm.MessageOutputStream;
|
||||||
import meerkat.crypto.concrete.SHA256Digest;
|
import meerkat.crypto.concrete.SHA256Digest;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Crypto.Signature;
|
import meerkat.protobuf.Crypto.Signature;
|
||||||
import meerkat.protobuf.Voting.*;
|
import meerkat.protobuf.Voting.*;
|
||||||
import meerkat.util.BulletinBoardUtils;
|
import meerkat.util.BulletinBoardUtils;
|
||||||
|
|
|
@ -6,8 +6,8 @@ import com.google.protobuf.Int64Value;
|
||||||
import meerkat.bulletinboard.workers.singleserver.*;
|
import meerkat.bulletinboard.workers.singleserver.*;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.crypto.concrete.SHA256Digest;
|
import meerkat.crypto.concrete.SHA256Digest;
|
||||||
import meerkat.protobuf.BulletinBoardApi;
|
import meerkat.protobuf.BulletinBoardAPI;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Voting.*;
|
import meerkat.protobuf.Voting.*;
|
||||||
import meerkat.rest.*;
|
import meerkat.rest.*;
|
||||||
import meerkat.util.BulletinBoardUtils;
|
import meerkat.util.BulletinBoardUtils;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package meerkat.bulletinboard;
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.util.BulletinBoardUtils;
|
import meerkat.util.BulletinBoardUtils;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.google.protobuf.Timestamp;
|
||||||
import meerkat.bulletinboard.workers.singleserver.*;
|
import meerkat.bulletinboard.workers.singleserver.*;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.crypto.concrete.SHA256Digest;
|
import meerkat.crypto.concrete.SHA256Digest;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Crypto;
|
import meerkat.protobuf.Crypto;
|
||||||
import meerkat.protobuf.Voting.BulletinBoardClientParams;
|
import meerkat.protobuf.Voting.BulletinBoardClientParams;
|
||||||
import meerkat.util.BulletinBoardUtils;
|
import meerkat.util.BulletinBoardUtils;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.google.common.util.concurrent.FutureCallback;
|
||||||
|
|
||||||
import com.google.protobuf.Timestamp;
|
import com.google.protobuf.Timestamp;
|
||||||
import meerkat.bulletinboard.workers.multiserver.*;
|
import meerkat.bulletinboard.workers.multiserver.*;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Crypto.Signature;
|
import meerkat.protobuf.Crypto.Signature;
|
||||||
import meerkat.protobuf.Voting.*;
|
import meerkat.protobuf.Voting.*;
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ package meerkat.bulletinboard;
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.protobuf.Timestamp;
|
import com.google.protobuf.Timestamp;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.util.BulletinBoardUtils;
|
import meerkat.util.BulletinBoardUtils;
|
||||||
|
|
||||||
import static meerkat.protobuf.BulletinBoardApi.FilterType.*;
|
import static meerkat.protobuf.BulletinBoardAPI.FilterType.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.google.common.util.concurrent.FutureCallback;
|
||||||
import meerkat.bulletinboard.MultiServerWorker;
|
import meerkat.bulletinboard.MultiServerWorker;
|
||||||
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package meerkat.bulletinboard.workers.multiserver;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
||||||
import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage;
|
import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package meerkat.bulletinboard.workers.multiserver;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package meerkat.bulletinboard.workers.multiserver;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ package meerkat.bulletinboard.workers.multiserver;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
||||||
import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage;
|
import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage;
|
||||||
import meerkat.protobuf.BulletinBoardApi.MessageID;
|
import meerkat.protobuf.BulletinBoardAPI.MessageID;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package meerkat.bulletinboard.workers.multiserver;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
import meerkat.bulletinboard.SingleServerBulletinBoardClient;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package meerkat.bulletinboard.workers.singleserver;
|
||||||
import com.google.protobuf.Int64Value;
|
import com.google.protobuf.Int64Value;
|
||||||
import meerkat.bulletinboard.SingleServerWorker;
|
import meerkat.bulletinboard.SingleServerWorker;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.protobuf.BulletinBoardApi.BeginBatchMessage;
|
import meerkat.protobuf.BulletinBoardAPI.BeginBatchMessage;
|
||||||
import meerkat.rest.Constants;
|
import meerkat.rest.Constants;
|
||||||
|
|
||||||
import javax.ws.rs.ProcessingException;
|
import javax.ws.rs.ProcessingException;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package meerkat.bulletinboard.workers.singleserver;
|
package meerkat.bulletinboard.workers.singleserver;
|
||||||
|
|
||||||
import meerkat.protobuf.BulletinBoardApi.CloseBatchMessage;
|
import meerkat.protobuf.BulletinBoardAPI.CloseBatchMessage;
|
||||||
|
|
||||||
import static meerkat.bulletinboard.BulletinBoardConstants.CLOSE_BATCH_PATH;
|
import static meerkat.bulletinboard.BulletinBoardConstants.CLOSE_BATCH_PATH;
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ package meerkat.bulletinboard.workers.singleserver;
|
||||||
import com.google.protobuf.Int64Value;
|
import com.google.protobuf.Int64Value;
|
||||||
import meerkat.bulletinboard.SingleServerWorker;
|
import meerkat.bulletinboard.SingleServerWorker;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.protobuf.BulletinBoardApi.SyncQuery;
|
import meerkat.protobuf.BulletinBoardAPI.SyncQuery;
|
||||||
import meerkat.protobuf.BulletinBoardApi.GenerateSyncQueryParams;
|
import meerkat.protobuf.BulletinBoardAPI.GenerateSyncQueryParams;
|
||||||
import meerkat.rest.Constants;
|
import meerkat.rest.Constants;
|
||||||
|
|
||||||
import javax.ws.rs.ProcessingException;
|
import javax.ws.rs.ProcessingException;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package meerkat.bulletinboard.workers.singleserver;
|
||||||
import meerkat.bulletinboard.SingleServerWorker;
|
import meerkat.bulletinboard.SingleServerWorker;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.comm.MessageInputStream;
|
import meerkat.comm.MessageInputStream;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.rest.Constants;
|
import meerkat.rest.Constants;
|
||||||
|
|
||||||
import javax.ws.rs.client.Client;
|
import javax.ws.rs.client.Client;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package meerkat.bulletinboard.workers.singleserver;
|
package meerkat.bulletinboard.workers.singleserver;
|
||||||
|
|
||||||
import meerkat.protobuf.BulletinBoardApi.BatchMessage;
|
import meerkat.protobuf.BulletinBoardAPI.BatchMessage;
|
||||||
|
|
||||||
import static meerkat.bulletinboard.BulletinBoardConstants.POST_BATCH_PATH;
|
import static meerkat.bulletinboard.BulletinBoardConstants.POST_BATCH_PATH;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package meerkat.bulletinboard.workers.singleserver;
|
package meerkat.bulletinboard.workers.singleserver;
|
||||||
|
|
||||||
import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage;
|
import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage;
|
||||||
|
|
||||||
import static meerkat.bulletinboard.BulletinBoardConstants.POST_MESSAGE_PATH;
|
import static meerkat.bulletinboard.BulletinBoardConstants.POST_MESSAGE_PATH;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ package meerkat.bulletinboard.workers.singleserver;
|
||||||
|
|
||||||
import meerkat.bulletinboard.SingleServerWorker;
|
import meerkat.bulletinboard.SingleServerWorker;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.protobuf.BulletinBoardApi.SyncQuery;
|
import meerkat.protobuf.BulletinBoardAPI.SyncQuery;
|
||||||
import meerkat.protobuf.BulletinBoardApi.SyncQueryResponse;
|
import meerkat.protobuf.BulletinBoardAPI.SyncQueryResponse;
|
||||||
import meerkat.rest.Constants;
|
import meerkat.rest.Constants;
|
||||||
|
|
||||||
import javax.ws.rs.ProcessingException;
|
import javax.ws.rs.ProcessingException;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package meerkat.bulletinboard.workers.singleserver;
|
||||||
import meerkat.bulletinboard.SingleServerWorker;
|
import meerkat.bulletinboard.SingleServerWorker;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.comm.MessageInputStream;
|
import meerkat.comm.MessageInputStream;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.rest.Constants;
|
import meerkat.rest.Constants;
|
||||||
|
|
||||||
import javax.ws.rs.client.Client;
|
import javax.ws.rs.client.Client;
|
||||||
|
|
|
@ -3,10 +3,10 @@ package meerkat.bulletinboard.workers.singleserver;
|
||||||
import meerkat.bulletinboard.SingleServerWorker;
|
import meerkat.bulletinboard.SingleServerWorker;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.comm.MessageInputStream;
|
import meerkat.comm.MessageInputStream;
|
||||||
import meerkat.protobuf.BulletinBoardApi;
|
import meerkat.protobuf.BulletinBoardAPI;
|
||||||
import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessageList;
|
import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessageList;
|
||||||
import meerkat.protobuf.BulletinBoardApi.MessageFilterList;
|
import meerkat.protobuf.BulletinBoardAPI.MessageFilterList;
|
||||||
import meerkat.protobuf.BulletinBoardApi.BulletinBoardMessage;
|
import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage;
|
||||||
import meerkat.rest.Constants;
|
import meerkat.rest.Constants;
|
||||||
|
|
||||||
import javax.ws.rs.ProcessingException;
|
import javax.ws.rs.ProcessingException;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import meerkat.bulletinboard.sqlserver.H2QueryProvider;
|
||||||
|
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.crypto.concrete.ECDSASignature;
|
import meerkat.crypto.concrete.ECDSASignature;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.util.BulletinBoardMessageComparator;
|
import meerkat.util.BulletinBoardMessageComparator;
|
||||||
import meerkat.util.BulletinBoardMessageGenerator;
|
import meerkat.util.BulletinBoardMessageGenerator;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.google.protobuf.Timestamp;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.crypto.concrete.ECDSASignature;
|
import meerkat.crypto.concrete.ECDSASignature;
|
||||||
import meerkat.crypto.concrete.SHA256Digest;
|
import meerkat.crypto.concrete.SHA256Digest;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Crypto;
|
import meerkat.protobuf.Crypto;
|
||||||
import meerkat.util.BulletinBoardMessageComparator;
|
import meerkat.util.BulletinBoardMessageComparator;
|
||||||
import meerkat.util.BulletinBoardMessageGenerator;
|
import meerkat.util.BulletinBoardMessageGenerator;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.google.protobuf.ByteString;
|
||||||
import com.google.protobuf.Timestamp;
|
import com.google.protobuf.Timestamp;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.crypto.concrete.ECDSASignature;
|
import meerkat.crypto.concrete.ECDSASignature;
|
||||||
import meerkat.protobuf.BulletinBoardApi.*;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.util.BulletinBoardMessageComparator;
|
import meerkat.util.BulletinBoardMessageComparator;
|
||||||
import meerkat.util.BulletinBoardMessageGenerator;
|
import meerkat.util.BulletinBoardMessageGenerator;
|
||||||
|
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
||||||
"project": {
|
|
||||||
"name": "bulletin-board-server-frontend"
|
|
||||||
},
|
|
||||||
"apps": [
|
|
||||||
{
|
|
||||||
"root": "src",
|
|
||||||
"outDir": "dist",
|
|
||||||
"assets": [
|
|
||||||
"assets",
|
|
||||||
"favicon.ico"
|
|
||||||
],
|
|
||||||
"index": "index.html",
|
|
||||||
"main": "main.ts",
|
|
||||||
"polyfills": "polyfills.ts",
|
|
||||||
"test": "test.ts",
|
|
||||||
"tsconfig": "tsconfig.app.json",
|
|
||||||
"testTsconfig": "tsconfig.spec.json",
|
|
||||||
"prefix": "app",
|
|
||||||
"styles": [
|
|
||||||
"styles.css"
|
|
||||||
],
|
|
||||||
"scripts": [],
|
|
||||||
"environmentSource": "environments/environment.ts",
|
|
||||||
"environments": {
|
|
||||||
"dev": "environments/environment.ts",
|
|
||||||
"prod": "environments/environment.prod.ts"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"e2e": {
|
|
||||||
"protractor": {
|
|
||||||
"config": "./protractor.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": [
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.app.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.spec.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "e2e/tsconfig.e2e.json"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"test": {
|
|
||||||
"karma": {
|
|
||||||
"config": "./karma.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaults": {
|
|
||||||
"styleExt": "css",
|
|
||||||
"component": {}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
# Editor configuration, see http://editorconfig.org
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
max_line_length = off
|
|
||||||
trim_trailing_whitespace = false
|
|
|
@ -1,42 +0,0 @@
|
||||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# compiled output
|
|
||||||
/dist
|
|
||||||
/tmp
|
|
||||||
/out-tsc
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
|
|
||||||
# IDEs and editors
|
|
||||||
/.idea
|
|
||||||
.project
|
|
||||||
.classpath
|
|
||||||
.c9/
|
|
||||||
*.launch
|
|
||||||
.settings/
|
|
||||||
*.sublime-workspace
|
|
||||||
|
|
||||||
# IDE - VSCode
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
|
|
||||||
# misc
|
|
||||||
/.sass-cache
|
|
||||||
/connect.lock
|
|
||||||
/coverage
|
|
||||||
/libpeerconnection.log
|
|
||||||
npm-debug.log
|
|
||||||
testem.log
|
|
||||||
/typings
|
|
||||||
|
|
||||||
# e2e
|
|
||||||
/e2e/*.js
|
|
||||||
/e2e/*.map
|
|
||||||
|
|
||||||
# System Files
|
|
||||||
.DS_Store
|
|
||||||
Thumbs.db
|
|
|
@ -1,28 +0,0 @@
|
||||||
# BulletinBoardServerFrontend
|
|
||||||
|
|
||||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.2.0.
|
|
||||||
|
|
||||||
## Development server
|
|
||||||
|
|
||||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
|
||||||
|
|
||||||
## Code scaffolding
|
|
||||||
|
|
||||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|module`.
|
|
||||||
|
|
||||||
## Build
|
|
||||||
|
|
||||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
|
|
||||||
|
|
||||||
## Running unit tests
|
|
||||||
|
|
||||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
||||||
|
|
||||||
## Running end-to-end tests
|
|
||||||
|
|
||||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
|
||||||
Before running the tests make sure you are serving the app via `ng serve`.
|
|
||||||
|
|
||||||
## Further help
|
|
||||||
|
|
||||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
|
|
@ -1,60 +0,0 @@
|
||||||
plugins {
|
|
||||||
id "com.moowork.node" version "1.2.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
node {
|
|
||||||
download = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ext {
|
|
||||||
bundlejs = "src/app/bundle.js"
|
|
||||||
bundlets = "src/app/bundle.d.ts"
|
|
||||||
}
|
|
||||||
|
|
||||||
//task installAngularCli(type: NpmTask) {
|
|
||||||
// args = ['install', '@angular/cli']
|
|
||||||
//}
|
|
||||||
//npm_install.dependsOn(installAngularCli);
|
|
||||||
|
|
||||||
task printProtos {
|
|
||||||
doLast {
|
|
||||||
println getProtoFiles().join(" ")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printProtos.description = "List all the .proto files we can find."
|
|
||||||
|
|
||||||
|
|
||||||
def getProtoFiles() {
|
|
||||||
def protoFiles = []
|
|
||||||
|
|
||||||
rootProject.subprojects { proj ->
|
|
||||||
if (proj.hasProperty('sourceSets') && proj.sourceSets.hasProperty('main') &&
|
|
||||||
proj.sourceSets.main.hasProperty('proto')) {
|
|
||||||
protoFiles = protoFiles + proj.sourceSets.main.proto.getFiles();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return protoFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
task generateProtobufBundle(type: NpmTask) {
|
|
||||||
doFirst {
|
|
||||||
// We need do this in doFirst since getProtoFiles won't find all subprojects
|
|
||||||
// until after configuration is complete
|
|
||||||
def protoFiles = getProtoFiles()
|
|
||||||
generateProtobufBundle.args = ['run', 'protoc', '--' ] + protoFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
dependsOn npm_install
|
|
||||||
}
|
|
||||||
generateProtobufBundle.description = "Generate the bundle.js/bundle.d.ts files containing compiled protobufs"
|
|
||||||
|
|
||||||
|
|
||||||
npm_run_build.dependsOn(npm_install)
|
|
||||||
npm_run_build.dependsOn(generateProtobufBundle)
|
|
||||||
npm_start.dependsOn(generateProtobufBundle)
|
|
||||||
|
|
||||||
|
|
||||||
// It would be nice if this worked, but it seems to get stuck:
|
|
||||||
//npm_start.dependsOn(project(':bulletin-board-server').jettyStart);
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
import { BulletinBoardServerFrontendPage } from './app.po';
|
|
||||||
|
|
||||||
describe('bulletin-board-server-frontend App', () => {
|
|
||||||
let page: BulletinBoardServerFrontendPage;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
page = new BulletinBoardServerFrontendPage();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display welcome message', () => {
|
|
||||||
page.navigateTo();
|
|
||||||
expect(page.getParagraphText()).toEqual('Welcome to app!!');
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,11 +0,0 @@
|
||||||
import { browser, by, element } from 'protractor';
|
|
||||||
|
|
||||||
export class BulletinBoardServerFrontendPage {
|
|
||||||
navigateTo() {
|
|
||||||
return browser.get('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
getParagraphText() {
|
|
||||||
return element(by.css('app-root h1')).getText();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "../out-tsc/e2e",
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es5",
|
|
||||||
"types": [
|
|
||||||
"jasmine",
|
|
||||||
"jasminewd2",
|
|
||||||
"node"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
const { execFileSync } = require('child_process');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const isWin = (process.platform === 'win32');
|
|
||||||
|
|
||||||
const bundlejs = 'src/app/bundle.js'
|
|
||||||
const bundlets = 'src/app/bundle.d.ts'
|
|
||||||
|
|
||||||
const npm = isWin ? 'npm.cmd' : 'npm';
|
|
||||||
|
|
||||||
|
|
||||||
var args = process.argv.slice(2).map(function(x) {
|
|
||||||
return path.normalize(x);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
var pbjs_args = [
|
|
||||||
'-t', 'static-module', '-w', 'commonjs', '-o', bundlejs
|
|
||||||
].concat(args);
|
|
||||||
|
|
||||||
console.log("Running pbjs " + pbjs_args.join(" "));
|
|
||||||
var out = execFileSync(npm, ['run', 'pbjs', '--'].concat(pbjs_args));
|
|
||||||
console.log("" + out);
|
|
||||||
|
|
||||||
var pbts_args = [
|
|
||||||
'-o', bundlets, bundlejs
|
|
||||||
];
|
|
||||||
|
|
||||||
console.log("Running pbts " + pbts_args.join(" "));
|
|
||||||
out = execFileSync(npm, ['run', 'pbts', '--'].concat(pbts_args));
|
|
||||||
console.log("" + out);
|
|
|
@ -1 +0,0 @@
|
||||||
../gradlew
|
|
|
@ -1,33 +0,0 @@
|
||||||
// Karma configuration file, see link for more information
|
|
||||||
// https://karma-runner.github.io/0.13/config/configuration-file.html
|
|
||||||
|
|
||||||
module.exports = function (config) {
|
|
||||||
config.set({
|
|
||||||
basePath: '',
|
|
||||||
frameworks: ['jasmine', '@angular/cli'],
|
|
||||||
plugins: [
|
|
||||||
require('karma-jasmine'),
|
|
||||||
require('karma-chrome-launcher'),
|
|
||||||
require('karma-jasmine-html-reporter'),
|
|
||||||
require('karma-coverage-istanbul-reporter'),
|
|
||||||
require('@angular/cli/plugins/karma')
|
|
||||||
],
|
|
||||||
client:{
|
|
||||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
||||||
},
|
|
||||||
coverageIstanbulReporter: {
|
|
||||||
reports: [ 'html', 'lcovonly' ],
|
|
||||||
fixWebpackSourcePaths: true
|
|
||||||
},
|
|
||||||
angularCli: {
|
|
||||||
environment: 'dev'
|
|
||||||
},
|
|
||||||
reporters: ['progress', 'kjhtml'],
|
|
||||||
port: 9876,
|
|
||||||
colors: true,
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
autoWatch: true,
|
|
||||||
browsers: ['Chrome'],
|
|
||||||
singleRun: false
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -1,53 +0,0 @@
|
||||||
{
|
|
||||||
"name": "bulletin-board-server-frontend",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"license": "MIT",
|
|
||||||
"scripts": {
|
|
||||||
"ng": "ng",
|
|
||||||
"start": "ng serve --proxy-config proxy.conf.json",
|
|
||||||
"build": "ng build",
|
|
||||||
"test": "ng test",
|
|
||||||
"lint": "ng e2e",
|
|
||||||
"pbts": "pbts",
|
|
||||||
"pbjs": "pbjs",
|
|
||||||
"protoc" : "node ./generate-protobuf.js"
|
|
||||||
},
|
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@angular/animations": "^4.0.0",
|
|
||||||
"@angular/common": "^4.0.0",
|
|
||||||
"@angular/compiler": "^4.0.0",
|
|
||||||
"@angular/core": "^4.0.0",
|
|
||||||
"@angular/forms": "^4.0.0",
|
|
||||||
"@angular/http": "^4.0.0",
|
|
||||||
"@angular/platform-browser": "^4.0.0",
|
|
||||||
"@angular/platform-browser-dynamic": "^4.0.0",
|
|
||||||
"@angular/router": "^4.0.0",
|
|
||||||
"@types/long": "^3.0.31",
|
|
||||||
"core-js": "^2.4.1",
|
|
||||||
"protobufjs": "^6.8.0",
|
|
||||||
"rxjs": "^5.1.0",
|
|
||||||
"zone.js": "^0.8.4"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@angular/cli": "^1.2.0",
|
|
||||||
"@angular/compiler-cli": "^4.0.0",
|
|
||||||
"@angular/language-service": "^4.0.0",
|
|
||||||
"@types/jasmine": "~2.5.53",
|
|
||||||
"@types/jasminewd2": "~2.0.2",
|
|
||||||
"@types/node": "~6.0.60",
|
|
||||||
"codelyzer": "~3.0.1",
|
|
||||||
"jasmine-core": "~2.6.2",
|
|
||||||
"jasmine-spec-reporter": "~4.1.0",
|
|
||||||
"karma": "~1.7.0",
|
|
||||||
"karma-chrome-launcher": "~2.1.1",
|
|
||||||
"karma-cli": "~1.0.1",
|
|
||||||
"karma-coverage-istanbul-reporter": "^1.2.1",
|
|
||||||
"karma-jasmine": "~1.1.0",
|
|
||||||
"karma-jasmine-html-reporter": "^0.2.2",
|
|
||||||
"protractor": "~5.1.2",
|
|
||||||
"ts-node": "~3.0.4",
|
|
||||||
"tslint": "~5.3.2",
|
|
||||||
"typescript": "~2.3.3"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
// Protractor configuration file, see link for more information
|
|
||||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
|
||||||
|
|
||||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
|
||||||
|
|
||||||
exports.config = {
|
|
||||||
allScriptsTimeout: 11000,
|
|
||||||
specs: [
|
|
||||||
'./e2e/**/*.e2e-spec.ts'
|
|
||||||
],
|
|
||||||
capabilities: {
|
|
||||||
'browserName': 'chrome'
|
|
||||||
},
|
|
||||||
directConnect: true,
|
|
||||||
baseUrl: 'http://localhost:4200/',
|
|
||||||
framework: 'jasmine',
|
|
||||||
jasmineNodeOpts: {
|
|
||||||
showColors: true,
|
|
||||||
defaultTimeoutInterval: 30000,
|
|
||||||
print: function() {}
|
|
||||||
},
|
|
||||||
onPrepare() {
|
|
||||||
require('ts-node').register({
|
|
||||||
project: 'e2e/tsconfig.e2e.json'
|
|
||||||
});
|
|
||||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"/bbserver" : {
|
|
||||||
"target" : "http://localhost:8081/",
|
|
||||||
"secure" : false
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
<!--The content below is only a placeholder and can be replaced.-->
|
|
||||||
<div style="text-align:center">
|
|
||||||
<h1>
|
|
||||||
Welcome to {{title}}!!
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<h3>Current status: {{status}}</h3>
|
|
||||||
<img width="300" src="assets/meerkat-logo.svg">
|
|
||||||
<hr>
|
|
||||||
{{errorMessage}}
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
import { TestBed, async } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
|
|
||||||
describe('AppComponent', () => {
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [
|
|
||||||
AppComponent
|
|
||||||
],
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should create the app', async(() => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
const app = fixture.debugElement.componentInstance;
|
|
||||||
expect(app).toBeTruthy();
|
|
||||||
}));
|
|
||||||
|
|
||||||
it(`should have as title 'app'`, async(() => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
const app = fixture.debugElement.componentInstance;
|
|
||||||
expect(app.title).toEqual('app');
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should render title in a h1 tag', async(() => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
fixture.detectChanges();
|
|
||||||
const compiled = fixture.debugElement.nativeElement;
|
|
||||||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!!');
|
|
||||||
}));
|
|
||||||
});
|
|
|
@ -1,55 +0,0 @@
|
||||||
import {Component, OnInit} from '@angular/core';
|
|
||||||
import {IntervalObservable} from "rxjs/observable/IntervalObservable";
|
|
||||||
import {BBService} from "./bb.service";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-root',
|
|
||||||
templateUrl: './app.component.html',
|
|
||||||
styleUrls: ['./app.component.css'],
|
|
||||||
providers: [BBService]
|
|
||||||
})
|
|
||||||
|
|
||||||
export class AppComponent implements OnInit {
|
|
||||||
|
|
||||||
title = 'Bulletin-Board Server';
|
|
||||||
status = 'Not connected';
|
|
||||||
errorMessage = '';
|
|
||||||
|
|
||||||
private alive: boolean; // used to unsubscribe from the IntervalObservable
|
|
||||||
// when OnDestroy is called.
|
|
||||||
|
|
||||||
constructor(private bbservice : BBService) { }
|
|
||||||
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
|
|
||||||
// Get initial status
|
|
||||||
this.bbservice.getStatus().subscribe(
|
|
||||||
status => { this.status = status.name; this.errorMessage = ""; },
|
|
||||||
error => { this.status = "Not connected"; this.errorMessage = <any>error; }
|
|
||||||
);
|
|
||||||
|
|
||||||
this.alive = true;
|
|
||||||
// Get new status every second
|
|
||||||
let o = IntervalObservable.create(1000)
|
|
||||||
//.takeWhile(() => this.alive) // only fires when component is alive
|
|
||||||
.subscribe(n => {
|
|
||||||
if (!this.alive) {
|
|
||||||
o.unsubscribe();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.bbservice.getStatus().subscribe(
|
|
||||||
status => { this.status = status.name + " " + n; this.errorMessage = ""; },
|
|
||||||
error => { this.errorMessage = <any>error; this.status = "Not connected"; }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ngOnDestroy(){
|
|
||||||
this.alive = false; // switches your IntervalObservable off
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { HttpModule } from '@angular/http';
|
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
import {BBService} from "./bb.service";
|
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
declarations: [
|
|
||||||
AppComponent,
|
|
||||||
],
|
|
||||||
imports: [
|
|
||||||
BrowserModule,
|
|
||||||
HttpModule,
|
|
||||||
],
|
|
||||||
providers: [],
|
|
||||||
bootstrap: [AppComponent]
|
|
||||||
})
|
|
||||||
export class AppModule { }
|
|
|
@ -1,36 +0,0 @@
|
||||||
/// <reference types="@types/long" />
|
|
||||||
import { Injectable } from '@angular/core';
|
|
||||||
import {Headers, Http, RequestOptions, ResponseContentType} from '@angular/http';
|
|
||||||
|
|
||||||
import { meerkat } from "./bundle.js";
|
|
||||||
import {Observable} from "rxjs/Observable";
|
|
||||||
import 'rxjs/add/operator/catch';
|
|
||||||
import 'rxjs/add/operator/map';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class BBService {
|
|
||||||
private headers = new Headers({'Content-Type': 'application/x-protobuf'});
|
|
||||||
private bbUrl = '/bbserver'; // URL to web api
|
|
||||||
private statusPath = '/status';
|
|
||||||
|
|
||||||
constructor(private http: Http) { }
|
|
||||||
|
|
||||||
getStatus(): Observable<meerkat.ServerStatus> {
|
|
||||||
let options = new RequestOptions({
|
|
||||||
responseType: ResponseContentType.ArrayBuffer
|
|
||||||
});
|
|
||||||
|
|
||||||
let res = this.http.get(this.bbUrl + this.statusPath, options);
|
|
||||||
|
|
||||||
return res
|
|
||||||
.catch(this.handleError)
|
|
||||||
.map(x => {
|
|
||||||
return meerkat.ServerStatus.decode(new Uint8Array(x.arrayBuffer()));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private handleError(error: any): Promise<any> {
|
|
||||||
console.error('An error occurred', error); // for demo purposes only
|
|
||||||
return Promise.reject(error.message || error);
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 53 KiB |
|
@ -1,3 +0,0 @@
|
||||||
export const environment = {
|
|
||||||
production: true
|
|
||||||
};
|
|
|
@ -1,8 +0,0 @@
|
||||||
// The file contents for the current environment will overwrite these during build.
|
|
||||||
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
|
|
||||||
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
|
||||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
|
||||||
|
|
||||||
export const environment = {
|
|
||||||
production: false
|
|
||||||
};
|
|
Before Width: | Height: | Size: 5.3 KiB |
|
@ -1,14 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>BulletinBoardServerFrontend</title>
|
|
||||||
<base href="/">
|
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<app-root></app-root>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,11 +0,0 @@
|
||||||
import { enableProdMode } from '@angular/core';
|
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
||||||
|
|
||||||
import { AppModule } from './app/app.module';
|
|
||||||
import { environment } from './environments/environment';
|
|
||||||
|
|
||||||
if (environment.production) {
|
|
||||||
enableProdMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
|
|
@ -1,72 +0,0 @@
|
||||||
/**
|
|
||||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
||||||
* You can add your own extra polyfills to this file.
|
|
||||||
*
|
|
||||||
* This file is divided into 2 sections:
|
|
||||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
||||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
||||||
* file.
|
|
||||||
*
|
|
||||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
||||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
||||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
||||||
*
|
|
||||||
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
|
||||||
* BROWSER POLYFILLS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
|
||||||
// import 'core-js/es6/symbol';
|
|
||||||
// import 'core-js/es6/object';
|
|
||||||
// import 'core-js/es6/function';
|
|
||||||
// import 'core-js/es6/parse-int';
|
|
||||||
// import 'core-js/es6/parse-float';
|
|
||||||
// import 'core-js/es6/number';
|
|
||||||
// import 'core-js/es6/math';
|
|
||||||
// import 'core-js/es6/string';
|
|
||||||
// import 'core-js/es6/date';
|
|
||||||
// import 'core-js/es6/array';
|
|
||||||
// import 'core-js/es6/regexp';
|
|
||||||
// import 'core-js/es6/map';
|
|
||||||
// import 'core-js/es6/weak-map';
|
|
||||||
// import 'core-js/es6/set';
|
|
||||||
|
|
||||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
|
||||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
|
||||||
|
|
||||||
/** Evergreen browsers require these. **/
|
|
||||||
import 'core-js/es6/reflect';
|
|
||||||
import 'core-js/es7/reflect';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Required to support Web Animations `@angular/animation`.
|
|
||||||
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
|
|
||||||
**/
|
|
||||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
|
||||||
* Zone JS is required by Angular itself.
|
|
||||||
*/
|
|
||||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
|
||||||
* APPLICATION IMPORTS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Date, currency, decimal and percent pipes.
|
|
||||||
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
|
||||||
*/
|
|
||||||
// import 'intl'; // Run `npm install --save intl`.
|
|
||||||
/**
|
|
||||||
* Need to import at least one locale-data with intl.
|
|
||||||
*/
|
|
||||||
// import 'intl/locale-data/jsonp/en';
|
|
|
@ -1 +0,0 @@
|
||||||
/* You can add global styles to this file, and also import other style files */
|
|
|
@ -1,32 +0,0 @@
|
||||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
||||||
|
|
||||||
import 'zone.js/dist/long-stack-trace-zone';
|
|
||||||
import 'zone.js/dist/proxy.js';
|
|
||||||
import 'zone.js/dist/sync-test';
|
|
||||||
import 'zone.js/dist/jasmine-patch';
|
|
||||||
import 'zone.js/dist/async-test';
|
|
||||||
import 'zone.js/dist/fake-async-test';
|
|
||||||
import { getTestBed } from '@angular/core/testing';
|
|
||||||
import {
|
|
||||||
BrowserDynamicTestingModule,
|
|
||||||
platformBrowserDynamicTesting
|
|
||||||
} from '@angular/platform-browser-dynamic/testing';
|
|
||||||
|
|
||||||
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
|
|
||||||
declare const __karma__: any;
|
|
||||||
declare const require: any;
|
|
||||||
|
|
||||||
// Prevent Karma from running prematurely.
|
|
||||||
__karma__.loaded = function () {};
|
|
||||||
|
|
||||||
// First, initialize the Angular testing environment.
|
|
||||||
getTestBed().initTestEnvironment(
|
|
||||||
BrowserDynamicTestingModule,
|
|
||||||
platformBrowserDynamicTesting()
|
|
||||||
);
|
|
||||||
// Then we find all the tests.
|
|
||||||
const context = require.context('./', true, /\.spec\.ts$/);
|
|
||||||
// And load the modules.
|
|
||||||
context.keys().map(context);
|
|
||||||
// Finally, start Karma to run the tests.
|
|
||||||
__karma__.start();
|
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "../out-tsc/app",
|
|
||||||
"module": "es2015",
|
|
||||||
"baseUrl": "",
|
|
||||||
"types": []
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"test.ts",
|
|
||||||
"**/*.spec.ts"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "../out-tsc/spec",
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es5",
|
|
||||||
"baseUrl": "",
|
|
||||||
"types": [
|
|
||||||
"jasmine",
|
|
||||||
"node"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"test.ts"
|
|
||||||
],
|
|
||||||
"include": [
|
|
||||||
"**/*.spec.ts",
|
|
||||||
"**/*.d.ts"
|
|
||||||
]
|
|
||||||
}
|
|