Skip to content

Commit

Permalink
Merge pull request #65 from bookdash/develop
Browse files Browse the repository at this point in the history
[Upgrade] Android version 14 + App version update
  • Loading branch information
julianorrish authored Aug 22, 2024
2 parents 992938d + 116c144 commit 4025287
Show file tree
Hide file tree
Showing 26 changed files with 402 additions and 224 deletions.
109 changes: 64 additions & 45 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,34 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.github.triplet.play'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-kapt'

repositories {
mavenCentral()
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion = rootProject.ext.compileSdkVersion

defaultConfig {
applicationId "org.bookdash.android"
applicationId = "org.bookdash.android"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion
versionCode rootProject.ext.versionCode
versionName "$rootProject.ext.versionName"
versionCode = rootProject.ext.versionCode
versionName = "$rootProject.ext.versionName"
testInstrumentationRunner "org.bookdash.android.presentation.CustomTestRunner"
resConfigs "en"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true

}
dataBinding {
enabled = true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

File signFile = rootProject.file('release-keystore.properties')
if (signFile.exists()) {
Expand All @@ -44,7 +46,6 @@ android {
}
}
buildTypes.release.signingConfig signingConfigs.release

}

packagingOptions {
Expand All @@ -60,27 +61,42 @@ android {
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
exclude 'LICENSE.txt'
}
flavorDimensions "env"
productFlavors {
mock {
dimension "env"
applicationIdSuffix ".qa"
}
qa {
dimension "env"
applicationIdSuffix ".qa"
}
prod {
dimension "env"
}
}

flavorDimensions.add("env")

// productFlavors {
// mock {
// dimension "env"
// versionNameSuffix ".qa"
// applicationIdSuffix ".qa"
// }
// prod {
// dimension "env"
// }
// }

// productFlavors {
// mock {
// dimension "env"
// applicationIdSuffix = ".qa"
// }
// qa {
// dimension "env"
// applicationIdSuffix = ".qa"
// }
// prod {
// dimension "env"
// }
// }
// Remove mockRelease as it's not needed.
android.variantFilter { variant ->
if (variant.buildType.name.equals('release')
&& variant.getFlavors().get(0).name.equals('mock')) {
variant.setIgnore(true)
}
}
// androidComponents {
// onVariants { variant ->
// // Remove 'mock' flavor variants in 'release' build type
// if (variant.buildType.name == 'release' && variant.productFlavors.any { it.name == 'mock' }) {
// variant.ignore = true
// }
// }
// }
// Always show the result of every unit test, even if it passes.
testOptions.unitTests.all {
testLogging {
Expand Down Expand Up @@ -108,6 +124,7 @@ android {
jsonFile = rootProject.file('google-play-keys.json')
track = "${track}"
}
namespace 'org.bookdash.android'
}
dependencies {

Expand All @@ -118,42 +135,42 @@ dependencies {
testImplementation("org.powermock:powermock-api-mockito:$rootProject.ext.powerMockito")

// Android Testing Library's runner and rules
androidTestImplementation 'androidx.test.espresso:espresso-web:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.6.1'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test:rules:1.6.1'

// Espresso UI Testing
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0') {
androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1') {
exclude group: "javax.inject"
}
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
androidTestImplementation 'androidx.appcompat:appcompat:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.6.1'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.6.1'
androidTestImplementation 'androidx.appcompat:appcompat:1.7.0'
androidTestImplementation "com.google.android.material:material:$rootProject.ext.materialVersion"

implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation "com.google.android.material:material:$rootProject.ext.materialVersion"
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation "com.github.bumptech.glide:glide:$rootProject.ext.glideVersion"
kapt "com.github.bumptech.glide:compiler:$rootProject.ext.glideVersion"
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.github.castorflex.smoothprogressbar:library-circular:1.3.0'

// Import the Firebase Bill of Materials (BoM)
implementation platform('com.google.firebase:firebase-bom:26.0.0')
implementation platform('com.google.firebase:firebase-bom:33.1.2')

// Firebase Dependencies
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-config'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-database'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-perf'
Expand All @@ -164,14 +181,16 @@ dependencies {
implementation 'io.reactivex:rxjava:1.2.5'
implementation 'com.jakewharton.threetenabp:threetenabp:1.3.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.drawerlayout:drawerlayout:1.2.0"
implementation "com.google.android.material:material:$rootProject.ext.materialVersion"

implementation project(path: ':materialhelptutorial')
implementation project(':fabbutton')
implementation project(path: ':fabbutton')
}

apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.bookdash.android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;

import androidx.multidex.BuildConfig;
import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication;

Expand All @@ -11,6 +12,7 @@
import com.jakewharton.threetenabp.AndroidThreeTen;

import org.bookdash.android.config.CrashlyticsTree;
import org.bookdash.android.di.Injection;

import rx.Subscriber;
import timber.log.Timber;
Expand Down Expand Up @@ -82,5 +84,4 @@ synchronized public FirebaseAnalytics getDefaultTracker() {
}
return firebaseAnalytics;
}

}
90 changes: 90 additions & 0 deletions app/src/main/java/org/bookdash/android/di/Injection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package org.bookdash.android.di;

import android.content.Context;

import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.storage.FirebaseStorage;

import org.bookdash.android.config.FirebaseConfig;
import org.bookdash.android.config.RemoteConfigSettingsApi;
import org.bookdash.android.data.book.BookService;
import org.bookdash.android.data.book.BookServiceImpl;
import org.bookdash.android.data.book.DownloadService;
import org.bookdash.android.data.book.DownloadServiceImpl;
import org.bookdash.android.data.database.firebase.FirebaseBookDatabase;
import org.bookdash.android.data.settings.SettingsApiImpl;
import org.bookdash.android.data.settings.SettingsRepositories;
import org.bookdash.android.data.settings.SettingsRepository;
import org.bookdash.android.data.tracking.Analytics;
import org.bookdash.android.data.tracking.BookDashFirebaseAnalytics;
import org.bookdash.android.data.tutorial.TutorialsRepositories;
import org.bookdash.android.data.tutorial.TutorialsRepository;
import org.bookdash.android.data.utils.firebase.FirebaseObservableListeners;

/**
* @author rebeccafranks
* @since 15/11/03.
*/
public class Injection {
public static final String STORAGE_PREFIX = "gs://book-dash.appspot.com/";

private static BookService bookService = null;
private static RemoteConfigSettingsApi config;
private static DownloadService downloadService = null;
private static Analytics firebaseAnalytics = null;

private Injection() {

}

public static void init(Context context) {
if (!isInitialized()) {
FirebaseApp firebaseApp = FirebaseApp
.initializeApp(context, FirebaseOptions.fromResource(context), "Book Dash");
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance(firebaseApp);
firebaseDatabase.setPersistenceEnabled(true);
FirebaseObservableListeners firebaseObservableListeners = new FirebaseObservableListeners();
FirebaseBookDatabase bookDatabase = new FirebaseBookDatabase(firebaseDatabase, firebaseObservableListeners);
bookService = new BookServiceImpl(bookDatabase);

config = FirebaseConfig.newInstance().init();

downloadService = new DownloadServiceImpl(FirebaseStorage.getInstance(firebaseApp));
firebaseAnalytics = new BookDashFirebaseAnalytics(FirebaseAnalytics.getInstance(context));

}
}

private static boolean isInitialized() {
return bookService != null && config != null;
}

public static TutorialsRepository provideTutorialRepo(Context context) {
return TutorialsRepositories.getInstance(context);
}

public static SettingsRepository provideSettingsRepo(Context context) {
return SettingsRepositories
.getInstance(new SettingsApiImpl(context, provideRemoteConfig()), FirebaseMessaging.getInstance());
}

private static RemoteConfigSettingsApi provideRemoteConfig() {
return config;
}

public static BookService provideBookService() {
return bookService;
}

public static DownloadService provideDownloadService() {
return downloadService;
}

public static Analytics provideAnalytics() {
return firebaseAnalytics;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.google.firebase.storage.StorageReference;

import org.bookdash.android.BookDashApplication;
import org.bookdash.android.Injection;
import org.bookdash.android.di.Injection;
import org.threeten.bp.Instant;
import org.threeten.bp.ZoneId;
import org.threeten.bp.ZonedDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;

import org.bookdash.android.Injection;
import org.bookdash.android.config.FirebaseConfig;
import org.bookdash.android.di.Injection;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.storage.StorageReference;

import org.bookdash.android.Injection;
import org.bookdash.android.R;
import org.bookdash.android.config.GlideApp;
import org.bookdash.android.databinding.ActivityBookInformationBinding;
import org.bookdash.android.di.Injection;
import org.bookdash.android.domain.model.firebase.FireBookDetails;
import org.bookdash.android.domain.model.firebase.FireContributor;
import org.bookdash.android.domain.model.gson.BookPages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

import com.google.android.material.snackbar.Snackbar;

import org.bookdash.android.Injection;
import org.bookdash.android.R;
import org.bookdash.android.di.Injection;
import org.bookdash.android.domain.model.firebase.FireBookDetails;
import org.bookdash.android.presentation.bookinfo.BookInfoActivity;
import org.bookdash.android.presentation.main.NavDrawerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

import com.google.android.material.snackbar.Snackbar;

import org.bookdash.android.Injection;
import org.bookdash.android.R;
import org.bookdash.android.di.Injection;
import org.bookdash.android.domain.model.firebase.FireBookDetails;
import org.bookdash.android.presentation.bookinfo.BookInfoActivity;
import org.bookdash.android.presentation.main.NavDrawerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import com.google.android.material.snackbar.Snackbar;

import org.bookdash.android.BuildConfig;
import org.bookdash.android.Injection;
import org.bookdash.android.R;
import org.bookdash.android.di.Injection;
import org.bookdash.android.presentation.about.AboutFragment;
import org.bookdash.android.presentation.activity.BaseAppCompatActivity;
import org.bookdash.android.presentation.downloads.DownloadsFragment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import org.bookdash.android.Injection;
import org.bookdash.android.R;
import org.bookdash.android.di.Injection;
import org.bookdash.android.domain.model.firebase.FireBookDetails;
import org.bookdash.android.presentation.activity.BaseAppCompatActivity;
import org.bookdash.android.presentation.bookinfo.BookInfoActivity;
Expand Down
Loading

0 comments on commit 4025287

Please sign in to comment.