Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

Commit d6d3e0b

Browse files
author
Kevin King
committed
Release Krypton for Teams
1 parent a1cc00c commit d6d3e0b

219 files changed

Lines changed: 13497 additions & 907 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
[submodule "zxing"]
55
path = zxing
66
url = https://github.com/zxing/zxing
7-
[submodule "identicon"]
8-
path = identicon
9-
url = https://github.com/KryptCo/identicon
107
[submodule "ssh-wire"]
118
path = ssh-wire
129
url = git@github.com:kryptco/ssh-wire
10+
[submodule "sigchain"]
11+
path = sigchain
12+
url = git@github.com:kryptco/sigchain

.idea/modules.xml

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "co.krypt.kryptonite"
88
minSdkVersion 23
99
targetSdkVersion 27
10-
versionCode 28
11-
versionName "2.3.1"
10+
versionCode 40
11+
versionName "2.4.0"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1313
externalNativeBuild {
1414
cmake {
@@ -69,12 +69,15 @@ dependencies {
6969
compile 'com.google.firebase:firebase-crash:11.6.2'
7070
compile 'com.android.support:recyclerview-v7:27.0.2'
7171
compile 'com.android.support:cardview-v7:27.0.2'
72+
compile 'com.github.anrwatchdog:anrwatchdog:1.3.+'
7273
compile 'com.jakewharton:disklrucache:2.0.2'
7374
compile 'com.j256.ormlite:ormlite-android:5.0'
7475
compile 'com.jaredrummler:android-device-names:1.1.2'
7576
compile 'com.github.zafarkhaja:java-semver:0.9.0'
7677
compile 'com.journeyapps:zxing-android-embedded:3.5.0@aar'
7778
compile 'com.google.zxing:core:3.3.1'
79+
compile 'mobi.upod:time-duration-picker:1.1.3'
80+
compile 'org.greenrobot:eventbus:3.1.1'
7881
testCompile 'junit:junit:4.12'
7982
testCompile 'org.mockito:mockito-core:1.10.19'
8083
testCompile 'org.powermock:powermock-module-junit4:1.6.4'

app/release/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":28},"path":"app-release.apk","properties":{"packageId":"co.krypt.kryptonite","split":"","minSdkVersion":"23"}}]
1+
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":40},"path":"app-release.apk","properties":{"packageId":"co.krypt.kryptonite","split":"","minSdkVersion":"23"}}]

app/src/main/AndroidManifest.xml

Lines changed: 69 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
package="co.krypt.krypton">
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="co.krypt.krypton">
55

6-
<uses-permission android:name="android.permission.CAMERA" />
6+
<uses-permission android:name="android.permission.CAMERA"/>
77

8-
<uses-feature android:name="android.hardware.camera" />
9-
<uses-feature android:name="android.hardware.camera.autofocus" />
8+
<uses-feature android:name="android.hardware.camera"/>
9+
<uses-feature android:name="android.hardware.camera.autofocus"/>
1010

11-
<uses-permission android:name="android.permission.BLUETOOTH" />
12-
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
11+
<uses-permission android:name="android.permission.BLUETOOTH"/>
12+
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
13+
14+
<uses-permission android:name="android.permission.WAKE_LOCK"/>
1315

1416
<uses-feature
1517
android:name="android.hardware.bluetooth_le"
16-
android:required="false" />
18+
android:required="false"/>
1719

1820
<application
1921
android:allowBackup="false"
@@ -22,63 +24,102 @@
2224
android:supportsRtl="true"
2325
android:theme="@style/AppTheme"
2426
tools:replace="android:allowBackup">
25-
<activity android:name=".MeActivity" />
26-
<!--Note: MainActivity kept the legacy package so that launch icons on the home screen remained. -->
27+
<activity android:name=".MeActivity"/>
28+
<!-- Note: MainActivity kept the legacy package so that launch icons on the home screen remained. -->
2729
<activity
2830
android:name="co.krypt.kryptonite.MainActivity"
2931
android:label="Krypton"
3032
android:launchMode="singleTop"
3133
android:screenOrientation="portrait"
32-
android:theme="@style/AppTheme"
34+
android:theme="@style/AppTheme.Launcher"
3335
android:windowSoftInputMode="stateHidden">
3436
<intent-filter>
35-
<action android:name="android.intent.action.MAIN" />
37+
<action android:name="android.intent.action.MAIN"/>
3638

37-
<category android:name="android.intent.category.LAUNCHER" />
39+
<category android:name="android.intent.category.LAUNCHER"/>
3840
</intent-filter>
3941
</activity>
4042
<activity
41-
android:name="co.krypt.krypton.policy.UnlockScreenDummyActivity"
43+
android:name=".policy.UnlockScreenDummyActivity"
4244
android:launchMode="singleInstance"
4345
android:taskAffinity=""
44-
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
46+
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
4547

4648
<service
47-
android:name="co.krypt.krypton.transport.FirebaseMessagingService"
49+
android:name=".transport.FirebaseMessagingService"
4850
android:enabled="true">
4951
<intent-filter>
50-
<action android:name="com.google.firebase.MESSAGING_EVENT" />
52+
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
5153
</intent-filter>
5254
</service>
5355
<service
54-
android:name="co.krypt.krypton.transport.FirebaseInstanceIDService"
56+
android:name=".transport.FirebaseInstanceIDService"
5557
android:enabled="true"
5658
android:exported="true">
5759
<intent-filter>
58-
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
60+
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
5961
</intent-filter>
6062
</service>
6163

6264
<receiver
63-
android:name="co.krypt.krypton.policy.NoAuthReceiver"
65+
android:name=".policy.NoAuthReceiver"
6466
android:enabled="true"
65-
android:exported="false" />
67+
android:exported="false"/>
6668

6769
<service
68-
android:name="co.krypt.krypton.transport.BluetoothService"
70+
android:name=".transport.BluetoothService"
6971
android:enabled="true"
70-
android:exported="false" />
72+
android:exported="false"/>
7173

7274
<activity
73-
android:name="co.krypt.krypton.onboarding.OnboardingActivity"
75+
android:name=".onboarding.OnboardingActivity"
7476
android:launchMode="singleTop"
75-
android:screenOrientation="portrait" />
77+
android:theme="@style/AppTheme.Launcher"
78+
android:screenOrientation="portrait"/>
79+
<activity
80+
android:name=".team.onboarding.TeamOnboardingActivity"
81+
android:launchMode="singleTask"
82+
android:screenOrientation="portrait"
83+
android:windowSoftInputMode="adjustNothing"
84+
android:theme="@style/AppTheme.Launcher"
85+
>
86+
<intent-filter>
87+
<action android:name="android.intent.action.VIEW"/>
88+
89+
<category android:name="android.intent.category.DEFAULT"/>
90+
<category android:name="android.intent.category.BROWSABLE"/>
91+
92+
<data
93+
android:host="verify_email"
94+
android:scheme="krypton"/>
95+
</intent-filter>
96+
<intent-filter>
97+
<action android:name="android.intent.action.VIEW"/>
98+
99+
<category android:name="android.intent.category.DEFAULT"/>
100+
<category android:name="android.intent.category.BROWSABLE"/>
101+
102+
<data
103+
android:host="krypt.co"
104+
android:path="/app/verify_email.html"
105+
android:scheme="https"/>
106+
</intent-filter>
107+
<intent-filter>
108+
<action android:name="android.intent.action.VIEW"/>
109+
110+
<category android:name="android.intent.category.DEFAULT"/>
111+
<category android:name="android.intent.category.BROWSABLE"/>
112+
113+
<data
114+
android:host="join_team"
115+
android:scheme="krypton"/>
116+
</intent-filter>
117+
</activity>
76118

77119
<provider
78-
android:name="co.krypt.krypton.log.AuditLogContentProvider"
120+
android:name=".log.AuditLogContentProvider"
79121
android:authorities="co.krypt.krypton.log.AuditLogContentProvider"
80-
android:exported="true" />
81-
122+
android:exported="true"/>
82123
</application>
83124

84125
</manifest>

app/src/main/java/co/krypt/krypton/analytics/Analytics.java

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import java.security.SecureRandom;
1717
import java.util.HashMap;
1818
import java.util.Map;
19+
import java.util.concurrent.ExecutorService;
20+
import java.util.concurrent.Executors;
1921

2022
import co.krypt.krypton.BuildConfig;
2123

@@ -31,6 +33,8 @@ public class Analytics {
3133
private static final Object lock = new Object();
3234
private SharedPreferences preferences;
3335

36+
private static final ExecutorService threadPool = Executors.newSingleThreadExecutor();
37+
3438
private static final String TRACKING_ID() {
3539
if (BuildConfig.DEBUG) {
3640
return "UA-86173430-1";
@@ -60,27 +64,24 @@ public void publishEmailToTeamsIfNeeded(final String email) {
6064
return;
6165
}
6266
if (!email.equals(getPublishedEmail())) {
63-
new Thread(new Runnable() {
64-
@Override
65-
public void run() {
66-
Uri.Builder uri = new Uri.Builder().scheme("https").authority("teams.krypt.co")
67-
.appendQueryParameter("id", getClientID())
68-
.appendQueryParameter("email", email);
67+
threadPool.submit(() -> {
68+
Uri.Builder uri = new Uri.Builder().scheme("https").authority("teams.krypt.co")
69+
.appendQueryParameter("id", getClientID())
70+
.appendQueryParameter("email", email);
71+
try {
72+
URL url = new URL(uri.toString());
73+
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
74+
connection.setRequestMethod("PUT");
6975
try {
70-
URL url = new URL(uri.toString());
71-
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
72-
connection.setRequestMethod("PUT");
73-
try {
74-
InputStream in = new BufferedInputStream(connection.getInputStream());
75-
preferences.edit().putString(PUBLISHED_EMAIL_KEY, email).apply();
76-
} finally {
77-
connection.disconnect();
78-
}
79-
} catch (IOException e) {
80-
e.printStackTrace();
76+
InputStream in = new BufferedInputStream(connection.getInputStream());
77+
preferences.edit().putString(PUBLISHED_EMAIL_KEY, email).apply();
78+
} finally {
79+
connection.disconnect();
8180
}
81+
} catch (IOException e) {
82+
e.printStackTrace();
8283
}
83-
}).start();
84+
});
8485
}
8586
}
8687
}
@@ -108,22 +109,19 @@ private void post(String clientID, HashMap<String, String> params, boolean force
108109
for (Map.Entry<String, String> param: defaultParams.entrySet()) {
109110
uri.appendQueryParameter(param.getKey(), param.getValue());
110111
}
111-
new Thread(new Runnable() {
112-
@Override
113-
public void run() {
112+
threadPool.submit(() -> {
113+
try {
114+
URL url = new URL(uri.build().toString());
115+
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
114116
try {
115-
URL url = new URL(uri.build().toString());
116-
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
117-
try {
118-
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
119-
} finally {
120-
urlConnection.disconnect();
121-
}
122-
} catch (IOException e) {
123-
e.printStackTrace();
117+
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
118+
} finally {
119+
urlConnection.disconnect();
124120
}
121+
} catch (IOException e) {
122+
e.printStackTrace();
125123
}
126-
}).start();
124+
});
127125
}
128126

129127
public void postPageView(String page) {

0 commit comments

Comments
 (0)