Skip to content

Commit

Permalink
complies with new gradle and with Android Studio Koala Feature Drop |…
Browse files Browse the repository at this point in the history
… 2024.1.2 and the release candidate version of SharkMessenger.jar etc.
  • Loading branch information
thsc42 committed Sep 24, 2024
1 parent 871e4ee commit 4d44153
Show file tree
Hide file tree
Showing 27 changed files with 119 additions and 173 deletions.
8 changes: 5 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 31
compileSdkVersion = 34
defaultConfig {
applicationId "net.sharksystem"
minSdkVersion 23
targetSdkVersion 31
targetSdkVersion 33
versionCode 1
versionName "1.0"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
namespace 'net.sharksystem'
}

dependencies {
Expand All @@ -27,9 +27,11 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.test.espresso:espresso-contrib:3.6.1'
testImplementation 'junit:junit:4.13.1'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation "com.google.android.material:material:1.5.0-alpha03"
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
Expand Down
Binary file modified app/libs/ASAPHub.jar
Binary file not shown.
Binary file modified app/libs/ASAPJava.jar
Binary file not shown.
Binary file modified app/libs/SharkMessenger.jar
Binary file not shown.
Binary file modified app/libs/SharkPKI.jar
Binary file not shown.
Binary file modified app/libs/SharkPeer.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

import net.sharksystem.R;
import net.sharksystem.android.ASAPChannelIntent;
import net.sharksystem.app.messenger.SharkMessengerException;
import net.sharksystem.asap.utils.PeerIDHelper;
import net.sharksystem.messenger.SharkMessengerException;
import net.sharksystem.sharknet.android.SharkNetActivity;
import net.sharksystem.sharknet.android.SharkNetApp;

Expand Down Expand Up @@ -52,16 +52,11 @@ public void onClick(View view) {

this.startActivity(intent);

} catch (IOException e) {
} catch (IOException | SharkMessengerException e) {
String text = "failure: " + e.getLocalizedMessage();
Log.e(this.getLogStart(), text);
Toast.makeText(this, "IO error - that's serious", Toast.LENGTH_SHORT).show();
} catch (SharkMessengerException e) {
String text = "failure: " + e.getLocalizedMessage();
Log.w(this.getLogStart(), text);
Toast.makeText(this, "already exists(?)", Toast.LENGTH_SHORT).show();
}
finally {
} finally {
this.finish();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import net.sharksystem.R;
import net.sharksystem.SharkException;
import net.sharksystem.android.ASAPChannelIntent;
import net.sharksystem.app.messenger.SharkMessengerException;
import net.sharksystem.asap.ASAPException;
import net.sharksystem.messenger.SharkMessengerException;
import net.sharksystem.pki.android.PersonListSelectionActivity;
import net.sharksystem.pki.android.PersonStatusHelper;
import net.sharksystem.sharknet.android.SharkNetActivity;
Expand Down Expand Up @@ -109,7 +109,7 @@ public void onSendClick(View view) {

// send with shark messenger
this.getSharkNetApp().getSharkMessenger().sendSharkMessage(
content, this.uri, sign, encrypt);
content, this.uri, sign);

} catch (IOException | SharkMessengerException e) {
Toast.makeText(this, e.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,11 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {

try {
switch (item.getItemId()) {
case R.id.snChannelViewMenuAddMessage:
this.doAddMessage();
return true;

default:
// If we got here, the user's action was not recognized.
// Invoke the superclass to handle it.
return super.onOptionsItemSelected(item);
if(item.getItemId() == R.id.snChannelViewMenuAddMessage) {
this.doAddMessage();
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
catch(Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.appcompat.view.menu.MenuView;
import androidx.recyclerview.widget.RecyclerView;

import net.sharksystem.R;
import net.sharksystem.android.ASAPChannelIntent;
import net.sharksystem.asap.ASAPException;
import net.sharksystem.asap.utils.DateTimeHelper;
import net.sharksystem.messenger.SharkMessage;
import net.sharksystem.messenger.SharkMessengerComponent;
import net.sharksystem.messenger.SharkMessengerException;
import net.sharksystem.app.messenger.SharkMessage;
import net.sharksystem.app.messenger.SharkMessengerComponent;
import net.sharksystem.app.messenger.SharkMessengerException;
import net.sharksystem.sharknet.android.SharkNetApp;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.sharksystem.messenger.android;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
Expand All @@ -14,9 +15,8 @@
import androidx.recyclerview.widget.RecyclerView;

import net.sharksystem.R;
import net.sharksystem.messenger.SharkMessengerException;
import net.sharksystem.app.messenger.SharkMessengerException;
import net.sharksystem.sharknet.android.SharkNetActivity;
import net.sharksystem.sharknet.android.SharkNetApp;

import java.io.IOException;

Expand Down Expand Up @@ -84,24 +84,20 @@ public boolean onCreateOptionsMenu(Menu menu) {
return true;
}

@SuppressLint("NonConstantResourceId")
@Override
public boolean onOptionsItemSelected(MenuItem item) {
try {
switch (item.getItemId()) {
case R.id.snAddChannelButton:
this.doAddChannel();
return true;

case R.id.snRemoveAllChannelButton:
this.doRemoveAll();
// force adapter to refresh ui
this.mAdapter.notifyDataSetChanged();
return true;

default:
// If we got here, the user's action was not recognized.
// Invoke the superclass to handle it.
return super.onOptionsItemSelected(item);
if(item.getItemId() == R.id.snAddChannelButton) {
this.doAddChannel();
return true;
} else if(item.getItemId() == R.id.snRemoveAllChannelButton) {
this.doRemoveAll();
// force adapter to refresh ui
this.mAdapter.notifyDataSetChanged();
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
catch(Exception e) {
Expand Down Expand Up @@ -138,11 +134,11 @@ private void doAddChannel() {

private void doRemoveAll() throws IOException, SharkMessengerException {
String sampleLine = Long.toString(System.currentTimeMillis());
Log.d(this.getLogStart(), "doRemoveAll called");
Log.e(this.getLogStart(), "doRemoveAll called - TODO - nyi");

SharkNetApp.getSharkNetApp().getSharkMessenger().removeAllChannels();
//SharkNetApp.getSharkNetApp().getSharkMessenger().removeAllChannels();

Toast.makeText(this, "done - removed all makan", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "done - removed all channels - TODO", Toast.LENGTH_SHORT).show();
}

// @Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import net.sharksystem.R;
import net.sharksystem.SharkException;
import net.sharksystem.android.ASAPChannelIntent;
import net.sharksystem.messenger.SharkMessengerChannel;
import net.sharksystem.messenger.SharkMessengerException;
import net.sharksystem.app.messenger.SharkMessengerChannel;
import net.sharksystem.app.messenger.SharkMessengerException;
import net.sharksystem.sharknet.android.SharkNetApp;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package net.sharksystem.messenger.android;

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

import net.sharksystem.R;
import net.sharksystem.SharkException;
import net.sharksystem.app.messenger.SharkMessage;
import net.sharksystem.app.messenger.SharkMessengerComponent;
import net.sharksystem.asap.android.apps.ASAPActivity;
import net.sharksystem.messenger.SharkMessage;
import net.sharksystem.messenger.SharkMessengerComponent;
import net.sharksystem.messenger.SharkMessengerException;
import net.sharksystem.sharknet.android.SharkNetActivity;
import net.sharksystem.sharknet.android.SharkNetApp;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

import android.widget.Toast;

import net.sharksystem.app.messenger.SharkMessage;
import net.sharksystem.asap.ASAPException;
import net.sharksystem.asap.ASAPHop;
import net.sharksystem.asap.ASAPSecurityException;
import net.sharksystem.asap.utils.ASAPSerialization;
import net.sharksystem.asap.utils.DateTimeHelper;
import net.sharksystem.messenger.SharkMessage;
import net.sharksystem.sharknet.android.SharkNetApp;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.Timestamp;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -118,10 +115,10 @@ public static CharSequence getCreationTimeCharSequence(SharkMessage sharkMessage
CharSequence creationTimeCharSequence = "time: unknown";

if(sharkMessage.couldBeDecrypted()) {
Timestamp creationTime = null;
long creationTime = 0;
try {
creationTime = sharkMessage.getCreationTime();
creationTimeCharSequence = DateTimeHelper.long2DateString(creationTime.getTime());
creationTimeCharSequence = DateTimeHelper.long2DateString(creationTime);
} catch (ASAPException | IOException e) {
creationTimeCharSequence = "failure while reading timestamp";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,14 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {

try {
switch (item.getItemId()) {
case R.id.personListSelectionDoneButton:
Toast.makeText(this, "something clicked", Toast.LENGTH_SHORT).show();
return true;

case R.id.abortButton:
this.finish();
return true;

default:
// If we got here, the user's action was not recognized.
// Invoke the superclass to handle it.
return super.onOptionsItemSelected(item);
if(item.getItemId() == R.id.personListSelectionDoneButton) {
Toast.makeText(this, "something clicked", Toast.LENGTH_SHORT).show();
return true;
} else if(item.getItemId() == R.id.abortButton) {
this.finish();
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
catch(Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ public void onSendCredentialsClick(View view) {
byte[] cic = cicEditText.getText().toString().getBytes(StandardCharsets.UTF_8);

try {
CredentialMessage credentialMessage =
this.getSharkNetApp().getSharkPKI().createCredentialMessage(cic);

CredentialExchangeActivity.addCredentialMessageToObjectHolder(credentialMessage, true);

this.getSharkNetApp().getSharkPKI().sendOnlineCredentialMessage(credentialMessage);
this.getSharkNetApp().getSharkPKI().sendTransientCredentialMessage();

Intent intent = new Intent(this, CredentialViewActivity.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,12 @@ protected void onCreate(Bundle savedInstanceState) {
//this.getSharkNetApp().getSharkPKI().setSharkCredentialReceivedListener(this);
}

/*
public void onSendClick(View v) {
try {
CredentialMessage credentialMessage =
this.getSharkNetApp().getSharkPKI().createCredentialMessage();
/**
* tag (defined by ViewActivity) -> key (defined here); key -> value (actual value)
*/

// credential message stored under a key
ObjectHolder.getObjectHolder().setObject(
CREDENTIAL_MESSAGE_KEY, credentialMessage);
Expand Down Expand Up @@ -103,7 +100,6 @@ private void doHandleCertificateMessage(ASAPMessages asapMessages) {
Toast.makeText(this,
"You received a signed certificate. Do you already have public key of the signer?"
, Toast.LENGTH_LONG).show();
*/
}
public void onDoneClick(View v) {
Expand All @@ -127,5 +123,5 @@ public void asapMessagesReceived(ASAPMessages asapMessages,
this.credentialSendActivity.doHandleCertificateMessage(asapMessages);
}
}

*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void setKeyCreationDateView() throws ASAPSecurityException {

private void notifyKeyPairCreated() {
// sync
this.getSharkNetApp().getSharkPKI().syncNewReceivedCertificates();
//this.getSharkNetApp().getSharkPKI().syncNewReceivedCertificates();

// re-launch
this.finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ protected void onCreate(Bundle savedInstanceState) {
sfSpinner.setSelection(personValues.getSigningFailureRate());

tv = findViewById(R.id.personEditIdentityAssuranceLevel);
tv.setText(String.valueOf(personValues.getIdentityAssurance()));

tv.setText(String.valueOf(
this.getSharkNetApp().getSharkPKI().getIdentityAssurance(
personValues.getUserID())));

} catch (SharkException e) {
Log.e(Util.getLogStart(this), "fatal: " + e.getLocalizedMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public void onBindViewHolder(PersonListContentAdapter.MyViewHolder holder, int p
holder.itemView.setTag(R.id.user_id_tag, userID);
holder.personName.setText(personValues.getName());

int identityAssurance = personValues.getIdentityAssurance();
int identityAssurance = SharkNetApp.getSharkNetApp().getSharkPKI()
.getIdentityAssurance(personValues.getUserID());
Log.d(this.getLogStart(), "identity Assurance: " + identityAssurance);
holder.personIdentityAssurance.setText(String.valueOf(identityAssurance));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,14 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {

try {
switch (item.getItemId()) {
case R.id.personListSelectionDoneButton:
this.doDone();
return true;

case R.id.abortButton:
this.finish();
return true;

default:
// If we got here, the user's action was not recognized.
// Invoke the superclass to handle it.
return super.onOptionsItemSelected(item);
if(item.getItemId() == R.id.personListSelectionDoneButton) {
this.doDone();
return true;
} else if(item.getItemId() == R.id.abortButton) {
this.finish();
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
catch(Exception e) {
Expand Down
Loading

0 comments on commit 4d44153

Please sign in to comment.