Skip to content

Commit

Permalink
fixed ~~all~~ most of the ~~things~~ errors - it compiles now
Browse files Browse the repository at this point in the history
  • Loading branch information
octoshrimpy committed Oct 22, 2024
1 parent 93b7b15 commit ecb99a3
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 41 deletions.
14 changes: 11 additions & 3 deletions android-smsmms/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdk 25
compileSdk 33

defaultConfig {
minSdkVersion 23
targetSdkVersion 25
minSdkVersion 26
targetSdkVersion 33
}


Expand All @@ -45,5 +45,13 @@ dependencies {
}

repositories {
google()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
maven {
name 'glide-snapshot'
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
mavenCentral()
jcenter()
}
1 change: 1 addition & 0 deletions android-smsmms/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application>

<provider android:name=".MmsFileProvider"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
import java.io.IOException;
import java.util.ArrayList;

import android.net.Network;
import android.net.NetworkRequest;
import android.net.ConnectivityManager;
import android.net.NetworkCapabilities;
import android.os.Build;

/**
* The TransactionService of the MMS Client is responsible for handling requests
* to initiate client-transactions sent from:
Expand Down Expand Up @@ -181,6 +187,7 @@ public void onCreate() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
registerReceiver(mReceiver, intentFilter);
mConnMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
}

private void initServiceHandler() {
Expand Down Expand Up @@ -458,8 +465,10 @@ else if (mProcessing.isEmpty()) {
private synchronized void createWakeLock() {
// Create a new wake lock if we haven't made one yet.
if (mWakeLock == null) {
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MMS Connectivity");
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);

// Use a unique tag with a prefix followed by a colon for better debugging
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "myapp:MMSConnectivity");
mWakeLock.setReferenceCounted(false);
}
}
Expand All @@ -481,31 +490,68 @@ private void releaseWakeLock() {

protected int beginMmsConnectivity() throws IOException {
Timber.v("beginMmsConnectivity");

// Take a wake lock so we don't fall asleep before the message is downloaded.
createWakeLock();

if (Utils.isMmsOverWifiEnabled(this)) {
NetworkInfo niWF = mConnMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if ((niWF != null) && (niWF.isConnected())) {
Timber.v("beginMmsConnectivity: Wifi active");
return 0;
Network[] networks = mConnMgr.getAllNetworks();
for (Network network : networks) {
NetworkCapabilities capabilities = mConnMgr.getNetworkCapabilities(network);
if (capabilities != null && capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) {
if (capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) &&
capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)) {
Timber.v("beginMmsConnectivity: Wifi active");
return 0;
}
}
}
}

int result = mConnMgr.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, "enableMMS");
// Request the mobile network for MMS connectivity
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
NetworkRequest.Builder builder = new NetworkRequest.Builder();

Timber.v("beginMmsConnectivity: result=" + result);
// Specify MMS capability and cellular transport
builder.addCapability(NetworkCapabilities.NET_CAPABILITY_MMS);
builder.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);

switch (result) {
case 0:
case 1:
acquireWakeLock();
return result;
NetworkRequest networkRequest = builder.build();

mConnMgr.requestNetwork(networkRequest, new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
// Bind the process to the network once it's available
mConnMgr.bindProcessToNetwork(network);
Timber.v("beginMmsConnectivity: Mobile network available for MMS");

// Acquire wake lock once the network is available
acquireWakeLock();
}

@Override
public void onUnavailable() {
Timber.e("beginMmsConnectivity: Unable to establish MMS connectivity");
// You can handle this by throwing an IOException if necessary
}

@Override
public void onLost(Network network) {
Timber.e("beginMmsConnectivity: Mobile network for MMS lost");
// Handle losing the network if needed
}
});

// You may need to block or wait until the network becomes available before proceeding.
// Using something like a CountDownLatch can help block until onAvailable() is called.
// Here we return 1 to indicate the request has been initiated.
return 1;
}

throw new IOException("Cannot establish MMS connectivity");
}


protected void endMmsConnectivity() {
try {
Timber.v("endMmsConnectivity");
Expand Down
14 changes: 10 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ buildscript {
ext.billing_version = '5.1.0'
ext.conductor_version = '2.1.5'
ext.coroutines_version = '1.4.3'
ext.dagger_version = "2.16"
ext.dagger_version = "2.18"
ext.espresso_version = '3.1.0-alpha3'
ext.exoplayer_version = "2.8.1"
ext.exoplayer_version = "r2.9.0"
ext.glide_version = "4.8.0"
ext.junit_version = '4.12'
ext.kotlin_version = '1.7.20'
Expand All @@ -24,7 +24,7 @@ buildscript {
ext.mockito_version = '2.18.3'
ext.moshi_version = '1.8.0'
ext.okhttp3_version = '4.10.0'
ext.realm_version = '10.16.0'
ext.realm_version = '10.15.0'
ext.realm_adapters_version = '3.1.0'
ext.rxandroid_version = '2.0.1'
ext.rxdogtag_version = '0.2.0'
Expand All @@ -37,9 +37,15 @@ buildscript {
ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2]

repositories {
google()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
maven {
name 'glide-snapshot'
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
mavenCentral()
jcenter()
google()
}

dependencies {
Expand Down
10 changes: 9 additions & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ android {
compileSdk 33

defaultConfig {
minSdkVersion 23
minSdk 26
targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand All @@ -40,5 +40,13 @@ dependencies {
}

repositories {
google()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
maven {
name 'glide-snapshot'
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
mavenCentral()
jcenter()
}
20 changes: 15 additions & 5 deletions data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ android {
}

defaultConfig {
minSdkVersion 23
minSdk 26
targetSdkVersion 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down Expand Up @@ -63,8 +63,10 @@ dependencies {
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
//Resolve jdk8+ Generation Annotations - javax annotation does not exist
compileOnly 'com.github.pengrad:jdk9-deps:1.0'
// compileOnly "javax.annotation:jsr250-api:1.0"
implementation 'com.github.pengrad:jdk9-deps:1ffe84c468'

// look into jakarta.annotation-api when switching to java 9
implementation 'javax.annotation:javax.annotation-api:1.3.2'

// rxjava
implementation "io.reactivex.rxjava2:rxandroid:$rxandroid_version"
Expand All @@ -85,12 +87,12 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$coroutines_version"

implementation 'com.callcontrol:datashare:1.2.0'
implementation 'com.callcontrol:datashare:1.3.0'
implementation "com.f2prateek.rx.preferences2:rx-preferences:$rx_preferences_version"
implementation "com.jakewharton.timber:timber:$timber_version"
implementation "com.squareup.moshi:moshi:$moshi_version"
implementation "com.squareup.okhttp3:okhttp:$okhttp3_version"
implementation 'io.michaelrocks:libphonenumber-android:8.10.16'
implementation 'io.michaelrocks:libphonenumber-android:8.13.47'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation project(":android-smsmms")
implementation project(':common')
Expand All @@ -101,5 +103,13 @@ dependencies {
}

repositories {
google()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
maven {
name 'glide-snapshot'
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
mavenCentral()
jcenter()
}
5 changes: 4 additions & 1 deletion data/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<manifest />
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,18 @@ class SubscriptionManagerCompat @Inject constructor(context: Context, private va

val activeSubscriptionInfoList: List<SubscriptionInfoCompat>
get() {
return subscriptionManager?.activeSubscriptionInfoList?.map { SubscriptionInfoCompat(it) } ?: listOf()
return if (permissions.hasPhone()) {
try {
subscriptionManager?.activeSubscriptionInfoList?.map {
SubscriptionInfoCompat(it)
} ?: listOf()
} catch (e: SecurityException) {
// Handle exception if permission is not granted
listOf()
}
} else {
listOf()
}
}

init {
Expand Down
18 changes: 16 additions & 2 deletions domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ android {
}

defaultConfig {
minSdkVersion 23
minSdk 26
targetSdkVersion 33
}
namespace 'dev.octoshrimpy.quik.domain'
Expand All @@ -45,7 +45,10 @@ dependencies {
implementation "com.google.dagger:dagger:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
//Resolve jdk8+ Generation Annotations - javax annotation does not exist
compileOnly 'com.github.pengrad:jdk9-deps:1.0'
implementation 'com.github.pengrad:jdk9-deps:1ffe84c468'

// look into jakarta.annotation-api when switching to java 9
implementation 'javax.annotation:javax.annotation-api:1.3.2'

// realm
kapt "io.realm:realm-annotations:$realm_version"
Expand All @@ -66,8 +69,19 @@ dependencies {
implementation "com.jakewharton.timber:timber:$timber_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation project(":common")

// implementation 'com.github.pengrad:jdk9-deps:1ffe84c'

}

repositories {
google()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
maven {
name 'glide-snapshot'
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
mavenCentral()
jcenter()
}
22 changes: 13 additions & 9 deletions presentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ android {

defaultConfig {
applicationId 'dev.octoshrimpy.quik'
minSdkVersion 23
minSdkVersion 26
targetSdkVersion 33
versionCode 2224
versionName "4.0.7"
versionName '4.0.7'
setProperty("archivesBaseName", "QUIK-v${versionName}")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

setProperty("archivesBaseName", "QUIK-v${versionName}")
versionNameSuffix '-testing'
}

signingConfigs {
Expand Down Expand Up @@ -125,8 +126,8 @@ dependencies {
kapt "com.github.bumptech.glide:compiler:$glide_version"

// exoplayer
implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
implementation("com.google.android.exoplayer:exoplayer-ui:$exoplayer_version", {
implementation "com.github.google.ExoPlayer:exoplayer-core:$exoplayer_version"
implementation("com.github.google.ExoPlayer:exoplayer-ui:$exoplayer_version", {
exclude group: "com.android.support", module: "support-media-compat"
})

Expand All @@ -148,8 +149,10 @@ dependencies {
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
// compileOnly "javax.annotation:jsr250-api:1.0"
//Resolve jdk8+ Generation Annotations - javax annotation does not exist
compileOnly 'com.github.pengrad:jdk9-deps:1.0'
// implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation 'com.github.pengrad:jdk9-deps:1ffe84c468'

// look into jakarta.annotation-api when switching to java 9
implementation 'javax.annotation:javax.annotation-api:1.3.2'

// ezvcard
implementation('com.googlecode.ez-vcard:ez-vcard:0.10.4', {
Expand All @@ -159,7 +162,8 @@ dependencies {
})

// realm
implementation("io.realm:android-adapters:$realm_adapters_version") { transitive = false }
implementation "com.github.realm:realm-android-adapters:$realm_adapters_version"
// implementation("io.realm:android-adapters:$realm_adapters_version") { transitive = false }
kapt "io.realm:realm-annotations:$realm_version"
kapt "io.realm:realm-annotations-processor:$realm_version"

Expand Down Expand Up @@ -191,9 +195,9 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$coroutines_version"

implementation "com.github.chrisbanes:PhotoView:2.0.0"
implementation "com.github.chrisbanes:photoview:2.1.4"
implementation "com.f2prateek.rx.preferences2:rx-preferences:$rx_preferences_version"
implementation "com.google.android:flexbox:0.3.1"
implementation "com.github.google:flexbox-layout:0.3.1"
implementation "com.jakewharton.timber:timber:$timber_version"
implementation "com.squareup.moshi:moshi-kotlin:$moshi_version"
implementation "me.leolin:ShortcutBadger:1.1.22"
Expand Down
Loading

0 comments on commit ecb99a3

Please sign in to comment.