Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded kotlin and Android #158

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ crash.txt
/publishTODO.txt
.idea/copyright/
/app/google-services.json
/app/partner-keys.json
/.idea/markdown-navigator/
/app/src/main/java/com/breadwallet/presenter/fragments/FragmentBreadSignal.java
/fastlane/
fastlane/
partner-keys.json
/.idea/appInsightsSettings.xml
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/migrations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 30 additions & 24 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ android {

buildFeatures {
dataBinding true
buildConfig true
}

signingConfigs {
Expand Down Expand Up @@ -57,15 +58,15 @@ android {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}

compileSdkVersion 32
compileSdkVersion 34

defaultConfig {
testInstrumentationRunner = 'androidx.test.runner.AndroidJUnitRunner'
applicationId = 'com.loafwallet'
minSdkVersion 27
targetSdkVersion 32
versionCode 734
versionName "v2.9.0"
minSdkVersion 31
targetSdkVersion 33
versionCode 738
versionName "v2.9.1"
multiDexEnabled true
archivesBaseName = "${versionName}(${versionCode})"

Expand Down Expand Up @@ -245,6 +246,7 @@ android {

}
namespace 'com.breadwallet'
buildToolsVersion '34.0.0'
}

task copyResDirectoryToClasses(type: Copy) {
Expand All @@ -263,13 +265,13 @@ repositories {

dependencies {

androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0')
androidTestImplementation('androidx.test:runner:1.4.0')
androidTestImplementation('androidx.test:rules:1.4.0')
androidTestImplementation('androidx.test.espresso:espresso-core:3.5.1')
androidTestImplementation('androidx.test:runner:1.5.2')
androidTestImplementation('androidx.test:rules:1.5.0')
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.6.20-RC'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.9.22'

// commons
implementation 'commons-io:commons-io:2.4'
Expand All @@ -279,35 +281,40 @@ dependencies {
implementation 'org.slf4j:slf4j-api:1.7.22'

// androidx
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'

// preferences
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
// ChromeCustomTabs
implementation 'androidx.browser:browser:1.4.0'
implementation 'androidx.browser:browser:1.7.0'
// material design
implementation 'com.google.android.material:material:1.5.0'
implementation 'com.google.android.material:material:1.11.0'

implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'

implementation 'com.google.zxing:core:3.4.1'
implementation 'com.google.zxing:core:3.5.2'

implementation 'io.sigpipe:jbsdiff:1.0'

implementation 'com.squareup.okhttp3:okhttp:4.3.1'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'

// Firebase
implementation platform('com.google.firebase:firebase-bom:29.3.1')
implementation platform('com.google.firebase:firebase-bom:32.7.1')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-crashlytics-ndk'

// push notifications
implementation 'com.google.firebase:firebase-messaging:23.4.0'
implementation 'com.pusher:push-notifications-android:1.8.0'

// Timber
implementation 'com.jakewharton.timber:timber:4.7.1'

Expand All @@ -318,15 +325,15 @@ dependencies {
implementation 'com.github.razir.progressbutton:progressbutton:2.1.0'

// Dagger
implementation 'com.google.dagger:dagger:2.41'
kapt 'com.google.dagger:dagger-compiler:2.41'
implementation 'com.google.dagger:dagger:2.50'
kapt 'com.google.dagger:dagger-compiler:2.50'

// Play Core
implementation 'com.google.android.play:core:1.10.3'
implementation 'com.google.android.play:core-ktx:1.8.1'

// Ktlint
ktlint 'com.pinterest:ktlint:0.44.0'
ktlint 'com.pinterest:ktlint:0.50.0'

//kotlin https://stackoverflow.com/questions/69817925/problem-duplicate-class-androidx-lifecycle-viewmodel-found-in-modules
def lifecycle_version = "2.4.0"
Expand All @@ -348,4 +355,3 @@ task ktlintFormat(type: JavaExec, group: "formatting") {
classpath = configurations.ktlint
args "-F", "src/**/*.kt"
}

8 changes: 7 additions & 1 deletion 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">

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
Expand All @@ -14,11 +13,15 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.BIND_JOB_SERVICE"/>
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

<!-- Allows unlocking your device and activating its screen so UI tests can succeed -->
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<!-- Allows changing locales -->
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>

<uses-sdk android:minSdkVersion="31" android:targetSdkVersion="33"/>

<uses-feature
android:name="android.hardware.location.gps"
android:required="false"/>
Expand All @@ -36,6 +39,7 @@
android:required="false"/>

<application
xmlns:tools="http://schemas.android.com/tools"
android:name=".BreadApp"
android:allowBackup="false"
android:fullBackupContent="false"
Expand All @@ -46,6 +50,8 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:windowSoftInputMode="stateVisible|adjustResize"
tools:replace="android:fullBackupContent"
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"
>

<activity
Expand Down
35 changes: 33 additions & 2 deletions app/src/main/java/com/breadwallet/BreadApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicInteger;
import com.pusher.pushnotifications.PushNotifications;

import static timber.log.Timber.DebugTree;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import timber.log.Timber;

Expand All @@ -49,9 +52,37 @@ public void onCreate() {
if (Utils.isEmulatorOrDebug(this)) {
enableCrashlytics = false;
}
// setup Push Notifications
//PushNotifications.start(getApplicationContext(), "06a438d5-27ba-4cc2-94df-554dc932a796");
//PushNotifications.addDeviceInterest("");

// // Pusher
// pushNotifications.start(instanceId: Partner.partnerKeyPath(name: .pusherStaging))
// // pushNotifications.registerForRemoteNotifications()
// let generaliOSInterest = "general-ios"
// let debugGeneraliOSInterest = "debug-general-ios"
//
// try? pushNotifications
// .addDeviceInterest(interest: generaliOSInterest)
// try? pushNotifications
// .addDeviceInterest(interest: debugGeneraliOSInterest)
//
// let interests = pushNotifications.getDeviceInterests()?.joined(separator: "|") ?? ""
// let device = UIDevice.current.identifierForVendor?.uuidString ?? "ID"
// let interestesDict: [String: String] = ["device_id": device,
// "pusher_interests": interests]
//
// LWAnalytics.logEventWithParameters(itemName: ._20231202_RIGI, properties: interestesDict)

// delay(4.0) {
// self.appDelegate.pushNotifications.registerForRemoteNotifications()
// }


// setup Timber
Timber.plant(new Timber.DebugTree());
if(BuildConfig.DEBUG){
Timber.plant(new Timber.DebugTree());
}

FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(enableCrashlytics);
AnalyticsManager.init(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,27 +190,22 @@ private void setListeners() {
public boolean handleNavigationItemSelected(int menuItemId) {
if (mSelectedBottomNavItem == menuItemId) return true;
mSelectedBottomNavItem = menuItemId;
switch (menuItemId) {
case R.id.nav_history:
ExtensionKt.replaceFragment(BreadActivity.this, new HistoryFragment(), false, R.id.fragment_container);
break;
case R.id.nav_send:
if (BRAnimator.isClickAllowed()) {
BRAnimator.showSendFragment(BreadActivity.this, null);
}
mSelectedBottomNavItem = 0;
break;
case R.id.nav_receive:
if (BRAnimator.isClickAllowed()) {
BRAnimator.showReceiveFragment(BreadActivity.this, true);
}
mSelectedBottomNavItem = 0;
break;
case R.id.nav_buy:
ExtensionKt.replaceFragment(BreadActivity.this, new BuyTabFragment(), false, R.id.fragment_container);
break;
if (menuItemId == R.id.nav_history) {
ExtensionKt.replaceFragment(BreadActivity.this, new HistoryFragment(), false, R.id.fragment_container);
} else if (menuItemId == R.id.nav_send) {
if (BRAnimator.isClickAllowed()) {
BRAnimator.showSendFragment(BreadActivity.this, null);
}
mSelectedBottomNavItem = 0;
} else if (menuItemId == R.id.nav_receive) {
if (BRAnimator.isClickAllowed()) {
BRAnimator.showReceiveFragment(BreadActivity.this, true);
}
mSelectedBottomNavItem = 0;
} else if (menuItemId == R.id.nav_buy) {
ExtensionKt.replaceFragment(BreadActivity.this, new BuyTabFragment(), false, R.id.fragment_container);
}
return true;
return true;
}

private void swap() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,11 +820,8 @@ private void unlockFocus() {

@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.take_picture: {
takePicture();
break;
}
if (view.getId() == R.id.take_picture) {
takePicture();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ private void init(AttributeSet attrs) {
final int N = a.getIndexCount();
for (int i = 0; i < N; ++i) {
int attr = a.getIndex(i);
switch (attr) {
case R.styleable.BRKeyboard_showAlphabet:
if (attr==R.styleable.BRKeyboard_showAlphabet) {
showAlphabet = a.getBoolean(attr, false);
break;
}
}
a.recycle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,15 @@ private void init(AttributeSet attrs) {
final int N = a.getIndexCount();
for (int i = 0; i < N; ++i) {
int attr = a.getIndex(i);
switch (attr) {
case R.styleable.BRLinearLayoutWithCaret_strokeColor:
@ColorInt int strokeColor = a.getColor(attr, 0);
if (strokeColor != 0) strokePaint.setColor(strokeColor);
break;
case R.styleable.BRLinearLayoutWithCaret_backgroundColor:
@ColorInt int bgColor = a.getColor(attr, 0);
if (bgColor != 0) backgroundPaint.setColor(bgColor);
break;
case R.styleable.BRLinearLayoutWithCaret_withStroke:
withStroke = a.getBoolean(attr, false);
break;

if (attr==R.styleable.BRLinearLayoutWithCaret_strokeColor) {
@ColorInt int strokeColor = a.getColor(attr, 0);
if (strokeColor != 0) strokePaint.setColor(strokeColor);
} else if (attr==R.styleable.BRLinearLayoutWithCaret_backgroundColor) {
@ColorInt int bgColor = a.getColor(attr, 0);
if (bgColor != 0) backgroundPaint.setColor(bgColor);
}else{
withStroke = a.getBoolean(attr, false);
}
}
a.recycle();
Expand Down
Loading