Skip to content

Commit

Permalink
Merge pull request #64 from Beldex-Coin/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
codeman-crypto authored Dec 3, 2024
2 parents 11f449a + 68c586b commit 9fa34c1
Show file tree
Hide file tree
Showing 37 changed files with 106 additions and 79 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ dependencies {
configurations.all {
exclude module: "commons-logging"
}
def canonicalVersionCode = 71
def canonicalVersionName = "2.6.1"
def canonicalVersionCode = 73
def canonicalVersionName = "2.6.2"

def postFixSize = 10
def abiPostFix = ['armeabi-v7a' : 1,
Expand Down
30 changes: 15 additions & 15 deletions app/playMainNet/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,48 @@
"type": "UNIVERSAL",
"filters": [],
"attributes": [],
"versionCode": 71,
"versionName": "2.6.1",
"outputFile": "Bchat-2.6.1-universal.apk"
"versionCode": 73,
"versionName": "2.6.2",
"outputFile": "Bchat-2.6.2-universal.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
"value": "x86_64"
}
],
"attributes": [],
"versionCode": 71,
"versionName": "2.6.1",
"outputFile": "Bchat-2.6.1-armeabi-v7a.apk"
"versionCode": 73,
"versionName": "2.6.2",
"outputFile": "Bchat-2.6.2-x86_64.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86_64"
"value": "arm64-v8a"
}
],
"attributes": [],
"versionCode": 71,
"versionName": "2.6.1",
"outputFile": "Bchat-2.6.1-x86_64.apk"
"versionCode": 73,
"versionName": "2.6.2",
"outputFile": "Bchat-2.6.2-arm64-v8a.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "arm64-v8a"
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 71,
"versionName": "2.6.1",
"outputFile": "Bchat-2.6.1-arm64-v8a.apk"
"versionCode": 73,
"versionName": "2.6.2",
"outputFile": "Bchat-2.6.2-armeabi-v7a.apk"
}
],
"elementType": "File"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/assets/changeLog.json
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,14 @@
"description":"Minor bug fixes"
}
]
},
{
"title": "2.6.2",
"descriptions": [
{
"description":"Minor bug fixes"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public DatabaseSecret getOrCreateDatabaseSecret() {
else return createAndStoreDatabaseSecret(context);
}

private DatabaseSecret getUnencryptedDatabaseSecret(@NonNull Context context, @NonNull String unencryptedSecret)
private @NonNull DatabaseSecret getUnencryptedDatabaseSecret(@NonNull Context context, @NonNull String unencryptedSecret)
{
try {
DatabaseSecret databaseSecret = new DatabaseSecret(unencryptedSecret);

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
if (Build.VERSION.SDK_INT < 23) {
return databaseSecret;
} else {
KeyStoreHelper.SealedData encryptedSecret = KeyStoreHelper.seal(databaseSecret.asBytes());
Expand All @@ -50,23 +50,23 @@ private DatabaseSecret getUnencryptedDatabaseSecret(@NonNull Context context, @N
}
}

private DatabaseSecret getEncryptedDatabaseSecret(@NonNull String serializedEncryptedSecret) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
private @NonNull DatabaseSecret getEncryptedDatabaseSecret(@NonNull String serializedEncryptedSecret) {
if (Build.VERSION.SDK_INT < 23) {
throw new AssertionError("OS downgrade not supported. KeyStore sealed data exists on platform < M!");
} else {
KeyStoreHelper.SealedData encryptedSecret = KeyStoreHelper.SealedData.fromString(serializedEncryptedSecret);
return new DatabaseSecret(KeyStoreHelper.unseal(encryptedSecret));
}
}

private DatabaseSecret createAndStoreDatabaseSecret(@NonNull Context context) {
private @NonNull DatabaseSecret createAndStoreDatabaseSecret(@NonNull Context context) {
SecureRandom random = new SecureRandom();
byte[] secret = new byte[32];
random.nextBytes(secret);

DatabaseSecret databaseSecret = new DatabaseSecret(secret);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (Build.VERSION.SDK_INT >= 23) {
KeyStoreHelper.SealedData encryptedSecret = KeyStoreHelper.seal(databaseSecret.asBytes());
TextSecurePreferences.setDatabaseEncryptedSecret(context, encryptedSecret.serialize());
} else {
Expand Down
55 changes: 32 additions & 23 deletions app/src/main/java/io/beldex/bchat/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1214,35 +1214,44 @@ class HomeFragment : BaseFragment(),ConversationClickListener,
AsyncTaskCoroutine<Int?, NodeInfo?>() {

override fun doInBackground(vararg params: Int?): NodeInfo? {
val favourites: Set<NodeInfo?> = activityCallback!!.getOrPopulateFavouritesRemoteNodeList(requireActivity(),storeNodes)
var selectedNode: NodeInfo?
if (params[0] == findBest) {
selectedNode = autoselect(favourites)
} else if (params[0] == pingSelected) {
selectedNode = activityCallback!!.getNode()
if (selectedNode == null) {
for (node in favourites) {
if (node!!.isSelected) {
selectedNode = node
break
if(isAdded) {
val favourites: Set<NodeInfo?> =
activityCallback!!.getOrPopulateFavouritesRemoteNodeList(
requireActivity(),
storeNodes
)
var selectedNode: NodeInfo?
if (params[0] == findBest) {
selectedNode = autoselect(favourites)
} else if (params[0] == pingSelected) {
selectedNode = activityCallback!!.getNode()
if (selectedNode == null) {
for (node in favourites) {
if (node!!.isSelected) {
selectedNode = node
break
}
}
}
}
if (selectedNode == null) { // autoselect
selectedNode = autoselect(favourites)
} else {
//Steve Josephh21
if(selectedNode!=null) {
selectedNode!!.testRpcService()
if (selectedNode == null) { // autoselect
selectedNode = autoselect(favourites)
} else {
//Steve Josephh21
if (selectedNode != null) {
selectedNode!!.testRpcService()
}
}
} else throw IllegalStateException()
return if (selectedNode != null && selectedNode.isValid) {
activityCallback!!.setNode(selectedNode)
selectedNode
} else {
activityCallback!!.setNode(null)
null
}
} else throw IllegalStateException()
return if (selectedNode != null && selectedNode.isValid) {
activityCallback!!.setNode(selectedNode)
selectedNode
} else {
activityCallback!!.setNode(null)
null
return null
}
}

Expand Down
10 changes: 8 additions & 2 deletions app/src/main/java/io/beldex/bchat/service/KeyCachingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;

import io.beldex.bchat.ApplicationContext;
import io.beldex.bchat.BuildConfig;
import io.beldex.bchat.DatabaseUpgradeActivity;
import io.beldex.bchat.DummyActivity;
import io.beldex.bchat.home.HomeActivity;
import com.beldex.libsignal.utilities.Log;
import io.beldex.bchat.home.HomeActivity;
import io.beldex.bchat.notifications.NotificationChannels;
import com.beldex.libbchat.utilities.ServiceUtil;
import com.beldex.libbchat.utilities.TextSecurePreferences;
Expand Down Expand Up @@ -83,7 +83,13 @@ public class KeyCachingService extends Service {
public static void setMasterSecret(Context context, Object masterSecret) {
// Start and bind to the KeyCachingService instance.
Intent bindIntent = new Intent(context, KeyCachingService.class);
context.startService(bindIntent);
try { context.startService(bindIntent); }
catch(Exception e) {
try { ContextCompat.startForegroundService(context, bindIntent); }
catch (Exception e2) {
Log.d("Beldex", "Unable to start KeyCachingService intent: ",e2);
}
}
context.bindService(bindIntent, new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/io/beldex/bchat/util/RestoreHeight.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ static public RestoreHeight getInstance() {
blockheight.put("2024-08-01", 3479700L);
blockheight.put("2024-09-01", 3536850L);
blockheight.put("2024-10-01", 3668050L);
blockheight.put("2024-11-01", 3784050L);
}

public long getHeight(String date) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class RescanDialog(val contextHomeActivity: HomeActivity, private val daemonBloc
dates["2024-08"] = 3479700
dates["2024-09"] = 3536850
dates["2024-10"] = 3668050
dates["2024-11"] = 3784050

return ComposeView(requireContext()).apply {
setContent {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout-sw400dp/activity_register.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
app:layout_constraintDimensionRatio="1:1"
app:lottie_autoPlay="true"
app:lottie_enableMergePathsForKitKatAndAbove="true"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
tools:ignore="ContentDescription" />
Expand Down Expand Up @@ -168,7 +168,7 @@
app:layout_constraintDimensionRatio="1:1"
app:lottie_autoPlay="true"
app:lottie_enableMergePathsForKitKatAndAbove="true"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
tools:ignore="ContentDescription" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
android:adjustViewBounds="true"
android:layout_centerInParent="true"
app:layout_constraintDimensionRatio="1:1"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
app:lottie_autoPlay="true"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_create_closed_group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
app:layout_constraintDimensionRatio="1:1"
app:lottie_autoPlay="true"
app:lottie_enableMergePathsForKitKatAndAbove="true"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
tools:ignore="ContentDescription" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ android:alpha="0">
android:adjustViewBounds="true"
android:layout_centerInParent="true"
app:layout_constraintDimensionRatio="1:1"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
app:lottie_autoPlay="true"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_create_private_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
android:adjustViewBounds="true"
android:layout_centerInParent="true"
app:layout_constraintDimensionRatio="1:1"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
app:lottie_autoPlay="true"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_edit_closed_group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
android:layout_centerInParent="true"
android:layout_marginTop="8dp"
app:layout_constraintDimensionRatio="1:1"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
app:lottie_autoPlay="true"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_in_chat_send_success.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:adjustViewBounds="true"
android:layout_margin="20dp"
app:layout_constraintDimensionRatio="1:1"
app:lottie_fileName="send.json"
app:lottie_rawRes="@raw/sent"
app:lottie_loop="false"
app:lottie_speed="1"
app:lottie_autoPlay="true"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_join_public_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
android:layout_centerInParent="true"
android:layout_marginTop="8dp"
app:layout_constraintDimensionRatio="1:1"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
app:lottie_autoPlay="true"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_join_public_chat_new.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
app:layout_constraintDimensionRatio="1:1"
app:lottie_autoPlay="true"
app:lottie_enableMergePathsForKitKatAndAbove="true"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
tools:ignore="ContentDescription" />
Expand Down Expand Up @@ -164,7 +164,7 @@
app:layout_constraintDimensionRatio="1:1"
app:lottie_autoPlay="true"
app:lottie_enableMergePathsForKitKatAndAbove="true"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
tools:ignore="ContentDescription" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:adjustViewBounds="true"
android:layout_centerInParent="true"
app:layout_constraintDimensionRatio="1:1"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
app:lottie_autoPlay="true"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_my_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
app:layout_constraintDimensionRatio="1:1"
app:lottie_autoPlay="true"
app:lottie_enableMergePathsForKitKatAndAbove="true"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
tools:ignore="ContentDescription" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_path.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
android:adjustViewBounds="true"
android:layout_centerInParent="true"
app:layout_constraintDimensionRatio="1:1"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
app:lottie_autoPlay="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:adjustViewBounds="true"
android:layout_centerInParent="true"
app:layout_constraintDimensionRatio="1:1"
app:lottie_fileName="load_animation.json"
app:lottie_rawRes="@raw/load_animation"
app:lottie_loop="true"
app:lottie_speed="1"
app:lottie_autoPlay="true"
Expand Down
Loading

0 comments on commit 9fa34c1

Please sign in to comment.