-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Device Settings, Intercom Integration and Improvements #902
Changes from all commits
134c194
1c48887
43db752
5f736aa
4331261
0470b90
288ef6f
c57ad3d
725849f
98bcaf8
70e9996
f53c3b8
4d7e0bc
def9628
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,13 @@ if (keystorePropertiesFile.exists()) { | |
|
||
android { | ||
|
||
buildFeatures { | ||
buildConfig = true | ||
} | ||
|
||
namespace "com.friend.ios" | ||
|
||
|
||
Comment on lines
+36
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The The + buildFeatures {
+ buildConfig = true
+ }
+
+ namespace "com.friend.ios" |
||
// ----- BEGIN flavorDimensions (autogenerated by flutter_flavorizr) ----- | ||
flavorDimensions += "flavor-type" | ||
|
||
|
@@ -76,6 +83,8 @@ android { | |
versionName flutterVersionName | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
multiDexEnabled true | ||
buildConfigField("String", "INTERCOM_APP_ID", "\"${System.getenv("intercom.app.id")}\"") | ||
buildConfigField("String", "INTERCOM_ANDROID_API_KEY", "\"${System.getenv("intercom.android.api.key")}\"") | ||
Comment on lines
+86
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're using environment variables to store sensitive data such as the Intercom App ID and API key. This is a good practice as it keeps these values out of the codebase, reducing the risk of accidental exposure. However, ensure that these environment variables are properly set in the build environment where this code will run. + buildConfigField("String", "INTERCOM_APP_ID", "\"${System.getenv("intercom.app.id")}\"")
+ buildConfigField("String", "INTERCOM_ANDROID_API_KEY", "\"${System.getenv("intercom.android.api.key")}\"") |
||
} | ||
|
||
signingConfigs { | ||
|
@@ -105,6 +114,7 @@ android { | |
shrinkResources true | ||
} | ||
debug{ | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You've added ProGuard rules file to the debug build type. While this is not an issue per se, it's unusual to use ProGuard in debug builds as it obfuscates the code, making debugging more difficult. If you have a specific reason for doing this, it's fine. Otherwise, consider removing it from the debug build type. + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
||
minifyEnabled true | ||
} | ||
} | ||
|
@@ -117,9 +127,10 @@ flutter { | |
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.10" | ||
androidTestImplementation 'androidx.test:runner:1.2.0' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | ||
implementation 'androidx.multidex:multidex:2.0.1' | ||
Comment on lines
129
to
132
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Kotlin dependency has been removed from the dependencies block. If Kotlin is no longer being used in the project, this is fine. However, if there are still parts of the project written in Kotlin, this will cause compilation errors. Please ensure that all Kotlin code has been properly migrated to Java or another language before removing this dependency. |
||
implementation 'com.squareup.okhttp3:okhttp:4.12.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3' | ||
implementation 'io.intercom.android:intercom-sdk:latest.release' | ||
Comment on lines
130
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You've added new dependencies and removed the Kotlin standard library dependency. The Intercom SDK has been added for chat support, which aligns with the PR description. However, the removal of the Kotlin standard library might cause issues if there are any Kotlin files in your project. If you're not using Kotlin at all, then it's fine to remove this dependency. - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.10"
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
+ implementation 'io.intercom.android:intercom-sdk:latest.release' |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
# This is generated automatically by the Android Gradle plugin. | ||
-dontwarn com.google.android.play.core.splitcompat.SplitCompatApplication | ||
-dontwarn com.google.android.play.core.splitinstall.SplitInstallException | ||
-dontwarn com.google.android.play.core.splitinstall.SplitInstallManager | ||
-dontwarn com.google.android.play.core.splitinstall.SplitInstallManagerFactory | ||
-dontwarn com.google.android.play.core.splitinstall.SplitInstallRequest$Builder | ||
-dontwarn com.google.android.play.core.splitinstall.SplitInstallRequest | ||
-dontwarn com.google.android.play.core.splitinstall.SplitInstallSessionState | ||
-dontwarn com.google.android.play.core.splitinstall.SplitInstallStateUpdatedListener | ||
-dontwarn com.google.android.play.core.tasks.OnFailureListener | ||
-dontwarn com.google.android.play.core.tasks.OnSuccessListener | ||
-dontwarn com.google.android.play.core.tasks.Task | ||
|
||
# XML parser stuff | ||
-dontwarn org.xmlpull.v1.** | ||
-dontwarn org.kxml2.io.** | ||
-dontwarn android.content.res.** | ||
-dontwarn org.slf4j.impl.StaticLoggerBinder | ||
|
||
|
||
-keep class org.xmlpull.** { *; } | ||
-keepclassmembers class org.xmlpull.** { *; } | ||
|
||
#Flutter Wrapper | ||
-keep class io.flutter.app.** { *; } | ||
-keep class io.flutter.plugin.** { *; } | ||
|
@@ -6,6 +29,10 @@ | |
-keep class io.flutter.** { *; } | ||
-keep class io.flutter.plugins.** { *; } | ||
|
||
# For Awesome Notification Plugin | ||
-keep class com.google.common.reflect.TypeToken | ||
-keep class * extends com.google.common.reflect.TypeToken | ||
|
||
Comment on lines
+32
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Proguard rules for the Awesome Notification Plugin are added, but it's not clear if this plugin is used in the project. If it's not used, these lines should be removed to avoid unnecessary rules. - # For Awesome Notification Plugin
- -keep class com.google.common.reflect.TypeToken
- -keep class * extends com.google.common.reflect.TypeToken If the plugin is indeed used, then this change is fine. |
||
# You might not be using firebase | ||
-keep class com.google.firebase.** { *; } | ||
-keep class com.builttoroam.devicecalendar.** { *; } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ | |
|
||
<!-- Add android:stopWithTask option only when necessary. --> | ||
<application | ||
android:name=".MyApp" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Please ensure that the - <application
+ <application
+ android:name=".MyApp"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true" |
||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:requestLegacyExternalStorage="true" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.friend.ios | ||
|
||
import android.app.Application | ||
import io.maido.intercom.IntercomFlutterPlugin | ||
|
||
class MyApp : Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
IntercomFlutterPlugin.initSdk(this, appId = BuildConfig.INTERCOM_APP_ID, androidApiKey = BuildConfig.INTERCOM_ANDROID_API_KEY) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Fri Jun 23 08:50:38 CEST 2017 | ||
#Sun Sep 22 21:12:01 IST 2024 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -445,7 +445,7 @@ | |
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerDebug-prod.entitlements"; | ||
DEVELOPMENT_TEAM = 9536L8KLMP; | ||
INFOPLIST_KEY_CFBundleDisplayName = Omi; | ||
IPHONEOS_DEPLOYMENT_TARGET = 14.0; | ||
IPHONEOS_DEPLOYMENT_TARGET = 15.0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The iOS deployment target has been updated from 14.0 to 15.0. This change will require all users to have at least iOS 15.0 installed on their devices to use the app. If there are still a significant number of users on iOS 14, this could potentially exclude them from being able to update or install the app. Please ensure that this change aligns with your user base and support strategy. - IPHONEOS_DEPLOYMENT_TARGET = 14.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 15.0; |
||
PRODUCT_BUNDLE_IDENTIFIER = "com.friend-app-with-wearable.ios12"; | ||
PRODUCT_NAME = Runner; | ||
TARGETED_DEVICE_FAMILY = 1; | ||
|
@@ -461,7 +461,7 @@ | |
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerProfile-prod.entitlements"; | ||
DEVELOPMENT_TEAM = 9536L8KLMP; | ||
INFOPLIST_KEY_CFBundleDisplayName = Omi; | ||
IPHONEOS_DEPLOYMENT_TARGET = 14.0; | ||
IPHONEOS_DEPLOYMENT_TARGET = 15.0; | ||
PRODUCT_BUNDLE_IDENTIFIER = "com.friend-app-with-wearable.ios12"; | ||
PRODUCT_NAME = Runner; | ||
TARGETED_DEVICE_FAMILY = 1; | ||
|
@@ -477,7 +477,7 @@ | |
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-prod.entitlements"; | ||
DEVELOPMENT_TEAM = 9536L8KLMP; | ||
INFOPLIST_KEY_CFBundleDisplayName = Omi; | ||
IPHONEOS_DEPLOYMENT_TARGET = 14.0; | ||
IPHONEOS_DEPLOYMENT_TARGET = 15.0; | ||
PRODUCT_BUNDLE_IDENTIFIER = "com.friend-app-with-wearable.ios12"; | ||
PRODUCT_NAME = Runner; | ||
TARGETED_DEVICE_FAMILY = 1; | ||
|
@@ -493,7 +493,7 @@ | |
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerDebug-dev.entitlements"; | ||
DEVELOPMENT_TEAM = 9536L8KLMP; | ||
INFOPLIST_KEY_CFBundleDisplayName = Omi; | ||
IPHONEOS_DEPLOYMENT_TARGET = 14.0; | ||
IPHONEOS_DEPLOYMENT_TARGET = 15.0; | ||
PRODUCT_BUNDLE_IDENTIFIER = "com.friend-app-with-wearable.ios12.development"; | ||
PRODUCT_NAME = Runner; | ||
TARGETED_DEVICE_FAMILY = 1; | ||
|
@@ -509,7 +509,7 @@ | |
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerProfile-dev.entitlements"; | ||
DEVELOPMENT_TEAM = 9536L8KLMP; | ||
INFOPLIST_KEY_CFBundleDisplayName = Omi; | ||
IPHONEOS_DEPLOYMENT_TARGET = 14.0; | ||
IPHONEOS_DEPLOYMENT_TARGET = 15.0; | ||
PRODUCT_BUNDLE_IDENTIFIER = "com.friend-app-with-wearable.ios12.development"; | ||
PRODUCT_NAME = Runner; | ||
TARGETED_DEVICE_FAMILY = 1; | ||
|
@@ -525,7 +525,7 @@ | |
CODE_SIGN_ENTITLEMENTS = "Runner/RunnerRelease-dev.entitlements"; | ||
DEVELOPMENT_TEAM = 9536L8KLMP; | ||
INFOPLIST_KEY_CFBundleDisplayName = Omi; | ||
IPHONEOS_DEPLOYMENT_TARGET = 14.0; | ||
IPHONEOS_DEPLOYMENT_TARGET = 15.0; | ||
PRODUCT_BUNDLE_IDENTIFIER = "com.friend-app-with-wearable.ios12.development"; | ||
PRODUCT_NAME = Runner; | ||
TARGETED_DEVICE_FAMILY = 1; | ||
|
@@ -604,7 +604,7 @@ | |
); | ||
INFOPLIST_FILE = Runner/Info.plist; | ||
INFOPLIST_KEY_CFBundleDisplayName = Omi; | ||
IPHONEOS_DEPLOYMENT_TARGET = 14.0; | ||
IPHONEOS_DEPLOYMENT_TARGET = 15.0; | ||
LD_RUNPATH_SEARCH_PATHS = ( | ||
"$(inherited)", | ||
"@executable_path/Frameworks", | ||
|
@@ -904,7 +904,7 @@ | |
); | ||
INFOPLIST_FILE = Runner/Info.plist; | ||
INFOPLIST_KEY_CFBundleDisplayName = Omi; | ||
IPHONEOS_DEPLOYMENT_TARGET = 14.0; | ||
IPHONEOS_DEPLOYMENT_TARGET = 15.0; | ||
LD_RUNPATH_SEARCH_PATHS = ( | ||
"$(inherited)", | ||
"@executable_path/Frameworks", | ||
|
@@ -949,7 +949,7 @@ | |
); | ||
INFOPLIST_FILE = Runner/Info.plist; | ||
INFOPLIST_KEY_CFBundleDisplayName = Omi; | ||
IPHONEOS_DEPLOYMENT_TARGET = 14.0; | ||
IPHONEOS_DEPLOYMENT_TARGET = 15.0; | ||
LD_RUNPATH_SEARCH_PATHS = ( | ||
"$(inherited)", | ||
"@executable_path/Frameworks", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ import 'package:friend_private/providers/message_provider.dart'; | |
import 'package:friend_private/providers/onboarding_provider.dart'; | ||
import 'package:friend_private/providers/plugin_provider.dart'; | ||
import 'package:friend_private/providers/speech_profile_provider.dart'; | ||
import 'package:friend_private/providers/websocket_provider.dart'; | ||
import 'package:friend_private/services/notification_service.dart'; | ||
import 'package:friend_private/services/services.dart'; | ||
import 'package:friend_private/utils/analytics/gleap.dart'; | ||
|
@@ -39,6 +38,7 @@ import 'package:friend_private/utils/features/calendar.dart'; | |
import 'package:friend_private/utils/logger.dart'; | ||
import 'package:gleap_sdk/gleap_sdk.dart'; | ||
import 'package:instabug_flutter/instabug_flutter.dart'; | ||
import 'package:intercom_flutter/intercom_flutter.dart'; | ||
import 'package:opus_dart/opus_dart.dart'; | ||
import 'package:opus_flutter/opus_flutter.dart' as opus_flutter; | ||
import 'package:provider/provider.dart'; | ||
|
@@ -58,6 +58,13 @@ Future<bool> _init() async { | |
await Firebase.initializeApp(options: dev.DefaultFirebaseOptions.currentPlatform, name: 'dev'); | ||
} | ||
|
||
if (Env.intercomAppId != null) { | ||
await Intercom.instance.initialize( | ||
Env.intercomAppId!, | ||
iosApiKey: Env.intercomIOSApiKey, | ||
androidApiKey: Env.intercomAndroidApiKey, | ||
); | ||
} | ||
Comment on lines
+61
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code initializes Intercom with the provided API keys. However, it's important to handle potential exceptions that might occur during initialization. For instance, if the API keys are incorrect or if there's a network issue, this could throw an error and crash the app. Consider wrapping this block in a try-catch statement to handle any exceptions gracefully. + try {
if (Env.intercomAppId != null) {
await Intercom.instance.initialize(
Env.intercomAppId!,
iosApiKey: Env.intercomIOSApiKey,
androidApiKey: Env.intercomAndroidApiKey,
);
}
+ } catch (e) {
+ // Log the exception or handle it appropriately
+ } |
||
await NotificationService.instance.initialize(); | ||
await SharedPreferencesUtil.init(); | ||
await MixpanelManager.init(); | ||
|
@@ -270,14 +277,20 @@ class DeciderWidget extends StatefulWidget { | |
class _DeciderWidgetState extends State<DeciderWidget> { | ||
@override | ||
void initState() { | ||
WidgetsBinding.instance.addPostFrameCallback((_) { | ||
WidgetsBinding.instance.addPostFrameCallback((_) async { | ||
if (context.read<ConnectivityProvider>().isConnected) { | ||
NotificationService.instance.saveNotificationToken(); | ||
} | ||
|
||
if (context.read<AuthenticationProvider>().user != null) { | ||
context.read<HomeProvider>().setupHasSpeakerProfile(); | ||
await Intercom.instance.loginIdentifiedUser( | ||
userId: FirebaseAuth.instance.currentUser!.uid, | ||
); | ||
context.read<MessageProvider>().setMessagesFromCache(); | ||
context.read<MessageProvider>().refreshMessages(); | ||
} else { | ||
await Intercom.instance.loginUnidentifiedUser(); | ||
Comment on lines
+280
to
+293
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The WidgetsBinding.instance.addPostFrameCallback((_) async {
if (context.read<ConnectivityProvider>().isConnected) {
NotificationService.instance.saveNotificationToken();
}
if (context.read<AuthenticationProvider>().user != null) {
context.read<HomeProvider>().setupHasSpeakerProfile();
+ try {
await Intercom.instance.loginIdentifiedUser(
userId: FirebaseAuth.instance.currentUser!.uid,
);
+ } catch (e) {
+ // Log the exception or handle it appropriately
+ }
context.read<MessageProvider>().setMessagesFromCache();
context.read<MessageProvider>().refreshMessages();
} else {
+ try {
await Intercom.instance.loginUnidentifiedUser();
+ } catch (e) {
+ // Log the exception or handle it appropriately
+ }
}
}); |
||
} | ||
}); | ||
super.initState(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:friend_private/pages/home/device_settings.dart'; | ||
import 'package:friend_private/pages/settings/device_settings.dart'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import path for - import 'package:friend_private/pages/home/device_settings.dart';
+ import 'package:friend_private/pages/settings/device_settings.dart'; |
||
import 'package:friend_private/pages/home/page.dart'; | ||
import 'package:friend_private/pages/onboarding/find_device/page.dart'; | ||
import 'package:friend_private/utils/other/temp.dart'; | ||
|
@@ -24,9 +24,7 @@ class _ConnectDevicePageState extends State<ConnectDevicePage> { | |
onPressed: () { | ||
Navigator.of(context).push( | ||
MaterialPageRoute( | ||
builder: (context) => const DeviceSettings( | ||
isDeviceConnected: false, | ||
), | ||
builder: (context) => const DeviceSettings(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The instantiation of - builder: (context) => const DeviceSettings(isDeviceConnected: false),
+ builder: (context) => const DeviceSettings(), |
||
), | ||
); | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entelligence.AI
The namespace "com.friend.ios" seems to be added in the Android build.gradle file. This could potentially cause confusion as it's an iOS namespace being used in an Android context. If this is intentional and required for some reason, consider adding a comment explaining why this is necessary.