Skip to content
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

Chat and other minor fixes #827

Merged
merged 2 commits into from
Sep 12, 2024
Merged

Chat and other minor fixes #827

merged 2 commits into from
Sep 12, 2024

Conversation

mdmohsin7
Copy link
Collaborator

@mdmohsin7 mdmohsin7 commented Sep 12, 2024

  • The "enabled plugins" dropdown behave weirdly when the user doesn't have any enabled plugins
  • Replace broken basedhardware links with omi

Summary by Entelligence.AI

  • Style: Updated the styling and behavior of buttons across the application for improved user interaction.
  • New Feature: Enhanced the home page UI to display a message prompting users to enable plugins if none are active, and added a dropdown for plugin selection when plugins are enabled.
  • Chore: Changed the header string in the memory detail share feature from "GENERATED BY FRIEND, basedhardware.com" to "GENERATED BY FRIEND, omi.me".
  • Chore: Updated the URL in the privacy policy link within the authentication provider from 'https://basedhardware.com/privacy-policy' to 'https://www.omi.me/pages/privacy'.

Copy link

github-actions bot commented Sep 12, 2024

Image description Entelligence.AI

Walkthrough

This pull request primarily focuses on enhancing user interaction and updating branding details. Changes include UI adjustments for button styling and behavior, improved plugin selection logic on the home page, and updates to header strings and privacy policy URLs to reflect a new domain.

Changes

Files Summary
app/lib/pages/capture/widgets/widgets.dart, app/lib/pages/plugins/page.dart Updated button styles and behaviors, including the URLs launched on button press and associated analytics events.
app/lib/pages/home/page.dart Improved UI rendering logic for plugin selection based on their availability.
app/lib/pages/memory_detail/share.dart, app/lib/providers/auth_provider.dart Updated header strings and privacy policy URLs to reflect the transition from 'basedhardware.com' to 'omi.me'.

🎉 Code changes here, code changes there,
Enhancing UX with utmost care.
Buttons shine with a brand-new glow,
Plugins dance in a better flow.
From old domains, we take our leave,
In 'omi.me', we now believe! 🚀


Uplevel your code reviews with Entelligence.AI Pro

Entelligence.AI Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, Entelligence.AI Pro is free for open source projects.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description Entelligence.AI

Commits Files that changed from the base of the PR and between a21cd31 and 46ee4a8 commits.
Files selected (5)
  • app/lib/pages/capture/widgets/widgets.dart (1)
  • app/lib/pages/home/page.dart (1)
  • app/lib/pages/memory_detail/share.dart (1)
  • app/lib/pages/plugins/page.dart (1)
  • app/lib/providers/auth_provider.dart (1)
Files skipped from review due to trivial changes (3)
  • app/lib/pages/memory_detail/share.dart
  • app/lib/pages/plugins/page.dart
  • app/lib/providers/auth_provider.dart
Review comments generated (2)
  • Review: 2
  • LGTM: 0

Tips

Chat with Image description Entelligence.AI Bot (@Entelligence.AI)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @Entelligence.AI in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @Entelligence.AI: ignore anywhere in the PR description to pause further reviews from the bot.

Comment on lines +154 to +176
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 0),
decoration: BoxDecoration(
border: const GradientBoxBorder(
gradient: LinearGradient(colors: [
Color.fromARGB(127, 208, 208, 208),
Color.fromARGB(127, 188, 99, 121),
Color.fromARGB(127, 86, 101, 182),
Color.fromARGB(127, 126, 190, 236)
]),
width: 2,
),
child: TextButton(
onPressed: () {
launchUrl(Uri.parse('https://basedhardware.com'));
MixpanelManager().getFriendClicked();
},
child: const Text(
'Get a Friend',
style: TextStyle(color: Colors.white, fontSize: 16),
))),
borderRadius: BorderRadius.circular(12),
),
child: TextButton(
onPressed: () {
launchUrl(Uri.parse('https://omi.me'));
MixpanelManager().getFriendClicked();
},
child: const Text(
'Get a Friend',
style: TextStyle(color: Colors.white, fontSize: 16),
),
),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description Entelligence.AI

The URL in the launchUrl function has been updated from 'https://basedhardware.com' to 'https://omi.me'. Ensure that this new URL is correct and functional. Also, make sure that the associated analytics event MixpanelManager().getFriendClicked(); is still relevant and correctly configured for this new URL.

- launchUrl(Uri.parse('https://basedhardware.com'));
+ launchUrl(Uri.parse('https://omi.me'));
  MixpanelManager().getFriendClicked();

If there are any changes needed in the analytics configuration due to this URL change, please update it accordingly.

Comment on lines +439 to +481
child: provider.plugins.where((p) => p.enabled).isEmpty
? GestureDetector(
onTap: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (c) => const PluginsPage(filterChatOnly: true)));
},
child: const Row(
children: [
Icon(size: 20, Icons.chat, color: Colors.white),
SizedBox(width: 10),
Text('Enable Plugins',
style: TextStyle(color: Colors.white, fontWeight: FontWeight.w500, fontSize: 16)),
],
),
)
: Container(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: DropdownButton<String>(
menuMaxHeight: 350,
value: SharedPreferencesUtil().selectedChatPluginId,
onChanged: (s) async {
if ((s == 'no_selected' && provider.plugins.where((p) => p.enabled).isEmpty) ||
s == 'enable') {
await routeToPage(context, const PluginsPage(filterChatOnly: true));
return;
}
print('Selected: $s prefs: ${SharedPreferencesUtil().selectedChatPluginId}');
if (s == null || s == SharedPreferencesUtil().selectedChatPluginId) return;
SharedPreferencesUtil().selectedChatPluginId = s;
var plugin = provider.plugins.firstWhereOrNull((p) => p.id == s);
chatPageKey.currentState?.sendInitialPluginMessage(plugin);
},
icon: Container(),
alignment: Alignment.center,
dropdownColor: Colors.black,
style: const TextStyle(color: Colors.white, fontSize: 16),
underline: Container(height: 0, color: Colors.transparent),
isExpanded: false,
itemHeight: 48,
padding: EdgeInsets.zero,
items: _getPluginsDropdownItems(context, provider),
),
),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description Entelligence.AI

The new code introduces a check to see if any plugins are enabled. If no plugins are enabled, it shows a message prompting the user to enable them. This is a good UX improvement as it provides clear instructions to the user when no plugins are enabled. However, there's a potential issue with this implementation. The SharedPreferencesUtil().selectedChatPluginId is being accessed multiple times in this function. Each access could potentially result in a disk I/O operation which can be expensive and slow down the UI. It would be better to store the value in a local variable at the start of the function and use that instead.

-                                  value: SharedPreferencesUtil().selectedChatPluginId,
+                                  String selectedChatPluginId = SharedPreferencesUtil().selectedChatPluginId;
+                                  value: selectedChatPluginId,

-                                  print('Selected: $s prefs: ${SharedPreferencesUtil().selectedChatPluginId}');
+                                  print('Selected: $s prefs: $selectedChatPluginId');

-                                  if (s == null || s == SharedPreferencesUtil().selectedChatPluginId) return;
+                                  if (s == null || s == selectedChatPluginId) return;

-                                  SharedPreferencesUtil().selectedChatPluginId = s;
+                                  selectedChatPluginId = s;

Also, the print statement on line 465 seems like debug code that should not be in production. Consider removing it or replacing it with proper logging if necessary.

@josancamon19 josancamon19 merged commit 755c10d into main Sep 12, 2024
1 check passed
@josancamon19 josancamon19 deleted the chat-and-other-fixes branch September 12, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants