Skip to content

Commit

Permalink
Merge pull request #1388 from BlueBubblesApp/development
Browse files Browse the repository at this point in the history
v1.3.0 Release
  • Loading branch information
zlshames authored Aug 22, 2021
2 parents 89768e2 + 3727387 commit 80dc243
Show file tree
Hide file tree
Showing 341 changed files with 18,563 additions and 30,318 deletions.
67 changes: 27 additions & 40 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ if (localPropertiesFile.exists()) {
}
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
Expand All @@ -21,20 +27,12 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}


apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
//apply plugin: 'com.google.gms.google-services' // Google Services plugin
apply plugin: 'kotlin-android'

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 29
compileSdkVersion 31

lintOptions {
checkReleaseBuilds false
Expand All @@ -48,18 +46,11 @@ android {
defaultConfig {
applicationId "com.bluebubbles.messaging"
minSdkVersion 21
targetSdkVersion 29
// v0.1.14 hotfix version (0-9) armv7 OR arm64
// version code: 1 0114 0 70 64

//noinspection AccidentalOctal
versionCode 11200064
// pinned to 30 because 31 doesn't compile yet
targetSdkVersion 30
versionCode 20000000 + flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

// ndk {
// abiFilters 'armeabi-v7a'
// }
}

compileOptions {
Expand Down Expand Up @@ -99,41 +90,37 @@ flutter {
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.firebase:firebase-analytics:17.3.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.github.judemanutd:autostarter:1.0.8'
implementation "androidx.core:core:1.3.2"
implementation "androidx.sharetarget:sharetarget:1.0.0"


//for notifications
implementation "com.android.support:support-compat:28.0.0"
implementation "androidx.core:core:1.6.0"
implementation "androidx.sharetarget:sharetarget:1.1.0"

//for location sending
implementation "com.google.android.gms:play-services-location:17.0.0"
implementation "com.google.android.gms:play-services-location:18.0.0"


// Add the SDK for Firebase Cloud Messaging
implementation 'com.google.firebase:firebase-messaging:20.1.6'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-messaging-directboot:20.2.0'
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation 'com.google.firebase:firebase-database:20.0.1'
implementation 'com.google.firebase:firebase-messaging-directboot:22.0.0'
implementation 'com.google.firebase:firebase-iid:21.1.0'

//for json string to map
implementation 'com.google.code.gson:gson:2.8.6'

//for crash reporting
// implementation 'io.sentry:sentry-android:2.2.2'

implementation 'com.google.mlkit:smart-reply:16.1.0'
implementation 'com.google.mlkit:smart-reply:16.2.0'

// for workmanager
implementation "androidx.work:work-runtime:2.4.0"
implementation "androidx.work:work-runtime:2.5.0"

// Why won't it fucking compile
implementation 'com.google.guava:guava:27.0.1-android'
Expand Down
29 changes: 23 additions & 6 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.CALL_PHONE" />

<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
Expand All @@ -26,11 +26,14 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<application
android:allowBackup="false"
android:name=".Application"
android:icon="@mipmap/ic_launcher"
android:label="BlueBubbles"
android:appCategory="social"
android:requestLegacyExternalStorage="true"
android:debuggable="false"
android:usesCleartextTraffic="true">
Expand Down Expand Up @@ -71,8 +74,7 @@
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize"
android:allowEmbedded="true"
android:resizeableActivity="true"
android:documentLaunchMode="always">
android:resizeableActivity="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down Expand Up @@ -100,10 +102,15 @@
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
<data android:mimeType="text/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/vcard" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/x-vcard" />
</intent-filter>
Expand All @@ -117,13 +124,20 @@
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
<meta-data
android:name="android.service.chooser.chooser_target_service"
android:value="androidx.sharetarget.ChooserTargetServiceCompat" />
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />
</activity>
<!--
Don't delete the meta-data below.
Expand All @@ -132,6 +146,9 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<!-- <meta-data
android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc"/> -->

</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
package com.bluebubbles.messaging;

import android.content.Context;
import android.os.Build;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;

import com.baseflow.permissionhandler.PermissionHandlerPlugin;
import com.bluebubbles.messaging.workers.FCMWorker;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.ValueEventListener;
import com.itsclicking.clickapp.fluttersocketio.FlutterSocketIoPlugin;
import com.tekartik.sqflite.SqflitePlugin;

import java.util.ArrayList;

import flutter.plugins.contactsservice.contactsservice.ContactsServicePlugin;
import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugins.pathprovider.PathProviderPlugin;
import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin;
import io.flutter.view.FlutterCallbackInformation;
import io.flutter.view.FlutterMain;
import io.flutter.view.FlutterNativeView;
import io.flutter.view.FlutterRunArguments;

public class Application extends FlutterApplication implements PluginRegistry.PluginRegistrantCallback {

Expand All @@ -35,8 +10,6 @@ PluginRegistry.PluginRegistrantCallback getCallback() {
return callback;
}



@Override
public void onCreate() {
super.onCreate();
Expand All @@ -47,5 +20,4 @@ public void onCreate() {
public void registerWith(PluginRegistry registry) {

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import androidx.annotation.NonNull;

import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.android.FlutterFragmentActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugins.GeneratedPluginRegistrant;
Expand All @@ -12,6 +12,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ClipData;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
Expand All @@ -30,7 +31,6 @@
import com.bluebubbles.messaging.method_call_handler.MethodCallHandler;
import com.bluebubbles.messaging.method_call_handler.handlers.SocketIssueWarning;
import com.bluebubbles.messaging.sharing.ShareShortcutManager;
import com.itsclicking.clickapp.fluttersocketio.SocketIOManager;

import java.io.BufferedOutputStream;
import java.io.File;
Expand All @@ -45,8 +45,7 @@
import java.util.List;
import java.util.Map;


public class MainActivity extends FlutterActivity {
public class MainActivity extends FlutterFragmentActivity {
public static final String CHANNEL = "com.bluebubbles.messaging";
private static final String TAG = "MainActivity";
public static FlutterEngine engine;
Expand Down Expand Up @@ -83,20 +82,20 @@ protected void onNewIntent(Intent intent) {
if (type == null) return;

if (Intent.ACTION_SEND.equals(action)) {
if (type.equals("text/plain")) {
if (type.startsWith("text/")) {
handleSendText(intent); // Handle text being sent
} else {
handleShareFile(intent);
}
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
handleSendMultipleImages(intent);
} else {
if (type.equals("NotificationOpen")) {
if (type.equals("NotificationOpen") || type.equals("DirectShare")) {
Log.d("Notifications", "Tapped on notification with ID: " + intent.getExtras().getInt("id"));
startingChat = intent.getStringExtra("chatGUID");
startingChat = intent.getStringExtra("chatGuid");

Log.d("Notifications", "Opening Chat with GUID: " + startingChat);
new MethodChannel(engine.getDartExecutor().getBinaryMessenger(), CHANNEL).invokeMethod("ChatOpen", intent.getExtras().getString("chatGUID"));
new MethodChannel(engine.getDartExecutor().getBinaryMessenger(), CHANNEL).invokeMethod("ChatOpen", intent.getExtras().getString("chatGuid"));
} else if (type.equals(SocketIssueWarning.TYPE)) {
new MethodChannel(engine.getDartExecutor().getBinaryMessenger(), CHANNEL).invokeMethod("socket-error-open", null);
}
Expand All @@ -110,24 +109,12 @@ protected void onNewIntent(Intent intent) {
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PICK_IMAGE) {
if (resultCode == RESULT_OK) {
File sharedFiles = new File(getApplicationContext().getFilesDir().getAbsolutePath() + "/sharedFiles/");
if (!sharedFiles.exists()) {
sharedFiles.mkdir();
List<String> images = readPathsFromIntent(data);
if (result != null) {
result.success(images);
}
File file = new File(getApplicationContext().getFilesDir().getAbsolutePath() + "/sharedFiles/" + getFileName(data.getData()));
try {
file.createNewFile();
writeBytesFromURI(data.getData(), file);
if (result != null) {
result.success(file.getAbsolutePath());
Log.d("PICK_FILE", "Result is okay! " + file.getAbsolutePath());
}
} catch (IOException e) {
e.printStackTrace();
}

} else {
Log.d("PICK_FILE", "Something went wrong");
Log.d("PICK_FILE", "Nothing selected, or something went wrong");
result.success(null);
}
result = null;
Expand All @@ -141,6 +128,49 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}

List<String> readPathsFromIntent(Intent intent) {
// Try to get the initial data
Uri fileUri = intent.getData();
List<Uri> fileUris = new ArrayList<Uri>();
List<String> images = new ArrayList<String>();

// If the initial data is null, we need to get the clip data
if (fileUri == null) {
ClipData clipData = intent.getClipData();

// If we have clip data, pull out all the URIs of the items in it
if (clipData != null) {
for (int i = 0; i < clipData.getItemCount(); i++) {
fileUris.add(clipData.getItemAt(i).getUri());
}
}
} else {
fileUris.add(fileUri);
}

// Create the shared files directory if it doesn't exist
File filesDir = new File(getFilesDir().getPath() + "/sharedFiles/");
if (!filesDir.exists()) {
filesDir.mkdir();
}

// For each of the URIs, write the attachments to the shared directory
for (Uri uri : fileUris) {
try {
File file = new File(getFilesDir().getPath() + "/sharedFiles/" + getFileName(uri));
file.createNewFile();
images.add(file.getPath());
writeBytesFromURI(uri, file);
} catch (Exception e) {
Log.d("share", "FAILURE");
e.printStackTrace();
}
}

// Return the new local file paths
return images;
}


void handleSendText(Intent intent) {
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
Expand Down Expand Up @@ -271,7 +301,6 @@ protected void onStart() {
@Override
protected void onDestroy() {
Log.d("MainActivity", "Removing Activity from memory");
SocketIOManager.getInstance().destroyAllSockets();
engine = null;
super.onDestroy();
}
Expand Down
Loading

0 comments on commit 80dc243

Please sign in to comment.