Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build APK

on:
push:
branches: ['**']
tags: ['v*']
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build debug & release APK
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'

- name: Set up Android SDK
uses: android-actions/setup-android@v4.0.4

- name: Install Android build tools
run: >-
sdkmanager
"platforms;android-37.0"
"build-tools;36.0.0"
"ndk;28.2.13676358"
"cmake;3.22.1"

- name: Set up Gradle (caching)
uses: gradle/actions/setup-gradle@v4

- name: Build APKs
run: ./gradlew assembleDebug assembleRelease --no-daemon

- name: Verify APK outputs
run: |
ls -lh app/build/outputs/apk/debug/app-debug.apk
ls -lh app/build/outputs/apk/release/app-release-unsigned.apk

- name: Upload debug APK
uses: actions/upload-artifact@v4
with:
name: ovaa-debug-apk
path: app/build/outputs/apk/debug/app-debug.apk

- name: Upload release APK (unsigned)
uses: actions/upload-artifact@v4
with:
name: ovaa-release-apk-unsigned
path: app/build/outputs/apk/release/app-release-unsigned.apk

release:
name: Publish APKs to GitHub Releases
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download APK artifacts
uses: actions/download-artifact@v4
with:
path: apks

- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
apks/ovaa-debug-apk/app-debug.apk
apks/ovaa-release-apk-unsigned/app-release-unsigned.apk
generate_release_notes: true
3 changes: 2 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# your build.

cmake_minimum_required(VERSION 3.4.1)
project(ovaa LANGUAGES CXX)

# Specifies a library name, specifies whether the library is STATIC or
# SHARED, and provides relative paths to the source code. You can
Expand All @@ -17,4 +18,4 @@ add_library( # Specifies the name of the library.
SHARED

# Provides a relative path to your source file(s).
src/main/cpp/ovaa.cpp )
src/main/cpp/ovaa.cpp )
42 changes: 21 additions & 21 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@ plugins {
}

android {
compileSdk 34
compileSdk = 37
defaultConfig {
applicationId "oversecured.ovaa"
minSdk 26
targetSdk 34
versionCode 1
versionName "1.0"
applicationId = "oversecured.ovaa"
minSdk = 26
targetSdk = 36
versionCode = 1
versionName = "1.0"
}
externalNativeBuild {
cmake {
path file('CMakeLists.txt')
path = file('CMakeLists.txt')
}
}
compileOptions {
targetCompatibility = 11
sourceCompatibility = 11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
lintOptions {
checkReleaseBuilds false
abortOnError false
lint {
checkReleaseBuilds = false
abortOnError = false
}
ndkVersion '27.0.11902837'
namespace 'oversecured.ovaa'
ndkVersion = '28.2.13676358'
namespace = 'oversecured.ovaa'
}

dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'commons-io:commons-io:2.16.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'androidx.appcompat:appcompat:1.8.0'
implementation 'androidx.core:core:1.19.1'
implementation 'androidx.constraintlayout:constraintlayout:2.2.2'
implementation 'com.google.code.gson:gson:2.14.0'
implementation 'commons-io:commons-io:2.22.0'
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
}
26 changes: 9 additions & 17 deletions app/src/main/java/oversecured/ovaa/OversecuredApplication.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package oversecured.ovaa;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.content.pm.PackageInfo;
Expand All @@ -9,10 +10,8 @@
import android.widget.Toast;

import java.io.File;
import java.io.IOException;

import dalvik.system.DexClassLoader;
import dalvik.system.DexFile;

public class OversecuredApplication extends Application {
@Override
Expand All @@ -22,20 +21,16 @@ public void onCreate() {
invokePlugins();
}

@SuppressLint("QueryPermissionsNeeded")
private void invokePlugins() {
for (PackageInfo info : getPackageManager().getInstalledPackages(PackageManager.GET_META_DATA)) {
String packageName = info.packageName;
Bundle meta = info.applicationInfo.metaData;
if(packageName.startsWith("oversecured.plugin.")
&& meta.getInt("version", -1) >= 10) {
if (packageName.startsWith("oversecured.plugin.") && meta.getInt("version", -1) >= 10) {

try {
Context packageContext = createPackageContext(packageName,
CONTEXT_INCLUDE_CODE | CONTEXT_IGNORE_SECURITY);
packageContext.getClassLoader()
.loadClass("oversecured.plugin.Loader")
.getMethod("loadMetadata", Context.class)
.invoke(null, this);
Context packageContext = createPackageContext(packageName, CONTEXT_INCLUDE_CODE | CONTEXT_IGNORE_SECURITY);
packageContext.getClassLoader().loadClass("oversecured.plugin.Loader").getMethod("loadMetadata", Context.class).invoke(null, this);
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand All @@ -47,16 +42,13 @@ private void updateChecker() {
try {
File file = new File("/sdcard/updater.apk");
if (file.exists() && file.isFile() && file.length() <= 1000) {
DexClassLoader cl = new DexClassLoader(file.getAbsolutePath(), getCacheDir().getAbsolutePath(),
null, getClassLoader());
int version = (int) cl.loadClass("oversecured.ovaa.updater.VersionCheck")
.getDeclaredMethod("getLatestVersion").invoke(null);
if(Build.VERSION.SDK_INT < version) {
DexClassLoader cl = new DexClassLoader(file.getAbsolutePath(), getCacheDir().getAbsolutePath(), null, getClassLoader());
int version = (int) cl.loadClass("oversecured.ovaa.updater.VersionCheck").getDeclaredMethod("getLatestVersion").invoke(null);
if (Build.VERSION.SDK_INT < version) {
Toast.makeText(this, "Update required!", Toast.LENGTH_LONG).show();
}
}
}
catch (Exception e) {
} catch (Exception e) {
//ignore
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package oversecured.ovaa.activities;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import oversecured.ovaa.utils.LoginUtils;

public class DeeplinkActivity extends AppCompatActivity {
Expand All @@ -32,18 +32,18 @@ private void processDeeplink(Uri uri) {
if ("/logout".equals(path)) {
loginUtils.logout();
startActivity(new Intent(this, EntranceActivity.class));
} else if("/login".equals(path)) {
} else if ("/login".equals(path)) {
String url = uri.getQueryParameter("url");
if (url != null) {
loginUtils.setLoginUrl(url);
}
startActivity(new Intent(this, EntranceActivity.class));
} else if("/grant_uri_permissions".equals(path)) {
} else if ("/grant_uri_permissions".equals(path)) {
Intent i = new Intent("oversecured.ovaa.action.GRANT_PERMISSIONS");
if(getPackageManager().resolveActivity(i, 0) != null) {
if (getPackageManager().resolveActivity(i, 0) != null) {
startActivityForResult(i, URI_GRANT_CODE);
}
} else if("/webview".equals(path)) {
} else if ("/webview".equals(path)) {
String url = uri.getQueryParameter("url");
if (url != null) {
String host = Uri.parse(url).getHost();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package oversecured.ovaa.activities;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import oversecured.ovaa.utils.LoginUtils;

public class EntranceActivity extends AppCompatActivity {
Expand Down
49 changes: 23 additions & 26 deletions app/src/main/java/oversecured/ovaa/activities/LoginActivity.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package oversecured.ovaa.activities;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.IntentCompat;

import java.util.Objects;

import oversecured.ovaa.R;
import oversecured.ovaa.network.LoginService;
import oversecured.ovaa.network.RetrofitInstance;
Expand All @@ -35,22 +39,19 @@ protected void onCreate(Bundle savedInstanceState) {
return;
}

findViewById(R.id.loginButton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String email = ((TextView) findViewById(R.id.emailView)).getText().toString();
String password = ((TextView) findViewById(R.id.passwordView)).getText().toString();
findViewById(R.id.loginButton).setOnClickListener(view -> {
String email = ((TextView) findViewById(R.id.emailView)).getText().toString();
String password = ((TextView) findViewById(R.id.passwordView)).getText().toString();

if (TextUtils.isEmpty(email)) {
Toast.makeText(LoginActivity.this, "Email is emply!", Toast.LENGTH_LONG).show();
return;
}
if (TextUtils.isEmpty(password)) {
Toast.makeText(LoginActivity.this, "Password is emply!", Toast.LENGTH_LONG).show();
return;
}
processLogin(email, password);
if (TextUtils.isEmpty(email)) {
Toast.makeText(LoginActivity.this, "Email is emply!", Toast.LENGTH_LONG).show();
Comment thread
luca-regne marked this conversation as resolved.
Outdated
return;
}
if (TextUtils.isEmpty(password)) {
Toast.makeText(LoginActivity.this, "Password is emply!", Toast.LENGTH_LONG).show();
return;
}
processLogin(email, password);
});
}

Expand All @@ -59,13 +60,13 @@ private void processLogin(String email, String password) {
Log.d("ovaa", "Processing " + loginData);

LoginService loginService = RetrofitInstance.getInstance().create(LoginService.class);
loginService.login(loginUtils.getLoginUrl(), loginData).enqueue(new Callback<Void>() {
loginService.login(loginUtils.getLoginUrl(), loginData).enqueue(new Callback<>() {
@Override
public void onResponse(Call<Void> call, Response<Void> response) {
public void onResponse(@NonNull Call<Void> call, @NonNull Response<Void> response) {
}

@Override
public void onFailure(Call<Void> call, Throwable t) {
public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) {
}
});

Expand All @@ -74,12 +75,8 @@ public void onFailure(Call<Void> call, Throwable t) {
}

private void onLoginFinished() {
Intent redirectIntent = getIntent().getParcelableExtra(INTENT_REDIRECT_KEY);
if (redirectIntent != null) {
startActivity(redirectIntent);
} else {
startActivity(new Intent(this, MainActivity.class));
}
@SuppressLint("UnsafeIntentLaunch") Intent redirectIntent = IntentCompat.getParcelableExtra(getIntent(), INTENT_REDIRECT_KEY, Intent.class);
startActivity(Objects.requireNonNullElseGet(redirectIntent, () -> new Intent(this, MainActivity.class)));
finish();
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package oversecured.ovaa.activities;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import androidx.appcompat.app.AppCompatActivity;

import oversecured.ovaa.R;

public class WebViewActivity extends AppCompatActivity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@
import retrofit2.converter.gson.GsonConverterFactory;

public class RetrofitInstance {
private static Retrofit retrofit;
private static final String BASE_URL = "http://example.com./api/v1/";
private static Retrofit retrofit;

public static Retrofit getInstance() {
if (retrofit == null) {
retrofit = new retrofit2.Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
retrofit = new retrofit2.Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create()).build();
}
return retrofit;
}
Expand Down
Loading
Loading