Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 29 additions & 18 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.resonate.resonate">

<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -8,10 +10,18 @@
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<application

<application
android:label="Resonate"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">

<!-- UCropActivity -->
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait" />

<!-- MainActivity -->
<activity
android:name=".MainActivity"
android:exported="true"
Expand All @@ -20,6 +30,7 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">

<!-- App Link-->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
Expand All @@ -28,27 +39,27 @@
<data android:scheme="http" android:host="resonate.aossie.org" android:pathPrefix="/room" />
<data android:scheme="https" android:host="resonate.aossie.org" android:pathPrefix="/room" />
</intent-filter>
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->

<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:exported="true" android:name="com.linusu.flutter_web_auth_2.CallbackActivity">
<intent-filter android:label="flutter_web_auth_2">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="appwrite-callback-64a12ff22a44f02f0545" />
</intent-filter>
</activity>

<!-- CallbackActivity for flutter_web_auth_2 -->
<activity android:exported="true" android:name="com.linusu.flutter_web_auth_2.CallbackActivity">
<intent-filter android:label="flutter_web_auth_2">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="appwrite-callback-64a12ff22a44f02f0545" />
</intent-filter>
</activity>

<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
Expand Down
147 changes: 99 additions & 48 deletions lib/controllers/edit_profile_controller.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:developer';

import 'package:image_cropper/image_cropper.dart';
import 'dart:io';
import 'package:appwrite/appwrite.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
Expand Down Expand Up @@ -62,65 +63,115 @@ class EditProfileController extends GetxController {
}

Future<void> pickImageFromCamera() async {
try {
// Display Loading Dialog
Get.dialog(
Center(
child: LoadingAnimationWidget.threeRotatingDots(
color: Colors.amber, size: Get.pixelRatio * 20),
),
barrierDismissible: false,
name: "Loading Dialog");

XFile? file = await _imagePicker.pickImage(
source: ImageSource.camera, maxHeight: 400, maxWidth: 400);
if (file == null) return;
profileImagePath = file.path;
try {
// Display Loading Dialog
Get.dialog(
Center(
child: LoadingAnimationWidget.threeRotatingDots(
color: Colors.amber,
size: Get.pixelRatio * 20,
),
),
barrierDismissible: false,
name: "Loading Dialog",
);

XFile? file = await _imagePicker.pickImage(
source: ImageSource.camera,
maxHeight: 400,
maxWidth: 400,
);

if (file == null) return;

// Crop the image
final croppedFile = await _cropImage(file.path);

if (croppedFile != null) {
profileImagePath = croppedFile.path;
update();

removeImage = false;
} catch (e) {
log(e.toString());
} finally {
// Close the loading dialog
Get.back();
}
} catch (e) {
log(e.toString());
} finally {
// Close the loading dialog
Get.back();
}
}

void removeProfilePicture() {
if (authStateController.profileImageUrl != userProfileImagePlaceholderUrl) {
removeImage = true;
}
profileImagePath = null;
update();
void removeProfilePicture() {
if (authStateController.profileImageUrl !=
userProfileImagePlaceholderUrl) {
removeImage = true;
}
profileImagePath = null;
update();
}

Future<void> pickImageFromGallery() async {
try {
// Display Loading Dialog
Get.dialog(
Center(
child: LoadingAnimationWidget.threeRotatingDots(
color: Colors.amber, size: Get.pixelRatio * 20),
),
barrierDismissible: false,
name: "Loading Dialog");

XFile? file = await _imagePicker.pickImage(
source: ImageSource.gallery, maxHeight: 400, maxWidth: 400);
if (file == null) return;
profileImagePath = file.path;
Future<void> pickImageFromGallery() async {
try {
// Display Loading Dialog
Get.dialog(
Center(
child: LoadingAnimationWidget.threeRotatingDots(
color: Colors.amber,
size: Get.pixelRatio * 20,
),
),
barrierDismissible: false,
name: "Loading Dialog",
);

XFile? file = await _imagePicker.pickImage(
source: ImageSource.gallery,
maxHeight: 400,
maxWidth: 400,
);

if (file == null) return;

// Crop the image
final croppedFile = await _cropImage(file.path);

if (croppedFile != null) {
profileImagePath = croppedFile.path;
update();

removeImage = false;
} catch (e) {
log(e.toString());
} finally {
// Close the loading dialog
Get.back();
}
} catch (e) {
log(e.toString());
} finally {
// Close the loading dialog
Get.back();
}
}

Future<File?> _cropImage(String imagePath) async {
File? croppedFile = await ImageCropper().cropImage(
sourcePath: imagePath,
aspectRatioPresets: [
CropAspectRatioPreset.square,
CropAspectRatioPreset.ratio3x2,
CropAspectRatioPreset.original,
CropAspectRatioPreset.ratio4x3,
CropAspectRatioPreset.ratio16x9,
],
androidUiSettings: AndroidUiSettings(
toolbarColor: Colors.amber,
statusBarColor: Colors.amber.shade900,
toolbarWidgetColor: Colors.white,
cropFrameColor: Colors.amber,
initAspectRatio: CropAspectRatioPreset.original,
lockAspectRatio: false,
),
iosUiSettings: IOSUiSettings(
minimumAspectRatio: 1.0,
),
);

return croppedFile;
}
Future<bool> isUsernameAvailable(String username) async {
try {
await databases.getDocument(
Expand Down
34 changes: 21 additions & 13 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.17.2"
connectivity_plus:
dependency: transitive
description:
Expand Down Expand Up @@ -760,6 +760,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.17"
image_cropper:
dependency: "direct main"
description:
name: image_cropper
sha256: "60542ffd03436e6f80a1d7c9839f75b6a62b0a290cd98624fa29d150fdf672c8"
url: "https://pub.dev"
source: hosted
version: "1.5.1"
image_picker:
dependency: "direct main"
description:
Expand Down Expand Up @@ -948,10 +956,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.9.1"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -1257,10 +1265,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
url: "https://pub.dev"
source: hosted
version: "1.11.1"
version: "1.11.0"
stop_watch_timer:
dependency: "direct main"
description:
Expand All @@ -1273,10 +1281,10 @@ packages:
dependency: transitive
description:
name: stream_channel
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
version: "2.1.1"
stream_transform:
dependency: transitive
description:
Expand Down Expand Up @@ -1313,10 +1321,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.6.0"
textfield_tags:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1481,10 +1489,10 @@ packages:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "0.1.4-beta"
web_socket_channel:
dependency: transitive
description:
Expand Down Expand Up @@ -1550,5 +1558,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.0-194.0.dev <4.0.0"
dart: ">=3.1.0-185.0.dev <4.0.0"
flutter: ">=3.10.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ dependencies:
firebase_core: ^2.20.0
flutter_local_notifications: ^16.1.0
firebase_analytics: ^10.6.3
image_cropper: ^1.5.1

dev_dependencies:
flutter_test:
Expand Down