From f6c2c7c3fe6700f16821395f5f018e0e2401a7e4 Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Thu, 17 Oct 2024 18:34:39 -0400 Subject: [PATCH 001/155] feat: Android Variants (#984) * feat: Android Variants Added Android Variants Moved folder structures Removed Android build scripts used to update new variant info Aligned eas.json profiles Added new manifest and strings for Android resource merger * missed file commit --- .github/workflows/build-app-release.yml | 8 +- .github/workflows/build-internal.yml | 17 +-- android/app/build.gradle | 18 ++- android/app/src/main/AndroidManifest.xml | 7 +- android/app/src/main/google-services.json | 39 +++++++ .../com/converse/{dev => }/AsyncStorage.kt | 4 +- .../java/com/converse/{dev => }/BackendApi.kt | 2 +- .../java/com/converse/{dev => }/Datatypes.kt | 2 +- .../java/com/converse/{dev => }/Keychain.kt | 2 +- .../com/converse/{dev => }/MainActivity.kt | 2 +- .../com/converse/{dev => }/MainApplication.kt | 2 +- .../converse/{dev => }/MessageNotification.kt | 4 +- .../main/java/com/converse/{dev => }/Mmkv.kt | 2 +- .../converse/{dev => }/NotificationParser.kt | 2 +- .../converse/{dev => }/NotificationUtils.kt | 2 +- .../java/com/converse/{dev => }/Profile.kt | 2 +- .../{dev => }/PushNotificationsService.kt | 24 ++-- .../java/com/converse/{dev => }/Sentry.kt | 2 +- .../main/java/com/converse/{dev => }/Spam.kt | 8 +- .../java/com/converse/{dev => }/Sqlite.kt | 2 +- .../main/java/com/converse/{dev => }/Utils.kt | 2 +- .../com/converse/{dev => }/xmtp/Client.kt | 4 +- .../converse/{dev => }/xmtp/Conversations.kt | 4 +- .../com/converse/{dev => }/xmtp/Messages.kt | 6 +- android/app/src/main/res/values/strings.xml | 2 +- android/app/src/preview/AndroidManifest.xml | 31 +++++ android/app/src/preview/google-services.json | 39 +++++++ .../app/src/preview/res/values/strings.xml | 3 + android/app/src/prod/AndroidManifest.xml | 31 +++++ android/app/src/prod/google-services.json | 39 +++++++ android/app/src/prod/res/values/strings.xml | 3 + eas.json | 109 +++++------------- package.json | 3 +- scripts/build/android/preview.js | 60 ---------- scripts/build/android/production.js | 61 ---------- scripts/build/android/utils.js | 34 ------ scripts/build/build.js | 3 +- scripts/build/update.js | 1 - 38 files changed, 281 insertions(+), 305 deletions(-) create mode 100644 android/app/src/main/google-services.json rename android/app/src/main/java/com/converse/{dev => }/AsyncStorage.kt (94%) rename android/app/src/main/java/com/converse/{dev => }/BackendApi.kt (99%) rename android/app/src/main/java/com/converse/{dev => }/Datatypes.kt (98%) rename android/app/src/main/java/com/converse/{dev => }/Keychain.kt (97%) rename android/app/src/main/java/com/converse/{dev => }/MainActivity.kt (98%) rename android/app/src/main/java/com/converse/{dev => }/MainApplication.kt (98%) rename android/app/src/main/java/com/converse/{dev => }/MessageNotification.kt (98%) rename android/app/src/main/java/com/converse/{dev => }/Mmkv.kt (99%) rename android/app/src/main/java/com/converse/{dev => }/NotificationParser.kt (98%) rename android/app/src/main/java/com/converse/{dev => }/NotificationUtils.kt (98%) rename android/app/src/main/java/com/converse/{dev => }/Profile.kt (99%) rename android/app/src/main/java/com/converse/{dev => }/PushNotificationsService.kt (96%) rename android/app/src/main/java/com/converse/{dev => }/Sentry.kt (97%) rename android/app/src/main/java/com/converse/{dev => }/Spam.kt (97%) rename android/app/src/main/java/com/converse/{dev => }/Sqlite.kt (98%) rename android/app/src/main/java/com/converse/{dev => }/Utils.kt (98%) rename android/app/src/main/java/com/converse/{dev => }/xmtp/Client.kt (97%) rename android/app/src/main/java/com/converse/{dev => }/xmtp/Conversations.kt (99%) rename android/app/src/main/java/com/converse/{dev => }/xmtp/Messages.kt (99%) create mode 100644 android/app/src/preview/AndroidManifest.xml create mode 100644 android/app/src/preview/google-services.json create mode 100644 android/app/src/preview/res/values/strings.xml create mode 100644 android/app/src/prod/AndroidManifest.xml create mode 100644 android/app/src/prod/google-services.json create mode 100644 android/app/src/prod/res/values/strings.xml delete mode 100644 scripts/build/android/preview.js delete mode 100644 scripts/build/android/production.js delete mode 100644 scripts/build/android/utils.js diff --git a/.github/workflows/build-app-release.yml b/.github/workflows/build-app-release.yml index fb68f6521..1c1121698 100644 --- a/.github/workflows/build-app-release.yml +++ b/.github/workflows/build-app-release.yml @@ -50,12 +50,8 @@ jobs: - name: Update EAS config with env variables run: node scripts/build/eas.js --env production - - name: Update Android Files - # TODO: This should be handled by build configs in the future - run: node scripts/build/android/production.js - - name: Build for Android - run: eas build --profile production-android --platform android --non-interactive --auto-submit --no-wait + run: eas build --profile production --platform android --non-interactive --auto-submit --no-wait build-ios: runs-on: ubuntu-latest @@ -98,7 +94,7 @@ jobs: run: node scripts/build/ios/production.js - name: Build for iOS - run: eas build --profile production-ios --platform ios --non-interactive --auto-submit --no-wait + run: eas build --profile production --platform ios --non-interactive --auto-submit --no-wait increment-build-numbers: runs-on: ubuntu-latest diff --git a/.github/workflows/build-internal.yml b/.github/workflows/build-internal.yml index 73f1a8c19..27740f7d0 100644 --- a/.github/workflows/build-internal.yml +++ b/.github/workflows/build-internal.yml @@ -63,21 +63,12 @@ jobs: node scripts/build/eas.js --env preview fi - - name: Update Android Files - # TODO: This should be handled by build configs in the future - run: | - if [ "${{ github.event.inputs.environment || 'Production' }}" == "Production" ]; then - node scripts/build/android/production.js - else - node scripts/build/android/preview.js - fi - - name: Build for Android run: | if [ "${{ github.event.inputs.environment || 'Production' }}" == "Production" ]; then - eas build --profile production-android --platform android --non-interactive --auto-submit --no-wait + eas build --profile production --platform android --non-interactive --auto-submit --no-wait else - eas build --profile preview-android --platform android --non-interactive --auto-submit --no-wait + eas build --profile preview --platform android --non-interactive --auto-submit --no-wait fi build-ios: @@ -138,9 +129,9 @@ jobs: - name: Build for iOS run: | if [ "${{ github.event.inputs.environment || 'Production' }}" == "Production" ]; then - eas build --profile production-ios --platform ios --non-interactive --auto-submit --no-wait + eas build --profile production --platform ios --non-interactive --auto-submit --no-wait else - eas build --profile preview-ios --platform ios --non-interactive --auto-submit --no-wait + eas build --profile preview --platform ios --non-interactive --auto-submit --no-wait fi increment-build-numbers: diff --git a/android/app/build.gradle b/android/app/build.gradle index 4c0b78a6c..167feefc2 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -103,7 +103,7 @@ android { buildToolsVersion rootProject.ext.buildToolsVersion compileSdk rootProject.ext.compileSdkVersion - namespace 'com.converse.dev' + namespace 'com.converse' defaultConfig { applicationId 'com.converse.dev' minSdkVersion rootProject.ext.minSdkVersion @@ -124,6 +124,22 @@ android { } + flavorDimensions "env" + productFlavors { + dev { + dimension "env" + applicationId "com.converse.dev" + } + prod { + dimension "env" + applicationId "com.converse.prod" + } + preview { + dimension "env" + applicationId "com.converse.preview" + } + } + signingConfigs { debug { storeFile file('debug.keystore') diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 33c35ee79..216b322fb 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,12 +10,7 @@ - - + diff --git a/android/app/src/main/google-services.json b/android/app/src/main/google-services.json new file mode 100644 index 000000000..115bfb5d8 --- /dev/null +++ b/android/app/src/main/google-services.json @@ -0,0 +1,39 @@ +{ + "project_info": { + "project_number": "564961909146", + "project_id": "converse-unshut-labs", + "storage_bucket": "converse-unshut-labs.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:564961909146:android:93ca1fb8d079f640bd0223", + "android_client_info": { + "package_name": "com.converse.dev" + } + }, + "oauth_client": [ + { + "client_id": "564961909146-n61c2ccs7s26k7i5gmv2e1cv3r52t4i5.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBLyJ66tj4-ej4Cq2BHa-EJhHNTNWp8bFE" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "564961909146-n61c2ccs7s26k7i5gmv2e1cv3r52t4i5.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/app/src/main/java/com/converse/dev/AsyncStorage.kt b/android/app/src/main/java/com/converse/AsyncStorage.kt similarity index 94% rename from android/app/src/main/java/com/converse/dev/AsyncStorage.kt rename to android/app/src/main/java/com/converse/AsyncStorage.kt index efa714c63..24cd02948 100644 --- a/android/app/src/main/java/com/converse/dev/AsyncStorage.kt +++ b/android/app/src/main/java/com/converse/AsyncStorage.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import android.util.Log import com.facebook.react.bridge.Arguments @@ -7,7 +7,7 @@ import kotlinx.coroutines.runBlocking import kotlinx.coroutines.suspendCancellableCoroutine import java.util.ArrayList import kotlin.coroutines.resume -import com.converse.dev.PushNotificationsService.Companion as PushNotificationsService +import com.converse.PushNotificationsService.Companion as PushNotificationsService fun getAsyncStorage(key: String): String? { val storageArguments = Arguments.createArray() diff --git a/android/app/src/main/java/com/converse/dev/BackendApi.kt b/android/app/src/main/java/com/converse/BackendApi.kt similarity index 99% rename from android/app/src/main/java/com/converse/dev/BackendApi.kt rename to android/app/src/main/java/com/converse/BackendApi.kt index 60a4fbfe2..32166df8c 100644 --- a/android/app/src/main/java/com/converse/dev/BackendApi.kt +++ b/android/app/src/main/java/com/converse/BackendApi.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import com.android.volley.toolbox.JsonObjectRequest import kotlinx.coroutines.suspendCancellableCoroutine diff --git a/android/app/src/main/java/com/converse/dev/Datatypes.kt b/android/app/src/main/java/com/converse/Datatypes.kt similarity index 98% rename from android/app/src/main/java/com/converse/dev/Datatypes.kt rename to android/app/src/main/java/com/converse/Datatypes.kt index 159fbdf97..95410c6ae 100644 --- a/android/app/src/main/java/com/converse/dev/Datatypes.kt +++ b/android/app/src/main/java/com/converse/Datatypes.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import kotlin.math.roundToInt diff --git a/android/app/src/main/java/com/converse/dev/Keychain.kt b/android/app/src/main/java/com/converse/Keychain.kt similarity index 97% rename from android/app/src/main/java/com/converse/dev/Keychain.kt rename to android/app/src/main/java/com/converse/Keychain.kt index 69c5c11ed..0538f6ada 100644 --- a/android/app/src/main/java/com/converse/dev/Keychain.kt +++ b/android/app/src/main/java/com/converse/Keychain.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import expo.modules.securestore.SecureStoreModule diff --git a/android/app/src/main/java/com/converse/dev/MainActivity.kt b/android/app/src/main/java/com/converse/MainActivity.kt similarity index 98% rename from android/app/src/main/java/com/converse/dev/MainActivity.kt rename to android/app/src/main/java/com/converse/MainActivity.kt index 55e0fb9c7..0a6dfbc50 100644 --- a/android/app/src/main/java/com/converse/dev/MainActivity.kt +++ b/android/app/src/main/java/com/converse/MainActivity.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import android.os.Build import android.os.Bundle diff --git a/android/app/src/main/java/com/converse/dev/MainApplication.kt b/android/app/src/main/java/com/converse/MainApplication.kt similarity index 98% rename from android/app/src/main/java/com/converse/dev/MainApplication.kt rename to android/app/src/main/java/com/converse/MainApplication.kt index 2282724ef..03393a496 100644 --- a/android/app/src/main/java/com/converse/dev/MainApplication.kt +++ b/android/app/src/main/java/com/converse/MainApplication.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import android.app.Application import android.content.res.Configuration diff --git a/android/app/src/main/java/com/converse/dev/MessageNotification.kt b/android/app/src/main/java/com/converse/MessageNotification.kt similarity index 98% rename from android/app/src/main/java/com/converse/dev/MessageNotification.kt rename to android/app/src/main/java/com/converse/MessageNotification.kt index ed8921f56..82e1486c5 100644 --- a/android/app/src/main/java/com/converse/dev/MessageNotification.kt +++ b/android/app/src/main/java/com/converse/MessageNotification.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import android.content.ComponentName import android.content.Context @@ -14,7 +14,7 @@ import androidx.core.content.pm.ShortcutManagerCompat import androidx.core.graphics.drawable.IconCompat import com.bumptech.glide.Glide import com.bumptech.glide.load.engine.DiskCacheStrategy -import com.converse.dev.xmtp.NotificationDataResult +import com.converse.xmtp.NotificationDataResult import expo.modules.notifications.notifications.model.Notification import expo.modules.notifications.notifications.model.NotificationAction import expo.modules.notifications.notifications.model.NotificationResponse diff --git a/android/app/src/main/java/com/converse/dev/Mmkv.kt b/android/app/src/main/java/com/converse/Mmkv.kt similarity index 99% rename from android/app/src/main/java/com/converse/dev/Mmkv.kt rename to android/app/src/main/java/com/converse/Mmkv.kt index dbf8b7fef..35ab22e0b 100644 --- a/android/app/src/main/java/com/converse/dev/Mmkv.kt +++ b/android/app/src/main/java/com/converse/Mmkv.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import android.content.Context import android.util.Log import com.beust.klaxon.Klaxon diff --git a/android/app/src/main/java/com/converse/dev/NotificationParser.kt b/android/app/src/main/java/com/converse/NotificationParser.kt similarity index 98% rename from android/app/src/main/java/com/converse/dev/NotificationParser.kt rename to android/app/src/main/java/com/converse/NotificationParser.kt index ea41ee3f6..d87227a6a 100644 --- a/android/app/src/main/java/com/converse/dev/NotificationParser.kt +++ b/android/app/src/main/java/com/converse/NotificationParser.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import com.beust.klaxon.Converter import com.beust.klaxon.JsonValue diff --git a/android/app/src/main/java/com/converse/dev/NotificationUtils.kt b/android/app/src/main/java/com/converse/NotificationUtils.kt similarity index 98% rename from android/app/src/main/java/com/converse/dev/NotificationUtils.kt rename to android/app/src/main/java/com/converse/NotificationUtils.kt index 35d028018..984bad81a 100644 --- a/android/app/src/main/java/com/converse/dev/NotificationUtils.kt +++ b/android/app/src/main/java/com/converse/NotificationUtils.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import android.util.Log import android.content.Context diff --git a/android/app/src/main/java/com/converse/dev/Profile.kt b/android/app/src/main/java/com/converse/Profile.kt similarity index 99% rename from android/app/src/main/java/com/converse/dev/Profile.kt rename to android/app/src/main/java/com/converse/Profile.kt index 4700776d6..4a6f4c15d 100644 --- a/android/app/src/main/java/com/converse/dev/Profile.kt +++ b/android/app/src/main/java/com/converse/Profile.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import android.content.Context import android.util.Log diff --git a/android/app/src/main/java/com/converse/dev/PushNotificationsService.kt b/android/app/src/main/java/com/converse/PushNotificationsService.kt similarity index 96% rename from android/app/src/main/java/com/converse/dev/PushNotificationsService.kt rename to android/app/src/main/java/com/converse/PushNotificationsService.kt index 13102d3e5..7c12e27da 100644 --- a/android/app/src/main/java/com/converse/dev/PushNotificationsService.kt +++ b/android/app/src/main/java/com/converse/PushNotificationsService.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import android.Manifest import android.content.pm.PackageManager @@ -7,16 +7,18 @@ import androidx.core.app.ActivityCompat import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import com.beust.klaxon.Klaxon -import com.converse.dev.xmtp.NotificationDataResult -import com.converse.dev.xmtp.getGroup -import com.converse.dev.xmtp.getNewConversationFromEnvelope -import com.converse.dev.xmtp.getNewGroup -import com.converse.dev.xmtp.getXmtpClient -import com.converse.dev.xmtp.handleGroupMessage -import com.converse.dev.xmtp.handleGroupWelcome -import com.converse.dev.xmtp.handleNewConversationFirstMessage -import com.converse.dev.xmtp.handleOngoingConversationMessage -import com.converse.dev.xmtp.initCodecs +import com.bumptech.glide.Glide +import com.bumptech.glide.load.engine.DiskCacheStrategy +import com.converse.xmtp.NotificationDataResult +import com.converse.xmtp.getGroup +import com.converse.xmtp.getNewConversationFromEnvelope +import com.converse.xmtp.getNewGroup +import com.converse.xmtp.getXmtpClient +import com.converse.xmtp.handleGroupMessage +import com.converse.xmtp.handleGroupWelcome +import com.converse.xmtp.handleNewConversationFirstMessage +import com.converse.xmtp.handleOngoingConversationMessage +import com.converse.xmtp.initCodecs import com.facebook.react.bridge.ReactApplicationContext import com.google.crypto.tink.subtle.Base64 import com.google.firebase.messaging.FirebaseMessagingService diff --git a/android/app/src/main/java/com/converse/dev/Sentry.kt b/android/app/src/main/java/com/converse/Sentry.kt similarity index 97% rename from android/app/src/main/java/com/converse/dev/Sentry.kt rename to android/app/src/main/java/com/converse/Sentry.kt index 317696445..db67c26d7 100644 --- a/android/app/src/main/java/com/converse/dev/Sentry.kt +++ b/android/app/src/main/java/com/converse/Sentry.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import android.content.Context import android.util.Log diff --git a/android/app/src/main/java/com/converse/dev/Spam.kt b/android/app/src/main/java/com/converse/Spam.kt similarity index 97% rename from android/app/src/main/java/com/converse/dev/Spam.kt rename to android/app/src/main/java/com/converse/Spam.kt index 160721a64..b194243fa 100644 --- a/android/app/src/main/java/com/converse/dev/Spam.kt +++ b/android/app/src/main/java/com/converse/Spam.kt @@ -3,10 +3,10 @@ import android.util.Log import com.android.volley.Request import com.android.volley.toolbox.JsonObjectRequest import com.android.volley.toolbox.Volley -import com.converse.dev.containsURL -import com.converse.dev.getAsyncStorage -import com.converse.dev.getMmkv -import com.converse.dev.xmtp.getContentTypeString +import com.converse.containsURL +import com.converse.getAsyncStorage +import com.converse.getMmkv +import com.converse.xmtp.getContentTypeString import kotlinx.coroutines.runBlocking import kotlinx.coroutines.suspendCancellableCoroutine import org.json.JSONObject diff --git a/android/app/src/main/java/com/converse/dev/Sqlite.kt b/android/app/src/main/java/com/converse/Sqlite.kt similarity index 98% rename from android/app/src/main/java/com/converse/dev/Sqlite.kt rename to android/app/src/main/java/com/converse/Sqlite.kt index 085ff3a77..eb4401967 100644 --- a/android/app/src/main/java/com/converse/dev/Sqlite.kt +++ b/android/app/src/main/java/com/converse/Sqlite.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import android.database.sqlite.SQLiteDatabase import android.content.Context diff --git a/android/app/src/main/java/com/converse/dev/Utils.kt b/android/app/src/main/java/com/converse/Utils.kt similarity index 98% rename from android/app/src/main/java/com/converse/dev/Utils.kt rename to android/app/src/main/java/com/converse/Utils.kt index 39392d10d..ae949b5ff 100644 --- a/android/app/src/main/java/com/converse/dev/Utils.kt +++ b/android/app/src/main/java/com/converse/Utils.kt @@ -1,4 +1,4 @@ -package com.converse.dev +package com.converse import com.google.crypto.tink.subtle.Base64 import com.google.protobuf.ByteString diff --git a/android/app/src/main/java/com/converse/dev/xmtp/Client.kt b/android/app/src/main/java/com/converse/xmtp/Client.kt similarity index 97% rename from android/app/src/main/java/com/converse/dev/xmtp/Client.kt rename to android/app/src/main/java/com/converse/xmtp/Client.kt index d63fed765..36b8de51f 100644 --- a/android/app/src/main/java/com/converse/dev/xmtp/Client.kt +++ b/android/app/src/main/java/com/converse/xmtp/Client.kt @@ -1,8 +1,8 @@ -package com.converse.dev.xmtp +package com.converse.xmtp import android.content.Context import android.util.Log -import com.converse.dev.* +import com.converse.* import org.xmtp.android.library.* import com.google.crypto.tink.subtle.Base64 import org.xmtp.android.library.Client diff --git a/android/app/src/main/java/com/converse/dev/xmtp/Conversations.kt b/android/app/src/main/java/com/converse/xmtp/Conversations.kt similarity index 99% rename from android/app/src/main/java/com/converse/dev/xmtp/Conversations.kt rename to android/app/src/main/java/com/converse/xmtp/Conversations.kt index 280d20a51..e2794d202 100644 --- a/android/app/src/main/java/com/converse/dev/xmtp/Conversations.kt +++ b/android/app/src/main/java/com/converse/xmtp/Conversations.kt @@ -1,4 +1,4 @@ -package com.converse.dev.xmtp +package com.converse.xmtp import android.content.Context import android.util.Log @@ -7,7 +7,7 @@ import com.android.volley.Request import com.android.volley.toolbox.JsonObjectRequest import com.android.volley.toolbox.Volley import com.beust.klaxon.Klaxon -import com.converse.dev.* +import com.converse.* import com.google.crypto.tink.subtle.Base64 import org.json.JSONObject diff --git a/android/app/src/main/java/com/converse/dev/xmtp/Messages.kt b/android/app/src/main/java/com/converse/xmtp/Messages.kt similarity index 99% rename from android/app/src/main/java/com/converse/dev/xmtp/Messages.kt rename to android/app/src/main/java/com/converse/xmtp/Messages.kt index 827156172..701a43c19 100644 --- a/android/app/src/main/java/com/converse/dev/xmtp/Messages.kt +++ b/android/app/src/main/java/com/converse/xmtp/Messages.kt @@ -1,4 +1,4 @@ -package com.converse.dev.xmtp +package com.converse.xmtp import android.content.Context import android.util.Log @@ -7,8 +7,8 @@ import com.android.volley.toolbox.JsonObjectRequest import com.android.volley.toolbox.Volley import com.beust.klaxon.Klaxon -import com.converse.dev.* -import com.converse.dev.PushNotificationsService.Companion.TAG +import com.converse.* +import com.converse.PushNotificationsService.Companion.TAG import android.util.Base64 import android.util.Base64.NO_WRAP import androidx.core.app.Person diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 2918adad9..dc907a7cb 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -3,5 +3,5 @@ contain false automatic - exposdk:49.0.0 + 2.0.6 \ No newline at end of file diff --git a/android/app/src/preview/AndroidManifest.xml b/android/app/src/preview/AndroidManifest.xml new file mode 100644 index 000000000..5ef15e678 --- /dev/null +++ b/android/app/src/preview/AndroidManifest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/preview/google-services.json b/android/app/src/preview/google-services.json new file mode 100644 index 000000000..e962a6a4b --- /dev/null +++ b/android/app/src/preview/google-services.json @@ -0,0 +1,39 @@ +{ + "project_info": { + "project_number": "564961909146", + "project_id": "converse-unshut-labs", + "storage_bucket": "converse-unshut-labs.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:564961909146:android:2faf5c4a2bbcd133bd0223", + "android_client_info": { + "package_name": "com.converse.preview" + } + }, + "oauth_client": [ + { + "client_id": "564961909146-n61c2ccs7s26k7i5gmv2e1cv3r52t4i5.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBLyJ66tj4-ej4Cq2BHa-EJhHNTNWp8bFE" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "564961909146-n61c2ccs7s26k7i5gmv2e1cv3r52t4i5.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} diff --git a/android/app/src/preview/res/values/strings.xml b/android/app/src/preview/res/values/strings.xml new file mode 100644 index 000000000..2e88d1848 --- /dev/null +++ b/android/app/src/preview/res/values/strings.xml @@ -0,0 +1,3 @@ + + Converse PREVIEW + diff --git a/android/app/src/prod/AndroidManifest.xml b/android/app/src/prod/AndroidManifest.xml new file mode 100644 index 000000000..f0ee2c224 --- /dev/null +++ b/android/app/src/prod/AndroidManifest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/prod/google-services.json b/android/app/src/prod/google-services.json new file mode 100644 index 000000000..796bcfe6e --- /dev/null +++ b/android/app/src/prod/google-services.json @@ -0,0 +1,39 @@ +{ + "project_info": { + "project_number": "564961909146", + "project_id": "converse-unshut-labs", + "storage_bucket": "converse-unshut-labs.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:564961909146:android:7490961d2153aca8bd0223", + "android_client_info": { + "package_name": "com.converse.prod" + } + }, + "oauth_client": [ + { + "client_id": "564961909146-n61c2ccs7s26k7i5gmv2e1cv3r52t4i5.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBLyJ66tj4-ej4Cq2BHa-EJhHNTNWp8bFE" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "564961909146-n61c2ccs7s26k7i5gmv2e1cv3r52t4i5.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} diff --git a/android/app/src/prod/res/values/strings.xml b/android/app/src/prod/res/values/strings.xml new file mode 100644 index 000000000..9565a7d78 --- /dev/null +++ b/android/app/src/prod/res/values/strings.xml @@ -0,0 +1,3 @@ + + Converse + diff --git a/eas.json b/eas.json index 86a58d1e7..b90a3b49c 100644 --- a/eas.json +++ b/eas.json @@ -11,68 +11,21 @@ "env": { "EXPO_ENV": "dev" }, - "node": "20.15.1" - }, - "ios-simulator": { - "developmentClient": true, - "distribution": "internal", - "channel": "development", - "env": { - "EXPO_ENV": "dev" - }, - "ios": { - "simulator": true, - "cocoapods": "1.14.3" - }, - "node": "20.15.1" - }, - "preview-ios": { - "autoIncrement": true, - "channel": "preview", - "env": { - "EXPO_ENV": "preview", - "EXPO_PLATFORM": "ios" - }, - "node": "20.15.1", - "ios": { - "cocoapods": "1.14.3" - } - }, - "preview-ios-internal": { - "distribution": "internal", - "autoIncrement": true, - "channel": "preview", - "env": { - "EXPO_ENV": "preview", - "EXPO_PLATFORM": "ios" - }, - "node": "20.15.1", - "ios": { - "cocoapods": "1.14.3" - } - }, - "preview-android": { - "distribution": "internal", - "autoIncrement": true, - "channel": "preview", - "env": { - "EXPO_ENV": "preview", - "EXPO_PLATFORM": "android" - }, "node": "20.15.1", "ios": { "cocoapods": "1.14.3" }, "android": { - "buildType": "app-bundle" + "gradleCommand": ":app:assembleDevDebug", + "resourceClass": "medium" } }, - "production-ios-internal": { - "distribution": "internal", + "production": { "channel": "production", - "autoIncrement": true, - "env": { - "EXPO_PLATFORM": "ios" + "android": { + "buildType": "app-bundle", + "gradleCommand": ":app:bundleProdRelease", + "resourceClass": "large" }, "node": "20.15.1", "ios": { @@ -80,43 +33,37 @@ "cocoapods": "1.14.3" } }, - "production-ios": { - "channel": "production", - "autoIncrement": true, + "preview": { + "extends": "production", + "channel": "preview", + "android": { + "gradleCommand": ":app:bundlePreviewRelease" + }, "env": { - "EXPO_PLATFORM": "ios" + "EXPO_ENV": "preview" }, - "node": "20.15.1", "ios": { - "resourceClass": "large", - "cocoapods": "1.14.3" + "resourceClass": "medium" } }, - "production-android": { - "channel": "production", - "autoIncrement": true, + "ios-simulator": { + "extends": "development", + "developmentClient": true, + "distribution": "internal", "env": { - "EXPO_PLATFORM": "android" + "EXPO_ENV": "dev" }, - "node": "20.15.1", "ios": { - "cocoapods": "1.14.3" - }, - "android": { - "resourceClass": "large" + "simulator": true } }, - "production-android-internal": { - "distribution": "internal", - "channel": "production", - "autoIncrement": true, - "node": "20.15.1", - "ios": { - "cocoapods": "1.14.3" - }, - "android": { - "resourceClass": "large" - } + "preview-internal": { + "extends": "preview", + "distribution": "internal" + }, + "production-internal": { + "extends": "production", + "distribution": "internal" } }, "submit": { diff --git a/package.json b/package.json index 5e9ca5b6b..4b9a7a134 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "converse", "version": "1.0.0", "scripts": { - "android": "EXPO_ENV=dev expo start --android", + "android": "EXPO_ENV=dev expo run:android --variant devDebug", + "android:build:dev": "eas build -p android --profile development --local", "android:reverse": "adb reverse tcp:8081 tcp:8081 && adb reverse tcp:9875 tcp:9875", "build": "node scripts/build/build.js", "commit": "git show --format=\"%h\" --no-patch", diff --git a/scripts/build/android/preview.js b/scripts/build/android/preview.js deleted file mode 100644 index dc6ee889b..000000000 --- a/scripts/build/android/preview.js +++ /dev/null @@ -1,60 +0,0 @@ -const { execSync } = require("child_process"); -const fs = require("fs"); - -const { findFilesRecursively } = require("./utils"); - -const replaceAppName = (path) => { - const content = fs.readFileSync(path, "utf-8"); - const newContent = content.replace( - /com\.converse\.dev/g, - "com.converse.preview" - ); - fs.writeFileSync(path, newContent); -}; - -const go = async () => { - const APP_GRADLE_PATH = "android/app/build.gradle"; - const APP_MANIFEST_PATH = "android/app/src/main/AndroidManifest.xml"; - const STRINGS_PATH = "android/app/src/main/res/values/strings.xml"; - const GOOGLE_SERVICES_PATH = "android/app/google-services.json"; - - const APP_FILES_PATH = "android/app/src/main/java/com/converse/dev"; - - replaceAppName(APP_GRADLE_PATH); - - findFilesRecursively(APP_FILES_PATH).map((f) => replaceAppName(f)); - - const appManifest = fs.readFileSync(APP_MANIFEST_PATH, "utf-8"); - const newAppManifest = appManifest - .replace(/com\.converse\.dev/g, "com.converse.preview") - .replace(/converse-dev/g, "converse-preview") - .replace(/dev\.getconverse\.app/g, "preview.getconverse.app") - .replace(/dev\.converse\.xyz/g, "preview.converse.xyz"); - fs.writeFileSync(APP_MANIFEST_PATH, newAppManifest); - - const googleServices = fs.readFileSync(GOOGLE_SERVICES_PATH, "utf-8"); - const newGoogleServices = JSON.parse(googleServices); - newGoogleServices.client[0].client_info.mobilesdk_app_id = - "1:564961909146:android:2faf5c4a2bbcd133bd0223"; - newGoogleServices.client[0].client_info.android_client_info.package_name = - "com.converse.preview"; - - fs.writeFileSync( - GOOGLE_SERVICES_PATH, - JSON.stringify(newGoogleServices, null, 2) - ); - - const strings = fs.readFileSync(STRINGS_PATH, "utf-8"); - const newStrings = strings.replace( - 'Converse DEV', - 'Converse PREVIEW' - ); - fs.writeFileSync(STRINGS_PATH, newStrings); - - const CODE_PATH = "android/app/src/main/java/com/converse/dev"; - const NEW_CODE_PATH = "android/app/src/main/java/com/converse/preview"; - - execSync(`git mv ${CODE_PATH} ${NEW_CODE_PATH}`); -}; - -go(); diff --git a/scripts/build/android/production.js b/scripts/build/android/production.js deleted file mode 100644 index e022b3767..000000000 --- a/scripts/build/android/production.js +++ /dev/null @@ -1,61 +0,0 @@ -const { execSync } = require("child_process"); -const fs = require("fs"); - -const { findFilesRecursively } = require("./utils"); - -const replaceAppName = (path) => { - const content = fs.readFileSync(path, "utf-8"); - const newContent = content.replace( - /com\.converse\.dev/g, - "com.converse.prod" - ); - fs.writeFileSync(path, newContent); -}; - -const go = async () => { - const APP_GRADLE_PATH = "android/app/build.gradle"; - const APP_MANIFEST_PATH = "android/app/src/main/AndroidManifest.xml"; - const STRINGS_PATH = "android/app/src/main/res/values/strings.xml"; - const GOOGLE_SERVICES_PATH = "android/app/google-services.json"; - - const APP_FILES_PATH = "android/app/src/main/java/com/converse/dev"; - - replaceAppName(APP_GRADLE_PATH); - - findFilesRecursively(APP_FILES_PATH).map((f) => replaceAppName(f)); - - const appManifest = fs.readFileSync(APP_MANIFEST_PATH, "utf-8"); - const newAppManifest = appManifest - .replace(/com\.converse\.dev/g, "com.converse.prod") - .replace(/converse-dev/g, "converse") - .replace(/ic_launcher_preview/g, "ic_launcher") - .replace(/dev\.getconverse\.app/g, "getconverse.app") - .replace(/dev\.converse\.xyz/g, "converse.xyz"); - fs.writeFileSync(APP_MANIFEST_PATH, newAppManifest); - - const googleServices = fs.readFileSync(GOOGLE_SERVICES_PATH, "utf-8"); - const newGoogleServices = JSON.parse(googleServices); - newGoogleServices.client[0].client_info.mobilesdk_app_id = - "1:564961909146:android:7490961d2153aca8bd0223"; - newGoogleServices.client[0].client_info.android_client_info.package_name = - "com.converse.prod"; - - fs.writeFileSync( - GOOGLE_SERVICES_PATH, - JSON.stringify(newGoogleServices, null, 2) - ); - - const strings = fs.readFileSync(STRINGS_PATH, "utf-8"); - const newStrings = strings.replace( - 'Converse DEV', - 'Converse' - ); - fs.writeFileSync(STRINGS_PATH, newStrings); - - const CODE_PATH = "android/app/src/main/java/com/converse/dev"; - const NEW_CODE_PATH = "android/app/src/main/java/com/converse/prod"; - - execSync(`git mv ${CODE_PATH} ${NEW_CODE_PATH}`); -}; - -go(); diff --git a/scripts/build/android/utils.js b/scripts/build/android/utils.js deleted file mode 100644 index 01f72cd97..000000000 --- a/scripts/build/android/utils.js +++ /dev/null @@ -1,34 +0,0 @@ -const fs = require("fs"); -const path = require("path"); - -const findFilesRecursively = ( - folderPath, - fileExtensions = [".kt", ".java"] -) => { - const files = []; - - function scanDirectory(directory) { - fs.readdirSync(directory).forEach((file) => { - const filePath = path.join(directory, file); - const stats = fs.statSync(filePath); - - if (stats.isDirectory()) { - scanDirectory(filePath); - } else if (stats.isFile()) { - const fileExtension = path.extname(filePath); - - if (fileExtensions.includes(fileExtension)) { - files.push(filePath); - } - } - }); - } - - scanDirectory(folderPath); - - return files; -}; - -module.exports = { - findFilesRecursively, -}; diff --git a/scripts/build/build.js b/scripts/build/build.js index 497602d26..3bd21f7e8 100644 --- a/scripts/build/build.js +++ b/scripts/build/build.js @@ -1,5 +1,4 @@ const { spawn, execSync } = require("child_process"); -const fs = require("fs"); const isClean = require("git-is-clean"); const path = require("path"); const prompts = require("prompts"); @@ -78,7 +77,7 @@ const build = async () => { const buildCommand = "eas"; const buildProfile = env === "production" || env === "preview" - ? `${env}-${platform}${buildInternalProduction ? "-internal" : ""}` + ? `${env}${buildInternalProduction ? "-internal" : ""}` : env; const buildArgs = [ "build", diff --git a/scripts/build/update.js b/scripts/build/update.js index 3dc2c8e29..a7e97b71d 100644 --- a/scripts/build/update.js +++ b/scripts/build/update.js @@ -26,7 +26,6 @@ const update = async () => { try { await executeCommand("node", ["scripts/build/eas.js", "--env", env]); await executeCommand("node", [`scripts/build/ios/${env}.js`]); - await executeCommand("node", [`scripts/build/android/${env}.js`]); const updateEnv = { ...process.env }; if (env === "preview") { updateEnv.EXPO_ENV = "preview"; From 1dca34e849219170e4c3c18b1c90a3f6665b9808 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:40:41 +0200 Subject: [PATCH 002/155] [create-pull-request] automated change (#1024) Co-authored-by: alexrisch --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 3d6e6f16b..37b152f90 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,6 @@ { "expo": { - "version": "2.0.7", + "version": "2.0.8", "ios": { "buildNumber": "15" }, From e04f85358535fd61458e260a9640f05e95b2bc7e Mon Sep 17 00:00:00 2001 From: Thierry Skoda <6875849+thierryskoda@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:46:45 -0400 Subject: [PATCH 003/155] feat: more design system stuff (#1006) * wip * more color fix * fix hstack file name * fix hstack file name * fix hstack file name * fix types + fix button + add more theme stuff * fix button * more fixes * fix snapshots * wip * bottom sheet wip * fix button component and refactor bottom sheet into multiple files * more bottom sheet fixes * clean up * fix --- .prettierrc | 4 +- App.tsx | 6 +- components/Button/Button.ios.tsx | 156 ------------- components/Button/Button.tsx | 104 +-------- .../ChatPlaceholder/GroupChatPlaceholder.tsx | 2 +- .../NewConversationButton.tsx | 19 +- .../ProfileSettingsButton.tsx | 2 +- .../RequestsSegmentedController.tsx | 11 +- components/ExternalWalletPicker.tsx | 4 +- components/Onboarding/OnboardingComponent.tsx | 3 +- components/Onboarding/PrivyConnect.tsx | 2 +- components/Picto/Picto.ios.tsx | 4 +- components/Search/NavigationChatButton.tsx | 4 +- components/__tests__/Button.test.tsx | 10 +- .../__snapshots__/Button.test.tsx.snap | 219 +++++++++++------- design-system/BlurView.tsx | 42 ++++ .../BottomSheet/BottomSheet.utils.tsx | 13 ++ .../BottomSheetBackdropOpacity.tsx | 18 ++ .../BottomSheetContentContainer.tsx | 9 + .../BottomSheet/BottomSheetHandleBar.tsx | 34 +++ .../BottomSheet/BottomSheetHeader.tsx | 44 ++++ .../BottomSheet/BottomSheetModal.tsx | 50 ++++ .../BottomSheetModalBlurBackdrop.tsx | 56 +++++ .../BottomSheet/IBottomSheet.types.tsx | 5 + design-system/Button/Button.props.ts | 105 +++++++++ design-system/Button/Button.styles.ts | 138 +++++++++++ design-system/Button/Button.tsx | 142 ++++++++++++ design-system/Button/OldButton.tsx | 139 +++++++++++ design-system/Center.tsx | 24 ++ design-system/{Hstack.tsx => HStack.tsx} | 0 design-system/Icon/Icon.tsx | 3 + design-system/IconButton.tsx | 153 ++++++++++++ design-system/IconButton/IconButton.props.ts | 62 +++++ design-system/IconButton/IconButton.styles.ts | 146 ++++++++++++ design-system/IconButton/IconButton.tsx | 85 +++++++ design-system/Text/Text.presets.ts | 26 +-- design-system/Text/Text.styles.ts | 16 +- design-system/Text/Text.tsx | 20 +- design-system/Title.tsx | 13 -- design-system/TouchableOpacity.tsx | 10 +- hooks/usePressInOut.tsx | 37 +++ package.json | 1 + screens/GroupInvite.tsx | 4 +- screens/GroupLink.tsx | 2 +- .../Navigation/ConversationListNav.ios.tsx | 2 +- screens/Navigation/Navigation.tsx | 129 ++++++----- screens/NewConversation/NewConversation.tsx | 8 +- screens/NotificationsScreen.tsx | 2 +- screens/ShareProfile.tsx | 187 ++++++++------- screens/TopUp.tsx | 7 +- styles/colors/helpers.android.ts | 13 +- styles/colors/index.ts | 57 +++++ styles/sizes/index.ts | 23 +- theme/animations.ts | 5 +- theme/avatar.ts | 9 + theme/border-radius.ts | 9 +- theme/colors.ts | 54 ----- theme/colorsDark.ts | 163 ++++++------- theme/colorsLight.ts | 71 ++++++ theme/icon.ts | 7 + theme/index.ts | 2 +- theme/palette.ts | 131 +++++++++++ theme/spacing.ts | 23 +- theme/styles.ts | 12 + theme/timing.ts | 19 +- theme/typography.ts | 56 +++-- theme/useAppTheme.ts | 18 +- tsconfig.json | 4 +- types/general.ts | 76 ++++++ utils/debug.ts | 7 + yarn.lock | 10 +- 71 files changed, 2255 insertions(+), 796 deletions(-) delete mode 100644 components/Button/Button.ios.tsx create mode 100644 design-system/BlurView.tsx create mode 100644 design-system/BottomSheet/BottomSheet.utils.tsx create mode 100644 design-system/BottomSheet/BottomSheetBackdropOpacity.tsx create mode 100644 design-system/BottomSheet/BottomSheetContentContainer.tsx create mode 100644 design-system/BottomSheet/BottomSheetHandleBar.tsx create mode 100644 design-system/BottomSheet/BottomSheetHeader.tsx create mode 100644 design-system/BottomSheet/BottomSheetModal.tsx create mode 100644 design-system/BottomSheet/BottomSheetModalBlurBackdrop.tsx create mode 100644 design-system/BottomSheet/IBottomSheet.types.tsx create mode 100644 design-system/Button/Button.props.ts create mode 100644 design-system/Button/Button.styles.ts create mode 100644 design-system/Button/Button.tsx create mode 100644 design-system/Button/OldButton.tsx create mode 100644 design-system/Center.tsx rename design-system/{Hstack.tsx => HStack.tsx} (100%) create mode 100644 design-system/Icon/Icon.tsx create mode 100644 design-system/IconButton.tsx create mode 100644 design-system/IconButton/IconButton.props.ts create mode 100644 design-system/IconButton/IconButton.styles.ts create mode 100644 design-system/IconButton/IconButton.tsx delete mode 100644 design-system/Title.tsx create mode 100644 hooks/usePressInOut.tsx create mode 100644 theme/avatar.ts delete mode 100644 theme/colors.ts create mode 100644 theme/colorsLight.ts create mode 100644 theme/icon.ts create mode 100644 theme/palette.ts create mode 100644 theme/styles.ts create mode 100644 types/general.ts diff --git a/.prettierrc b/.prettierrc index 1b016bffe..757fd64ca 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,3 +1,3 @@ { - "trailingComma": "es5" -} \ No newline at end of file + "trailingComma": "es5" +} diff --git a/App.tsx b/App.tsx index fd562eb5c..78c0b7e17 100644 --- a/App.tsx +++ b/App.tsx @@ -27,8 +27,8 @@ import { import { KeyboardProvider } from "react-native-keyboard-controller"; import { Provider as PaperProvider } from "react-native-paper"; import { ThirdwebProvider } from "thirdweb/react"; -import "./utils/splash/splash"; +import "./utils/splash/splash"; import XmtpEngine from "./components/XmtpEngine"; import config from "./config"; import { useAppStore } from "./data/store/appStore"; @@ -113,7 +113,7 @@ const AppKeyboardProvider = export default function AppWithProviders() { const colorScheme = useColorScheme(); - const theme = useMemo(() => { + const paperTheme = useMemo(() => { return colorScheme === "dark" ? MaterialDarkTheme : MaterialLightTheme; }, [colorScheme]); @@ -127,7 +127,7 @@ export default function AppWithProviders() { - + diff --git a/components/Button/Button.ios.tsx b/components/Button/Button.ios.tsx deleted file mode 100644 index 5285e8751..000000000 --- a/components/Button/Button.ios.tsx +++ /dev/null @@ -1,156 +0,0 @@ -import { - dangerColor, - inversePrimaryColor, - primaryColor, - tertiaryBackgroundColor, -} from "@styles/colors"; -import { PictoSizes } from "@styles/sizes"; -import React from "react"; -import { - GestureResponderEvent, - Platform, - StyleProp, - StyleSheet, - Text, - TextStyle, - TouchableOpacity, - useColorScheme, - ViewStyle, -} from "react-native"; - -import Picto from "../Picto/Picto"; - -type Props = { - title: string; - onPress?: (event: GestureResponderEvent) => void; - variant: "primary" | "secondary" | "secondary-danger" | "grey" | "text"; - style?: StyleProp; - textStyle?: StyleProp; - allowFontScaling?: boolean; - picto?: string; - numberOfLines?: number; - hitSlop?: number; -}; - -export default function Button({ - title, - onPress, - variant, - style, - textStyle, - picto, - allowFontScaling = true, - numberOfLines, - hitSlop, -}: Props) { - const colorScheme = useColorScheme(); - const styles = useStyles(); - const buttonStyle = - variant === "primary" - ? [styles.buttonPrimary] - : variant === "secondary" - ? [styles.buttonPrimary, styles.buttonSecondary] - : variant === "grey" - ? [styles.buttonGrey] - : variant === "secondary-danger" - ? [styles.buttonPrimary, styles.buttonSecondary, styles.buttonDanger] - : [styles.buttonText]; - const buttonTextStyle = - variant === "primary" - ? [styles.buttonPrimaryText] - : variant === "secondary" || variant === "secondary-danger" - ? [styles.buttonPrimaryText, styles.buttonSecondaryText] - : variant === "grey" - ? [styles.buttonGreyText] - : [styles.buttonTextText]; - return ( - - {picto && ( - - )} - - {title} - - - ); -} - -const useStyles = () => { - const colorScheme = useColorScheme(); - return StyleSheet.create({ - buttonPrimary: { - backgroundColor: primaryColor(colorScheme), - display: "flex", - alignSelf: "stretch", - marginHorizontal: 32, - textAlign: "center", - paddingVertical: 14, - borderRadius: 14, - flexDirection: "row", - justifyContent: "center", - }, - buttonPrimaryText: { - color: inversePrimaryColor(colorScheme), - textAlign: "center", - fontWeight: "600", - fontSize: 17, - }, - buttonSecondary: { - paddingRight: 15, - paddingLeft: 15, - borderRadius: 100, - paddingVertical: 7, - }, - buttonDanger: { - backgroundColor: dangerColor(colorScheme), - }, - buttonSecondaryText: { - fontWeight: "400", - }, - buttonGrey: { - backgroundColor: tertiaryBackgroundColor(colorScheme), - paddingHorizontal: 15, - paddingVertical: 4, - borderRadius: 100, - }, - buttonGreyText: { - color: colorScheme === "dark" ? "white" : primaryColor(colorScheme), - textAlign: "center", - fontWeight: "600", - fontSize: 17, - }, - buttonText: { - flexDirection: "row", - }, - buttonTextText: { - color: Platform.OS === "ios" ? primaryColor(colorScheme) : "blue", - textAlign: "center", - fontWeight: "400", - fontSize: 17, - }, - picto: { - marginRight: 15, - marginLeft: 10, - }, - }); -}; diff --git a/components/Button/Button.tsx b/components/Button/Button.tsx index b022f5e8a..ccf3c1fd4 100644 --- a/components/Button/Button.tsx +++ b/components/Button/Button.tsx @@ -1,99 +1,7 @@ -import React from "react"; -import { - GestureResponderEvent, - StyleProp, - StyleSheet, - Text, - TextStyle, - View, - ViewStyle, -} from "react-native"; -import { Button as MaterialButton } from "react-native-paper"; +import { Button } from "../../design-system/Button/Button"; -import Picto from "../Picto/Picto"; - -type Props = { - title: string; - onPress?: (event: GestureResponderEvent) => void; - variant: "primary" | "secondary" | "grey" | "text" | "secondary-danger"; - style?: StyleProp; - textStyle?: StyleProp; - allowFontScaling?: boolean; - picto?: string; -}; - -export default function Button({ - title, - onPress, - variant, - style, - textStyle, - picto, - allowFontScaling = true, -}: Props) { - return ( - - ( - - ) - : undefined - } - > - {title} - - - ); -} - -const styles = StyleSheet.create({ - buttonPrimaryContainer: { - paddingHorizontal: 32, - width: "100%", - }, - buttonSecondaryContainer: { - paddingHorizontal: 16, - width: "auto", - }, - buttonPrimary: { - width: "100%", - }, - picto: { - marginRight: 10, - }, - textContainer: { - flexGrow: 1, - }, -}); +/** + * @deprecated This component is deprecated. Please use the Button component from the design system directly. + * Import it from "../../design-system/Button/Button" instead. + */ +export default Button; diff --git a/components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx b/components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx index 69d72b052..f38da8186 100644 --- a/components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx +++ b/components/Chat/ChatPlaceholder/GroupChatPlaceholder.tsx @@ -93,7 +93,7 @@ export function GroupChatPlaceholder({ messagesCount }: Props) {