Compare commits
107 Commits
Author | SHA1 | Date | |
---|---|---|---|
bd1369e72d | |||
10520b4448 | |||
cab2217793 | |||
4e4e551e2f | |||
597a8a802a | |||
fff756cbe0 | |||
e38778dbf9 | |||
cc9081b011 | |||
14e8f7b775 | |||
a70e6c7118 | |||
48ca885a2c | |||
09cb340a9d | |||
b6ebd6bef6 | |||
2ec25fd1a2 | |||
bc99865ba8 | |||
f834351ce2 | |||
0f1a02f65b | |||
6ad0a34645 | |||
fdc71475fc | |||
047defebd1 | |||
6148e889aa | |||
1d7affcd84 | |||
cc1e0599aa | |||
221b97901f | |||
498bb0e5fb | |||
aa94dfcfe0 | |||
65d9253876 | |||
3ac510c4b1 | |||
253cd1ecbd | |||
c82c48dfec | |||
433beec2dd | |||
3a1e7537dd | |||
9170ae6be7 | |||
a5ee5b7f09 | |||
32e6658f3d | |||
e45d9b39d5 | |||
cf1cfecb08 | |||
95ea3e558f | |||
0006a94632 | |||
7ea18dbe12 | |||
6004b74724 | |||
4d82ae8058 | |||
7fe26d0df0 | |||
80bade0e03 | |||
b63db7fe76 | |||
49f73f5f04 | |||
98749f42c0 | |||
f0e6bd64f4 | |||
3bea3a114a | |||
454f711656 | |||
82e4c923e7 | |||
5b4d8282ae | |||
cf767a1d94 | |||
af93a8386a | |||
29ca263130 | |||
7332f68d9c | |||
e9e6f3313e | |||
85764c37c2 | |||
ef1f29f905 | |||
22026efa7d | |||
4a3e6a9e15 | |||
00092ba7b6 | |||
b5da8ece4a | |||
dfe9165bc9 | |||
3d45b54236 | |||
7f63fe7f0e | |||
bc5dbab9c5 | |||
9910fc7a92 | |||
2356eac118 | |||
0135b8d838 | |||
8ec33ccbf4 | |||
d267316a35 | |||
138da60e55 | |||
4562c2f991 | |||
8009f4ca9b | |||
54dee9702b | |||
94385564bd | |||
0b2309816f | |||
8283272a3b | |||
eb02a47e9a | |||
7c0c1ec94f | |||
272044a77e | |||
39c22b1cf6 | |||
98c3bb912d | |||
035b92d9b8 | |||
0bfc0bd61b | |||
de00a20eee | |||
73982f48d6 | |||
1d36b30361 | |||
dea743a307 | |||
c48bd3e758 | |||
56bbf73b5e | |||
4f6c5aa053 | |||
d8e79fb4f9 | |||
06e0fa465b | |||
895a257f50 | |||
d9804ba00b | |||
62ff1c2f1c | |||
a157596a2e | |||
12102bf527 | |||
c00a018380 | |||
53b3cac4ca | |||
19eabfaba1 | |||
ec2eadad6d | |||
54e176e75d | |||
0a7ccaeefa | |||
a5f093e185 |
@ -1,6 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.android.application"
|
id "com.android.application"
|
||||||
id 'com.google.gms.google-services'
|
id 'com.google.gms.google-services'
|
||||||
|
id 'com.google.firebase.crashlytics'
|
||||||
id "kotlin-android"
|
id "kotlin-android"
|
||||||
id "dev.flutter.flutter-gradle-plugin"
|
id "dev.flutter.flutter-gradle-plugin"
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<uses-feature android:name="android.hardware.camera"/>
|
<uses-feature android:name="android.hardware.camera" />
|
||||||
<uses-feature android:name="android.hardware.camera.autofocus"/>
|
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
<uses-permission android:name="android.permission.CAMERA"/>
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30"/>
|
<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_CONNECT" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30"/>
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
|
||||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
@ -19,31 +19,31 @@
|
|||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="Solian"
|
android:label="Solian"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:supportsRtl="true">
|
android:supportsRtl="true">
|
||||||
<receiver android:exported="false"
|
<receiver android:exported="false"
|
||||||
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"/>
|
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
|
||||||
<receiver android:exported="false"
|
<receiver android:exported="false"
|
||||||
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
|
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
|
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||||
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
|
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||||
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
|
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:taskAffinity=""
|
android:taskAffinity=""
|
||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||||
the Android process has started. This theme is visible to the user
|
the Android process has started. This theme is visible to the user
|
||||||
while the Flutter UI initializes. After that, this theme continues
|
while the Flutter UI initializes. After that, this theme continues
|
||||||
@ -58,29 +58,36 @@
|
|||||||
<data android:host="sn.solsynth.dev" />
|
<data android:host="sn.solsynth.dev" />
|
||||||
<data android:scheme="https" />
|
<data android:scheme="https" />
|
||||||
<data android:scheme="https" />
|
<data android:scheme="https" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="solink" />
|
<data android:scheme="solink" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="io.flutter.embedding.android.NormalTheme"
|
android:name="io.flutter.embedding.android.NormalTheme"
|
||||||
android:resource="@style/NormalTheme"
|
android:resource="@style/NormalTheme"
|
||||||
/>
|
/>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.yalantis.ucrop.UCropActivity"
|
android:name="com.yalantis.ucrop.UCropActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||||
|
|
||||||
<!-- Don't delete the meta-data below.
|
<!-- Don't delete the meta-data below.
|
||||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="flutterEmbedding"
|
android:name="flutterEmbedding"
|
||||||
android:value="2"/>
|
android:value="2" />
|
||||||
</application>
|
</application>
|
||||||
<!-- Required to query activities that can process text, see:
|
<!-- Required to query activities that can process text, see:
|
||||||
https://developer.android.com/training/package-visibility and
|
https://developer.android.com/training/package-visibility and
|
||||||
@ -89,8 +96,8 @@
|
|||||||
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
|
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
|
||||||
<queries>
|
<queries>
|
||||||
<intent>
|
<intent>
|
||||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
<action android:name="android.intent.action.PROCESS_TEXT" />
|
||||||
<data android:mimeType="text/plain"/>
|
<data android:mimeType="text/plain" />
|
||||||
</intent>
|
</intent>
|
||||||
</queries>
|
</queries>
|
||||||
</manifest>
|
</manifest>
|
BIN
android/app/src/main/res/drawable-hdpi/splash.png
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
android/app/src/main/res/drawable-mdpi/splash.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
android/app/src/main/res/drawable-night-v21/background.png
Normal file
After Width: | Height: | Size: 69 B |
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="fill" android:src="@drawable/background"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="center" android:src="@drawable/splash"/>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
BIN
android/app/src/main/res/drawable-night/background.png
Normal file
After Width: | Height: | Size: 69 B |
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="fill" android:src="@drawable/background"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="center" android:src="@drawable/splash"/>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
BIN
android/app/src/main/res/drawable-v21/background.png
Normal file
After Width: | Height: | Size: 69 B |
@ -1,12 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Modify this file to customize your launch splash screen -->
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:drawable="?android:colorBackground" />
|
<item>
|
||||||
|
<bitmap android:gravity="fill" android:src="@drawable/background"/>
|
||||||
<!-- You can insert your own image assets here -->
|
</item>
|
||||||
<!-- <item>
|
<item>
|
||||||
<bitmap
|
<bitmap android:gravity="center" android:src="@drawable/splash"/>
|
||||||
android:gravity="center"
|
</item>
|
||||||
android:src="@mipmap/launch_image" />
|
|
||||||
</item> -->
|
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
BIN
android/app/src/main/res/drawable-xhdpi/splash.png
Normal file
After Width: | Height: | Size: 117 KiB |
BIN
android/app/src/main/res/drawable-xxhdpi/splash.png
Normal file
After Width: | Height: | Size: 233 KiB |
BIN
android/app/src/main/res/drawable-xxxhdpi/splash.png
Normal file
After Width: | Height: | Size: 355 KiB |
BIN
android/app/src/main/res/drawable/background.png
Normal file
After Width: | Height: | Size: 69 B |
@ -1,12 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Modify this file to customize your launch splash screen -->
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:drawable="@android:color/white" />
|
<item>
|
||||||
|
<bitmap android:gravity="fill" android:src="@drawable/background"/>
|
||||||
<!-- You can insert your own image assets here -->
|
</item>
|
||||||
<!-- <item>
|
<item>
|
||||||
<bitmap
|
<bitmap android:gravity="center" android:src="@drawable/splash"/>
|
||||||
android:gravity="center"
|
</item>
|
||||||
android:src="@mipmap/launch_image" />
|
|
||||||
</item> -->
|
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
19
android/app/src/main/res/values-night-v31/styles.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||||
|
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||||
|
<item name="android:forceDarkAllowed">false</item>
|
||||||
|
<item name="android:windowFullscreen">false</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
|
||||||
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||||
|
</style>
|
||||||
|
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||||
|
This theme determines the color of the Android Window while your
|
||||||
|
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||||
|
running.
|
||||||
|
|
||||||
|
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||||
|
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||||
|
<item name="android:windowBackground">?android:colorBackground</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
@ -5,6 +5,10 @@
|
|||||||
<!-- Show a splash screen on the activity. Automatically removed when
|
<!-- Show a splash screen on the activity. Automatically removed when
|
||||||
the Flutter engine draws its first frame -->
|
the Flutter engine draws its first frame -->
|
||||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||||
|
<item name="android:forceDarkAllowed">false</item>
|
||||||
|
<item name="android:windowFullscreen">false</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
|
||||||
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||||
This theme determines the color of the Android Window while your
|
This theme determines the color of the Android Window while your
|
||||||
|
19
android/app/src/main/res/values-v31/styles.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||||
|
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||||
|
<item name="android:forceDarkAllowed">false</item>
|
||||||
|
<item name="android:windowFullscreen">false</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
|
||||||
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||||
|
</style>
|
||||||
|
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||||
|
This theme determines the color of the Android Window while your
|
||||||
|
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||||
|
running.
|
||||||
|
|
||||||
|
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||||
|
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||||
|
<item name="android:windowBackground">?android:colorBackground</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
@ -5,6 +5,10 @@
|
|||||||
<!-- Show a splash screen on the activity. Automatically removed when
|
<!-- Show a splash screen on the activity. Automatically removed when
|
||||||
the Flutter engine draws its first frame -->
|
the Flutter engine draws its first frame -->
|
||||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||||
|
<item name="android:forceDarkAllowed">false</item>
|
||||||
|
<item name="android:windowFullscreen">false</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
|
||||||
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||||
This theme determines the color of the Android Window while your
|
This theme determines the color of the Android Window while your
|
||||||
|
@ -12,6 +12,17 @@ subprojects {
|
|||||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||||
}
|
}
|
||||||
subprojects {
|
subprojects {
|
||||||
|
// TO FIX LIVEKIT ISSUE BY THIS
|
||||||
|
// https://github.com/livekit/client-sdk-flutter/issues/569#issuecomment-2275686786
|
||||||
|
afterEvaluate { project ->
|
||||||
|
if (project.plugins.hasPlugin("com.android.application") ||
|
||||||
|
project.plugins.hasPlugin("com.android.library")) {
|
||||||
|
project.android {
|
||||||
|
compileSdkVersion 34
|
||||||
|
buildToolsVersion "34.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
project.evaluationDependsOn(":app")
|
project.evaluationDependsOn(":app")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ plugins {
|
|||||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
id "com.android.application" version '8.4.0' apply false
|
id "com.android.application" version '8.4.0' apply false
|
||||||
id "com.google.gms.google-services" version "4.3.15" apply false
|
id "com.google.gms.google-services" version "4.3.15" apply false
|
||||||
|
id "com.google.firebase.crashlytics" version "2.8.1" apply false
|
||||||
id "org.jetbrains.kotlin.android" version '2.0.0' apply false
|
id "org.jetbrains.kotlin.android" version '2.0.0' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
build.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
targets:
|
||||||
|
$default:
|
||||||
|
builders:
|
||||||
|
json_serializable:
|
||||||
|
options:
|
||||||
|
explicit_to_json: true
|
||||||
|
field_rename: snake
|
295
ios/Podfile.lock
@ -38,39 +38,126 @@ PODS:
|
|||||||
- file_picker (0.0.1):
|
- file_picker (0.0.1):
|
||||||
- DKImagePickerController/PhotoGallery
|
- DKImagePickerController/PhotoGallery
|
||||||
- Flutter
|
- Flutter
|
||||||
- Firebase/CoreOnly (10.29.0):
|
- Firebase/Analytics (11.0.0):
|
||||||
- FirebaseCore (= 10.29.0)
|
- Firebase/Core
|
||||||
- Firebase/Messaging (10.29.0):
|
- Firebase/Core (11.0.0):
|
||||||
- Firebase/CoreOnly
|
- Firebase/CoreOnly
|
||||||
- FirebaseMessaging (~> 10.29.0)
|
- FirebaseAnalytics (~> 11.0.0)
|
||||||
- firebase_core (3.3.0):
|
- Firebase/CoreOnly (11.0.0):
|
||||||
- Firebase/CoreOnly (= 10.29.0)
|
- FirebaseCore (= 11.0.0)
|
||||||
- Flutter
|
- Firebase/Crashlytics (11.0.0):
|
||||||
- firebase_messaging (15.0.4):
|
- Firebase/CoreOnly
|
||||||
- Firebase/Messaging (= 10.29.0)
|
- FirebaseCrashlytics (~> 11.0.0)
|
||||||
|
- Firebase/Messaging (11.0.0):
|
||||||
|
- Firebase/CoreOnly
|
||||||
|
- FirebaseMessaging (~> 11.0.0)
|
||||||
|
- Firebase/Performance (11.0.0):
|
||||||
|
- Firebase/CoreOnly
|
||||||
|
- FirebasePerformance (~> 11.0.0)
|
||||||
|
- firebase_analytics (11.3.0):
|
||||||
|
- Firebase/Analytics (= 11.0.0)
|
||||||
- firebase_core
|
- firebase_core
|
||||||
- Flutter
|
- Flutter
|
||||||
- FirebaseCore (10.29.0):
|
- firebase_core (3.4.0):
|
||||||
- FirebaseCoreInternal (~> 10.0)
|
- Firebase/CoreOnly (= 11.0.0)
|
||||||
- GoogleUtilities/Environment (~> 7.12)
|
- Flutter
|
||||||
- GoogleUtilities/Logger (~> 7.12)
|
- firebase_crashlytics (4.1.0):
|
||||||
- FirebaseCoreInternal (10.29.0):
|
- Firebase/Crashlytics (= 11.0.0)
|
||||||
- "GoogleUtilities/NSData+zlib (~> 7.8)"
|
- firebase_core
|
||||||
- FirebaseInstallations (10.29.0):
|
- Flutter
|
||||||
- FirebaseCore (~> 10.0)
|
- firebase_messaging (15.1.0):
|
||||||
- GoogleUtilities/Environment (~> 7.8)
|
- Firebase/Messaging (= 11.0.0)
|
||||||
- GoogleUtilities/UserDefaults (~> 7.8)
|
- firebase_core
|
||||||
- PromisesObjC (~> 2.1)
|
- Flutter
|
||||||
- FirebaseMessaging (10.29.0):
|
- firebase_performance (0.10.0-5):
|
||||||
- FirebaseCore (~> 10.0)
|
- Firebase/Performance (= 11.0.0)
|
||||||
- FirebaseInstallations (~> 10.0)
|
- firebase_core
|
||||||
- GoogleDataTransport (~> 9.3)
|
- Flutter
|
||||||
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
|
- FirebaseABTesting (11.1.0):
|
||||||
- GoogleUtilities/Environment (~> 7.8)
|
- FirebaseCore (~> 11.0)
|
||||||
- GoogleUtilities/Reachability (~> 7.8)
|
- FirebaseAnalytics (11.0.0):
|
||||||
- GoogleUtilities/UserDefaults (~> 7.8)
|
- FirebaseAnalytics/AdIdSupport (= 11.0.0)
|
||||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
- FirebaseCore (~> 11.0)
|
||||||
|
- FirebaseInstallations (~> 11.0)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
|
||||||
|
- GoogleUtilities/MethodSwizzler (~> 8.0)
|
||||||
|
- GoogleUtilities/Network (~> 8.0)
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.0)"
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- FirebaseAnalytics/AdIdSupport (11.0.0):
|
||||||
|
- FirebaseCore (~> 11.0)
|
||||||
|
- FirebaseInstallations (~> 11.0)
|
||||||
|
- GoogleAppMeasurement (= 11.0.0)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
|
||||||
|
- GoogleUtilities/MethodSwizzler (~> 8.0)
|
||||||
|
- GoogleUtilities/Network (~> 8.0)
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.0)"
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- FirebaseCore (11.0.0):
|
||||||
|
- FirebaseCoreInternal (~> 11.0)
|
||||||
|
- GoogleUtilities/Environment (~> 8.0)
|
||||||
|
- GoogleUtilities/Logger (~> 8.0)
|
||||||
|
- FirebaseCoreExtension (11.1.0):
|
||||||
|
- FirebaseCore (~> 11.0)
|
||||||
|
- FirebaseCoreInternal (11.1.0):
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.0)"
|
||||||
|
- FirebaseCrashlytics (11.0.0):
|
||||||
|
- FirebaseCore (~> 11.0)
|
||||||
|
- FirebaseInstallations (~> 11.0)
|
||||||
|
- FirebaseRemoteConfigInterop (~> 11.0)
|
||||||
|
- FirebaseSessions (~> 11.0)
|
||||||
|
- GoogleDataTransport (~> 10.0)
|
||||||
|
- GoogleUtilities/Environment (~> 8.0)
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- PromisesObjC (~> 2.4)
|
||||||
|
- FirebaseInstallations (11.1.0):
|
||||||
|
- FirebaseCore (~> 11.0)
|
||||||
|
- GoogleUtilities/Environment (~> 8.0)
|
||||||
|
- GoogleUtilities/UserDefaults (~> 8.0)
|
||||||
|
- PromisesObjC (~> 2.4)
|
||||||
|
- FirebaseMessaging (11.0.0):
|
||||||
|
- FirebaseCore (~> 11.0)
|
||||||
|
- FirebaseInstallations (~> 11.0)
|
||||||
|
- GoogleDataTransport (~> 10.0)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
|
||||||
|
- GoogleUtilities/Environment (~> 8.0)
|
||||||
|
- GoogleUtilities/Reachability (~> 8.0)
|
||||||
|
- GoogleUtilities/UserDefaults (~> 8.0)
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- FirebasePerformance (11.0.0):
|
||||||
|
- FirebaseCore (~> 11.0)
|
||||||
|
- FirebaseInstallations (~> 11.0)
|
||||||
|
- FirebaseRemoteConfig (~> 11.0)
|
||||||
|
- FirebaseSessions (~> 11.0)
|
||||||
|
- GoogleDataTransport (~> 10.0)
|
||||||
|
- GoogleUtilities/Environment (~> 8.0)
|
||||||
|
- GoogleUtilities/MethodSwizzler (~> 8.0)
|
||||||
|
- GoogleUtilities/UserDefaults (~> 8.0)
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- FirebaseRemoteConfig (11.1.0):
|
||||||
|
- FirebaseABTesting (~> 11.0)
|
||||||
|
- FirebaseCore (~> 11.0)
|
||||||
|
- FirebaseInstallations (~> 11.0)
|
||||||
|
- FirebaseRemoteConfigInterop (~> 11.0)
|
||||||
|
- FirebaseSharedSwift (~> 11.0)
|
||||||
|
- GoogleUtilities/Environment (~> 8.0)
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.0)"
|
||||||
|
- FirebaseRemoteConfigInterop (11.1.0)
|
||||||
|
- FirebaseSessions (11.1.0):
|
||||||
|
- FirebaseCore (~> 11.0)
|
||||||
|
- FirebaseCoreExtension (~> 11.0)
|
||||||
|
- FirebaseInstallations (~> 11.0)
|
||||||
|
- GoogleDataTransport (~> 10.0)
|
||||||
|
- GoogleUtilities/Environment (~> 8.0)
|
||||||
|
- GoogleUtilities/UserDefaults (~> 8.0)
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- PromisesSwift (~> 2.1)
|
||||||
|
- FirebaseSharedSwift (11.1.0)
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
|
- flutter_keyboard_visibility (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
- flutter_native_splash (0.0.1):
|
||||||
|
- Flutter
|
||||||
- flutter_secure_storage (6.0.0):
|
- flutter_secure_storage (6.0.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- flutter_webrtc (0.11.3):
|
- flutter_webrtc (0.11.3):
|
||||||
@ -79,33 +166,54 @@ PODS:
|
|||||||
- gal (1.0.0):
|
- gal (1.0.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- GoogleDataTransport (9.4.1):
|
- GoogleAppMeasurement (11.0.0):
|
||||||
- GoogleUtilities/Environment (~> 7.7)
|
- GoogleAppMeasurement/AdIdSupport (= 11.0.0)
|
||||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
|
||||||
- PromisesObjC (< 3.0, >= 1.2)
|
- GoogleUtilities/MethodSwizzler (~> 8.0)
|
||||||
- GoogleUtilities/AppDelegateSwizzler (7.13.3):
|
- GoogleUtilities/Network (~> 8.0)
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.0)"
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- GoogleAppMeasurement/AdIdSupport (11.0.0):
|
||||||
|
- GoogleAppMeasurement/WithoutAdIdSupport (= 11.0.0)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
|
||||||
|
- GoogleUtilities/MethodSwizzler (~> 8.0)
|
||||||
|
- GoogleUtilities/Network (~> 8.0)
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.0)"
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- GoogleAppMeasurement/WithoutAdIdSupport (11.0.0):
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (~> 8.0)
|
||||||
|
- GoogleUtilities/MethodSwizzler (~> 8.0)
|
||||||
|
- GoogleUtilities/Network (~> 8.0)
|
||||||
|
- "GoogleUtilities/NSData+zlib (~> 8.0)"
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- GoogleDataTransport (10.1.0):
|
||||||
|
- nanopb (~> 3.30910.0)
|
||||||
|
- PromisesObjC (~> 2.4)
|
||||||
|
- GoogleUtilities/AppDelegateSwizzler (8.0.2):
|
||||||
- GoogleUtilities/Environment
|
- GoogleUtilities/Environment
|
||||||
- GoogleUtilities/Logger
|
- GoogleUtilities/Logger
|
||||||
- GoogleUtilities/Network
|
- GoogleUtilities/Network
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- GoogleUtilities/Environment (7.13.3):
|
- GoogleUtilities/Environment (8.0.2):
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- PromisesObjC (< 3.0, >= 1.2)
|
- GoogleUtilities/Logger (8.0.2):
|
||||||
- GoogleUtilities/Logger (7.13.3):
|
|
||||||
- GoogleUtilities/Environment
|
- GoogleUtilities/Environment
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- GoogleUtilities/Network (7.13.3):
|
- GoogleUtilities/MethodSwizzler (8.0.2):
|
||||||
|
- GoogleUtilities/Logger
|
||||||
|
- GoogleUtilities/Privacy
|
||||||
|
- GoogleUtilities/Network (8.0.2):
|
||||||
- GoogleUtilities/Logger
|
- GoogleUtilities/Logger
|
||||||
- "GoogleUtilities/NSData+zlib"
|
- "GoogleUtilities/NSData+zlib"
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- GoogleUtilities/Reachability
|
- GoogleUtilities/Reachability
|
||||||
- "GoogleUtilities/NSData+zlib (7.13.3)":
|
- "GoogleUtilities/NSData+zlib (8.0.2)":
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- GoogleUtilities/Privacy (7.13.3)
|
- GoogleUtilities/Privacy (8.0.2)
|
||||||
- GoogleUtilities/Reachability (7.13.3):
|
- GoogleUtilities/Reachability (8.0.2):
|
||||||
- GoogleUtilities/Logger
|
- GoogleUtilities/Logger
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- GoogleUtilities/UserDefaults (7.13.3):
|
- GoogleUtilities/UserDefaults (8.0.2):
|
||||||
- GoogleUtilities/Logger
|
- GoogleUtilities/Logger
|
||||||
- GoogleUtilities/Privacy
|
- GoogleUtilities/Privacy
|
||||||
- image_cropper (0.0.4):
|
- image_cropper (0.0.4):
|
||||||
@ -113,7 +221,7 @@ PODS:
|
|||||||
- TOCropViewController (~> 2.7.4)
|
- TOCropViewController (~> 2.7.4)
|
||||||
- image_picker_ios (0.0.1):
|
- image_picker_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- livekit_client (2.2.3):
|
- livekit_client (2.2.4):
|
||||||
- Flutter
|
- Flutter
|
||||||
- WebRTC-SDK (= 125.6422.04)
|
- WebRTC-SDK (= 125.6422.04)
|
||||||
- media_kit_libs_ios_video (1.0.4):
|
- media_kit_libs_ios_video (1.0.4):
|
||||||
@ -122,11 +230,11 @@ PODS:
|
|||||||
- Flutter
|
- Flutter
|
||||||
- media_kit_video (0.0.1):
|
- media_kit_video (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- nanopb (2.30910.0):
|
- nanopb (3.30910.0):
|
||||||
- nanopb/decode (= 2.30910.0)
|
- nanopb/decode (= 3.30910.0)
|
||||||
- nanopb/encode (= 2.30910.0)
|
- nanopb/encode (= 3.30910.0)
|
||||||
- nanopb/decode (2.30910.0)
|
- nanopb/decode (3.30910.0)
|
||||||
- nanopb/encode (2.30910.0)
|
- nanopb/encode (3.30910.0)
|
||||||
- package_info_plus (0.4.5):
|
- package_info_plus (0.4.5):
|
||||||
- Flutter
|
- Flutter
|
||||||
- pasteboard (0.0.1):
|
- pasteboard (0.0.1):
|
||||||
@ -136,19 +244,18 @@ PODS:
|
|||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- permission_handler_apple (9.3.0):
|
- permission_handler_apple (9.3.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- pointer_interceptor_ios (0.0.1):
|
||||||
|
- Flutter
|
||||||
- PromisesObjC (2.4.0)
|
- PromisesObjC (2.4.0)
|
||||||
|
- PromisesSwift (2.4.0):
|
||||||
|
- PromisesObjC (= 2.4.0)
|
||||||
- protocol_handler_ios (0.0.1):
|
- protocol_handler_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- screen_brightness_ios (0.1.0):
|
- screen_brightness_ios (0.1.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- SDWebImage (5.19.4):
|
- SDWebImage (5.19.7):
|
||||||
- SDWebImage/Core (= 5.19.4)
|
- SDWebImage/Core (= 5.19.7)
|
||||||
- SDWebImage/Core (5.19.4)
|
- SDWebImage/Core (5.19.7)
|
||||||
- Sentry/HybridSDK (8.32.0)
|
|
||||||
- sentry_flutter (8.6.0):
|
|
||||||
- Flutter
|
|
||||||
- FlutterMacOS
|
|
||||||
- Sentry/HybridSDK (= 8.32.0)
|
|
||||||
- share_plus (0.0.1):
|
- share_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- shared_preferences_foundation (0.0.1):
|
- shared_preferences_foundation (0.0.1):
|
||||||
@ -171,9 +278,14 @@ DEPENDENCIES:
|
|||||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
|
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
|
||||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||||
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
||||||
|
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
|
||||||
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
|
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
|
||||||
|
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
|
||||||
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
|
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
|
||||||
|
- firebase_performance (from `.symlinks/plugins/firebase_performance/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
|
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
||||||
|
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
||||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||||
- flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`)
|
- flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`)
|
||||||
- gal (from `.symlinks/plugins/gal/darwin`)
|
- gal (from `.symlinks/plugins/gal/darwin`)
|
||||||
@ -187,9 +299,9 @@ DEPENDENCIES:
|
|||||||
- pasteboard (from `.symlinks/plugins/pasteboard/ios`)
|
- pasteboard (from `.symlinks/plugins/pasteboard/ios`)
|
||||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
|
- pointer_interceptor_ios (from `.symlinks/plugins/pointer_interceptor_ios/ios`)
|
||||||
- protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`)
|
- protocol_handler_ios (from `.symlinks/plugins/protocol_handler_ios/ios`)
|
||||||
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
|
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
|
||||||
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
|
|
||||||
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
||||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||||
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
|
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
|
||||||
@ -202,16 +314,26 @@ SPEC REPOS:
|
|||||||
- DKImagePickerController
|
- DKImagePickerController
|
||||||
- DKPhotoGallery
|
- DKPhotoGallery
|
||||||
- Firebase
|
- Firebase
|
||||||
|
- FirebaseABTesting
|
||||||
|
- FirebaseAnalytics
|
||||||
- FirebaseCore
|
- FirebaseCore
|
||||||
|
- FirebaseCoreExtension
|
||||||
- FirebaseCoreInternal
|
- FirebaseCoreInternal
|
||||||
|
- FirebaseCrashlytics
|
||||||
- FirebaseInstallations
|
- FirebaseInstallations
|
||||||
- FirebaseMessaging
|
- FirebaseMessaging
|
||||||
|
- FirebasePerformance
|
||||||
|
- FirebaseRemoteConfig
|
||||||
|
- FirebaseRemoteConfigInterop
|
||||||
|
- FirebaseSessions
|
||||||
|
- FirebaseSharedSwift
|
||||||
|
- GoogleAppMeasurement
|
||||||
- GoogleDataTransport
|
- GoogleDataTransport
|
||||||
- GoogleUtilities
|
- GoogleUtilities
|
||||||
- nanopb
|
- nanopb
|
||||||
- PromisesObjC
|
- PromisesObjC
|
||||||
|
- PromisesSwift
|
||||||
- SDWebImage
|
- SDWebImage
|
||||||
- Sentry
|
|
||||||
- SwiftyGif
|
- SwiftyGif
|
||||||
- TOCropViewController
|
- TOCropViewController
|
||||||
- WebRTC-SDK
|
- WebRTC-SDK
|
||||||
@ -223,12 +345,22 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/device_info_plus/ios"
|
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||||
file_picker:
|
file_picker:
|
||||||
:path: ".symlinks/plugins/file_picker/ios"
|
:path: ".symlinks/plugins/file_picker/ios"
|
||||||
|
firebase_analytics:
|
||||||
|
:path: ".symlinks/plugins/firebase_analytics/ios"
|
||||||
firebase_core:
|
firebase_core:
|
||||||
:path: ".symlinks/plugins/firebase_core/ios"
|
:path: ".symlinks/plugins/firebase_core/ios"
|
||||||
|
firebase_crashlytics:
|
||||||
|
:path: ".symlinks/plugins/firebase_crashlytics/ios"
|
||||||
firebase_messaging:
|
firebase_messaging:
|
||||||
:path: ".symlinks/plugins/firebase_messaging/ios"
|
:path: ".symlinks/plugins/firebase_messaging/ios"
|
||||||
|
firebase_performance:
|
||||||
|
:path: ".symlinks/plugins/firebase_performance/ios"
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
|
flutter_keyboard_visibility:
|
||||||
|
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
|
||||||
|
flutter_native_splash:
|
||||||
|
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
||||||
flutter_secure_storage:
|
flutter_secure_storage:
|
||||||
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
||||||
flutter_webrtc:
|
flutter_webrtc:
|
||||||
@ -255,12 +387,12 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||||
permission_handler_apple:
|
permission_handler_apple:
|
||||||
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||||
|
pointer_interceptor_ios:
|
||||||
|
:path: ".symlinks/plugins/pointer_interceptor_ios/ios"
|
||||||
protocol_handler_ios:
|
protocol_handler_ios:
|
||||||
:path: ".symlinks/plugins/protocol_handler_ios/ios"
|
:path: ".symlinks/plugins/protocol_handler_ios/ios"
|
||||||
screen_brightness_ios:
|
screen_brightness_ios:
|
||||||
:path: ".symlinks/plugins/screen_brightness_ios/ios"
|
:path: ".symlinks/plugins/screen_brightness_ios/ios"
|
||||||
sentry_flutter:
|
|
||||||
:path: ".symlinks/plugins/sentry_flutter/ios"
|
|
||||||
share_plus:
|
share_plus:
|
||||||
:path: ".symlinks/plugins/share_plus/ios"
|
:path: ".symlinks/plugins/share_plus/ios"
|
||||||
shared_preferences_foundation:
|
shared_preferences_foundation:
|
||||||
@ -280,36 +412,51 @@ SPEC CHECKSUMS:
|
|||||||
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
|
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
|
||||||
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
|
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
|
||||||
file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
|
file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
|
||||||
Firebase: cec914dab6fd7b1bd8ab56ea07ce4e03dd251c2d
|
Firebase: 9f574c08c2396885b5e7e100ed4293d956218af9
|
||||||
firebase_core: 57aeb91680e5d5e6df6b888064be7c785f146efb
|
firebase_analytics: 1a66fe8d4375eccff44671ea37897683a78b2675
|
||||||
firebase_messaging: c862b3d2b973ecc769194dc8de09bd22c77ae757
|
firebase_core: ceec591a66629daaee82d3321551692c4a871493
|
||||||
FirebaseCore: 30e9c1cbe3d38f5f5e75f48bfcea87d7c358ec16
|
firebase_crashlytics: e4f04180f443d5a8b56fbc0685bdbd7d90dd26f0
|
||||||
FirebaseCoreInternal: df84dd300b561c27d5571684f389bf60b0a5c934
|
firebase_messaging: 15d8b557010f3bb7b98d0302e1c7c8fbcd244425
|
||||||
FirebaseInstallations: 913cf60d0400ebd5d6b63a28b290372ab44590dd
|
firebase_performance: d373c742649e2d85d92cc223b4511c3d132887ef
|
||||||
FirebaseMessaging: 7b5d8033e183ab59eb5b852a53201559e976d366
|
FirebaseABTesting: c2e22c3aab99afa81d0561708b2c1c356c556976
|
||||||
|
FirebaseAnalytics: 27eb78b97880ea4a004839b9bac0b58880f5a92a
|
||||||
|
FirebaseCore: 3cf438f431f18c12cdf2aaf64434648b63f7e383
|
||||||
|
FirebaseCoreExtension: aa5c9779c2d0d39d83f1ceb3fdbafe80c4feecfa
|
||||||
|
FirebaseCoreInternal: adefedc9a88dbe393c4884640a73ec9e8e790f8c
|
||||||
|
FirebaseCrashlytics: 745d8f0221fe49c62865391d1bf56f5a12eeec0b
|
||||||
|
FirebaseInstallations: d0a8fea5a6fa91abc661591cf57c0f0d70863e57
|
||||||
|
FirebaseMessaging: d2d1d9c62c46dd2db49a952f7deb5b16ad2c9742
|
||||||
|
FirebasePerformance: efdc02bacb1b4710588c9f867011605c081cdf79
|
||||||
|
FirebaseRemoteConfig: 05521e937b72e01847a7128da5a492327364c705
|
||||||
|
FirebaseRemoteConfigInterop: abf8b1bbc0bf1b84abd22b66746926410bf91a87
|
||||||
|
FirebaseSessions: 78f137e68dc01ca71606169ba4ac73b98c13752a
|
||||||
|
FirebaseSharedSwift: 260a35e08943ec810d820a70bc0359136351d0c5
|
||||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||||
|
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
||||||
|
flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778
|
||||||
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
|
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
|
||||||
flutter_webrtc: 75b868e4f9e817c7a9a42ca4b6169063de4eec9f
|
flutter_webrtc: 75b868e4f9e817c7a9a42ca4b6169063de4eec9f
|
||||||
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
|
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
|
||||||
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
|
GoogleAppMeasurement: 6e49ffac7d3f2c3ded9cc663f912a13b67bbd0de
|
||||||
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
|
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
|
||||||
|
GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d
|
||||||
image_cropper: 37d40f62177c101ff4c164906d259ea2c3aa70cf
|
image_cropper: 37d40f62177c101ff4c164906d259ea2c3aa70cf
|
||||||
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
|
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
|
||||||
livekit_client: bad83a7776a41abc42e1f26d903eeac9164c8a9f
|
livekit_client: d079c5f040d4bf2b80440ff0ae997725a183e4bc
|
||||||
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
|
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
|
||||||
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
|
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
|
||||||
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
|
||||||
nanopb: 438bc412db1928dac798aa6fd75726007be04262
|
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
|
||||||
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
|
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
|
||||||
pasteboard: 982969ebaa7c78af3e6cc7761e8f5e77565d9ce0
|
pasteboard: 982969ebaa7c78af3e6cc7761e8f5e77565d9ce0
|
||||||
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
|
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
|
||||||
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||||
|
pointer_interceptor_ios: 508241697ff0947f853c061945a8b822463947c1
|
||||||
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
||||||
|
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
|
||||||
protocol_handler_ios: a5db8abc38526ee326988b808be621e5fd568990
|
protocol_handler_ios: a5db8abc38526ee326988b808be621e5fd568990
|
||||||
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
|
||||||
SDWebImage: 066c47b573f408f18caa467d71deace7c0f8280d
|
SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3
|
||||||
Sentry: 96ae1dcdf01a644bc3a3b1dc279cecaf48a833fb
|
|
||||||
sentry_flutter: 090351ce1ff5f96a4b33ef9455b7e3b28185387d
|
|
||||||
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
|
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
|
||||||
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
|
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
|
||||||
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
|
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
|
||||||
|
@ -254,6 +254,7 @@
|
|||||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
B1CDA9DD5B638A2BB88053CB /* [CP] Check Pods Manifest.lock */,
|
B1CDA9DD5B638A2BB88053CB /* [CP] Check Pods Manifest.lock */,
|
||||||
|
7356FAC42C72724B0051A465 /* [Crashlytics] Clear dSYM */,
|
||||||
9740EEB61CF901F6004384FC /* Run Script */,
|
9740EEB61CF901F6004384FC /* Run Script */,
|
||||||
97C146EA1CF9000F007C117D /* Sources */,
|
97C146EA1CF9000F007C117D /* Sources */,
|
||||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||||
@ -263,6 +264,7 @@
|
|||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||||
287A33C298CA352A7E7F32A4 /* [CP] Embed Pods Frameworks */,
|
287A33C298CA352A7E7F32A4 /* [CP] Embed Pods Frameworks */,
|
||||||
0818E8E4321C0D7433E07576 /* [CP] Copy Pods Resources */,
|
0818E8E4321C0D7433E07576 /* [CP] Copy Pods Resources */,
|
||||||
|
1A9FD6BE5DEE99CDA7399504 /* [Crashlytics] Upload dSYM */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@ -365,6 +367,24 @@
|
|||||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
|
||||||
showEnvVarsInLog = 0;
|
showEnvVarsInLog = 0;
|
||||||
};
|
};
|
||||||
|
1A9FD6BE5DEE99CDA7399504 /* [Crashlytics] Upload dSYM */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
name = "[Crashlytics] Upload dSYM";
|
||||||
|
outputFileListPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\n#!/bin/bash\nsleep 1 # Without this, there seems a chance that the script runs before dSYM generation is finished \n$PODS_ROOT/FirebaseCrashlytics/upload-symbols -gsp $PROJECT_DIR/Runner/GoogleService-Info.plist -p ios $DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME\n";
|
||||||
|
};
|
||||||
259653AE41D478F4C6BAE9B2 /* [CP] Check Pods Manifest.lock */ = {
|
259653AE41D478F4C6BAE9B2 /* [CP] Check Pods Manifest.lock */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@ -420,6 +440,24 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||||
};
|
};
|
||||||
|
7356FAC42C72724B0051A465 /* [Crashlytics] Clear dSYM */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
name = "[Crashlytics] Clear dSYM";
|
||||||
|
outputFileListPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\n#!/bin/bash\nrm -rf $DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME\n";
|
||||||
|
};
|
||||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
alwaysOutOfDate = 1;
|
alwaysOutOfDate = 1;
|
||||||
@ -433,7 +471,7 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
|
||||||
};
|
};
|
||||||
B1CDA9DD5B638A2BB88053CB /* [CP] Check Pods Manifest.lock */ = {
|
B1CDA9DD5B638A2BB88053CB /* [CP] Check Pods Manifest.lock */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
import Flutter
|
import Flutter
|
||||||
|
|
||||||
@UIApplicationMain
|
@main
|
||||||
@objc class AppDelegate: FlutterAppDelegate {
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
override func application(
|
override func application(
|
||||||
_ application: UIApplication,
|
_ application: UIApplication,
|
||||||
|
22
ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "background.png",
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filename" : "darkbackground.png",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png
vendored
Normal file
After Width: | Height: | Size: 69 B |
BIN
ios/Runner/Assets.xcassets/LaunchBackground.imageset/darkbackground.png
vendored
Normal file
After Width: | Height: | Size: 69 B |
@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "LaunchImage.png",
|
"filename" : "LaunchImage.png",
|
||||||
|
"idiom" : "universal",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "LaunchImage@2x.png",
|
"filename" : "LaunchImage@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "LaunchImage@3x.png",
|
"filename" : "LaunchImage@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"author" : "xcode",
|
||||||
"author" : "xcode"
|
"version" : 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 117 KiB |
Before Width: | Height: | Size: 68 B After Width: | Height: | Size: 233 KiB |
@ -16,13 +16,19 @@
|
|||||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" image="LaunchBackground" translatesAutoresizingMaskIntoConstraints="NO" id="tWc-Dq-wcI"/>
|
||||||
</imageView>
|
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"></imageView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
<constraint firstItem="YRO-k0-Ey4" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="3T2-ad-Qdv"/>
|
||||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
<constraint firstItem="tWc-Dq-wcI" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="RPx-PI-7Xg"/>
|
||||||
|
<constraint firstItem="tWc-Dq-wcI" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="SdS-ul-q2q"/>
|
||||||
|
<constraint firstAttribute="trailing" secondItem="tWc-Dq-wcI" secondAttribute="trailing" id="Swv-Gf-Rwn"/>
|
||||||
|
<constraint firstAttribute="trailing" secondItem="YRO-k0-Ey4" secondAttribute="trailing" id="TQA-XW-tRk"/>
|
||||||
|
<constraint firstItem="YRO-k0-Ey4" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="duK-uY-Gun"/>
|
||||||
|
<constraint firstItem="tWc-Dq-wcI" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="kV7-tw-vXt"/>
|
||||||
|
<constraint firstItem="YRO-k0-Ey4" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="xPn-NY-SIU"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
</viewController>
|
</viewController>
|
||||||
@ -32,6 +38,7 @@
|
|||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="LaunchImage" width="168" height="185"/>
|
<image name="LaunchImage" width="1026" height="1024"/>
|
||||||
|
<image name="LaunchBackground" width="1" height="1"/>
|
||||||
</resources>
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
@ -1,85 +1,87 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleURLTypes</key>
|
<key>CFBundleURLTypes</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleURLName</key>
|
<key>CFBundleURLName</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>CFBundleTypeRole</key>
|
<key>CFBundleTypeRole</key>
|
||||||
<string>Editor</string>
|
<string>Editor</string>
|
||||||
<key>CFBundleURLSchemes</key>
|
<key>CFBundleURLSchemes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>solink</string>
|
<string>solink</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>FirebaseMessagingAutoInitEnabled</key>
|
<key>FirebaseMessagingAutoInitEnabled</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
<string>Solian</string>
|
<string>Solian</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>solian</string>
|
<string>solian</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>Allow you take photo/video for your message or post</string>
|
<string>Allow you take photo/video for your message or post</string>
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
<string>Allow you record audio for your message or post</string>
|
<string>Allow you record audio for your message or post</string>
|
||||||
<key>NSPhotoLibraryUsageDescription</key>
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
<string>Allow you add photo to your message or post</string>
|
<string>Allow you add photo to your message or post</string>
|
||||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UIBackgroundModes</key>
|
<key>UIBackgroundModes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>audio</string>
|
<string>audio</string>
|
||||||
<string>fetch</string>
|
<string>fetch</string>
|
||||||
<string>remote-notification</string>
|
<string>remote-notification</string>
|
||||||
<string>voip</string>
|
<string>voip</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>LaunchScreen</string>
|
||||||
<key>UIMainStoryboardFile</key>
|
<key>UIMainStoryboardFile</key>
|
||||||
<string>Main</string>
|
<string>Main</string>
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
<key>FlutterDeepLinkingEnabled</key>
|
<key>FlutterDeepLinkingEnabled</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSUserActivityTypes</key>
|
<key>NSUserActivityTypes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>INSendMessageIntent</string>
|
<string>INSendMessageIntent</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
<key>UIStatusBarHidden</key>
|
||||||
|
<false/>
|
||||||
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -112,13 +112,18 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
label: 'bsPreparingData',
|
label: 'bsPreparingData',
|
||||||
action: () async {
|
action: () async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isTrue) {
|
try {
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
Get.find<RealmProvider>().refreshAvailableRealms(),
|
|
||||||
Get.find<ChannelProvider>().refreshAvailableChannel(),
|
|
||||||
Get.find<RelationshipProvider>().refreshRelativeList(),
|
|
||||||
Get.find<StickerProvider>().refreshAvailableStickers(),
|
Get.find<StickerProvider>().refreshAvailableStickers(),
|
||||||
|
if (auth.isAuthorized.isTrue)
|
||||||
|
Get.find<ChannelProvider>().refreshAvailableChannel(),
|
||||||
|
if (auth.isAuthorized.isTrue)
|
||||||
|
Get.find<RelationshipProvider>().refreshRelativeList(),
|
||||||
|
if (auth.isAuthorized.isTrue)
|
||||||
|
Get.find<RealmProvider>().refreshAvailableRealms(),
|
||||||
]);
|
]);
|
||||||
|
} catch (e) {
|
||||||
|
context.showErrorDialog(e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -162,28 +167,29 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_isBusy || _isErrored) {
|
if (_isBusy || _isErrored) {
|
||||||
return Material(
|
return GestureDetector(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
child: Material(
|
||||||
child: Column(
|
color: Theme.of(context).colorScheme.surface,
|
||||||
mainAxisSize: MainAxisSize.max,
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
SizedBox(
|
children: [
|
||||||
height: 280,
|
SizedBox(
|
||||||
child: Align(
|
height: 280,
|
||||||
alignment: Alignment.bottomCenter,
|
child: Align(
|
||||||
child: ClipRRect(
|
alignment: Alignment.bottomCenter,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
child: ClipRRect(
|
||||||
child: Image.asset('assets/logo.png', width: 80, height: 80),
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
|
child:
|
||||||
|
Image.asset('assets/logo.png', width: 80, height: 80),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Column(
|
||||||
GestureDetector(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
if (_isErrored && !_isDismissable && !_isBusy)
|
if (_isErrored && !_isDismissable && !_isBusy)
|
||||||
const Icon(Icons.cancel, size: 24),
|
const Icon(Icons.cancel, size: 24),
|
||||||
if (_isErrored && _isDismissable)
|
if (_isErrored && _isDismissable && !_isBusy)
|
||||||
const Icon(Icons.warning, size: 24),
|
const Icon(Icons.warning, size: 24),
|
||||||
if ((_isErrored && _isDismissable && _isBusy) || _isBusy)
|
if ((_isErrored && _isDismissable && _isBusy) || _isBusy)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
@ -214,6 +220,15 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
color: _unFocusColor,
|
color: _unFocusColor,
|
||||||
),
|
),
|
||||||
).paddingOnly(bottom: 4),
|
).paddingOnly(bottom: 4),
|
||||||
|
if (!_isBusy && _isErrored && _isDismissable)
|
||||||
|
Text(
|
||||||
|
'bsDismissibleErrorHint'.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: _unFocusColor,
|
||||||
|
),
|
||||||
|
).paddingOnly(bottom: 5),
|
||||||
Text(
|
Text(
|
||||||
'2024 © Solsynth LLC',
|
'2024 © Solsynth LLC',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -227,25 +242,25 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () {
|
],
|
||||||
if (_isBusy) return;
|
),
|
||||||
if (_isDismissable) {
|
|
||||||
setState(() {
|
|
||||||
_isBusy = false;
|
|
||||||
_isErrored = false;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
_isBusy = true;
|
|
||||||
_isErrored = false;
|
|
||||||
_periodCursor = 0;
|
|
||||||
});
|
|
||||||
_runPeriods();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
onTap: () {
|
||||||
|
if (_isBusy) return;
|
||||||
|
if (_isDismissable) {
|
||||||
|
setState(() {
|
||||||
|
_isBusy = false;
|
||||||
|
_isErrored = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_isBusy = true;
|
||||||
|
_isErrored = false;
|
||||||
|
_periodCursor = 0;
|
||||||
|
});
|
||||||
|
_runPeriods();
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,12 +10,14 @@ import 'package:solian/widgets/posts/editor/post_editor_categories_tags.dart';
|
|||||||
import 'package:solian/widgets/posts/editor/post_editor_date.dart';
|
import 'package:solian/widgets/posts/editor/post_editor_date.dart';
|
||||||
import 'package:solian/widgets/posts/editor/post_editor_overview.dart';
|
import 'package:solian/widgets/posts/editor/post_editor_overview.dart';
|
||||||
import 'package:solian/widgets/posts/editor/post_editor_publish_zone.dart';
|
import 'package:solian/widgets/posts/editor/post_editor_publish_zone.dart';
|
||||||
|
import 'package:solian/widgets/posts/editor/post_editor_thumbnail.dart';
|
||||||
import 'package:solian/widgets/posts/editor/post_editor_visibility.dart';
|
import 'package:solian/widgets/posts/editor/post_editor_visibility.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
class PostEditorController extends GetxController {
|
class PostEditorController extends GetxController {
|
||||||
late final SharedPreferences _prefs;
|
late final SharedPreferences _prefs;
|
||||||
|
|
||||||
|
final aliasController = TextEditingController();
|
||||||
final titleController = TextEditingController();
|
final titleController = TextEditingController();
|
||||||
final descriptionController = TextEditingController();
|
final descriptionController = TextEditingController();
|
||||||
final contentController = TextEditingController();
|
final contentController = TextEditingController();
|
||||||
@ -29,8 +31,9 @@ class PostEditorController extends GetxController {
|
|||||||
Rx<Realm?> realmZone = Rx(null);
|
Rx<Realm?> realmZone = Rx(null);
|
||||||
Rx<DateTime?> publishedAt = Rx(null);
|
Rx<DateTime?> publishedAt = Rx(null);
|
||||||
Rx<DateTime?> publishedUntil = Rx(null);
|
Rx<DateTime?> publishedUntil = Rx(null);
|
||||||
RxList<int> attachments = RxList<int>.empty(growable: true);
|
RxList<String> attachments = RxList<String>.empty(growable: true);
|
||||||
RxList<String> tags = RxList<String>.empty(growable: true);
|
RxList<String> tags = RxList<String>.empty(growable: true);
|
||||||
|
Rx<String?> thumbnail = Rx(null);
|
||||||
|
|
||||||
RxList<int> visibleUsers = RxList.empty(growable: true);
|
RxList<int> visibleUsers = RxList.empty(growable: true);
|
||||||
RxList<int> invisibleUsers = RxList.empty(growable: true);
|
RxList<int> invisibleUsers = RxList.empty(growable: true);
|
||||||
@ -113,18 +116,27 @@ class PostEditorController extends GetxController {
|
|||||||
return showModalBottomSheet(
|
return showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AttachmentEditorPopup(
|
builder: (context) => AttachmentEditorPopup(
|
||||||
usage: 'i.attachment',
|
pool: 'interactive',
|
||||||
initialAttachments: attachments,
|
initialAttachments: attachments,
|
||||||
onAdd: (int value) {
|
onAdd: (String value) {
|
||||||
attachments.add(value);
|
attachments.add(value);
|
||||||
},
|
},
|
||||||
onRemove: (int value) {
|
onRemove: (String value) {
|
||||||
attachments.remove(value);
|
attachments.remove(value);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> editThumbnail(BuildContext context) {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => PostEditorThumbnailDialog(
|
||||||
|
controller: this,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void toggleDraftMode() {
|
void toggleDraftMode() {
|
||||||
isDraft.value = !isDraft.value;
|
isDraft.value = !isDraft.value;
|
||||||
}
|
}
|
||||||
@ -157,6 +169,7 @@ class PostEditorController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void currentClear() {
|
void currentClear() {
|
||||||
|
aliasController.clear();
|
||||||
titleController.clear();
|
titleController.clear();
|
||||||
descriptionController.clear();
|
descriptionController.clear();
|
||||||
contentController.clear();
|
contentController.clear();
|
||||||
@ -165,6 +178,7 @@ class PostEditorController extends GetxController {
|
|||||||
visibleUsers.clear();
|
visibleUsers.clear();
|
||||||
invisibleUsers.clear();
|
invisibleUsers.clear();
|
||||||
visibility.value = 0;
|
visibility.value = 0;
|
||||||
|
thumbnail.value = null;
|
||||||
publishedAt.value = null;
|
publishedAt.value = null;
|
||||||
publishedUntil.value = null;
|
publishedUntil.value = null;
|
||||||
isDraft.value = false;
|
isDraft.value = false;
|
||||||
@ -185,17 +199,25 @@ class PostEditorController extends GetxController {
|
|||||||
|
|
||||||
type = value.type;
|
type = value.type;
|
||||||
editTo.value = value;
|
editTo.value = value;
|
||||||
|
realmZone.value = value.realm;
|
||||||
isDraft.value = value.isDraft ?? false;
|
isDraft.value = value.isDraft ?? false;
|
||||||
|
aliasController.text = value.alias ?? '';
|
||||||
titleController.text = value.body['title'] ?? '';
|
titleController.text = value.body['title'] ?? '';
|
||||||
descriptionController.text = value.body['description'] ?? '';
|
descriptionController.text = value.body['description'] ?? '';
|
||||||
contentController.text = value.body['content'] ?? '';
|
contentController.text = value.body['content'] ?? '';
|
||||||
publishedAt.value = value.publishedAt;
|
publishedAt.value = value.publishedAt;
|
||||||
publishedUntil.value = value.publishedUntil;
|
publishedUntil.value = value.publishedUntil;
|
||||||
tags.value =
|
tags.value = List.from(
|
||||||
value.body['tags']?.map((x) => x['alias']).toList() ?? List.empty();
|
value.body['tags']?.map((x) => x['alias']).toList() ?? List.empty(),
|
||||||
|
growable: true,
|
||||||
|
);
|
||||||
tags.refresh();
|
tags.refresh();
|
||||||
attachments.value = value.body['attachments']?.cast<int>() ?? List.empty();
|
attachments.value = List.from(
|
||||||
|
value.body['attachments'] ?? List.empty(),
|
||||||
|
growable: true,
|
||||||
|
);
|
||||||
attachments.refresh();
|
attachments.refresh();
|
||||||
|
thumbnail.value = value.body['thumbnail'];
|
||||||
|
|
||||||
contentLength.value = contentController.text.length;
|
contentLength.value = contentController.text.length;
|
||||||
}
|
}
|
||||||
@ -243,9 +265,11 @@ class PostEditorController extends GetxController {
|
|||||||
|
|
||||||
Map<String, dynamic> get payload {
|
Map<String, dynamic> get payload {
|
||||||
return {
|
return {
|
||||||
|
'alias': aliasController.text,
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'content': contentController.text,
|
'content': contentController.text,
|
||||||
|
'thumbnail': thumbnail.value,
|
||||||
'tags': tags.map((x) => {'alias': x}).toList(),
|
'tags': tags.map((x) => {'alias': x}).toList(),
|
||||||
'attachments': attachments,
|
'attachments': attachments,
|
||||||
'visible_users': visibleUsers,
|
'visible_users': visibleUsers,
|
||||||
@ -263,19 +287,33 @@ class PostEditorController extends GetxController {
|
|||||||
|
|
||||||
set payload(Map<String, dynamic> value) {
|
set payload(Map<String, dynamic> value) {
|
||||||
type = value['type'];
|
type = value['type'];
|
||||||
tags.value = value['tags'].map((x) => x['alias']).toList().cast<String>();
|
tags.value = List.from(
|
||||||
|
value['tags'].map((x) => x['alias']).toList(),
|
||||||
|
growable: true,
|
||||||
|
);
|
||||||
|
aliasController.text = value['alias'] ?? '';
|
||||||
titleController.text = value['title'] ?? '';
|
titleController.text = value['title'] ?? '';
|
||||||
descriptionController.text = value['description'] ?? '';
|
descriptionController.text = value['description'] ?? '';
|
||||||
contentController.text = value['content'] ?? '';
|
contentController.text = value['content'] ?? '';
|
||||||
attachments.value = value['attachments'].cast<int>() ?? List.empty();
|
attachments.value = List.from(
|
||||||
|
value['attachments'] ?? List.empty(),
|
||||||
|
growable: true,
|
||||||
|
);
|
||||||
attachments.refresh();
|
attachments.refresh();
|
||||||
|
thumbnail.value = value['thumbnail'];
|
||||||
visibility.value = value['visibility'];
|
visibility.value = value['visibility'];
|
||||||
isDraft.value = value['is_draft'];
|
isDraft.value = value['is_draft'];
|
||||||
if (value['visible_users'] != null) {
|
if (value['visible_users'] != null) {
|
||||||
visibleUsers.value = value['visible_users'].cast<int>();
|
visibleUsers.value = List.from(
|
||||||
|
value['visible_users'],
|
||||||
|
growable: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (value['invisible_users'] != null) {
|
if (value['invisible_users'] != null) {
|
||||||
invisibleUsers.value = value['invisible_users'].cast<int>();
|
invisibleUsers.value = List.from(
|
||||||
|
value['invisible_users'],
|
||||||
|
growable: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (value['published_at'] != null) {
|
if (value['published_at'] != null) {
|
||||||
publishedAt.value = DateTime.parse(value['published_at']).toLocal();
|
publishedAt.value = DateTime.parse(value['published_at']).toLocal();
|
||||||
@ -304,11 +342,13 @@ class PostEditorController extends GetxController {
|
|||||||
|
|
||||||
bool get isNotEmpty {
|
bool get isNotEmpty {
|
||||||
return [
|
return [
|
||||||
|
aliasController.text.isNotEmpty,
|
||||||
titleController.text.isNotEmpty,
|
titleController.text.isNotEmpty,
|
||||||
descriptionController.text.isNotEmpty,
|
descriptionController.text.isNotEmpty,
|
||||||
contentController.text.isNotEmpty,
|
contentController.text.isNotEmpty,
|
||||||
attachments.isNotEmpty,
|
attachments.isNotEmpty,
|
||||||
tags.isNotEmpty
|
tags.isNotEmpty,
|
||||||
|
thumbnail.value != null,
|
||||||
].any((x) => x);
|
].any((x) => x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,26 +1,39 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:solian/models/pagination.dart';
|
import 'package:solian/models/pagination.dart';
|
||||||
import 'package:solian/models/post.dart';
|
import 'package:solian/models/post.dart';
|
||||||
import 'package:solian/providers/content/posts.dart';
|
import 'package:solian/providers/content/posts.dart';
|
||||||
|
|
||||||
class PostListController extends GetxController {
|
class PostListController extends GetxController {
|
||||||
|
late final SharedPreferences _prefs;
|
||||||
|
|
||||||
String? author;
|
String? author;
|
||||||
|
|
||||||
/// The polling source modifier.
|
/// The polling source modifier.
|
||||||
/// - `0`: default recommendations
|
/// - `0`: default recommendations
|
||||||
/// - `1`: shuffle mode
|
/// - `1`: friend mode
|
||||||
|
/// - `2`: shuffle mode
|
||||||
RxInt mode = 0.obs;
|
RxInt mode = 0.obs;
|
||||||
|
|
||||||
/// The paging controller for infinite loading.
|
/// The paging controller for infinite loading.
|
||||||
/// Only available when mode is `0`.
|
/// Only available when mode is `0` or `1`.
|
||||||
PagingController<int, Post> pagingController =
|
PagingController<int, Post> pagingController =
|
||||||
PagingController(firstPageKey: 0);
|
PagingController(firstPageKey: 0);
|
||||||
|
|
||||||
PostListController({this.author}) {
|
PostListController({this.author}) {
|
||||||
|
_initPreferences();
|
||||||
_initPagingController();
|
_initPagingController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _initPreferences() {
|
||||||
|
SharedPreferences.getInstance().then((prefs) {
|
||||||
|
_prefs = prefs;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// Initialize a compatibility layer to paging controller
|
/// Initialize a compatibility layer to paging controller
|
||||||
void _initPagingController() {
|
void _initPagingController() {
|
||||||
pagingController.addPageRequestListener(_onPagingControllerRequest);
|
pagingController.addPageRequestListener(_onPagingControllerRequest);
|
||||||
@ -95,6 +108,13 @@ class PostListController extends GetxController {
|
|||||||
final idx = <dynamic>{};
|
final idx = <dynamic>{};
|
||||||
postList.retainWhere((x) => idx.add(x.id));
|
postList.retainWhere((x) => idx.add(x.id));
|
||||||
|
|
||||||
|
var lastId = postList.map((x) => x.id).reduce(max);
|
||||||
|
if (_prefs.containsKey('feed_last_read_at')) {
|
||||||
|
final storedId = _prefs.getInt('feed_last_read_at') ?? 0;
|
||||||
|
lastId = max(storedId, lastId);
|
||||||
|
}
|
||||||
|
_prefs.setInt('feed_last_read_at', lastId);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,10 +131,23 @@ class PostListController extends GetxController {
|
|||||||
author: author,
|
author: author,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
resp = await provider.listRecommendations(
|
switch (mode.value) {
|
||||||
pageKey,
|
case 2:
|
||||||
channel: mode.value == 0 ? null : 'shuffle',
|
resp = await provider.listRecommendations(
|
||||||
);
|
pageKey,
|
||||||
|
channel: 'shuffle',
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
resp = await provider.listRecommendations(
|
||||||
|
pageKey,
|
||||||
|
channel: 'friends',
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
resp = await provider.listRecommendations(pageKey);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
rethrow;
|
rethrow;
|
||||||
|
10
lib/exceptions/request.dart
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class RequestException implements Exception {
|
||||||
|
final Response data;
|
||||||
|
|
||||||
|
const RequestException(this.data);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'Request failed ${data.statusCode}: ${data.bodyString}';
|
||||||
|
}
|
6
lib/exceptions/unauthorized.dart
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class UnauthorizedException implements Exception {
|
||||||
|
const UnauthorizedException();
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'Unauthorized';
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
|
|
||||||
extension SolianExtenions on BuildContext {
|
extension SolianExtenions on BuildContext {
|
||||||
void showSnackbar(String content, {SnackBarAction? action}) {
|
void showSnackbar(String content, {SnackBarAction? action}) {
|
||||||
@ -48,15 +50,48 @@ extension SolianExtenions on BuildContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showErrorDialog(dynamic exception) {
|
Future<void> showErrorDialog(dynamic exception) {
|
||||||
var stack = StackTrace.current;
|
Widget content = Text(exception.toString().capitalize!);
|
||||||
var stackTrace = '$stack';
|
if (exception is UnauthorizedException) {
|
||||||
|
content = Text('errorHappenedUnauthorized'.tr);
|
||||||
|
}
|
||||||
|
if (exception is RequestException) {
|
||||||
|
String overall;
|
||||||
|
switch (exception.data.statusCode) {
|
||||||
|
case 400:
|
||||||
|
overall = 'errorHappenedRequestBad'.tr;
|
||||||
|
break;
|
||||||
|
case 401:
|
||||||
|
overall = 'errorHappenedUnauthorized'.tr;
|
||||||
|
break;
|
||||||
|
case 403:
|
||||||
|
overall = 'errorHappenedRequestForbidden'.tr;
|
||||||
|
break;
|
||||||
|
case 404:
|
||||||
|
overall = 'errorHappenedRequestNotFound'.tr;
|
||||||
|
break;
|
||||||
|
case null:
|
||||||
|
overall = 'errorHappenedRequestConnection'.tr;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
overall = 'errorHappenedRequestUnknown'.tr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exception.data.statusCode != null) {
|
||||||
|
content = Text(
|
||||||
|
'$overall\n\n(${exception.data.statusCode}) ${exception.data.bodyString}',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
content = Text(overall);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return showDialog<void>(
|
return showDialog<void>(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
context: this,
|
context: this,
|
||||||
builder: (ctx) => AlertDialog(
|
builder: (ctx) => AlertDialog(
|
||||||
title: Text('errorHappened'.tr),
|
title: Text('errorHappened'.tr),
|
||||||
content: Text('${exception.toString().capitalize!}\n\nStack Trace: $stackTrace'),
|
content: content,
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.pop(ctx),
|
onPressed: () => Navigator.pop(ctx),
|
||||||
|
@ -85,4 +85,5 @@ class DefaultFirebaseOptions {
|
|||||||
storageBucket: 'solian-0x001.appspot.com',
|
storageBucket: 'solian-0x001.appspot.com',
|
||||||
measurementId: 'G-EF9BZMKBC3',
|
measurementId: 'G-EF9BZMKBC3',
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
}
|
@ -1,4 +1,7 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
|
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_acrylic/flutter_acrylic.dart';
|
import 'package:flutter_acrylic/flutter_acrylic.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -6,11 +9,12 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:media_kit/media_kit.dart';
|
import 'package:media_kit/media_kit.dart';
|
||||||
import 'package:protocol_handler/protocol_handler.dart';
|
import 'package:protocol_handler/protocol_handler.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
|
||||||
import 'package:solian/bootstrapper.dart';
|
import 'package:solian/bootstrapper.dart';
|
||||||
import 'package:solian/firebase_options.dart';
|
import 'package:solian/firebase_options.dart';
|
||||||
import 'package:solian/platform.dart';
|
import 'package:solian/platform.dart';
|
||||||
import 'package:solian/providers/attachment_uploader.dart';
|
import 'package:solian/providers/attachment_uploader.dart';
|
||||||
|
import 'package:solian/providers/daily_sign.dart';
|
||||||
|
import 'package:solian/providers/link_expander.dart';
|
||||||
import 'package:solian/providers/stickers.dart';
|
import 'package:solian/providers/stickers.dart';
|
||||||
import 'package:solian/providers/theme_switcher.dart';
|
import 'package:solian/providers/theme_switcher.dart';
|
||||||
import 'package:solian/providers/websocket.dart';
|
import 'package:solian/providers/websocket.dart';
|
||||||
@ -29,32 +33,29 @@ import 'package:solian/translations.dart';
|
|||||||
import 'package:flutter_web_plugins/url_strategy.dart' show usePathUrlStrategy;
|
import 'package:flutter_web_plugins/url_strategy.dart' show usePathUrlStrategy;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
await SentryFlutter.init(
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
(options) {
|
MediaKit.ensureInitialized();
|
||||||
options.dsn =
|
|
||||||
'https://55438cdff9048aa2225df72fdc629c42@o4506965897117696.ingest.us.sentry.io/4507357676437504';
|
|
||||||
options.tracesSampleRate = 1.0;
|
|
||||||
options.profilesSampleRate = 1.0;
|
|
||||||
},
|
|
||||||
appRunner: () async {
|
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
|
||||||
MediaKit.ensureInitialized();
|
|
||||||
|
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
_initializeFirebase(),
|
_initializeFirebase(),
|
||||||
_initializePlatformComponents(),
|
_initializePlatformComponents(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
GoRouter.optionURLReflectsImperativeAPIs = true;
|
GoRouter.optionURLReflectsImperativeAPIs = true;
|
||||||
|
|
||||||
usePathUrlStrategy();
|
usePathUrlStrategy();
|
||||||
runApp(const SolianApp());
|
runApp(const SolianApp());
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _initializeFirebase() async {
|
Future<void> _initializeFirebase() async {
|
||||||
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
||||||
|
FlutterError.onError = (errorDetails) {
|
||||||
|
FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails);
|
||||||
|
};
|
||||||
|
PlatformDispatcher.instance.onError = (error, stack) {
|
||||||
|
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _initializePlatformComponents() async {
|
Future<void> _initializePlatformComponents() async {
|
||||||
@ -129,5 +130,7 @@ class SolianApp extends StatelessWidget {
|
|||||||
Get.lazyPut(() => RealmProvider());
|
Get.lazyPut(() => RealmProvider());
|
||||||
Get.lazyPut(() => ChatCallProvider());
|
Get.lazyPut(() => ChatCallProvider());
|
||||||
Get.lazyPut(() => AttachmentUploaderController());
|
Get.lazyPut(() => AttachmentUploaderController());
|
||||||
|
Get.lazyPut(() => LinkExpandProvider());
|
||||||
|
Get.lazyPut(() => DailySignProvider());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,47 @@
|
|||||||
import 'package:solian/models/account.dart';
|
import 'package:solian/models/account.dart';
|
||||||
|
|
||||||
|
class AttachmentPlaceholder {
|
||||||
|
int chunkCount;
|
||||||
|
int chunkSize;
|
||||||
|
Attachment meta;
|
||||||
|
|
||||||
|
AttachmentPlaceholder({
|
||||||
|
required this.chunkCount,
|
||||||
|
required this.chunkSize,
|
||||||
|
required this.meta,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory AttachmentPlaceholder.fromJson(Map<String, dynamic> json) =>
|
||||||
|
AttachmentPlaceholder(
|
||||||
|
chunkCount: json['chunk_count'],
|
||||||
|
chunkSize: json['chunk_size'],
|
||||||
|
meta: Attachment.fromJson(json['meta']),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'chunk_count': chunkCount,
|
||||||
|
'chunk_size': chunkSize,
|
||||||
|
'meta': meta.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class Attachment {
|
class Attachment {
|
||||||
int id;
|
int id;
|
||||||
DateTime createdAt;
|
DateTime createdAt;
|
||||||
DateTime updatedAt;
|
DateTime updatedAt;
|
||||||
DateTime? deletedAt;
|
DateTime? deletedAt;
|
||||||
|
String rid;
|
||||||
String uuid;
|
String uuid;
|
||||||
int size;
|
int size;
|
||||||
String name;
|
String name;
|
||||||
String alt;
|
String alt;
|
||||||
String usage;
|
|
||||||
String mimetype;
|
String mimetype;
|
||||||
String hash;
|
String hash;
|
||||||
int destination;
|
int destination;
|
||||||
bool isAnalyzed;
|
bool isAnalyzed;
|
||||||
|
bool isUploaded;
|
||||||
Map<String, dynamic>? metadata;
|
Map<String, dynamic>? metadata;
|
||||||
|
Map<String, dynamic>? fileChunks;
|
||||||
bool isMature;
|
bool isMature;
|
||||||
Account? account;
|
Account? account;
|
||||||
int? accountId;
|
int? accountId;
|
||||||
@ -24,58 +51,67 @@ class Attachment {
|
|||||||
required this.createdAt,
|
required this.createdAt,
|
||||||
required this.updatedAt,
|
required this.updatedAt,
|
||||||
required this.deletedAt,
|
required this.deletedAt,
|
||||||
|
required this.rid,
|
||||||
required this.uuid,
|
required this.uuid,
|
||||||
required this.size,
|
required this.size,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.alt,
|
required this.alt,
|
||||||
required this.usage,
|
|
||||||
required this.mimetype,
|
required this.mimetype,
|
||||||
required this.hash,
|
required this.hash,
|
||||||
required this.destination,
|
required this.destination,
|
||||||
required this.isAnalyzed,
|
required this.isAnalyzed,
|
||||||
|
required this.isUploaded,
|
||||||
required this.metadata,
|
required this.metadata,
|
||||||
|
required this.fileChunks,
|
||||||
required this.isMature,
|
required this.isMature,
|
||||||
required this.account,
|
required this.account,
|
||||||
required this.accountId,
|
required this.accountId,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Attachment.fromJson(Map<String, dynamic> json) => Attachment(
|
factory Attachment.fromJson(Map<String, dynamic> json) => Attachment(
|
||||||
id: json['id'],
|
id: json['id'],
|
||||||
createdAt: DateTime.parse(json['created_at']),
|
createdAt: DateTime.parse(json['created_at']),
|
||||||
updatedAt: DateTime.parse(json['updated_at']),
|
updatedAt: DateTime.parse(json['updated_at']),
|
||||||
deletedAt: json['deleted_at'] != null ? DateTime.parse(json['deleted_at']) : null,
|
deletedAt: json['deleted_at'] != null
|
||||||
uuid: json['uuid'],
|
? DateTime.parse(json['deleted_at'])
|
||||||
size: json['size'],
|
: null,
|
||||||
name: json['name'],
|
rid: json['rid'],
|
||||||
alt: json['alt'],
|
uuid: json['uuid'],
|
||||||
usage: json['usage'],
|
size: json['size'],
|
||||||
mimetype: json['mimetype'],
|
name: json['name'],
|
||||||
hash: json['hash'],
|
alt: json['alt'],
|
||||||
destination: json['destination'],
|
mimetype: json['mimetype'],
|
||||||
isAnalyzed: json['is_analyzed'],
|
hash: json['hash'],
|
||||||
metadata: json['metadata'],
|
destination: json['destination'],
|
||||||
isMature: json['is_mature'],
|
isAnalyzed: json['is_analyzed'],
|
||||||
account: json['account'] != null ? Account.fromJson(json['account']) : null,
|
isUploaded: json['is_uploaded'],
|
||||||
accountId: json['account_id'],
|
metadata: json['metadata'],
|
||||||
);
|
fileChunks: json['file_chunks'],
|
||||||
|
isMature: json['is_mature'],
|
||||||
|
account:
|
||||||
|
json['account'] != null ? Account.fromJson(json['account']) : null,
|
||||||
|
accountId: json['account_id'],
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'id': id,
|
'id': id,
|
||||||
'created_at': createdAt.toIso8601String(),
|
'created_at': createdAt.toIso8601String(),
|
||||||
'updated_at': updatedAt.toIso8601String(),
|
'updated_at': updatedAt.toIso8601String(),
|
||||||
'deleted_at': deletedAt?.toIso8601String(),
|
'deleted_at': deletedAt?.toIso8601String(),
|
||||||
'uuid': uuid,
|
'rid': rid,
|
||||||
'size': size,
|
'uuid': uuid,
|
||||||
'name': name,
|
'size': size,
|
||||||
'alt': alt,
|
'name': name,
|
||||||
'usage': usage,
|
'alt': alt,
|
||||||
'mimetype': mimetype,
|
'mimetype': mimetype,
|
||||||
'hash': hash,
|
'hash': hash,
|
||||||
'destination': destination,
|
'destination': destination,
|
||||||
'is_analyzed': isAnalyzed,
|
'is_analyzed': isAnalyzed,
|
||||||
'metadata': metadata,
|
'is_uploaded': isUploaded,
|
||||||
'is_mature': isMature,
|
'metadata': metadata,
|
||||||
'account': account?.toJson(),
|
'file_chunks': fileChunks,
|
||||||
'account_id': accountId,
|
'is_mature': isMature,
|
||||||
};
|
'account': account?.toJson(),
|
||||||
}
|
'account_id': accountId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
48
lib/models/daily_sign.dart
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:solian/models/account.dart';
|
||||||
|
|
||||||
|
part 'daily_sign.g.dart';
|
||||||
|
|
||||||
|
@JsonSerializable()
|
||||||
|
class DailySignRecord {
|
||||||
|
int id;
|
||||||
|
DateTime createdAt;
|
||||||
|
DateTime updatedAt;
|
||||||
|
DateTime? deletedAt;
|
||||||
|
Account account;
|
||||||
|
int resultTier;
|
||||||
|
int resultExperience;
|
||||||
|
int accountId;
|
||||||
|
|
||||||
|
DailySignRecord({
|
||||||
|
required this.id,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
required this.deletedAt,
|
||||||
|
required this.resultTier,
|
||||||
|
required this.resultExperience,
|
||||||
|
required this.account,
|
||||||
|
required this.accountId,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory DailySignRecord.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$DailySignRecordFromJson(json);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$DailySignRecordToJson(this);
|
||||||
|
|
||||||
|
String get symbol => switch (resultTier) {
|
||||||
|
0 => '大\n凶',
|
||||||
|
1 => '凶',
|
||||||
|
2 => '中\n平',
|
||||||
|
3 => '吉',
|
||||||
|
_ => '大\n吉',
|
||||||
|
};
|
||||||
|
|
||||||
|
String get overviewSuggestion => switch (resultTier) {
|
||||||
|
0 => '诸事不宜',
|
||||||
|
1 => '有些不宜',
|
||||||
|
2 => '平平淡淡',
|
||||||
|
3 => '有些事宜',
|
||||||
|
_ => '诸事皆宜',
|
||||||
|
};
|
||||||
|
}
|
33
lib/models/daily_sign.g.dart
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'daily_sign.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
DailySignRecord _$DailySignRecordFromJson(Map<String, dynamic> json) =>
|
||||||
|
DailySignRecord(
|
||||||
|
id: (json['id'] as num).toInt(),
|
||||||
|
createdAt: DateTime.parse(json['created_at'] as String),
|
||||||
|
updatedAt: DateTime.parse(json['updated_at'] as String),
|
||||||
|
deletedAt: json['deleted_at'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['deleted_at'] as String),
|
||||||
|
resultTier: (json['result_tier'] as num).toInt(),
|
||||||
|
resultExperience: (json['result_experience'] as num).toInt(),
|
||||||
|
account: Account.fromJson(json['account'] as Map<String, dynamic>),
|
||||||
|
accountId: (json['account_id'] as num).toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$DailySignRecordToJson(DailySignRecord instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'created_at': instance.createdAt.toIso8601String(),
|
||||||
|
'updated_at': instance.updatedAt.toIso8601String(),
|
||||||
|
'deleted_at': instance.deletedAt?.toIso8601String(),
|
||||||
|
'account': instance.account.toJson(),
|
||||||
|
'result_tier': instance.resultTier,
|
||||||
|
'result_experience': instance.resultExperience,
|
||||||
|
'account_id': instance.accountId,
|
||||||
|
};
|
@ -63,7 +63,7 @@ class Event {
|
|||||||
class EventMessageBody {
|
class EventMessageBody {
|
||||||
String text;
|
String text;
|
||||||
String algorithm;
|
String algorithm;
|
||||||
List<int>? attachments;
|
List<String>? attachments;
|
||||||
int? quoteEvent;
|
int? quoteEvent;
|
||||||
int? relatedEvent;
|
int? relatedEvent;
|
||||||
List<int>? relatedUsers;
|
List<int>? relatedUsers;
|
||||||
@ -82,7 +82,7 @@ class EventMessageBody {
|
|||||||
text: json['text'] ?? '',
|
text: json['text'] ?? '',
|
||||||
algorithm: json['algorithm'] ?? 'plain',
|
algorithm: json['algorithm'] ?? 'plain',
|
||||||
attachments: json['attachments'] != null
|
attachments: json['attachments'] != null
|
||||||
? List<int>.from(json['attachments'].map((x) => x))
|
? List<String>.from(json['attachments']?.whereType<String>())
|
||||||
: null,
|
: null,
|
||||||
quoteEvent: json['quote_event'],
|
quoteEvent: json['quote_event'],
|
||||||
relatedEvent: json['related_event'],
|
relatedEvent: json['related_event'],
|
||||||
|
65
lib/models/link.dart
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
class LinkMeta {
|
||||||
|
int id;
|
||||||
|
DateTime createdAt;
|
||||||
|
DateTime updatedAt;
|
||||||
|
DateTime? deletedAt;
|
||||||
|
String entryId;
|
||||||
|
String? icon;
|
||||||
|
String url;
|
||||||
|
String? title;
|
||||||
|
String? image;
|
||||||
|
String? video;
|
||||||
|
String? audio;
|
||||||
|
String? description;
|
||||||
|
String? siteName;
|
||||||
|
|
||||||
|
LinkMeta({
|
||||||
|
required this.id,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
required this.deletedAt,
|
||||||
|
required this.entryId,
|
||||||
|
required this.icon,
|
||||||
|
required this.url,
|
||||||
|
required this.title,
|
||||||
|
required this.image,
|
||||||
|
required this.video,
|
||||||
|
required this.audio,
|
||||||
|
required this.description,
|
||||||
|
required this.siteName,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LinkMeta.fromJson(Map<String, dynamic> json) => LinkMeta(
|
||||||
|
id: json['id'],
|
||||||
|
createdAt: DateTime.parse(json['created_at']),
|
||||||
|
updatedAt: DateTime.parse(json['updated_at']),
|
||||||
|
deletedAt: json['deleted_at'] != null
|
||||||
|
? DateTime.parse(json['deleted_at'])
|
||||||
|
: null,
|
||||||
|
entryId: json['entry_id'],
|
||||||
|
icon: json['icon'],
|
||||||
|
url: json['url'],
|
||||||
|
title: json['title'],
|
||||||
|
image: json['image'],
|
||||||
|
video: json['video'],
|
||||||
|
audio: json['audio'],
|
||||||
|
description: json['description'],
|
||||||
|
siteName: json['site_name'],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'id': id,
|
||||||
|
'created_at': createdAt.toIso8601String(),
|
||||||
|
'updated_at': updatedAt.toIso8601String(),
|
||||||
|
'deleted_at': deletedAt?.toIso8601String(),
|
||||||
|
'entry_id': entryId,
|
||||||
|
'icon': icon,
|
||||||
|
'url': url,
|
||||||
|
'title': title,
|
||||||
|
'image': image,
|
||||||
|
'video': video,
|
||||||
|
'audio': audio,
|
||||||
|
'description': description,
|
||||||
|
'site_name': siteName,
|
||||||
|
};
|
||||||
|
}
|
@ -1,22 +1,26 @@
|
|||||||
class NetworkPackage {
|
class NetworkPackage {
|
||||||
String method;
|
String method;
|
||||||
|
String? endpoint;
|
||||||
String? message;
|
String? message;
|
||||||
Map<String, dynamic>? payload;
|
Map<String, dynamic>? payload;
|
||||||
|
|
||||||
NetworkPackage({
|
NetworkPackage({
|
||||||
required this.method,
|
required this.method,
|
||||||
|
this.endpoint,
|
||||||
this.message,
|
this.message,
|
||||||
this.payload,
|
this.payload,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory NetworkPackage.fromJson(Map<String, dynamic> json) => NetworkPackage(
|
factory NetworkPackage.fromJson(Map<String, dynamic> json) => NetworkPackage(
|
||||||
method: json['w'],
|
method: json['w'],
|
||||||
|
endpoint: json['e'],
|
||||||
message: json['m'],
|
message: json['m'],
|
||||||
payload: json['p'],
|
payload: json['p'],
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'w': method,
|
'w': method,
|
||||||
|
'e': endpoint,
|
||||||
'm': message,
|
'm': message,
|
||||||
'p': payload,
|
'p': payload,
|
||||||
};
|
};
|
||||||
|
@ -8,6 +8,8 @@ class Post {
|
|||||||
DateTime updatedAt;
|
DateTime updatedAt;
|
||||||
DateTime? editedAt;
|
DateTime? editedAt;
|
||||||
DateTime? deletedAt;
|
DateTime? deletedAt;
|
||||||
|
String? alias;
|
||||||
|
String? areaAlias;
|
||||||
dynamic body;
|
dynamic body;
|
||||||
List<Tag>? tags;
|
List<Tag>? tags;
|
||||||
List<Category>? categories;
|
List<Category>? categories;
|
||||||
@ -33,6 +35,8 @@ class Post {
|
|||||||
required this.updatedAt,
|
required this.updatedAt,
|
||||||
required this.editedAt,
|
required this.editedAt,
|
||||||
required this.deletedAt,
|
required this.deletedAt,
|
||||||
|
required this.alias,
|
||||||
|
required this.areaAlias,
|
||||||
required this.type,
|
required this.type,
|
||||||
required this.body,
|
required this.body,
|
||||||
required this.tags,
|
required this.tags,
|
||||||
@ -60,6 +64,8 @@ class Post {
|
|||||||
deletedAt: json['deleted_at'] != null
|
deletedAt: json['deleted_at'] != null
|
||||||
? DateTime.parse(json['deleted_at'])
|
? DateTime.parse(json['deleted_at'])
|
||||||
: null,
|
: null,
|
||||||
|
alias: json['alias'],
|
||||||
|
areaAlias: json['area_alias'],
|
||||||
type: json['type'],
|
type: json['type'],
|
||||||
body: json['body'],
|
body: json['body'],
|
||||||
tags: json['tags']?.map((x) => Tag.fromJson(x)).toList().cast<Tag>(),
|
tags: json['tags']?.map((x) => Tag.fromJson(x)).toList().cast<Tag>(),
|
||||||
@ -101,6 +107,8 @@ class Post {
|
|||||||
'updated_at': updatedAt.toIso8601String(),
|
'updated_at': updatedAt.toIso8601String(),
|
||||||
'edited_at': editedAt?.toIso8601String(),
|
'edited_at': editedAt?.toIso8601String(),
|
||||||
'deleted_at': deletedAt?.toIso8601String(),
|
'deleted_at': deletedAt?.toIso8601String(),
|
||||||
|
'alias': alias,
|
||||||
|
'area_alias': areaAlias,
|
||||||
'type': type,
|
'type': type,
|
||||||
'body': body,
|
'body': body,
|
||||||
'tags': tags,
|
'tags': tags,
|
||||||
|
@ -52,6 +52,17 @@ class Realm {
|
|||||||
'is_community': isCommunity,
|
'is_community': isCommunity,
|
||||||
'account_id': accountId,
|
'account_id': accountId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (other is Realm) {
|
||||||
|
return other.id == id;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => id;
|
||||||
}
|
}
|
||||||
|
|
||||||
class RealmMember {
|
class RealmMember {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:solian/models/account.dart';
|
import 'package:solian/models/account.dart';
|
||||||
import 'package:solian/models/attachment.dart';
|
import 'package:solian/models/attachment.dart';
|
||||||
|
import 'package:solian/services.dart';
|
||||||
|
|
||||||
class Sticker {
|
class Sticker {
|
||||||
int id;
|
int id;
|
||||||
@ -30,6 +31,14 @@ class Sticker {
|
|||||||
required this.account,
|
required this.account,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
String get textPlaceholder => '${pack?.prefix}$alias';
|
||||||
|
String get textWarpedPlaceholder => ':$textPlaceholder:';
|
||||||
|
|
||||||
|
String get imageUrl => ServiceFinder.buildUrl(
|
||||||
|
'files',
|
||||||
|
'/attachments/${attachment.rid}',
|
||||||
|
);
|
||||||
|
|
||||||
factory Sticker.fromJson(Map<String, dynamic> json) => Sticker(
|
factory Sticker.fromJson(Map<String, dynamic> json) => Sticker(
|
||||||
id: json['id'],
|
id: json['id'],
|
||||||
createdAt: DateTime.parse(json['created_at']),
|
createdAt: DateTime.parse(json['created_at']),
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
import 'package:solian/models/account_status.dart';
|
import 'package:solian/models/account_status.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/services.dart';
|
import 'package:solian/services.dart';
|
||||||
@ -33,15 +35,14 @@ class StatusProvider extends GetConnect {
|
|||||||
|
|
||||||
Future<Response> getCurrentStatus() async {
|
Future<Response> getCurrentStatus() async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('auth');
|
final client = auth.configureClient('auth');
|
||||||
|
|
||||||
return await client.get('/users/me/status');
|
return await client.get('/users/me/status');
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> getSomeoneStatus(String name) =>
|
Future<Response> getSomeoneStatus(String name) => get('/users/$name/status');
|
||||||
get('/users/$name/status');
|
|
||||||
|
|
||||||
Future<Response> setStatus(
|
Future<Response> setStatus(
|
||||||
String type,
|
String type,
|
||||||
@ -53,7 +54,7 @@ class StatusProvider extends GetConnect {
|
|||||||
DateTime? clearAt,
|
DateTime? clearAt,
|
||||||
}) async {
|
}) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('auth');
|
final client = auth.configureClient('auth');
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ class StatusProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -82,13 +83,13 @@ class StatusProvider extends GetConnect {
|
|||||||
|
|
||||||
Future<Response> clearStatus() async {
|
Future<Response> clearStatus() async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('auth');
|
final client = auth.configureClient('auth');
|
||||||
|
|
||||||
final resp = await client.delete('/users/me/status');
|
final resp = await client.delete('/users/me/status');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
|
@ -1,24 +1,27 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:collection';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:cross_file/cross_file.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:path/path.dart' show basename;
|
||||||
import 'package:solian/models/attachment.dart';
|
import 'package:solian/models/attachment.dart';
|
||||||
import 'package:solian/providers/content/attachment.dart';
|
import 'package:solian/providers/content/attachment.dart';
|
||||||
|
|
||||||
class AttachmentUploadTask {
|
class AttachmentUploadTask {
|
||||||
File file;
|
XFile file;
|
||||||
String usage;
|
String pool;
|
||||||
Map<String, dynamic>? metadata;
|
Map<String, dynamic>? metadata;
|
||||||
|
Map<String, int>? chunkFiles;
|
||||||
|
|
||||||
double progress = 0;
|
double? progress;
|
||||||
bool isUploading = false;
|
bool isUploading = false;
|
||||||
bool isCompleted = false;
|
bool isCompleted = false;
|
||||||
dynamic error;
|
dynamic error;
|
||||||
|
|
||||||
AttachmentUploadTask({
|
AttachmentUploadTask({
|
||||||
required this.file,
|
required this.file,
|
||||||
required this.usage,
|
required this.pool,
|
||||||
this.metadata,
|
this.metadata,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -73,32 +76,36 @@ class AttachmentUploaderController extends GetxController {
|
|||||||
|
|
||||||
_startProgressSyncTimer();
|
_startProgressSyncTimer();
|
||||||
queueOfUpload[queueIndex].isUploading = true;
|
queueOfUpload[queueIndex].isUploading = true;
|
||||||
|
queueOfUpload[queueIndex].progress = 0;
|
||||||
|
|
||||||
final task = queueOfUpload[queueIndex];
|
final task = queueOfUpload[queueIndex];
|
||||||
final result = await _rawUploadAttachment(
|
try {
|
||||||
await task.file.readAsBytes(),
|
final result = await _chunkedUploadAttachment(
|
||||||
task.file.path,
|
task.file,
|
||||||
task.usage,
|
task.pool,
|
||||||
null,
|
null,
|
||||||
onProgress: (value) {
|
onData: (_) {},
|
||||||
queueOfUpload[queueIndex].progress = value;
|
onProgress: (progress) {
|
||||||
_progressOfUpload = value;
|
queueOfUpload[queueIndex].progress = progress;
|
||||||
},
|
_progressOfUpload = progress;
|
||||||
onError: (err) {
|
},
|
||||||
queueOfUpload[queueIndex].error = err;
|
);
|
||||||
queueOfUpload[queueIndex].isUploading = false;
|
return result;
|
||||||
},
|
} catch (err) {
|
||||||
);
|
queueOfUpload[queueIndex].error = err;
|
||||||
|
queueOfUpload[queueIndex].isUploading = false;
|
||||||
|
} finally {
|
||||||
|
_progressOfUpload = 1;
|
||||||
|
if (queueOfUpload[queueIndex].error == null) {
|
||||||
|
queueOfUpload.removeAt(queueIndex);
|
||||||
|
}
|
||||||
|
_stopProgressSyncTimer();
|
||||||
|
_syncProgress();
|
||||||
|
|
||||||
if (queueOfUpload[queueIndex].error == null) {
|
isUploading.value = false;
|
||||||
queueOfUpload.removeAt(queueIndex);
|
|
||||||
}
|
}
|
||||||
_stopProgressSyncTimer();
|
|
||||||
_syncProgress();
|
|
||||||
|
|
||||||
isUploading.value = false;
|
return null;
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> performUploadQueue({
|
Future<void> performUploadQueue({
|
||||||
@ -115,100 +122,126 @@ class AttachmentUploaderController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
queueOfUpload[idx].isUploading = true;
|
queueOfUpload[idx].isUploading = true;
|
||||||
|
queueOfUpload[idx].progress = 0;
|
||||||
|
|
||||||
final task = queueOfUpload[idx];
|
final task = queueOfUpload[idx];
|
||||||
final result = await _rawUploadAttachment(
|
try {
|
||||||
await task.file.readAsBytes(),
|
final result = await _chunkedUploadAttachment(
|
||||||
task.file.path,
|
task.file,
|
||||||
task.usage,
|
task.pool,
|
||||||
null,
|
null,
|
||||||
onProgress: (value) {
|
onData: (_) {},
|
||||||
queueOfUpload[idx].progress = value;
|
onProgress: (progress) {
|
||||||
_progressOfUpload = (idx + value) / queueOfUpload.length;
|
queueOfUpload[idx].progress = progress;
|
||||||
},
|
},
|
||||||
onError: (err) {
|
);
|
||||||
queueOfUpload[idx].error = err;
|
if (result != null) onData(result);
|
||||||
queueOfUpload[idx].isUploading = false;
|
} catch (err) {
|
||||||
},
|
queueOfUpload[idx].error = err;
|
||||||
);
|
queueOfUpload[idx].isUploading = false;
|
||||||
_progressOfUpload = (idx + 1) / queueOfUpload.length;
|
} finally {
|
||||||
if (result != null) onData(result);
|
_progressOfUpload = (idx + 1) / queueOfUpload.length;
|
||||||
|
}
|
||||||
|
|
||||||
queueOfUpload[idx].isUploading = false;
|
queueOfUpload[idx].isUploading = false;
|
||||||
queueOfUpload[idx].isCompleted = true;
|
queueOfUpload[idx].isCompleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
queueOfUpload.value =
|
queueOfUpload.removeWhere((x) => x.error == null);
|
||||||
queueOfUpload.where((x) => x.error == null).toList(growable: true);
|
|
||||||
_stopProgressSyncTimer();
|
_stopProgressSyncTimer();
|
||||||
_syncProgress();
|
_syncProgress();
|
||||||
|
|
||||||
isUploading.value = false;
|
isUploading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> uploadAttachmentWithCallback(
|
Future<Attachment?> uploadAttachmentFromData(
|
||||||
Uint8List data,
|
Uint8List data,
|
||||||
String path,
|
String path,
|
||||||
String usage,
|
String pool,
|
||||||
Map<String, dynamic>? metadata,
|
|
||||||
Function(Attachment?) callback,
|
|
||||||
) async {
|
|
||||||
if (isUploading.value) throw Exception('uploading blocked');
|
|
||||||
|
|
||||||
isUploading.value = true;
|
|
||||||
final result = await _rawUploadAttachment(
|
|
||||||
data,
|
|
||||||
path,
|
|
||||||
usage,
|
|
||||||
metadata,
|
|
||||||
onProgress: (progress) {
|
|
||||||
progressOfUpload.value = progress;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
isUploading.value = false;
|
|
||||||
callback(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Attachment?> uploadAttachment(
|
|
||||||
Uint8List data,
|
|
||||||
String path,
|
|
||||||
String usage,
|
|
||||||
Map<String, dynamic>? metadata,
|
Map<String, dynamic>? metadata,
|
||||||
) async {
|
) async {
|
||||||
if (isUploading.value) throw Exception('uploading blocked');
|
if (isUploading.value) throw Exception('uploading blocked');
|
||||||
|
|
||||||
isUploading.value = true;
|
isUploading.value = true;
|
||||||
final result = await _rawUploadAttachment(
|
|
||||||
data,
|
|
||||||
path,
|
|
||||||
usage,
|
|
||||||
metadata,
|
|
||||||
onProgress: (progress) {
|
|
||||||
progressOfUpload.value = progress;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
isUploading.value = false;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Attachment?> _rawUploadAttachment(
|
final AttachmentProvider attach = Get.find();
|
||||||
Uint8List data, String path, String usage, Map<String, dynamic>? metadata,
|
|
||||||
{Function(double)? onProgress, Function(dynamic err)? onError}) async {
|
|
||||||
final AttachmentProvider provider = Get.find();
|
|
||||||
try {
|
try {
|
||||||
final result = await provider.createAttachment(
|
final result = await attach.createAttachmentDirectly(
|
||||||
data,
|
data,
|
||||||
path,
|
path,
|
||||||
usage,
|
pool,
|
||||||
metadata,
|
metadata,
|
||||||
onProgress: onProgress,
|
|
||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
} catch (err) {
|
} catch (_) {
|
||||||
if (onError != null) {
|
|
||||||
onError(err);
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
|
} finally {
|
||||||
|
isUploading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<Attachment?> _chunkedUploadAttachment(
|
||||||
|
XFile file,
|
||||||
|
String pool,
|
||||||
|
Map<String, dynamic>? metadata, {
|
||||||
|
required Function(AttachmentPlaceholder) onData,
|
||||||
|
required Function(double) onProgress,
|
||||||
|
}) async {
|
||||||
|
final AttachmentProvider attach = Get.find();
|
||||||
|
|
||||||
|
final holder = await attach.createAttachmentMultipartPlaceholder(
|
||||||
|
await file.length(),
|
||||||
|
file.path,
|
||||||
|
pool,
|
||||||
|
metadata,
|
||||||
|
);
|
||||||
|
onData(holder);
|
||||||
|
|
||||||
|
onProgress(0);
|
||||||
|
|
||||||
|
final filename = basename(file.path);
|
||||||
|
final chunks = holder.meta.fileChunks ?? {};
|
||||||
|
var currentTask = 0;
|
||||||
|
|
||||||
|
final queue = Queue<Future<void>>();
|
||||||
|
final activeTasks = <Future<void>>[];
|
||||||
|
|
||||||
|
for (final entry in chunks.entries) {
|
||||||
|
queue.add(() async {
|
||||||
|
final beginCursor = entry.value * holder.chunkSize;
|
||||||
|
final endCursor = (entry.value + 1) * holder.chunkSize;
|
||||||
|
final data = Uint8List.fromList(await file
|
||||||
|
.openRead(beginCursor, endCursor)
|
||||||
|
.expand((chunk) => chunk)
|
||||||
|
.toList());
|
||||||
|
|
||||||
|
final out = await attach.uploadAttachmentMultipartChunk(
|
||||||
|
data,
|
||||||
|
filename,
|
||||||
|
holder.meta.rid,
|
||||||
|
entry.key,
|
||||||
|
);
|
||||||
|
holder.meta = out;
|
||||||
|
|
||||||
|
currentTask++;
|
||||||
|
onProgress(currentTask / chunks.length);
|
||||||
|
onData(holder);
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
|
||||||
|
while (queue.isNotEmpty || activeTasks.isNotEmpty) {
|
||||||
|
while (activeTasks.length < 3 && queue.isNotEmpty) {
|
||||||
|
final task = queue.removeFirst();
|
||||||
|
activeTasks.add(task);
|
||||||
|
|
||||||
|
task.then((_) => activeTasks.remove(task));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeTasks.isNotEmpty) {
|
||||||
|
await Future.any(activeTasks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return holder.meta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_connect/http/src/request/request.dart';
|
import 'package:get/get_connect/http/src/request/request.dart';
|
||||||
import 'package:solian/controllers/chat_events_controller.dart';
|
import 'package:solian/controllers/chat_events_controller.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
import 'package:solian/providers/websocket.dart';
|
import 'package:solian/providers/websocket.dart';
|
||||||
import 'package:solian/services.dart';
|
import 'package:solian/services.dart';
|
||||||
|
|
||||||
@ -81,7 +83,7 @@ class AuthProvider extends GetConnect {
|
|||||||
'grant_type': 'refresh_token',
|
'grant_type': 'refresh_token',
|
||||||
});
|
});
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
credentials = TokenSet(
|
credentials = TokenSet(
|
||||||
accessToken: resp.body['access_token'],
|
accessToken: resp.body['access_token'],
|
||||||
@ -128,7 +130,7 @@ class AuthProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> ensureCredentials() async {
|
Future<void> ensureCredentials() async {
|
||||||
if (isAuthorized.isFalse) throw Exception('unauthorized');
|
if (isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
if (credentials == null) await loadCredentials();
|
if (credentials == null) await loadCredentials();
|
||||||
|
|
||||||
if (credentials!.isExpired) {
|
if (credentials!.isExpired) {
|
||||||
@ -158,7 +160,7 @@ class AuthProvider extends GetConnect {
|
|||||||
'password': password,
|
'password': password,
|
||||||
});
|
});
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.body);
|
throw RequestException(resp);
|
||||||
} else if (resp.body['is_finished'] == false) {
|
} else if (resp.body['is_finished'] == false) {
|
||||||
throw RiskyAuthenticateException(resp.body['ticket']['id']);
|
throw RiskyAuthenticateException(resp.body['ticket']['id']);
|
||||||
}
|
}
|
||||||
@ -218,7 +220,7 @@ class AuthProvider extends GetConnect {
|
|||||||
final client = configureClient('auth');
|
final client = configureClient('auth');
|
||||||
final resp = await client.get('/users/me');
|
final resp = await client.get('/users/me');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
userProfile.value = resp.body;
|
userProfile.value = resp.body;
|
||||||
|
@ -2,6 +2,8 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
import 'package:livekit_client/livekit_client.dart';
|
import 'package:livekit_client/livekit_client.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:solian/models/call.dart';
|
import 'package:solian/models/call.dart';
|
||||||
@ -17,6 +19,10 @@ class ChatCallProvider extends GetxController {
|
|||||||
RxBool isReady = false.obs;
|
RxBool isReady = false.obs;
|
||||||
RxBool isMounted = false.obs;
|
RxBool isMounted = false.obs;
|
||||||
RxBool isInitialized = false.obs;
|
RxBool isInitialized = false.obs;
|
||||||
|
RxBool isBusy = false.obs;
|
||||||
|
|
||||||
|
RxString lastDuration = '00:00:00'.obs;
|
||||||
|
Timer? lastDurationUpdateTimer;
|
||||||
|
|
||||||
String? token;
|
String? token;
|
||||||
String? endpoint;
|
String? endpoint;
|
||||||
@ -38,6 +44,34 @@ class ChatCallProvider extends GetxController {
|
|||||||
RxList<ParticipantTrack> participantTracks = RxList.empty(growable: true);
|
RxList<ParticipantTrack> participantTracks = RxList.empty(growable: true);
|
||||||
Rx<ParticipantTrack?> focusTrack = Rx(null);
|
Rx<ParticipantTrack?> focusTrack = Rx(null);
|
||||||
|
|
||||||
|
void _updateDuration() {
|
||||||
|
if (current.value == null) {
|
||||||
|
lastDuration.value = '00:00:00';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration duration = DateTime.now().difference(current.value!.createdAt);
|
||||||
|
|
||||||
|
String twoDigits(int n) => n.toString().padLeft(2, '0');
|
||||||
|
String formattedTime = '${twoDigits(duration.inHours)}:'
|
||||||
|
'${twoDigits(duration.inMinutes.remainder(60))}:'
|
||||||
|
'${twoDigits(duration.inSeconds.remainder(60))}';
|
||||||
|
lastDuration.value = formattedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDurationUpdater() {
|
||||||
|
_updateDuration();
|
||||||
|
lastDurationUpdateTimer = Timer.periodic(
|
||||||
|
const Duration(seconds: 1),
|
||||||
|
(_) => _updateDuration(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableDurationUpdater() {
|
||||||
|
lastDurationUpdateTimer?.cancel();
|
||||||
|
lastDurationUpdateTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> checkPermissions() async {
|
Future<void> checkPermissions() async {
|
||||||
if (lkPlatformIs(PlatformType.macOS) || lkPlatformIs(PlatformType.linux)) {
|
if (lkPlatformIs(PlatformType.macOS) || lkPlatformIs(PlatformType.linux)) {
|
||||||
return;
|
return;
|
||||||
@ -56,7 +90,7 @@ class ChatCallProvider extends GetxController {
|
|||||||
|
|
||||||
Future<(String, String)> getRoomToken() async {
|
Future<(String, String)> getRoomToken() async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('messaging');
|
final client = auth.configureClient('messaging');
|
||||||
|
|
||||||
@ -69,7 +103,7 @@ class ChatCallProvider extends GetxController {
|
|||||||
endpoint = 'wss://${resp.body['endpoint']}';
|
endpoint = 'wss://${resp.body['endpoint']}';
|
||||||
return (token!, endpoint!);
|
return (token!, endpoint!);
|
||||||
} else {
|
} else {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +122,30 @@ class ChatCallProvider extends GetxController {
|
|||||||
|
|
||||||
void initRoom() {
|
void initRoom() {
|
||||||
initHardware();
|
initHardware();
|
||||||
room = Room();
|
room = Room(
|
||||||
|
roomOptions: const RoomOptions(
|
||||||
|
dynacast: true,
|
||||||
|
adaptiveStream: true,
|
||||||
|
defaultAudioPublishOptions: AudioPublishOptions(
|
||||||
|
name: 'call_voice',
|
||||||
|
stream: 'call_stream',
|
||||||
|
),
|
||||||
|
defaultVideoPublishOptions: VideoPublishOptions(
|
||||||
|
name: 'call_video',
|
||||||
|
stream: 'call_stream',
|
||||||
|
simulcast: true,
|
||||||
|
backupVideoCodec: BackupVideoCodec(enabled: true),
|
||||||
|
),
|
||||||
|
defaultScreenShareCaptureOptions: ScreenShareCaptureOptions(
|
||||||
|
useiOSBroadcastExtension: true,
|
||||||
|
params: VideoParametersPresets.screenShareH1080FPS30,
|
||||||
|
),
|
||||||
|
defaultCameraCaptureOptions: CameraCaptureOptions(
|
||||||
|
maxFrameRate: 30,
|
||||||
|
params: VideoParametersPresets.h1080_169,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
listener = room.createListener();
|
listener = room.createListener();
|
||||||
WakelockPlus.enable();
|
WakelockPlus.enable();
|
||||||
}
|
}
|
||||||
@ -96,36 +153,12 @@ class ChatCallProvider extends GetxController {
|
|||||||
void joinRoom(String url, String token) async {
|
void joinRoom(String url, String token) async {
|
||||||
if (isMounted.value) {
|
if (isMounted.value) {
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
isMounted.value = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await room.connect(
|
await room.connect(
|
||||||
url,
|
url,
|
||||||
token,
|
token,
|
||||||
roomOptions: const RoomOptions(
|
|
||||||
dynacast: true,
|
|
||||||
adaptiveStream: true,
|
|
||||||
defaultAudioPublishOptions: AudioPublishOptions(
|
|
||||||
name: 'call_voice',
|
|
||||||
stream: 'call_stream',
|
|
||||||
),
|
|
||||||
defaultVideoPublishOptions: VideoPublishOptions(
|
|
||||||
name: 'call_video',
|
|
||||||
stream: 'call_stream',
|
|
||||||
simulcast: true,
|
|
||||||
backupVideoCodec: BackupVideoCodec(enabled: true),
|
|
||||||
),
|
|
||||||
defaultScreenShareCaptureOptions: ScreenShareCaptureOptions(
|
|
||||||
useiOSBroadcastExtension: true,
|
|
||||||
params: VideoParametersPresets.screenShareH1080FPS30,
|
|
||||||
),
|
|
||||||
defaultCameraCaptureOptions: CameraCaptureOptions(
|
|
||||||
maxFrameRate: 30,
|
|
||||||
params: VideoParametersPresets.h1080_169,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
fastConnectOptions: FastConnectOptions(
|
fastConnectOptions: FastConnectOptions(
|
||||||
microphone: TrackOption(track: audioTrack.value),
|
microphone: TrackOption(track: audioTrack.value),
|
||||||
camera: TrackOption(track: videoTrack.value),
|
camera: TrackOption(track: videoTrack.value),
|
||||||
@ -133,6 +166,8 @@ class ChatCallProvider extends GetxController {
|
|||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
rethrow;
|
rethrow;
|
||||||
|
} finally {
|
||||||
|
isMounted.value = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +187,7 @@ class ChatCallProvider extends GetxController {
|
|||||||
void onRoomDidUpdate() => sortParticipants();
|
void onRoomDidUpdate() => sortParticipants();
|
||||||
|
|
||||||
void setupRoom() {
|
void setupRoom() {
|
||||||
if(isInitialized.value) return;
|
if (isInitialized.value) return;
|
||||||
|
|
||||||
sortParticipants();
|
sortParticipants();
|
||||||
room.addListener(onRoomDidUpdate);
|
room.addListener(onRoomDidUpdate);
|
||||||
@ -164,6 +199,7 @@ class ChatCallProvider extends GetxController {
|
|||||||
Hardware.instance.setSpeakerphoneOn(true);
|
Hardware.instance.setSpeakerphoneOn(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isBusy.value = false;
|
||||||
isInitialized.value = true;
|
isInitialized.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,6 +402,7 @@ class ChatCallProvider extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void disposeRoom() {
|
void disposeRoom() {
|
||||||
|
isBusy.value = false;
|
||||||
isMounted.value = false;
|
isMounted.value = false;
|
||||||
isInitialized.value = false;
|
isInitialized.value = false;
|
||||||
current.value = null;
|
current.value = null;
|
||||||
|
@ -2,12 +2,13 @@ import 'dart:convert';
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
import 'package:solian/models/attachment.dart';
|
import 'package:solian/models/attachment.dart';
|
||||||
import 'package:solian/models/pagination.dart';
|
import 'package:solian/models/pagination.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/services.dart';
|
import 'package:solian/services.dart';
|
||||||
import 'package:dio/dio.dart' as dio;
|
|
||||||
|
|
||||||
class AttachmentProvider extends GetConnect {
|
class AttachmentProvider extends GetConnect {
|
||||||
static Map<String, String> mimetypeOverrides = {
|
static Map<String, String> mimetypeOverrides = {
|
||||||
@ -20,22 +21,22 @@ class AttachmentProvider extends GetConnect {
|
|||||||
httpClient.baseUrl = ServiceFinder.buildUrl('files', null);
|
httpClient.baseUrl = ServiceFinder.buildUrl('files', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<int, Attachment> _cachedResponses = {};
|
final Map<String, Attachment> _cachedResponses = {};
|
||||||
|
|
||||||
Future<List<Attachment?>> listMetadata(
|
Future<List<Attachment?>> listMetadata(
|
||||||
List<int> id, {
|
List<String> rid, {
|
||||||
noCache = false,
|
noCache = false,
|
||||||
}) async {
|
}) async {
|
||||||
if (id.isEmpty) return List.empty();
|
if (rid.isEmpty) return List.empty();
|
||||||
|
|
||||||
List<Attachment?> result = List.filled(id.length, null);
|
List<Attachment?> result = List.filled(rid.length, null);
|
||||||
List<int> pendingQuery = List.empty(growable: true);
|
List<String> pendingQuery = List.empty(growable: true);
|
||||||
if (!noCache) {
|
if (!noCache) {
|
||||||
for (var idx = 0; idx < id.length; idx++) {
|
for (var idx = 0; idx < rid.length; idx++) {
|
||||||
if (_cachedResponses.containsKey(id[idx])) {
|
if (_cachedResponses.containsKey(rid[idx])) {
|
||||||
result[idx] = _cachedResponses[id[idx]];
|
result[idx] = _cachedResponses[rid[idx]];
|
||||||
} else {
|
} else {
|
||||||
pendingQuery.add(id[idx]);
|
pendingQuery.add(rid[idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,12 +53,12 @@ class AttachmentProvider extends GetConnect {
|
|||||||
rawOut.data!.map((x) => Attachment.fromJson(x)).toList();
|
rawOut.data!.map((x) => Attachment.fromJson(x)).toList();
|
||||||
for (final item in out) {
|
for (final item in out) {
|
||||||
if (item.destination != 0 && item.isAnalyzed) {
|
if (item.destination != 0 && item.isAnalyzed) {
|
||||||
_cachedResponses[item.id] = item;
|
_cachedResponses[item.rid] = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var i = 0; i < out.length; i++) {
|
for (var i = 0; i < out.length; i++) {
|
||||||
for (var j = 0; j < id.length; j++) {
|
for (var j = 0; j < rid.length; j++) {
|
||||||
if (out[i].id == id[j]) {
|
if (out[i].rid == rid[j]) {
|
||||||
result[j] = out[i];
|
result[j] = out[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,16 +67,16 @@ class AttachmentProvider extends GetConnect {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Attachment?> getMetadata(int id, {noCache = false}) async {
|
Future<Attachment?> getMetadata(String rid, {noCache = false}) async {
|
||||||
if (!noCache && _cachedResponses.containsKey(id)) {
|
if (!noCache && _cachedResponses.containsKey(rid)) {
|
||||||
return _cachedResponses[id]!;
|
return _cachedResponses[rid]!;
|
||||||
}
|
}
|
||||||
|
|
||||||
final resp = await get('/attachments/$id/meta');
|
final resp = await get('/attachments/$rid/meta');
|
||||||
if (resp.statusCode == 200) {
|
if (resp.statusCode == 200) {
|
||||||
final result = Attachment.fromJson(resp.body);
|
final result = Attachment.fromJson(resp.body);
|
||||||
if (result.destination != 0 && result.isAnalyzed) {
|
if (result.destination != 0 && result.isAnalyzed) {
|
||||||
_cachedResponses[id] = result;
|
_cachedResponses[rid] = result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -83,14 +84,21 @@ class AttachmentProvider extends GetConnect {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Attachment> createAttachment(
|
Future<Attachment> createAttachmentDirectly(
|
||||||
Uint8List data, String path, String usage, Map<String, dynamic>? metadata,
|
Uint8List data,
|
||||||
{Function(double)? onProgress}) async {
|
String path,
|
||||||
|
String pool,
|
||||||
|
Map<String, dynamic>? metadata,
|
||||||
|
) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final filePayload =
|
final client = auth.configureClient(
|
||||||
dio.MultipartFile.fromBytes(data, filename: basename(path));
|
'uc',
|
||||||
|
timeout: const Duration(minutes: 3),
|
||||||
|
);
|
||||||
|
|
||||||
|
final filePayload = MultipartFile(data, filename: basename(path));
|
||||||
final fileAlt = basename(path).contains('.')
|
final fileAlt = basename(path).contains('.')
|
||||||
? basename(path).substring(0, basename(path).lastIndexOf('.'))
|
? basename(path).substring(0, basename(path).lastIndexOf('.'))
|
||||||
: basename(path);
|
: basename(path);
|
||||||
@ -103,51 +111,101 @@ class AttachmentProvider extends GetConnect {
|
|||||||
if (mimetypeOverrides.keys.contains(fileExt)) {
|
if (mimetypeOverrides.keys.contains(fileExt)) {
|
||||||
mimetypeOverride = mimetypeOverrides[fileExt];
|
mimetypeOverride = mimetypeOverrides[fileExt];
|
||||||
}
|
}
|
||||||
final payload = dio.FormData.fromMap({
|
final payload = FormData({
|
||||||
'alt': fileAlt,
|
'alt': fileAlt,
|
||||||
'file': filePayload,
|
'file': filePayload,
|
||||||
'usage': usage,
|
'pool': pool,
|
||||||
if (mimetypeOverride != null) 'mimetype': mimetypeOverride,
|
if (mimetypeOverride != null) 'mimetype': mimetypeOverride,
|
||||||
'metadata': jsonEncode(metadata),
|
'metadata': jsonEncode(metadata),
|
||||||
});
|
});
|
||||||
final resp = await dio.Dio(
|
final resp = await client.post('/attachments', payload);
|
||||||
dio.BaseOptions(
|
|
||||||
baseUrl: ServiceFinder.buildUrl('files', null),
|
|
||||||
headers: {'Authorization': 'Bearer ${auth.credentials!.accessToken}'},
|
|
||||||
),
|
|
||||||
).post(
|
|
||||||
'/attachments',
|
|
||||||
data: payload,
|
|
||||||
onSendProgress: (count, total) {
|
|
||||||
if (onProgress != null) onProgress(count / total);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.data);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Attachment.fromJson(resp.data);
|
return Attachment.fromJson(resp.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<AttachmentPlaceholder> createAttachmentMultipartPlaceholder(
|
||||||
|
int size,
|
||||||
|
String path,
|
||||||
|
String pool,
|
||||||
|
Map<String, dynamic>? metadata,
|
||||||
|
) async {
|
||||||
|
final AuthProvider auth = Get.find();
|
||||||
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
|
final client = auth.configureClient('uc');
|
||||||
|
|
||||||
|
final fileAlt = basename(path).contains('.')
|
||||||
|
? basename(path).substring(0, basename(path).lastIndexOf('.'))
|
||||||
|
: basename(path);
|
||||||
|
final fileExt = basename(path)
|
||||||
|
.substring(basename(path).lastIndexOf('.') + 1)
|
||||||
|
.toLowerCase();
|
||||||
|
|
||||||
|
// Override for some files cannot be detected mimetype by server-side
|
||||||
|
String? mimetypeOverride;
|
||||||
|
if (mimetypeOverrides.keys.contains(fileExt)) {
|
||||||
|
mimetypeOverride = mimetypeOverrides[fileExt];
|
||||||
|
}
|
||||||
|
final resp = await client.post('/attachments/multipart', {
|
||||||
|
'alt': fileAlt,
|
||||||
|
'name': basename(path),
|
||||||
|
'size': size,
|
||||||
|
'pool': pool,
|
||||||
|
if (mimetypeOverride != null) 'mimetype': mimetypeOverride,
|
||||||
|
'metadata': metadata,
|
||||||
|
});
|
||||||
|
if (resp.statusCode != 200) {
|
||||||
|
throw RequestException(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return AttachmentPlaceholder.fromJson(resp.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Attachment> uploadAttachmentMultipartChunk(
|
||||||
|
Uint8List data,
|
||||||
|
String name,
|
||||||
|
String rid,
|
||||||
|
String cid,
|
||||||
|
) async {
|
||||||
|
final AuthProvider auth = Get.find();
|
||||||
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
|
final client = auth.configureClient(
|
||||||
|
'uc',
|
||||||
|
timeout: const Duration(minutes: 3),
|
||||||
|
);
|
||||||
|
|
||||||
|
final payload = FormData({
|
||||||
|
'file': MultipartFile(data, filename: name),
|
||||||
|
});
|
||||||
|
final resp = await client.post('/attachments/multipart/$rid/$cid', payload);
|
||||||
|
if (resp.statusCode != 200) {
|
||||||
|
throw RequestException(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Attachment.fromJson(resp.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> updateAttachment(
|
Future<Response> updateAttachment(
|
||||||
int id,
|
int id,
|
||||||
String alt,
|
String alt, {
|
||||||
String usage, {
|
|
||||||
bool isMature = false,
|
bool isMature = false,
|
||||||
}) async {
|
}) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('files');
|
final client = auth.configureClient('files');
|
||||||
|
|
||||||
var resp = await client.put('/attachments/$id', {
|
var resp = await client.put('/attachments/$id', {
|
||||||
'alt': alt,
|
'alt': alt,
|
||||||
'usage': usage,
|
|
||||||
'is_mature': isMature,
|
'is_mature': isMature,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -155,19 +213,19 @@ class AttachmentProvider extends GetConnect {
|
|||||||
|
|
||||||
Future<Response> deleteAttachment(int id) async {
|
Future<Response> deleteAttachment(int id) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('files');
|
final client = auth.configureClient('files');
|
||||||
|
|
||||||
var resp = await client.delete('/attachments/$id');
|
var resp = await client.delete('/attachments/$id');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearCache({int? id}) {
|
void clearCache({String? id}) {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
_cachedResponses.remove(id);
|
_cachedResponses.remove(id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
import 'package:solian/models/channel.dart';
|
import 'package:solian/models/channel.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/widgets/account/relative_select.dart';
|
import 'package:solian/widgets/account/relative_select.dart';
|
||||||
@ -16,7 +18,7 @@ class ChannelProvider extends GetxController {
|
|||||||
|
|
||||||
Future<void> refreshAvailableChannel() async {
|
Future<void> refreshAvailableChannel() async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
final resp = await listAvailableChannel();
|
final resp = await listAvailableChannel();
|
||||||
@ -29,13 +31,13 @@ class ChannelProvider extends GetxController {
|
|||||||
|
|
||||||
Future<Response> getChannel(String alias, {String realm = 'global'}) async {
|
Future<Response> getChannel(String alias, {String realm = 'global'}) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('messaging');
|
final client = auth.configureClient('messaging');
|
||||||
|
|
||||||
final resp = await client.get('/channels/$realm/$alias');
|
final resp = await client.get('/channels/$realm/$alias');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -44,13 +46,13 @@ class ChannelProvider extends GetxController {
|
|||||||
Future<Response> getMyChannelProfile(String alias,
|
Future<Response> getMyChannelProfile(String alias,
|
||||||
{String realm = 'global'}) async {
|
{String realm = 'global'}) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('messaging');
|
final client = auth.configureClient('messaging');
|
||||||
|
|
||||||
final resp = await client.get('/channels/$realm/$alias/me');
|
final resp = await client.get('/channels/$realm/$alias/me');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -59,7 +61,7 @@ class ChannelProvider extends GetxController {
|
|||||||
Future<Response?> getChannelOngoingCall(String alias,
|
Future<Response?> getChannelOngoingCall(String alias,
|
||||||
{String realm = 'global'}) async {
|
{String realm = 'global'}) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('messaging');
|
final client = auth.configureClient('messaging');
|
||||||
|
|
||||||
@ -67,7 +69,7 @@ class ChannelProvider extends GetxController {
|
|||||||
if (resp.statusCode == 404) {
|
if (resp.statusCode == 404) {
|
||||||
return null;
|
return null;
|
||||||
} else if (resp.statusCode != 200) {
|
} else if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -75,13 +77,13 @@ class ChannelProvider extends GetxController {
|
|||||||
|
|
||||||
Future<Response> listChannel({String scope = 'global'}) async {
|
Future<Response> listChannel({String scope = 'global'}) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('messaging');
|
final client = auth.configureClient('messaging');
|
||||||
|
|
||||||
final resp = await client.get('/channels/$scope');
|
final resp = await client.get('/channels/$scope');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -89,13 +91,13 @@ class ChannelProvider extends GetxController {
|
|||||||
|
|
||||||
Future<Response> listAvailableChannel({String realm = 'global'}) async {
|
Future<Response> listAvailableChannel({String realm = 'global'}) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('messaging');
|
final client = auth.configureClient('messaging');
|
||||||
|
|
||||||
final resp = await client.get('/channels/$realm/me/available');
|
final resp = await client.get('/channels/$realm/me/available');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -103,13 +105,13 @@ class ChannelProvider extends GetxController {
|
|||||||
|
|
||||||
Future<Response> createChannel(String scope, dynamic payload) async {
|
Future<Response> createChannel(String scope, dynamic payload) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('messaging');
|
final client = auth.configureClient('messaging');
|
||||||
|
|
||||||
final resp = await client.post('/channels/$scope', payload);
|
final resp = await client.post('/channels/$scope', payload);
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -118,7 +120,7 @@ class ChannelProvider extends GetxController {
|
|||||||
Future<Response?> createDirectChannel(
|
Future<Response?> createDirectChannel(
|
||||||
BuildContext context, String scope) async {
|
BuildContext context, String scope) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final related = await showModalBottomSheet(
|
final related = await showModalBottomSheet(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
@ -141,7 +143,7 @@ class ChannelProvider extends GetxController {
|
|||||||
'is_encrypted': false,
|
'is_encrypted': false,
|
||||||
});
|
});
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -149,13 +151,13 @@ class ChannelProvider extends GetxController {
|
|||||||
|
|
||||||
Future<Response> updateChannel(String scope, int id, dynamic payload) async {
|
Future<Response> updateChannel(String scope, int id, dynamic payload) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('messaging');
|
final client = auth.configureClient('messaging');
|
||||||
|
|
||||||
final resp = await client.put('/channels/$scope/$id', payload);
|
final resp = await client.put('/channels/$scope/$id', payload);
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/services.dart';
|
import 'package:solian/services.dart';
|
||||||
|
|
||||||
@ -9,19 +11,26 @@ class PostProvider extends GetConnect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> listRecommendations(int page,
|
Future<Response> listRecommendations(int page,
|
||||||
{int? realm, String? channel}) async {
|
{String? realm, String? channel}) async {
|
||||||
|
GetConnect client;
|
||||||
|
final AuthProvider auth = Get.find();
|
||||||
final queries = [
|
final queries = [
|
||||||
'take=${10}',
|
'take=${10}',
|
||||||
'offset=$page',
|
'offset=$page',
|
||||||
if (realm != null) 'realmId=$realm',
|
if (realm != null) 'realm=$realm',
|
||||||
];
|
];
|
||||||
final resp = await get(
|
if (auth.isAuthorized.value) {
|
||||||
|
client = auth.configureClient('co');
|
||||||
|
} else {
|
||||||
|
client = ServiceFinder.configureClient('co');
|
||||||
|
}
|
||||||
|
final resp = await client.get(
|
||||||
channel == null
|
channel == null
|
||||||
? '/recommendations?${queries.join('&')}'
|
? '/recommendations?${queries.join('&')}'
|
||||||
: '/recommendations/$channel?${queries.join('&')}',
|
: '/recommendations/$channel?${queries.join('&')}',
|
||||||
);
|
);
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.body);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -29,7 +38,7 @@ class PostProvider extends GetConnect {
|
|||||||
|
|
||||||
Future<Response> listDraft(int page) async {
|
Future<Response> listDraft(int page) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final queries = [
|
final queries = [
|
||||||
'take=${10}',
|
'take=${10}',
|
||||||
@ -38,25 +47,25 @@ class PostProvider extends GetConnect {
|
|||||||
final client = auth.configureClient('interactive');
|
final client = auth.configureClient('interactive');
|
||||||
final resp = await client.get('/posts/drafts?${queries.join('&')}');
|
final resp = await client.get('/posts/drafts?${queries.join('&')}');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.body);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Response> listPost(int page,
|
Future<Response> listPost(int page,
|
||||||
{int? realm, String? author, tag, category}) async {
|
{String? realm, String? author, tag, category}) async {
|
||||||
final queries = [
|
final queries = [
|
||||||
'take=${10}',
|
'take=${10}',
|
||||||
'offset=$page',
|
'offset=$page',
|
||||||
if (tag != null) 'tag=$tag',
|
if (tag != null) 'tag=$tag',
|
||||||
if (category != null) 'category=$category',
|
if (category != null) 'category=$category',
|
||||||
if (author != null) 'author=$author',
|
if (author != null) 'author=$author',
|
||||||
if (realm != null) 'realmId=$realm',
|
if (realm != null) 'realm=$realm',
|
||||||
];
|
];
|
||||||
final resp = await get('/posts?${queries.join('&')}');
|
final resp = await get('/posts?${queries.join('&')}');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.body);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -65,7 +74,7 @@ class PostProvider extends GetConnect {
|
|||||||
Future<Response> listPostReplies(String alias, int page) async {
|
Future<Response> listPostReplies(String alias, int page) async {
|
||||||
final resp = await get('/posts/$alias/replies?take=${10}&offset=$page');
|
final resp = await get('/posts/$alias/replies?take=${10}&offset=$page');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.body);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -74,7 +83,7 @@ class PostProvider extends GetConnect {
|
|||||||
Future<Response> getPost(String alias) async {
|
Future<Response> getPost(String alias) async {
|
||||||
final resp = await get('/posts/$alias');
|
final resp = await get('/posts/$alias');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.body);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -83,7 +92,7 @@ class PostProvider extends GetConnect {
|
|||||||
Future<Response> getArticle(String alias) async {
|
Future<Response> getArticle(String alias) async {
|
||||||
final resp = await get('/articles/$alias');
|
final resp = await get('/articles/$alias');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.body);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
import 'package:solian/models/realm.dart';
|
import 'package:solian/models/realm.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
|
|
||||||
@ -8,7 +10,7 @@ class RealmProvider extends GetxController {
|
|||||||
|
|
||||||
Future<void> refreshAvailableRealms() async {
|
Future<void> refreshAvailableRealms() async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
final resp = await listAvailableRealm();
|
final resp = await listAvailableRealm();
|
||||||
@ -21,13 +23,13 @@ class RealmProvider extends GetxController {
|
|||||||
|
|
||||||
Future<Response> getRealm(String alias) async {
|
Future<Response> getRealm(String alias) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('auth');
|
final client = auth.configureClient('auth');
|
||||||
|
|
||||||
final resp = await client.get('/realms/$alias');
|
final resp = await client.get('/realms/$alias');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -35,13 +37,13 @@ class RealmProvider extends GetxController {
|
|||||||
|
|
||||||
Future<Response> listAvailableRealm() async {
|
Future<Response> listAvailableRealm() async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) throw Exception('unauthorized');
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
final client = auth.configureClient('auth');
|
final client = auth.configureClient('auth');
|
||||||
|
|
||||||
final resp = await client.get('/realms/me/available');
|
final resp = await client.get('/realms/me/available');
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
|
37
lib/providers/daily_sign.dart
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
|
import 'package:solian/exceptions/unauthorized.dart';
|
||||||
|
import 'package:solian/models/daily_sign.dart';
|
||||||
|
import 'package:solian/providers/auth.dart';
|
||||||
|
|
||||||
|
class DailySignProvider extends GetxController {
|
||||||
|
Future<DailySignRecord?> getToday() async {
|
||||||
|
final AuthProvider auth = Get.find();
|
||||||
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
|
final client = auth.configureClient('id');
|
||||||
|
|
||||||
|
final resp = await client.get('/daily/today');
|
||||||
|
if (resp.statusCode != 200 && resp.statusCode != 404) {
|
||||||
|
throw RequestException(resp);
|
||||||
|
} else if (resp.statusCode == 404) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DailySignRecord.fromJson(resp.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<DailySignRecord> signToday() async {
|
||||||
|
final AuthProvider auth = Get.find();
|
||||||
|
if (auth.isAuthorized.isFalse) throw const UnauthorizedException();
|
||||||
|
|
||||||
|
final client = auth.configureClient('id');
|
||||||
|
|
||||||
|
final resp = await client.post('/daily', {});
|
||||||
|
if (resp.statusCode != 200) {
|
||||||
|
throw RequestException(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DailySignRecord.fromJson(resp.body);
|
||||||
|
}
|
||||||
|
}
|
26
lib/providers/link_expander.dart
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/models/link.dart';
|
||||||
|
import 'package:solian/services.dart';
|
||||||
|
|
||||||
|
class LinkExpandProvider extends GetxController {
|
||||||
|
final Map<String, LinkMeta?> _cachedResponse = {};
|
||||||
|
|
||||||
|
Future<LinkMeta?> expandLink(String url) async {
|
||||||
|
log('[LinkExpander] Expanding link... $url');
|
||||||
|
final target = utf8.fuse(base64).encode(url);
|
||||||
|
if (_cachedResponse.containsKey(target)) return _cachedResponse[target];
|
||||||
|
final client = ServiceFinder.configureClient('dealer');
|
||||||
|
final resp = await client.get('/api/links/$target');
|
||||||
|
if (resp.statusCode != 200) {
|
||||||
|
log('Unable to expand link ($url), status: ${resp.statusCode}, response: ${resp.body}');
|
||||||
|
_cachedResponse[target] = null;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final result = LinkMeta.fromJson(resp.body);
|
||||||
|
_cachedResponse[target] = result;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:floor/floor.dart';
|
import 'package:floor/floor.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
import 'package:solian/models/channel.dart';
|
import 'package:solian/models/channel.dart';
|
||||||
import 'package:solian/models/event.dart';
|
import 'package:solian/models/event.dart';
|
||||||
import 'package:solian/models/pagination.dart';
|
import 'package:solian/models/pagination.dart';
|
||||||
@ -29,20 +30,20 @@ Future<Event?> getRemoteEvent(int id, Channel channel, String scope) async {
|
|||||||
if (resp.statusCode == 404) {
|
if (resp.statusCode == 404) {
|
||||||
return null;
|
return null;
|
||||||
} else if (resp.statusCode != 200) {
|
} else if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Event.fromJson(resp.body);
|
return Event.fromJson(resp.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<(List<Event>, int)?> getRemoteEvents(
|
Future<(List<Event>, int)?> getRemoteEvents(
|
||||||
Channel channel,
|
Channel channel,
|
||||||
String scope, {
|
String scope, {
|
||||||
required int remainDepth,
|
required int remainDepth,
|
||||||
bool Function(List<Event> items)? onBrake,
|
bool Function(List<Event> items)? onBrake,
|
||||||
take = 10,
|
take = 10,
|
||||||
offset = 0,
|
offset = 0,
|
||||||
}) async {
|
}) async {
|
||||||
if (remainDepth <= 0) {
|
if (remainDepth <= 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -57,7 +58,7 @@ Future<(List<Event>, int)?> getRemoteEvents(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
final PaginationResult response = PaginationResult.fromJson(resp.body);
|
final PaginationResult response = PaginationResult.fromJson(resp.body);
|
||||||
@ -69,13 +70,13 @@ Future<(List<Event>, int)?> getRemoteEvents(
|
|||||||
}
|
}
|
||||||
|
|
||||||
final expandResult = (await getRemoteEvents(
|
final expandResult = (await getRemoteEvents(
|
||||||
channel,
|
channel,
|
||||||
scope,
|
scope,
|
||||||
remainDepth: remainDepth - 1,
|
remainDepth: remainDepth - 1,
|
||||||
take: take,
|
take: take,
|
||||||
offset: offset + result.length,
|
offset: offset + result.length,
|
||||||
))
|
))
|
||||||
?.$1 ??
|
?.$1 ??
|
||||||
List.empty();
|
List.empty();
|
||||||
|
|
||||||
return ([...result, ...expandResult], response.count);
|
return ([...result, ...expandResult], response.count);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
import 'package:solian/models/account.dart';
|
import 'package:solian/models/account.dart';
|
||||||
import 'package:solian/models/relations.dart';
|
import 'package:solian/models/relations.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
@ -42,7 +43,7 @@ class RelationshipProvider extends GetxController {
|
|||||||
final client = auth.configureClient('auth');
|
final client = auth.configureClient('auth');
|
||||||
final resp = await client.post('/users/me/relations?related=$username', {});
|
final resp = await client.post('/users/me/relations?related=$username', {});
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -57,7 +58,7 @@ class RelationshipProvider extends GetxController {
|
|||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
@ -71,7 +72,7 @@ class RelationshipProvider extends GetxController {
|
|||||||
{'status': status},
|
{'status': status},
|
||||||
);
|
);
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
|
@ -5,9 +5,12 @@ import 'package:solian/services.dart';
|
|||||||
|
|
||||||
class StickerProvider extends GetxController {
|
class StickerProvider extends GetxController {
|
||||||
final RxMap<String, String> aliasImageMapping = RxMap();
|
final RxMap<String, String> aliasImageMapping = RxMap();
|
||||||
final RxMap<String, List<Sticker>> availableStickers = RxMap();
|
final RxList<Sticker> availableStickers = RxList.empty(growable: true);
|
||||||
|
|
||||||
Future<void> refreshAvailableStickers() async {
|
Future<void> refreshAvailableStickers() async {
|
||||||
|
availableStickers.clear();
|
||||||
|
aliasImageMapping.clear();
|
||||||
|
|
||||||
final client = ServiceFinder.configureClient('files');
|
final client = ServiceFinder.configureClient('files');
|
||||||
final resp = await client.get(
|
final resp = await client.get(
|
||||||
'/stickers/manifest?take=100',
|
'/stickers/manifest?take=100',
|
||||||
@ -20,16 +23,9 @@ class StickerProvider extends GetxController {
|
|||||||
for (final pack in out) {
|
for (final pack in out) {
|
||||||
for (final sticker in (pack.stickers ?? List<Sticker>.empty())) {
|
for (final sticker in (pack.stickers ?? List<Sticker>.empty())) {
|
||||||
sticker.pack = pack;
|
sticker.pack = pack;
|
||||||
final imageUrl = ServiceFinder.buildUrl(
|
aliasImageMapping[sticker.textPlaceholder.toUpperCase()] =
|
||||||
'files',
|
sticker.imageUrl;
|
||||||
'/attachments/${sticker.attachmentId}',
|
availableStickers.add(sticker);
|
||||||
);
|
|
||||||
aliasImageMapping['${pack.prefix}${sticker.alias}'.camelCase!] =
|
|
||||||
imageUrl;
|
|
||||||
if (availableStickers[pack.prefix] == null) {
|
|
||||||
availableStickers[pack.prefix] = List.empty(growable: true);
|
|
||||||
}
|
|
||||||
availableStickers[pack.prefix]!.add(sticker);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import 'dart:io';
|
|||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:solian/exceptions/request.dart';
|
||||||
import 'package:solian/models/notification.dart';
|
import 'package:solian/models/notification.dart';
|
||||||
import 'package:solian/models/packet.dart';
|
import 'package:solian/models/packet.dart';
|
||||||
import 'package:solian/models/pagination.dart';
|
import 'package:solian/models/pagination.dart';
|
||||||
@ -50,31 +51,31 @@ class WebSocketProvider extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
await auth.ensureCredentials();
|
|
||||||
|
|
||||||
if (auth.credentials == null) await auth.loadCredentials();
|
|
||||||
|
|
||||||
final uri = Uri.parse(ServiceFinder.buildUrl(
|
|
||||||
'dealer',
|
|
||||||
'/api/ws?tk=${auth.credentials!.accessToken}',
|
|
||||||
).replaceFirst('http', 'ws'));
|
|
||||||
|
|
||||||
isConnecting.value = true;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await auth.ensureCredentials();
|
||||||
|
|
||||||
|
final uri = Uri.parse(ServiceFinder.buildUrl(
|
||||||
|
'dealer',
|
||||||
|
'/api/ws?tk=${auth.credentials!.accessToken}',
|
||||||
|
).replaceFirst('http', 'ws'));
|
||||||
|
|
||||||
|
isConnecting.value = true;
|
||||||
|
|
||||||
websocket = WebSocketChannel.connect(uri);
|
websocket = WebSocketChannel.connect(uri);
|
||||||
await websocket?.ready;
|
await websocket?.ready;
|
||||||
} catch (e) {
|
listen();
|
||||||
|
|
||||||
|
isConnected.value = true;
|
||||||
|
} catch (err) {
|
||||||
|
log('Unable connect dealer via websocket... $err');
|
||||||
if (!noRetry) {
|
if (!noRetry) {
|
||||||
await auth.refreshCredentials();
|
await auth.refreshCredentials();
|
||||||
return connect(noRetry: true);
|
return connect(noRetry: true);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
isConnecting.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
listen();
|
|
||||||
|
|
||||||
isConnected.value = true;
|
|
||||||
isConnecting.value = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void disconnect() {
|
void disconnect() {
|
||||||
@ -87,6 +88,7 @@ class WebSocketProvider extends GetxController {
|
|||||||
websocket?.stream.listen(
|
websocket?.stream.listen(
|
||||||
(event) {
|
(event) {
|
||||||
final packet = NetworkPackage.fromJson(jsonDecode(event));
|
final packet = NetworkPackage.fromJson(jsonDecode(event));
|
||||||
|
log('Websocket incoming message: ${packet.method} ${packet.message}');
|
||||||
stream.sink.add(packet);
|
stream.sink.add(packet);
|
||||||
},
|
},
|
||||||
onDone: () {
|
onDone: () {
|
||||||
@ -147,8 +149,8 @@ class WebSocketProvider extends GetxController {
|
|||||||
'device_token': token,
|
'device_token': token,
|
||||||
'device_id': deviceUuid,
|
'device_id': deviceUuid,
|
||||||
});
|
});
|
||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200 && resp.statusCode != 400) {
|
||||||
throw Exception(resp.bodyString);
|
throw RequestException(resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import 'package:solian/screens/channel/channel_chat.dart';
|
|||||||
import 'package:solian/screens/channel/channel_detail.dart';
|
import 'package:solian/screens/channel/channel_detail.dart';
|
||||||
import 'package:solian/screens/channel/channel_organize.dart';
|
import 'package:solian/screens/channel/channel_organize.dart';
|
||||||
import 'package:solian/screens/chat.dart';
|
import 'package:solian/screens/chat.dart';
|
||||||
|
import 'package:solian/screens/dashboard.dart';
|
||||||
import 'package:solian/screens/feed/search.dart';
|
import 'package:solian/screens/feed/search.dart';
|
||||||
import 'package:solian/screens/posts/post_detail.dart';
|
import 'package:solian/screens/posts/post_detail.dart';
|
||||||
import 'package:solian/screens/feed/draft_box.dart';
|
import 'package:solian/screens/feed/draft_box.dart';
|
||||||
@ -19,7 +20,7 @@ import 'package:solian/screens/realms.dart';
|
|||||||
import 'package:solian/screens/realms/realm_detail.dart';
|
import 'package:solian/screens/realms/realm_detail.dart';
|
||||||
import 'package:solian/screens/realms/realm_organize.dart';
|
import 'package:solian/screens/realms/realm_organize.dart';
|
||||||
import 'package:solian/screens/realms/realm_view.dart';
|
import 'package:solian/screens/realms/realm_view.dart';
|
||||||
import 'package:solian/screens/home.dart';
|
import 'package:solian/screens/feed.dart';
|
||||||
import 'package:solian/screens/posts/post_editor.dart';
|
import 'package:solian/screens/posts/post_editor.dart';
|
||||||
import 'package:solian/screens/settings.dart';
|
import 'package:solian/screens/settings.dart';
|
||||||
import 'package:solian/shells/root_shell.dart';
|
import 'package:solian/shells/root_shell.dart';
|
||||||
@ -34,6 +35,14 @@ abstract class AppRouter {
|
|||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
routes: [
|
routes: [
|
||||||
|
GoRoute(
|
||||||
|
path: '/',
|
||||||
|
name: 'dashboard',
|
||||||
|
builder: (context, state) => TitleShell(
|
||||||
|
state: state,
|
||||||
|
child: const DashboardScreen(),
|
||||||
|
),
|
||||||
|
),
|
||||||
_feedRoute,
|
_feedRoute,
|
||||||
_chatRoute,
|
_chatRoute,
|
||||||
_realmRoute,
|
_realmRoute,
|
||||||
@ -63,9 +72,9 @@ abstract class AppRouter {
|
|||||||
builder: (context, state, child) => child,
|
builder: (context, state, child) => child,
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/',
|
path: '/feed',
|
||||||
name: 'home',
|
name: 'feed',
|
||||||
builder: (context, state) => const HomeScreen(),
|
builder: (context, state) => const FeedScreen(),
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/feed/search',
|
path: '/feed/search',
|
||||||
@ -104,7 +113,6 @@ abstract class AppRouter {
|
|||||||
reply: arguments?.reply,
|
reply: arguments?.reply,
|
||||||
repost: arguments?.repost,
|
repost: arguments?.repost,
|
||||||
realm: arguments?.realm,
|
realm: arguments?.realm,
|
||||||
postListController: arguments?.postListController,
|
|
||||||
mode: int.tryParse(state.uri.queryParameters['mode'] ?? '0') ?? 0,
|
mode: int.tryParse(state.uri.queryParameters['mode'] ?? '0') ?? 0,
|
||||||
),
|
),
|
||||||
transitionsBuilder:
|
transitionsBuilder:
|
||||||
|
@ -16,7 +16,7 @@ class NotificationScreen extends StatefulWidget {
|
|||||||
class _NotificationScreenState extends State<NotificationScreen> {
|
class _NotificationScreenState extends State<NotificationScreen> {
|
||||||
bool _isBusy = false;
|
bool _isBusy = false;
|
||||||
|
|
||||||
Future<void> markAllRead() async {
|
Future<void> _markAllRead() async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) return;
|
if (auth.isAuthorized.isFalse) return;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
|||||||
setState(() => _isBusy = false);
|
setState(() => _isBusy = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> markOneRead(notify.Notification element, int index) async {
|
Future<void> _markOneRead(notify.Notification element, int index) async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) return;
|
if (auth.isAuthorized.isFalse) return;
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final WebSocketProvider provider = Get.find();
|
final WebSocketProvider ws = Get.find();
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.85,
|
height: MediaQuery.of(context).size.height * 0.85,
|
||||||
@ -83,7 +83,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
|||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: const LinearProgressIndicator().animate().scaleX(),
|
child: const LinearProgressIndicator().animate().scaleX(),
|
||||||
),
|
),
|
||||||
if (provider.notifications.isEmpty)
|
if (ws.notifications.isEmpty)
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
@ -96,7 +96,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (provider.notifications.isNotEmpty)
|
if (ws.notifications.isNotEmpty)
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
@ -104,14 +104,14 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
|||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: const Icon(Icons.checklist),
|
leading: const Icon(Icons.checklist),
|
||||||
title: Text('notifyAllRead'.tr),
|
title: Text('notifyAllRead'.tr),
|
||||||
onTap: _isBusy ? null : () => markAllRead(),
|
onTap: _isBusy ? null : () => _markAllRead(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverList.separated(
|
SliverList.separated(
|
||||||
itemCount: provider.notifications.length,
|
itemCount: ws.notifications.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
var element = provider.notifications[index];
|
var element = ws.notifications[index];
|
||||||
return Dismissible(
|
return Dismissible(
|
||||||
key: Key(const Uuid().v4()),
|
key: Key(const Uuid().v4()),
|
||||||
background: Container(
|
background: Container(
|
||||||
@ -135,7 +135,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onDismissed: (_) => markOneRead(element, index),
|
onDismissed: (_) => _markOneRead(element, index),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
separatorBuilder: (_, __) =>
|
separatorBuilder: (_, __) =>
|
||||||
|
@ -30,8 +30,8 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
|
|||||||
final _descriptionController = TextEditingController();
|
final _descriptionController = TextEditingController();
|
||||||
final _birthdayController = TextEditingController();
|
final _birthdayController = TextEditingController();
|
||||||
|
|
||||||
int? _avatar;
|
String? _avatar;
|
||||||
int? _banner;
|
String? _banner;
|
||||||
DateTime? _birthday;
|
DateTime? _birthday;
|
||||||
|
|
||||||
bool _isBusy = false;
|
bool _isBusy = false;
|
||||||
@ -109,14 +109,14 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
|
|||||||
|
|
||||||
setState(() => _isBusy = true);
|
setState(() => _isBusy = true);
|
||||||
|
|
||||||
final AttachmentProvider provider = Get.find();
|
final AttachmentProvider attach = Get.find();
|
||||||
|
|
||||||
Attachment? attachResult;
|
Attachment? attachResult;
|
||||||
try {
|
try {
|
||||||
attachResult = await provider.createAttachment(
|
attachResult = await attach.createAttachmentDirectly(
|
||||||
await file.readAsBytes(),
|
await file.readAsBytes(),
|
||||||
file.path,
|
file.path,
|
||||||
'p.$position',
|
'avatar',
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -129,7 +129,7 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
|
|||||||
|
|
||||||
final resp = await client.put(
|
final resp = await client.put(
|
||||||
'/users/me/$position',
|
'/users/me/$position',
|
||||||
{'attachment': attachResult.id},
|
{'attachment': attachResult.rid},
|
||||||
);
|
);
|
||||||
if (resp.statusCode == 200) {
|
if (resp.statusCode == 200) {
|
||||||
_syncWidget();
|
_syncWidget();
|
||||||
|
@ -300,6 +300,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
|
|||||||
PostWarpedListWidget(
|
PostWarpedListWidget(
|
||||||
isPinned: false,
|
isPinned: false,
|
||||||
controller: _postController.pagingController,
|
controller: _postController.pagingController,
|
||||||
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
|
@ -66,11 +66,11 @@ class _StickerScreenState extends State<StickerScreen> {
|
|||||||
Widget _buildEmoteEntry(Sticker item, String prefix) {
|
Widget _buildEmoteEntry(Sticker item, String prefix) {
|
||||||
final imageUrl = ServiceFinder.buildUrl(
|
final imageUrl = ServiceFinder.buildUrl(
|
||||||
'files',
|
'files',
|
||||||
'/attachments/${item.attachmentId}',
|
'/attachments/${item.attachment.rid}',
|
||||||
);
|
);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(item.name),
|
title: Text(item.name),
|
||||||
subtitle: Text(':${'$prefix${item.alias}'.camelCase}:'),
|
subtitle: Text(item.textWarpedPlaceholder),
|
||||||
contentPadding: const EdgeInsets.only(left: 16, right: 14),
|
contentPadding: const EdgeInsets.only(left: 16, right: 14),
|
||||||
trailing: Row(
|
trailing: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -159,15 +159,25 @@ class _StickerScreenState extends State<StickerScreen> {
|
|||||||
builderDelegate: PagedChildBuilderDelegate(
|
builderDelegate: PagedChildBuilderDelegate(
|
||||||
itemBuilder: (BuildContext context, item, int index) {
|
itemBuilder: (BuildContext context, item, int index) {
|
||||||
return ExpansionTile(
|
return ExpansionTile(
|
||||||
title: Text(item.name),
|
title: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(item.name),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Badge(
|
||||||
|
label: Text('#${item.id}'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
item.description,
|
item.description,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
children: item.stickers
|
children: item.stickers?.map((x) {
|
||||||
?.map((x) => _buildEmoteEntry(x, item.prefix))
|
x.pack = item;
|
||||||
.toList() ??
|
return _buildEmoteEntry(x, item.prefix);
|
||||||
|
}).toList() ??
|
||||||
List.empty(),
|
List.empty(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -79,8 +79,8 @@ class _SignInPopupState extends State<SignInPopup> with ProtocolListener {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
const redirect = 'solink://auth?status=done';
|
const redirect = 'solink://auth?status=done';
|
||||||
launchUrlString(
|
launchUrlString(
|
||||||
ServiceFinder.buildUrl('passport',
|
ServiceFinder.buildUrl('capital',
|
||||||
'/mfa?redirect_uri=$redirect&ticketId=${e.ticketId}'),
|
'/auth/mfa?redirect_uri=$redirect&ticketId=${e.ticketId}'),
|
||||||
mode: LaunchMode.inAppWebView,
|
mode: LaunchMode.inAppWebView,
|
||||||
);
|
);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
@ -136,8 +136,10 @@ class _SignInPopupState extends State<SignInPopup> with ProtocolListener {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Image.asset('assets/logo.png', width: 64, height: 64)
|
ClipRRect(
|
||||||
.paddingOnly(bottom: 4),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
|
child: Image.asset('assets/logo.png', width: 64, height: 64),
|
||||||
|
).paddingOnly(bottom: 4),
|
||||||
Text(
|
Text(
|
||||||
'signinGreeting'.tr,
|
'signinGreeting'.tr,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
@ -70,8 +70,10 @@ class _SignUpPopupState extends State<SignUpPopup> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Image.asset('assets/logo.png', width: 64, height: 64)
|
ClipRRect(
|
||||||
.paddingOnly(bottom: 4),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
|
child: Image.asset('assets/logo.png', width: 64, height: 64),
|
||||||
|
).paddingOnly(bottom: 4),
|
||||||
Text(
|
Text(
|
||||||
'signupGreeting'.tr,
|
'signupGreeting'.tr,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
@ -9,18 +9,23 @@ import 'package:solian/theme.dart';
|
|||||||
import 'package:solian/widgets/app_bar_leading.dart';
|
import 'package:solian/widgets/app_bar_leading.dart';
|
||||||
import 'package:solian/widgets/chat/call/call_controls.dart';
|
import 'package:solian/widgets/chat/call/call_controls.dart';
|
||||||
import 'package:solian/widgets/chat/call/call_participant.dart';
|
import 'package:solian/widgets/chat/call/call_participant.dart';
|
||||||
|
import 'package:livekit_client/livekit_client.dart' as livekit;
|
||||||
|
|
||||||
class CallScreen extends StatefulWidget {
|
class CallScreen extends StatefulWidget {
|
||||||
const CallScreen({super.key});
|
final bool hideAppBar;
|
||||||
|
final bool isExpandable;
|
||||||
|
|
||||||
|
const CallScreen({
|
||||||
|
super.key,
|
||||||
|
this.hideAppBar = false,
|
||||||
|
this.isExpandable = false,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CallScreen> createState() => _CallScreenState();
|
State<CallScreen> createState() => _CallScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
||||||
Timer? _timer;
|
|
||||||
String _currentDuration = '00:00:00';
|
|
||||||
|
|
||||||
int _layoutMode = 0;
|
int _layoutMode = 0;
|
||||||
|
|
||||||
bool _showControls = true;
|
bool _showControls = true;
|
||||||
@ -36,26 +41,6 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
|||||||
curve: Curves.fastOutSlowIn,
|
curve: Curves.fastOutSlowIn,
|
||||||
);
|
);
|
||||||
|
|
||||||
String _parseDuration() {
|
|
||||||
final ChatCallProvider provider = Get.find();
|
|
||||||
if (provider.current.value == null) return '00:00:00';
|
|
||||||
Duration duration =
|
|
||||||
DateTime.now().difference(provider.current.value!.createdAt);
|
|
||||||
|
|
||||||
String twoDigits(int n) => n.toString().padLeft(2, '0');
|
|
||||||
String formattedTime = '${twoDigits(duration.inHours)}:'
|
|
||||||
'${twoDigits(duration.inMinutes.remainder(60))}:'
|
|
||||||
'${twoDigits(duration.inSeconds.remainder(60))}';
|
|
||||||
|
|
||||||
return formattedTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _updateDuration() {
|
|
||||||
setState(() {
|
|
||||||
_currentDuration = _parseDuration();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _switchLayout() {
|
void _switchLayout() {
|
||||||
if (_layoutMode < 1) {
|
if (_layoutMode < 1) {
|
||||||
setState(() => _layoutMode++);
|
setState(() => _layoutMode++);
|
||||||
@ -161,45 +146,44 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
|||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: columns,
|
crossAxisCount: columns,
|
||||||
childAspectRatio: tileWidth / tileHeight,
|
childAspectRatio: tileWidth / tileHeight,
|
||||||
|
crossAxisSpacing: 8,
|
||||||
|
mainAxisSpacing: 8,
|
||||||
),
|
),
|
||||||
itemCount: math.max(0, call.participantTracks.length),
|
itemCount: math.max(0, call.participantTracks.length),
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
final track = call.participantTracks[index];
|
final track = call.participantTracks[index];
|
||||||
return Padding(
|
return Card(
|
||||||
padding: const EdgeInsets.all(16),
|
child: ClipRRect(
|
||||||
child: Card(
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
child: ClipRRect(
|
child: InteractiveParticipantWidget(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
child: InteractiveParticipantWidget(
|
participant: track,
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
onTap: () {
|
||||||
participant: track,
|
if (track.participant.sid !=
|
||||||
onTap: () {
|
call.focusTrack.value?.participant.sid) {
|
||||||
if (track.participant.sid !=
|
call.changeFocusTrack(track);
|
||||||
call.focusTrack.value?.participant.sid) {
|
}
|
||||||
call.changeFocusTrack(track);
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
).paddingAll(8);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
Get.find<ChatCallProvider>().setupRoom();
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
_updateDuration();
|
Future.delayed(Duration.zero, () {
|
||||||
_planAutoHideControls();
|
Get.find<ChatCallProvider>()
|
||||||
_timer = Timer.periodic(
|
..setupRoom()
|
||||||
const Duration(seconds: 1),
|
..enableDurationUpdater();
|
||||||
(_) => _updateDuration(),
|
|
||||||
);
|
_planAutoHideControls();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -210,30 +194,34 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ChatCallProvider provider = Get.find();
|
final ChatCallProvider ctrl = Get.find();
|
||||||
|
|
||||||
return Material(
|
return Material(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: widget.hideAppBar
|
||||||
leading: AppBarLeadingButton.adaptive(context),
|
? null
|
||||||
centerTitle: true,
|
: AppBar(
|
||||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
leading: AppBarLeadingButton.adaptive(context),
|
||||||
title: RichText(
|
centerTitle: true,
|
||||||
textAlign: TextAlign.center,
|
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||||
text: TextSpan(children: [
|
title: Obx(
|
||||||
TextSpan(
|
() => RichText(
|
||||||
text: 'call'.tr,
|
textAlign: TextAlign.center,
|
||||||
style: Theme.of(context).textTheme.titleLarge,
|
text: TextSpan(children: [
|
||||||
|
TextSpan(
|
||||||
|
text: 'call'.tr,
|
||||||
|
style: Theme.of(context).textTheme.titleLarge,
|
||||||
|
),
|
||||||
|
const TextSpan(text: '\n'),
|
||||||
|
TextSpan(
|
||||||
|
text: ctrl.lastDuration.value,
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const TextSpan(text: '\n'),
|
|
||||||
TextSpan(
|
|
||||||
text: _currentDuration,
|
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
@ -246,24 +234,111 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
|||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height: 64,
|
height: 64,
|
||||||
child: Row(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Expanded(child: SizedBox()),
|
Builder(builder: (context) {
|
||||||
IconButton(
|
final call = Get.find<ChatCallProvider>();
|
||||||
icon: _layoutMode == 0
|
final connectionQuality =
|
||||||
? const Icon(Icons.view_list)
|
call.room.localParticipant?.connectionQuality ??
|
||||||
: const Icon(Icons.grid_view),
|
livekit.ConnectionQuality.unknown;
|
||||||
onPressed: () {
|
return Expanded(
|
||||||
_switchLayout();
|
child: Column(
|
||||||
},
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Obx(() {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
call.channel.value?.name ??
|
||||||
|
'unknown'.tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text(call.lastDuration.value)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
{
|
||||||
|
livekit.ConnectionState.disconnected:
|
||||||
|
'callStatusDisconnected'.tr,
|
||||||
|
livekit.ConnectionState.connected:
|
||||||
|
'callStatusConnected'.tr,
|
||||||
|
livekit.ConnectionState.connecting:
|
||||||
|
'callStatusConnecting'.tr,
|
||||||
|
livekit.ConnectionState.reconnecting:
|
||||||
|
'callStatusReconnecting'.tr,
|
||||||
|
}[call.room.connectionState]!,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
if (connectionQuality !=
|
||||||
|
livekit.ConnectionQuality.unknown)
|
||||||
|
Icon(
|
||||||
|
{
|
||||||
|
livekit.ConnectionQuality.excellent:
|
||||||
|
Icons.signal_cellular_alt,
|
||||||
|
livekit.ConnectionQuality.good:
|
||||||
|
Icons.signal_cellular_alt_2_bar,
|
||||||
|
livekit.ConnectionQuality.poor:
|
||||||
|
Icons.signal_cellular_alt_1_bar,
|
||||||
|
}[connectionQuality],
|
||||||
|
color: {
|
||||||
|
livekit.ConnectionQuality.excellent:
|
||||||
|
Colors.green,
|
||||||
|
livekit.ConnectionQuality.good:
|
||||||
|
Colors.orange,
|
||||||
|
livekit.ConnectionQuality.poor:
|
||||||
|
Colors.red,
|
||||||
|
}[connectionQuality],
|
||||||
|
size: 16,
|
||||||
|
)
|
||||||
|
else
|
||||||
|
const SizedBox(
|
||||||
|
width: 12,
|
||||||
|
height: 12,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.white,
|
||||||
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
|
).paddingAll(3),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
if (widget.isExpandable)
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.fullscreen),
|
||||||
|
onPressed: () {
|
||||||
|
ctrl.gotoScreen(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: _layoutMode == 0
|
||||||
|
? const Icon(Icons.view_list)
|
||||||
|
: const Icon(Icons.grid_view),
|
||||||
|
onPressed: () {
|
||||||
|
_switchLayout();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
).paddingSymmetric(horizontal: 10),
|
).paddingOnly(left: 20, right: 16),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerLow,
|
color: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||||
elevation: 2,
|
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
switch (_layoutMode) {
|
switch (_layoutMode) {
|
||||||
@ -276,15 +351,15 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (provider.room.localParticipant != null)
|
if (ctrl.room.localParticipant != null)
|
||||||
SizeTransition(
|
SizeTransition(
|
||||||
sizeFactor: _controlsAnimation,
|
sizeFactor: _controlsAnimation,
|
||||||
axis: Axis.vertical,
|
axis: Axis.vertical,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
child: ControlsWidget(
|
child: ControlsWidget(
|
||||||
provider.room,
|
ctrl.room,
|
||||||
provider.room.localParticipant!,
|
ctrl.room.localParticipant!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -301,17 +376,13 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void deactivate() {
|
void deactivate() {
|
||||||
_timer?.cancel();
|
Get.find<ChatCallProvider>().disableDurationUpdater();
|
||||||
_timer = null;
|
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void activate() {
|
void activate() {
|
||||||
_timer ??= Timer.periodic(
|
Get.find<ChatCallProvider>().enableDurationUpdater();
|
||||||
const Duration(seconds: 1),
|
|
||||||
(_) => _updateDuration(),
|
|
||||||
);
|
|
||||||
super.activate();
|
super.activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,18 +11,20 @@ import 'package:solian/models/channel.dart';
|
|||||||
import 'package:solian/models/event.dart';
|
import 'package:solian/models/event.dart';
|
||||||
import 'package:solian/models/packet.dart';
|
import 'package:solian/models/packet.dart';
|
||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
|
import 'package:solian/providers/call.dart';
|
||||||
import 'package:solian/providers/content/channel.dart';
|
import 'package:solian/providers/content/channel.dart';
|
||||||
import 'package:solian/providers/websocket.dart';
|
import 'package:solian/providers/websocket.dart';
|
||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
|
import 'package:solian/screens/channel/call/call.dart';
|
||||||
import 'package:solian/screens/channel/channel_detail.dart';
|
import 'package:solian/screens/channel/channel_detail.dart';
|
||||||
import 'package:solian/theme.dart';
|
import 'package:solian/theme.dart';
|
||||||
import 'package:solian/widgets/app_bar_leading.dart';
|
import 'package:solian/widgets/app_bar_leading.dart';
|
||||||
import 'package:solian/widgets/app_bar_title.dart';
|
import 'package:solian/widgets/app_bar_title.dart';
|
||||||
import 'package:solian/widgets/channel/channel_call_indicator.dart';
|
import 'package:solian/widgets/channel/channel_call_indicator.dart';
|
||||||
import 'package:solian/widgets/chat/call/chat_call_action.dart';
|
import 'package:solian/widgets/chat/call/chat_call_action.dart';
|
||||||
import 'package:solian/widgets/chat/chat_event.dart';
|
|
||||||
import 'package:solian/widgets/chat/chat_event_list.dart';
|
import 'package:solian/widgets/chat/chat_event_list.dart';
|
||||||
import 'package:solian/widgets/chat/chat_message_input.dart';
|
import 'package:solian/widgets/chat/chat_message_input.dart';
|
||||||
|
import 'package:solian/widgets/chat/chat_typing_indicator.dart';
|
||||||
import 'package:solian/widgets/current_state_action.dart';
|
import 'package:solian/widgets/current_state_action.dart';
|
||||||
|
|
||||||
class ChannelChatScreen extends StatefulWidget {
|
class ChannelChatScreen extends StatefulWidget {
|
||||||
@ -39,7 +41,10 @@ class ChannelChatScreen extends StatefulWidget {
|
|||||||
State<ChannelChatScreen> createState() => _ChannelChatScreenState();
|
State<ChannelChatScreen> createState() => _ChannelChatScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
class _ChannelChatScreenState extends State<ChannelChatScreen>
|
||||||
|
with WidgetsBindingObserver, TickerProviderStateMixin {
|
||||||
|
DateTime? _isOutOfSyncSince;
|
||||||
|
|
||||||
bool _isBusy = false;
|
bool _isBusy = false;
|
||||||
int? _accountId;
|
int? _accountId;
|
||||||
|
|
||||||
@ -99,12 +104,18 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
setState(() => _isBusy = false);
|
setState(() => _isBusy = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<ChannelMember> _typingUsers = List.empty(growable: true);
|
||||||
|
final Map<int, Timer> _typingInactiveTimer = {};
|
||||||
|
|
||||||
void _listenMessages() {
|
void _listenMessages() {
|
||||||
final WebSocketProvider provider = Get.find();
|
final WebSocketProvider ws = Get.find();
|
||||||
_subscription = provider.stream.stream.listen((event) {
|
_subscription = ws.stream.stream.listen((event) {
|
||||||
switch (event.method) {
|
switch (event.method) {
|
||||||
case 'events.new':
|
case 'events.new':
|
||||||
final payload = Event.fromJson(event.payload!);
|
final payload = Event.fromJson(event.payload!);
|
||||||
|
final typingIdx =
|
||||||
|
_typingUsers.indexWhere((x) => x.id == payload.senderId);
|
||||||
|
if (typingIdx != -1) _typingUsers.removeAt(typingIdx);
|
||||||
_chatController.receiveEvent(payload);
|
_chatController.receiveEvent(payload);
|
||||||
break;
|
break;
|
||||||
case 'calls.new':
|
case 'calls.new':
|
||||||
@ -119,24 +130,61 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
setState(() => _ongoingCall = null);
|
setState(() => _ongoingCall = null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'status.typing':
|
||||||
|
if (event.payload?['channel_id'] != _channel!.id) break;
|
||||||
|
final member = ChannelMember.fromJson(event.payload!['member']);
|
||||||
|
if (member.id == _channelProfile!.id) break;
|
||||||
|
if (!_typingUsers.any((x) => x.id == member.id)) {
|
||||||
|
setState(() {
|
||||||
|
_typingUsers.add(member);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_typingInactiveTimer[member.id]?.cancel();
|
||||||
|
_typingInactiveTimer[member.id] = Timer(
|
||||||
|
const Duration(seconds: 3),
|
||||||
|
() {
|
||||||
|
setState(() {
|
||||||
|
_typingUsers.removeWhere((x) => x.id == member.id);
|
||||||
|
_typingInactiveTimer.remove(member.id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _keepUpdateWithServer() {
|
||||||
|
_getOngoingCall();
|
||||||
|
_chatController.getEvents(_channel!, widget.realm);
|
||||||
|
setState(() => _isOutOfSyncSince = null);
|
||||||
|
}
|
||||||
|
|
||||||
Event? _messageToReplying;
|
Event? _messageToReplying;
|
||||||
Event? _messageToEditing;
|
Event? _messageToEditing;
|
||||||
|
|
||||||
Widget buildHistoryBody(Event item, {bool isMerged = false}) {
|
@override
|
||||||
return ChatEvent(
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
key: Key('m${item.uuid}'),
|
switch (state) {
|
||||||
item: item,
|
case AppLifecycleState.resumed:
|
||||||
isMerged: isMerged,
|
if (_isOutOfSyncSince == null) break;
|
||||||
chatController: _chatController,
|
if (DateTime.now().difference(_isOutOfSyncSince!).inSeconds < 30) break;
|
||||||
);
|
_keepUpdateWithServer();
|
||||||
|
break;
|
||||||
|
case AppLifecycleState.paused:
|
||||||
|
if (mounted) {
|
||||||
|
setState(() => _isOutOfSyncSince = DateTime.now());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
|
||||||
_accountId = Get.find<AuthProvider>().userProfile.value!['id'];
|
_accountId = Get.find<AuthProvider>().userProfile.value!['id'];
|
||||||
|
|
||||||
_chatController = ChatEventController();
|
_chatController = ChatEventController();
|
||||||
@ -147,21 +195,10 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
_chatController.getEvents(_channel!, widget.realm);
|
_chatController.getEvents(_channel!, widget.realm);
|
||||||
_listenMessages();
|
_listenMessages();
|
||||||
});
|
});
|
||||||
|
|
||||||
super.initState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_isBusy || _channel == null) {
|
|
||||||
return Material(
|
|
||||||
color: Theme.of(context).colorScheme.surface,
|
|
||||||
child: const Center(
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String title = _channel?.name ?? 'loading'.tr;
|
String title = _channel?.name ?? 'loading'.tr;
|
||||||
String? placeholder;
|
String? placeholder;
|
||||||
|
|
||||||
@ -185,7 +222,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
actions: [
|
actions: [
|
||||||
const BackgroundStateWidget(),
|
const BackgroundStateWidget(),
|
||||||
Builder(builder: (context) {
|
Builder(builder: (context) {
|
||||||
if (_isBusy) return const SizedBox();
|
if (_isBusy || _channel == null) return const SizedBox();
|
||||||
|
|
||||||
return ChatCallButton(
|
return ChatCallButton(
|
||||||
realm: _channel!.realm,
|
realm: _channel!.realm,
|
||||||
channel: _channel!,
|
channel: _channel!,
|
||||||
@ -195,6 +233,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.more_vert),
|
icon: const Icon(Icons.more_vert),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
if (_channel == null) return;
|
||||||
|
|
||||||
AppRouter.instance
|
AppRouter.instance
|
||||||
.pushNamed(
|
.pushNamed(
|
||||||
'channelDetail',
|
'channelDetail',
|
||||||
@ -219,66 +259,112 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Builder(builder: (context) {
|
||||||
children: [
|
if (_isBusy || _channel == null) {
|
||||||
if (_ongoingCall != null)
|
return const Center(
|
||||||
ChannelCallIndicator(
|
child: CircularProgressIndicator(),
|
||||||
channel: _channel!,
|
);
|
||||||
ongoingCall: _ongoingCall!,
|
}
|
||||||
),
|
|
||||||
Expanded(
|
return Row(
|
||||||
child: ChatEventList(
|
children: [
|
||||||
scope: widget.realm,
|
Expanded(
|
||||||
channel: _channel!,
|
child: Column(
|
||||||
chatController: _chatController,
|
children: [
|
||||||
onEdit: (item) {
|
if (_ongoingCall != null)
|
||||||
setState(() => _messageToEditing = item);
|
ChannelCallIndicator(
|
||||||
},
|
channel: _channel!,
|
||||||
onReply: (item) {
|
ongoingCall: _ongoingCall!,
|
||||||
setState(() => _messageToReplying = item);
|
onJoin: () {
|
||||||
},
|
if (!SolianTheme.isLargeScreen(context)) {
|
||||||
),
|
final ChatCallProvider call = Get.find();
|
||||||
),
|
call.gotoScreen(context);
|
||||||
Obx(() {
|
}
|
||||||
if (_chatController.isLoading.isTrue) {
|
},
|
||||||
return const LinearProgressIndicator().animate().slideY();
|
),
|
||||||
} else {
|
Expanded(
|
||||||
return const SizedBox();
|
child: ChatEventList(
|
||||||
}
|
scope: widget.realm,
|
||||||
}),
|
channel: _channel!,
|
||||||
ClipRect(
|
chatController: _chatController,
|
||||||
child: BackdropFilter(
|
onEdit: (item) {
|
||||||
filter: ImageFilter.blur(sigmaX: 50, sigmaY: 50),
|
setState(() => _messageToEditing = item);
|
||||||
child: SafeArea(
|
},
|
||||||
child: ChatMessageInput(
|
onReply: (item) {
|
||||||
edit: _messageToEditing,
|
setState(() => _messageToReplying = item);
|
||||||
reply: _messageToReplying,
|
},
|
||||||
realm: widget.realm,
|
),
|
||||||
placeholder: placeholder,
|
),
|
||||||
channel: _channel!,
|
Obx(() {
|
||||||
onSent: (Event item) {
|
if (_chatController.isLoading.isTrue) {
|
||||||
setState(() {
|
return const LinearProgressIndicator().animate().slideY();
|
||||||
_chatController.addPendingEvent(item);
|
} else {
|
||||||
});
|
return const SizedBox();
|
||||||
},
|
}
|
||||||
onReset: () {
|
}),
|
||||||
setState(() {
|
ClipRect(
|
||||||
_messageToReplying = null;
|
child: BackdropFilter(
|
||||||
_messageToEditing = null;
|
filter: ImageFilter.blur(sigmaX: 50, sigmaY: 50),
|
||||||
});
|
child: SafeArea(
|
||||||
},
|
child: Column(
|
||||||
),
|
children: [
|
||||||
|
ChatTypingIndicator(users: _typingUsers),
|
||||||
|
ChatMessageInput(
|
||||||
|
edit: _messageToEditing,
|
||||||
|
reply: _messageToReplying,
|
||||||
|
realm: widget.realm,
|
||||||
|
placeholder: placeholder,
|
||||||
|
channel: _channel!,
|
||||||
|
onSent: (Event item) {
|
||||||
|
setState(() {
|
||||||
|
_chatController.addPendingEvent(item);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onReset: () {
|
||||||
|
setState(() {
|
||||||
|
_messageToReplying = null;
|
||||||
|
_messageToEditing = null;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Obx(() {
|
||||||
],
|
final ChatCallProvider call = Get.find();
|
||||||
),
|
if (call.isMounted.value && SolianTheme.isLargeScreen(context)) {
|
||||||
|
return const Expanded(
|
||||||
|
child: Row(children: [
|
||||||
|
VerticalDivider(width: 0.3, thickness: 0.3),
|
||||||
|
Expanded(
|
||||||
|
child: CallScreen(
|
||||||
|
hideAppBar: true,
|
||||||
|
isExpandable: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return const SizedBox();
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
for (var timer in _typingInactiveTimer.values) {
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
_subscription?.cancel();
|
_subscription?.cancel();
|
||||||
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,13 +80,15 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final ChannelProvider provider = Get.find();
|
final ChannelProvider channels = Get.find();
|
||||||
provider
|
channels
|
||||||
.createDirectChannel(context, 'global')
|
.createDirectChannel(context, 'global')
|
||||||
.then((resp) {
|
.then((resp) {
|
||||||
if (resp != null) {
|
if (resp != null) {
|
||||||
_channels.refreshAvailableChannel();
|
_channels.refreshAvailableChannel();
|
||||||
}
|
}
|
||||||
|
}).catchError((e) {
|
||||||
|
context.showErrorDialog(e);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -125,6 +127,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
noCategory: true,
|
noCategory: true,
|
||||||
channels: _channels.directChannels,
|
channels: _channels.directChannels,
|
||||||
selfId: selfId,
|
selfId: selfId,
|
||||||
|
useReplace: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
316
lib/screens/dashboard.dart
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:solian/exts.dart';
|
||||||
|
import 'package:solian/models/daily_sign.dart';
|
||||||
|
import 'package:solian/models/pagination.dart';
|
||||||
|
import 'package:solian/models/post.dart';
|
||||||
|
import 'package:solian/providers/content/posts.dart';
|
||||||
|
import 'package:solian/providers/daily_sign.dart';
|
||||||
|
import 'package:solian/providers/websocket.dart';
|
||||||
|
import 'package:solian/router.dart';
|
||||||
|
import 'package:solian/screens/account/notification.dart';
|
||||||
|
import 'package:solian/widgets/posts/post_list.dart';
|
||||||
|
|
||||||
|
class DashboardScreen extends StatefulWidget {
|
||||||
|
const DashboardScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<DashboardScreen> createState() => _DashboardScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DashboardScreenState extends State<DashboardScreen> {
|
||||||
|
late final WebSocketProvider _ws = Get.find();
|
||||||
|
late final PostProvider _posts = Get.find();
|
||||||
|
late final DailySignProvider _dailySign = Get.find();
|
||||||
|
|
||||||
|
Color get _unFocusColor =>
|
||||||
|
Theme.of(context).colorScheme.onSurface.withOpacity(0.75);
|
||||||
|
|
||||||
|
List<Post>? _currentPosts;
|
||||||
|
|
||||||
|
Future<void> _pullPosts() async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
final resp = await _posts.listRecommendations(0);
|
||||||
|
final result = PaginationResult.fromJson(resp.body);
|
||||||
|
if (prefs.containsKey('feed_last_read_at')) {
|
||||||
|
final id = prefs.getInt('feed_last_read_at')!;
|
||||||
|
setState(() {
|
||||||
|
_currentPosts = result.data
|
||||||
|
?.map((e) => Post.fromJson(e))
|
||||||
|
.where((x) => x.id > id)
|
||||||
|
.toList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _signingDaily = true;
|
||||||
|
DailySignRecord? _signRecord;
|
||||||
|
|
||||||
|
Future<void> _pullDaily() async {
|
||||||
|
try {
|
||||||
|
_signRecord = await _dailySign.getToday();
|
||||||
|
} catch (e) {
|
||||||
|
context.showErrorDialog(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() => _signingDaily = false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _signDaily() async {
|
||||||
|
setState(() => _signingDaily = true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
_signRecord = await _dailySign.signToday();
|
||||||
|
} catch (e) {
|
||||||
|
context.showErrorDialog(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() => _signingDaily = false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_pullPosts();
|
||||||
|
_pullDaily();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final width = MediaQuery.of(context).size.width;
|
||||||
|
|
||||||
|
return ListView(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('today'.tr, style: Theme.of(context).textTheme.headlineSmall),
|
||||||
|
Text(DateFormat('yyyy/MM/dd').format(DateTime.now())),
|
||||||
|
],
|
||||||
|
).paddingOnly(top: 8, left: 18, right: 18, bottom: 12),
|
||||||
|
Card(
|
||||||
|
child: ListTile(
|
||||||
|
leading: AnimatedSwitcher(
|
||||||
|
switchInCurve: Curves.fastOutSlowIn,
|
||||||
|
switchOutCurve: Curves.fastOutSlowIn,
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
transitionBuilder: (child, animation) {
|
||||||
|
return ScaleTransition(
|
||||||
|
scale: animation,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: _signRecord == null
|
||||||
|
? Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
DateFormat('dd').format(DateTime.now()),
|
||||||
|
style:
|
||||||
|
GoogleFonts.robotoMono(fontSize: 22, height: 1.2),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
DateFormat('yy/MM').format(DateTime.now()),
|
||||||
|
style: GoogleFonts.robotoMono(fontSize: 12),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Text(
|
||||||
|
_signRecord!.symbol,
|
||||||
|
style: GoogleFonts.notoSerifHk(fontSize: 20, height: 1),
|
||||||
|
).paddingSymmetric(horizontal: 9),
|
||||||
|
).paddingOnly(left: 4),
|
||||||
|
title: _signRecord == null
|
||||||
|
? const Text('诸事不宜')
|
||||||
|
: Text(_signRecord!.overviewSuggestion),
|
||||||
|
subtitle: _signRecord == null
|
||||||
|
? const Text('今日未拜访佛祖')
|
||||||
|
: Text('+${_signRecord!.resultExperience} EXP'),
|
||||||
|
trailing: AnimatedSwitcher(
|
||||||
|
switchInCurve: Curves.fastOutSlowIn,
|
||||||
|
switchOutCurve: Curves.fastOutSlowIn,
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
transitionBuilder: (child, animation) {
|
||||||
|
return ScaleTransition(
|
||||||
|
scale: animation,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: _signRecord == null
|
||||||
|
? IconButton(
|
||||||
|
tooltip: '上香求签',
|
||||||
|
icon: const Icon(Icons.local_fire_department),
|
||||||
|
onPressed: _signingDaily ? null : _signDaily,
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
).paddingSymmetric(horizontal: 8),
|
||||||
|
const Divider(thickness: 0.3).paddingSymmetric(vertical: 8),
|
||||||
|
Obx(
|
||||||
|
() => Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'notification'.tr,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(fontSize: 18),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'notificationUnreadCount'.trParams({
|
||||||
|
'count': _ws.notifications.length.toString(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.more_horiz),
|
||||||
|
onPressed: () {
|
||||||
|
showModalBottomSheet(
|
||||||
|
useRootNavigator: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
context: context,
|
||||||
|
builder: (context) => const NotificationScreen(),
|
||||||
|
).then((_) => _ws.notificationUnread.value = 0);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).paddingOnly(left: 18, right: 18, bottom: 8),
|
||||||
|
if (_ws.notifications.isNotEmpty)
|
||||||
|
SizedBox(
|
||||||
|
height: 76,
|
||||||
|
width: width,
|
||||||
|
child: ListView.builder(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
itemCount: min(_ws.notifications.length, 3),
|
||||||
|
itemBuilder: (context, idx) {
|
||||||
|
final x = _ws.notifications[idx];
|
||||||
|
return SizedBox(
|
||||||
|
width: width,
|
||||||
|
child: Card(
|
||||||
|
child: ListTile(
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 24,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
|
title: Text(x.title),
|
||||||
|
subtitle: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
if (x.subtitle != null) Text(x.subtitle!),
|
||||||
|
Text(x.body),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
).paddingSymmetric(horizontal: 8),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Card(
|
||||||
|
child: ListTile(
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
|
trailing: const Icon(Icons.inbox_outlined),
|
||||||
|
title: Text('notifyEmpty'.tr),
|
||||||
|
subtitle: Text('notifyEmptyCaption'.tr),
|
||||||
|
),
|
||||||
|
).paddingSymmetric(horizontal: 8),
|
||||||
|
],
|
||||||
|
).paddingOnly(bottom: 12),
|
||||||
|
),
|
||||||
|
if (_currentPosts?.isNotEmpty ?? false)
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'feed'.tr,
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.titleMedium!
|
||||||
|
.copyWith(fontSize: 18),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'notificationUnreadCount'.trParams({
|
||||||
|
'count': (_currentPosts?.length ?? 0).toString(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_forward),
|
||||||
|
onPressed: () {
|
||||||
|
AppRouter.instance.goNamed('feed');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
).paddingOnly(left: 18, right: 18, bottom: 8),
|
||||||
|
SizedBox(
|
||||||
|
height: 360,
|
||||||
|
width: width,
|
||||||
|
child: ListView.builder(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
itemCount: _currentPosts!.length,
|
||||||
|
itemBuilder: (context, idx) {
|
||||||
|
final item = _currentPosts![idx];
|
||||||
|
return SizedBox(
|
||||||
|
width: width,
|
||||||
|
child: Card(
|
||||||
|
child: Card(
|
||||||
|
child: PostListEntryWidget(
|
||||||
|
item: item,
|
||||||
|
isClickable: true,
|
||||||
|
isShowEmbed: true,
|
||||||
|
isNestedClickable: true,
|
||||||
|
onUpdate: (_) {
|
||||||
|
_pullPosts();
|
||||||
|
},
|
||||||
|
backgroundColor: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.surfaceContainerLow,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
).paddingSymmetric(horizontal: 8),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Powered by Solar Network',
|
||||||
|
style: TextStyle(color: _unFocusColor, fontSize: 12),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'占卜多少都是玩,人生还得靠自己',
|
||||||
|
style:
|
||||||
|
GoogleFonts.notoSerifHk(color: _unFocusColor, fontSize: 12),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
).paddingAll(8),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -4,22 +4,22 @@ import 'package:solian/controllers/post_list_controller.dart';
|
|||||||
import 'package:solian/providers/auth.dart';
|
import 'package:solian/providers/auth.dart';
|
||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
import 'package:solian/screens/account/notification.dart';
|
import 'package:solian/screens/account/notification.dart';
|
||||||
import 'package:solian/screens/posts/post_editor.dart';
|
|
||||||
import 'package:solian/theme.dart';
|
import 'package:solian/theme.dart';
|
||||||
|
import 'package:solian/widgets/account/signin_required_overlay.dart';
|
||||||
import 'package:solian/widgets/app_bar_title.dart';
|
import 'package:solian/widgets/app_bar_title.dart';
|
||||||
import 'package:solian/widgets/current_state_action.dart';
|
import 'package:solian/widgets/current_state_action.dart';
|
||||||
import 'package:solian/widgets/app_bar_leading.dart';
|
import 'package:solian/widgets/app_bar_leading.dart';
|
||||||
import 'package:solian/widgets/posts/post_shuffle_swiper.dart';
|
import 'package:solian/widgets/posts/post_shuffle_swiper.dart';
|
||||||
import 'package:solian/widgets/posts/post_warped_list.dart';
|
import 'package:solian/widgets/posts/post_warped_list.dart';
|
||||||
|
|
||||||
class HomeScreen extends StatefulWidget {
|
class FeedScreen extends StatefulWidget {
|
||||||
const HomeScreen({super.key});
|
const FeedScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<HomeScreen> createState() => _HomeScreenState();
|
State<FeedScreen> createState() => _FeedScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _HomeScreenState extends State<HomeScreen>
|
class _FeedScreenState extends State<FeedScreen>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late final PostListController _postController;
|
late final PostListController _postController;
|
||||||
late final TabController _tabController;
|
late final TabController _tabController;
|
||||||
@ -28,41 +28,44 @@ class _HomeScreenState extends State<HomeScreen>
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_postController = PostListController();
|
_postController = PostListController();
|
||||||
_tabController = TabController(length: 2, vsync: this);
|
_tabController = TabController(length: 3, vsync: this);
|
||||||
_tabController.addListener(() {
|
_tabController.addListener(() {
|
||||||
switch (_tabController.index) {
|
if (_postController.mode.value == _tabController.index) return;
|
||||||
case 0:
|
_postController.mode.value = _tabController.index;
|
||||||
case 1:
|
_postController.reloadAllOver();
|
||||||
if (_postController.mode.value == _tabController.index) return;
|
|
||||||
_postController.mode.value = _tabController.index;
|
|
||||||
_postController.reloadAllOver();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final AuthProvider auth = Get.find();
|
||||||
|
|
||||||
return Material(
|
return Material(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
child: const Icon(Icons.add),
|
child: const Icon(Icons.add),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
showModalBottomSheet(
|
final value = await showModalBottomSheet(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => PostCreatePopup(
|
builder: (context) => const PostCreatePopup(),
|
||||||
controller: _postController,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
if (value is Future) {
|
||||||
|
value.then((_) {
|
||||||
|
_postController.reloadAllOver();
|
||||||
|
});
|
||||||
|
} else if (value != null) {
|
||||||
|
_postController.reloadAllOver();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
body: NestedScrollView(
|
body: NestedScrollView(
|
||||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||||
return [
|
return [
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
title: AppBarTitle('home'.tr),
|
title: AppBarTitle('feed'.tr),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
floating: true,
|
floating: true,
|
||||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||||
@ -78,6 +81,7 @@ class _HomeScreenState extends State<HomeScreen>
|
|||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
tabs: [
|
tabs: [
|
||||||
Tab(text: 'postListNews'.tr),
|
Tab(text: 'postListNews'.tr),
|
||||||
|
Tab(text: 'postListFriends'.tr),
|
||||||
Tab(text: 'postListShuffle'.tr),
|
Tab(text: 'postListShuffle'.tr),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -100,9 +104,27 @@ class _HomeScreenState extends State<HomeScreen>
|
|||||||
child: CustomScrollView(slivers: [
|
child: CustomScrollView(slivers: [
|
||||||
PostWarpedListWidget(
|
PostWarpedListWidget(
|
||||||
controller: _postController.pagingController,
|
controller: _postController.pagingController,
|
||||||
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
|
Obx(() {
|
||||||
|
if (auth.isAuthorized.value) {
|
||||||
|
return RefreshIndicator(
|
||||||
|
onRefresh: () => _postController.reloadAllOver(),
|
||||||
|
child: CustomScrollView(slivers: [
|
||||||
|
PostWarpedListWidget(
|
||||||
|
controller: _postController.pagingController,
|
||||||
|
onUpdate: () => _postController.reloadAllOver(),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return SigninRequiredOverlay(
|
||||||
|
onSignedIn: () => _postController.reloadAllOver(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
PostShuffleSwiper(controller: _postController),
|
PostShuffleSwiper(controller: _postController),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -121,12 +143,10 @@ class _HomeScreenState extends State<HomeScreen>
|
|||||||
|
|
||||||
class PostCreatePopup extends StatelessWidget {
|
class PostCreatePopup extends StatelessWidget {
|
||||||
final bool hideDraftBox;
|
final bool hideDraftBox;
|
||||||
final PostListController controller;
|
|
||||||
|
|
||||||
const PostCreatePopup({
|
const PostCreatePopup({
|
||||||
super.key,
|
super.key,
|
||||||
this.hideDraftBox = false,
|
this.hideDraftBox = false,
|
||||||
required this.controller,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -142,13 +162,14 @@ class PostCreatePopup extends StatelessWidget {
|
|||||||
icon: const Icon(Icons.post_add),
|
icon: const Icon(Icons.post_add),
|
||||||
label: 'postEditorModeStory'.tr,
|
label: 'postEditorModeStory'.tr,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(
|
||||||
AppRouter.instance.pushNamed(
|
context,
|
||||||
'postEditor',
|
AppRouter.instance.pushNamed(
|
||||||
extra: PostPublishArguments(postListController: controller),
|
'postEditor',
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'mode': 0.toString(),
|
'mode': 0.toString(),
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -156,13 +177,14 @@ class PostCreatePopup extends StatelessWidget {
|
|||||||
icon: const Icon(Icons.description),
|
icon: const Icon(Icons.description),
|
||||||
label: 'postEditorModeArticle'.tr,
|
label: 'postEditorModeArticle'.tr,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(
|
||||||
AppRouter.instance.pushNamed(
|
context,
|
||||||
'postEditor',
|
AppRouter.instance.pushNamed(
|
||||||
extra: PostPublishArguments(postListController: controller),
|
'postEditor',
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'mode': 1.toString(),
|
'mode': 1.toString(),
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -170,8 +192,10 @@ class PostCreatePopup extends StatelessWidget {
|
|||||||
icon: const Icon(Icons.drafts),
|
icon: const Icon(Icons.drafts),
|
||||||
label: 'draftBoxOpen'.tr,
|
label: 'draftBoxOpen'.tr,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(
|
||||||
AppRouter.instance.pushNamed('draftBox');
|
context,
|
||||||
|
AppRouter.instance.pushNamed('draftBox'),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
@ -201,7 +225,12 @@ class PostCreatePopup extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
x.icon,
|
x.icon,
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(x.label),
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
x.label,
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
).paddingAll(18),
|
).paddingAll(18),
|
||||||
),
|
),
|
@ -21,7 +21,7 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> {
|
|||||||
final PagingController<int, Post> _pagingController =
|
final PagingController<int, Post> _pagingController =
|
||||||
PagingController(firstPageKey: 0);
|
PagingController(firstPageKey: 0);
|
||||||
|
|
||||||
getPosts(int pageKey) async {
|
_getPosts(int pageKey) async {
|
||||||
final PostProvider provider = Get.find();
|
final PostProvider provider = Get.find();
|
||||||
|
|
||||||
Response resp;
|
Response resp;
|
||||||
@ -49,7 +49,7 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_pagingController.addPageRequestListener(getPosts);
|
_pagingController.addPageRequestListener(_getPosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -76,6 +76,9 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> {
|
|||||||
itemBuilder: (context, item, index) {
|
itemBuilder: (context, item, index) {
|
||||||
return PostOwnedListEntry(
|
return PostOwnedListEntry(
|
||||||
item: item,
|
item: item,
|
||||||
|
isFullContent: true,
|
||||||
|
backgroundColor:
|
||||||
|
Theme.of(context).colorScheme.surfaceContainerLow,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
@ -85,7 +88,13 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> {
|
|||||||
noReact: true,
|
noReact: true,
|
||||||
),
|
),
|
||||||
).then((value) {
|
).then((value) {
|
||||||
if (value != null) _pagingController.refresh();
|
if (value is Future) {
|
||||||
|
value.then((_) {
|
||||||
|
_pagingController.refresh();
|
||||||
|
});
|
||||||
|
} else if (value != null) {
|
||||||
|
_pagingController.refresh();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
).paddingOnly(left: 12, right: 12, bottom: 4);
|
).paddingOnly(left: 12, right: 12, bottom: 4);
|
||||||
|
@ -77,7 +77,10 @@ class _FeedSearchScreenState extends State<FeedSearchScreen> {
|
|||||||
onRefresh: () => Future.sync(() => _pagingController.refresh()),
|
onRefresh: () => Future.sync(() => _pagingController.refresh()),
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
PostWarpedListWidget(controller: _pagingController),
|
PostWarpedListWidget(
|
||||||
|
controller: _pagingController,
|
||||||
|
onUpdate: () => _pagingController.refresh(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -59,8 +59,10 @@ class _PostDetailScreenState extends State<PostDetailScreen> {
|
|||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: PostItem(
|
child: PostItem(
|
||||||
item: item!,
|
item: item!,
|
||||||
isClickable: true,
|
isClickable: false,
|
||||||
|
isOverrideEmbedClickable: true,
|
||||||
isFullDate: true,
|
isFullDate: true,
|
||||||
|
isFullContent: true,
|
||||||
isShowReply: false,
|
isShowReply: false,
|
||||||
isContentSelectable: true,
|
isContentSelectable: true,
|
||||||
),
|
),
|
||||||
|
@ -5,7 +5,6 @@ import 'package:get/get.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:markdown_toolbar/markdown_toolbar.dart';
|
import 'package:markdown_toolbar/markdown_toolbar.dart';
|
||||||
import 'package:solian/controllers/post_editor_controller.dart';
|
import 'package:solian/controllers/post_editor_controller.dart';
|
||||||
import 'package:solian/controllers/post_list_controller.dart';
|
|
||||||
import 'package:solian/exts.dart';
|
import 'package:solian/exts.dart';
|
||||||
import 'package:solian/models/post.dart';
|
import 'package:solian/models/post.dart';
|
||||||
import 'package:solian/models/realm.dart';
|
import 'package:solian/models/realm.dart';
|
||||||
@ -15,6 +14,7 @@ import 'package:solian/router.dart';
|
|||||||
import 'package:solian/theme.dart';
|
import 'package:solian/theme.dart';
|
||||||
import 'package:solian/widgets/app_bar_leading.dart';
|
import 'package:solian/widgets/app_bar_leading.dart';
|
||||||
import 'package:solian/widgets/app_bar_title.dart';
|
import 'package:solian/widgets/app_bar_title.dart';
|
||||||
|
import 'package:solian/widgets/markdown_text_content.dart';
|
||||||
import 'package:solian/widgets/posts/post_item.dart';
|
import 'package:solian/widgets/posts/post_item.dart';
|
||||||
import 'package:badges/badges.dart' as badges;
|
import 'package:badges/badges.dart' as badges;
|
||||||
|
|
||||||
@ -23,14 +23,12 @@ class PostPublishArguments {
|
|||||||
final Post? reply;
|
final Post? reply;
|
||||||
final Post? repost;
|
final Post? repost;
|
||||||
final Realm? realm;
|
final Realm? realm;
|
||||||
final PostListController? postListController;
|
|
||||||
|
|
||||||
PostPublishArguments({
|
PostPublishArguments({
|
||||||
this.edit,
|
this.edit,
|
||||||
this.reply,
|
this.reply,
|
||||||
this.repost,
|
this.repost,
|
||||||
this.realm,
|
this.realm,
|
||||||
this.postListController,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +37,6 @@ class PostPublishScreen extends StatefulWidget {
|
|||||||
final Post? reply;
|
final Post? reply;
|
||||||
final Post? repost;
|
final Post? repost;
|
||||||
final Realm? realm;
|
final Realm? realm;
|
||||||
final PostListController? postListController;
|
|
||||||
final int mode;
|
final int mode;
|
||||||
|
|
||||||
const PostPublishScreen({
|
const PostPublishScreen({
|
||||||
@ -48,7 +45,6 @@ class PostPublishScreen extends StatefulWidget {
|
|||||||
this.reply,
|
this.reply,
|
||||||
this.repost,
|
this.repost,
|
||||||
this.realm,
|
this.realm,
|
||||||
this.postListController,
|
|
||||||
required this.mode,
|
required this.mode,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -69,7 +65,7 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
|
|
||||||
final AttachmentUploaderController uploader = Get.find();
|
final AttachmentUploaderController uploader = Get.find();
|
||||||
if (uploader.queueOfUpload.any(
|
if (uploader.queueOfUpload.any(
|
||||||
((x) => x.usage == 'i.attachment' && x.isUploading),
|
((x) => x.isUploading),
|
||||||
)) {
|
)) {
|
||||||
context.showErrorDialog('attachmentUploadInProgress'.tr);
|
context.showErrorDialog('attachmentUploadInProgress'.tr);
|
||||||
return;
|
return;
|
||||||
@ -94,10 +90,8 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
if (resp.statusCode != 200) {
|
if (resp.statusCode != 200) {
|
||||||
context.showErrorDialog(resp.bodyString);
|
context.showErrorDialog(resp.bodyString);
|
||||||
} else {
|
} else {
|
||||||
|
_editorController.currentClear();
|
||||||
_editorController.localClear();
|
_editorController.localClear();
|
||||||
if (widget.postListController != null) {
|
|
||||||
widget.postListController!.reloadAllOver();
|
|
||||||
}
|
|
||||||
AppRouter.instance.pop(resp.body);
|
AppRouter.instance.pop(resp.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +122,15 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (widget.edit == null) _editorController.localRead();
|
if (widget.edit == null && widget.reply == null && widget.repost == null) {
|
||||||
|
_editorController.localRead();
|
||||||
|
}
|
||||||
|
if (widget.reply != null) {
|
||||||
|
_editorController.replyTo.value = widget.reply;
|
||||||
|
}
|
||||||
|
if (widget.repost != null) {
|
||||||
|
_editorController.repostTo.value = widget.repost;
|
||||||
|
}
|
||||||
_editorController.contentController.addListener(() => setState(() {}));
|
_editorController.contentController.addListener(() => setState(() {}));
|
||||||
_syncWidget();
|
_syncWidget();
|
||||||
}
|
}
|
||||||
@ -174,10 +176,19 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
tileColor: Theme.of(context).colorScheme.surfaceContainerLow,
|
tileColor: Theme.of(context).colorScheme.surfaceContainerLow,
|
||||||
title: Text(
|
title: Row(
|
||||||
_editorController.title ?? 'title'.tr,
|
children: [
|
||||||
maxLines: 1,
|
Text(
|
||||||
overflow: TextOverflow.ellipsis,
|
_editorController.title ?? 'title'.tr,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
if (_editorController.aliasController.text.isNotEmpty)
|
||||||
|
Badge(
|
||||||
|
label: Text('#${_editorController.aliasController.text}'),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
_editorController.description ?? 'description'.tr,
|
_editorController.description ?? 'description'.tr,
|
||||||
@ -219,10 +230,15 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
collapsedBackgroundColor:
|
collapsedBackgroundColor:
|
||||||
Theme.of(context).colorScheme.surfaceContainer,
|
Theme.of(context).colorScheme.surfaceContainer,
|
||||||
children: [
|
children: [
|
||||||
PostItem(
|
Container(
|
||||||
item: _replyTo!,
|
constraints: const BoxConstraints(maxHeight: 280),
|
||||||
isReactable: false,
|
child: SingleChildScrollView(
|
||||||
).paddingOnly(bottom: 8),
|
child: PostItem(
|
||||||
|
item: _replyTo!,
|
||||||
|
isReactable: false,
|
||||||
|
).paddingOnly(bottom: 8),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (_repostTo != null)
|
if (_repostTo != null)
|
||||||
@ -237,37 +253,127 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
collapsedBackgroundColor:
|
collapsedBackgroundColor:
|
||||||
Theme.of(context).colorScheme.surfaceContainer,
|
Theme.of(context).colorScheme.surfaceContainer,
|
||||||
children: [
|
children: [
|
||||||
PostItem(
|
|
||||||
item: _repostTo!,
|
|
||||||
isReactable: false,
|
|
||||||
).paddingOnly(bottom: 8),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: ListView(
|
|
||||||
children: [
|
|
||||||
if (_isBusy)
|
|
||||||
const LinearProgressIndicator().animate().scaleX(),
|
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
constraints: const BoxConstraints(maxHeight: 280),
|
||||||
horizontal: 16,
|
child: SingleChildScrollView(
|
||||||
vertical: 8,
|
child: PostItem(
|
||||||
),
|
item: _repostTo!,
|
||||||
child: TextField(
|
isReactable: false,
|
||||||
maxLines: null,
|
).paddingOnly(bottom: 8),
|
||||||
autofocus: true,
|
|
||||||
autocorrect: true,
|
|
||||||
keyboardType: TextInputType.multiline,
|
|
||||||
controller: _editorController.contentController,
|
|
||||||
focusNode: _contentFocusNode,
|
|
||||||
decoration: InputDecoration.collapsed(
|
|
||||||
hintText: 'postContentPlaceholder'.tr,
|
|
||||||
),
|
|
||||||
onTapOutside: (_) =>
|
|
||||||
FocusManager.instance.primaryFocus?.unfocus(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 120)
|
],
|
||||||
|
),
|
||||||
|
if (_isBusy) const LinearProgressIndicator().animate().scaleX(),
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
|
maxLines: null,
|
||||||
|
autofocus: true,
|
||||||
|
autocorrect: true,
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
controller:
|
||||||
|
_editorController.contentController,
|
||||||
|
focusNode: _contentFocusNode,
|
||||||
|
decoration: InputDecoration.collapsed(
|
||||||
|
hintText: 'postContentPlaceholder'.tr,
|
||||||
|
),
|
||||||
|
onTapOutside: (_) => FocusManager
|
||||||
|
.instance.primaryFocus
|
||||||
|
?.unfocus(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 120)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Obx(() {
|
||||||
|
final textStyle = TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSurface
|
||||||
|
.withOpacity(0.75),
|
||||||
|
);
|
||||||
|
final showFactors = [
|
||||||
|
_editorController.isRestoreFromLocal.value,
|
||||||
|
_editorController.lastSaveTime.value != null,
|
||||||
|
];
|
||||||
|
final doShow = showFactors.any((x) => x);
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 4,
|
||||||
|
horizontal: 16,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
if (showFactors[0])
|
||||||
|
Text('postRestoreFromLocal'.tr,
|
||||||
|
style: textStyle)
|
||||||
|
.paddingOnly(right: 4),
|
||||||
|
if (showFactors[0])
|
||||||
|
InkWell(
|
||||||
|
child: Text('clear'.tr, style: textStyle),
|
||||||
|
onTap: () {
|
||||||
|
_editorController.localClear();
|
||||||
|
_editorController.currentClear();
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (showFactors.where((x) => x).length > 1)
|
||||||
|
Text(
|
||||||
|
'·',
|
||||||
|
style: textStyle,
|
||||||
|
).paddingSymmetric(horizontal: 8),
|
||||||
|
if (showFactors[1])
|
||||||
|
Text(
|
||||||
|
'postAutoSaveAt'.trParams({
|
||||||
|
'date': DateFormat('HH:mm:ss').format(
|
||||||
|
_editorController.lastSaveTime.value ??
|
||||||
|
DateTime.now(),
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
style: textStyle,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.animate(
|
||||||
|
key: const Key('post-editor-hint-animation'),
|
||||||
|
target: doShow ? 1 : 0,
|
||||||
|
)
|
||||||
|
.fade(curve: Curves.easeInOut, duration: 300.ms);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (SolianTheme.isLargeScreen(context))
|
||||||
|
const VerticalDivider(width: 0.3, thickness: 0.3)
|
||||||
|
.paddingSymmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
),
|
||||||
|
if (SolianTheme.isLargeScreen(context))
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: MarkdownTextContent(
|
||||||
|
content: _editorController.contentController.text,
|
||||||
|
parentId: 'post-editor-preview',
|
||||||
|
).paddingOnly(top: 12, right: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -276,85 +382,39 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Obx(() {
|
const Divider(thickness: 0.3, height: 0.3),
|
||||||
final textStyle = TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.onSurface
|
|
||||||
.withOpacity(0.75),
|
|
||||||
);
|
|
||||||
final showFactors = [
|
|
||||||
_editorController.isRestoreFromLocal.value,
|
|
||||||
_editorController.lastSaveTime.value != null,
|
|
||||||
];
|
|
||||||
final doShow = showFactors.any((x) => x);
|
|
||||||
return Container(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 4,
|
|
||||||
horizontal: 16,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
if (showFactors[0])
|
|
||||||
Text('postRestoreFromLocal'.tr, style: textStyle)
|
|
||||||
.paddingOnly(right: 4),
|
|
||||||
if (showFactors[0])
|
|
||||||
InkWell(
|
|
||||||
child: Text('clear'.tr, style: textStyle),
|
|
||||||
onTap: () {
|
|
||||||
_editorController.localClear();
|
|
||||||
_editorController.currentClear();
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (showFactors.where((x) => x).length > 1)
|
|
||||||
Text(
|
|
||||||
'·',
|
|
||||||
style: textStyle,
|
|
||||||
).paddingSymmetric(horizontal: 8),
|
|
||||||
if (showFactors[1])
|
|
||||||
Text(
|
|
||||||
'postAutoSaveAt'.trParams({
|
|
||||||
'date': DateFormat('HH:mm:ss').format(
|
|
||||||
_editorController.lastSaveTime.value ??
|
|
||||||
DateTime.now(),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
style: textStyle,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.animate(
|
|
||||||
key: const Key('post-editor-hint-animation'),
|
|
||||||
target: doShow ? 1 : 0,
|
|
||||||
)
|
|
||||||
.fade(curve: Curves.easeInOut, duration: 300.ms);
|
|
||||||
}),
|
|
||||||
if (_editorController.mode.value == 0)
|
|
||||||
Obx(
|
|
||||||
() => TweenAnimationBuilder<double>(
|
|
||||||
tween: Tween(
|
|
||||||
begin: 0,
|
|
||||||
end: _editorController.contentLength.value / 4096,
|
|
||||||
),
|
|
||||||
duration: const Duration(milliseconds: 300),
|
|
||||||
curve: Curves.easeInOut,
|
|
||||||
builder: (context, value, _) => LinearProgressIndicator(
|
|
||||||
minHeight: 2,
|
|
||||||
color: _editorController.contentLength.value > 4096
|
|
||||||
? Colors.red[900]
|
|
||||||
: Theme.of(context).colorScheme.primary,
|
|
||||||
value: value,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 56,
|
height: 56,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
children: [
|
children: [
|
||||||
|
if (_editorController.mode.value == 0)
|
||||||
|
Obx(
|
||||||
|
() => TweenAnimationBuilder<double>(
|
||||||
|
tween: Tween(
|
||||||
|
begin: 0,
|
||||||
|
end: _editorController.contentLength.value /
|
||||||
|
4096,
|
||||||
|
),
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
builder: (context, value, _) => SizedBox(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 3,
|
||||||
|
backgroundColor: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.secondaryContainer,
|
||||||
|
color: _editorController.contentLength.value >
|
||||||
|
4096
|
||||||
|
? Colors.red[900]
|
||||||
|
: Theme.of(context).colorScheme.primary,
|
||||||
|
value: value,
|
||||||
|
),
|
||||||
|
).paddingAll(10),
|
||||||
|
),
|
||||||
|
).paddingSymmetric(horizontal: 4),
|
||||||
Obx(() {
|
Obx(() {
|
||||||
final isDraft = _editorController.isDraft.value;
|
final isDraft = _editorController.isDraft.value;
|
||||||
return IconButton(
|
return IconButton(
|
||||||
@ -443,6 +503,23 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
_editorController.editPublishZone(context);
|
_editorController.editPublishZone(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: Obx(() {
|
||||||
|
return badges.Badge(
|
||||||
|
showBadge:
|
||||||
|
_editorController.thumbnail.value != null,
|
||||||
|
position: badges.BadgePosition.topEnd(
|
||||||
|
top: -4,
|
||||||
|
end: -6,
|
||||||
|
),
|
||||||
|
child: const Icon(Icons.preview),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
onPressed: () {
|
||||||
|
_editorController.editThumbnail(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Obx(() {
|
icon: Obx(() {
|
||||||
return badges.Badge(
|
return badges.Badge(
|
||||||
@ -465,14 +542,15 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
|||||||
MarkdownToolbar(
|
MarkdownToolbar(
|
||||||
hideImage: true,
|
hideImage: true,
|
||||||
useIncludedTextField: false,
|
useIncludedTextField: false,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor:
|
||||||
|
Theme.of(context).colorScheme.surface,
|
||||||
iconColor: Theme.of(context).colorScheme.onSurface,
|
iconColor: Theme.of(context).colorScheme.onSurface,
|
||||||
controller: _editorController.contentController,
|
controller: _editorController.contentController,
|
||||||
focusNode: _contentFocusNode,
|
focusNode: _contentFocusNode,
|
||||||
borderRadius:
|
borderRadius:
|
||||||
const BorderRadius.all(Radius.circular(20)),
|
const BorderRadius.all(Radius.circular(20)),
|
||||||
width: 40,
|
width: 40,
|
||||||
).paddingSymmetric(horizontal: 4),
|
).paddingSymmetric(horizontal: 2),
|
||||||
],
|
],
|
||||||
).paddingSymmetric(horizontal: 6, vertical: 8),
|
).paddingSymmetric(horizontal: 6, vertical: 8),
|
||||||
),
|
),
|
||||||
|
@ -171,7 +171,7 @@ class _RealmPostListWidgetState extends State<RealmPostListWidget> {
|
|||||||
|
|
||||||
Response resp;
|
Response resp;
|
||||||
try {
|
try {
|
||||||
resp = await provider.listPost(pageKey, realm: widget.realm.id);
|
resp = await provider.listPost(pageKey, realm: widget.realm.alias);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_pagingController.error = e;
|
_pagingController.error = e;
|
||||||
return;
|
return;
|
||||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:solian/controllers/chat_events_controller.dart';
|
||||||
import 'package:solian/exts.dart';
|
import 'package:solian/exts.dart';
|
||||||
import 'package:solian/providers/theme_switcher.dart';
|
import 'package:solian/providers/theme_switcher.dart';
|
||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
@ -93,6 +94,18 @@ class _SettingScreenState extends State<SettingScreen> {
|
|||||||
AppRouter.instance.pushNamed('about');
|
AppRouter.instance.pushNamed('about');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
TextButton(
|
||||||
|
style: const ButtonStyle(
|
||||||
|
visualDensity: VisualDensity(horizontal: -4, vertical: -4),
|
||||||
|
),
|
||||||
|
child: Text('messageHistoryWipe'.tr),
|
||||||
|
onPressed: () {
|
||||||
|
final chatHistory = ChatEventController();
|
||||||
|
chatHistory.initialize().then((_) async {
|
||||||
|
await chatHistory.database.localEvents.wipeLocalEvents();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
).paddingSymmetric(horizontal: 12, vertical: 8),
|
).paddingSymmetric(horizontal: 12, vertical: 8),
|
||||||
],
|
],
|
||||||
|
@ -5,15 +5,15 @@ abstract class ServiceFinder {
|
|||||||
|
|
||||||
static const String dealerUrl =
|
static const String dealerUrl =
|
||||||
devFlag ? 'http://localhost:8442' : 'https://api.sn.solsynth.dev';
|
devFlag ? 'http://localhost:8442' : 'https://api.sn.solsynth.dev';
|
||||||
static const String passportUrl =
|
static const String capitalUrl =
|
||||||
devFlag ? 'http://localhost:8444' : 'https://id.solsynth.dev';
|
devFlag ? 'http://localhost:8444' : 'https://solsynth.dev';
|
||||||
|
|
||||||
static String buildUrl(String serviceName, String? append) {
|
static String buildUrl(String serviceName, String? append) {
|
||||||
append ??= '';
|
append ??= '';
|
||||||
if (serviceName == 'dealer') {
|
if (serviceName == 'dealer') {
|
||||||
return '$dealerUrl$append';
|
return '$dealerUrl$append';
|
||||||
} else if (serviceName == 'passport') {
|
} else if (serviceName == 'capital') {
|
||||||
return '$passportUrl$append';
|
return '$capitalUrl$append';
|
||||||
}
|
}
|
||||||
return '$dealerUrl/cgi/$serviceName$append';
|
return '$dealerUrl/cgi/$serviceName$append';
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:firebase_analytics/firebase_analytics.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:solian/theme.dart';
|
import 'package:solian/theme.dart';
|
||||||
@ -29,6 +30,15 @@ class RootShell extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final routeName = state.topRoute?.name;
|
final routeName = state.topRoute?.name;
|
||||||
|
|
||||||
|
if (routeName != null) {
|
||||||
|
FirebaseAnalytics.instance.logEvent(
|
||||||
|
name: 'screen_view',
|
||||||
|
parameters: {
|
||||||
|
'firebase_screen': routeName,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: rootScaffoldKey,
|
key: rootScaffoldKey,
|
||||||
drawer: SolianTheme.isLargeScreen(context)
|
drawer: SolianTheme.isLargeScreen(context)
|
||||||
|
@ -8,10 +8,14 @@ const i18nEnglish = {
|
|||||||
'home': 'Home',
|
'home': 'Home',
|
||||||
'guest': 'Guest',
|
'guest': 'Guest',
|
||||||
'draft': 'Draft',
|
'draft': 'Draft',
|
||||||
|
'dashboard': 'Dashboard',
|
||||||
|
'today': 'Today',
|
||||||
'draftSave': 'Save',
|
'draftSave': 'Save',
|
||||||
'draftBox': 'Draft Box',
|
'draftBox': 'Draft Box',
|
||||||
'more': 'More',
|
'more': 'More',
|
||||||
'share': 'Share',
|
'share': 'Share',
|
||||||
|
'shareNoUri': 'Share text content',
|
||||||
|
'alias': 'Alias',
|
||||||
'feed': 'Feed',
|
'feed': 'Feed',
|
||||||
'unlink': 'Unlink',
|
'unlink': 'Unlink',
|
||||||
'feedSearch': 'Search Feed',
|
'feedSearch': 'Search Feed',
|
||||||
@ -38,7 +42,10 @@ const i18nEnglish = {
|
|||||||
'openInAlbum': 'Open in album',
|
'openInAlbum': 'Open in album',
|
||||||
'openInBrowser': 'Open in browser',
|
'openInBrowser': 'Open in browser',
|
||||||
'notification': 'Notification',
|
'notification': 'Notification',
|
||||||
|
'notificationUnreadCount': '@count unread notifications',
|
||||||
'errorHappened': 'An error occurred',
|
'errorHappened': 'An error occurred',
|
||||||
|
'errorHappenedUnauthorized':
|
||||||
|
'Unauthorized request, please sign in or try resign in.',
|
||||||
'forgotPassword': 'Forgot password',
|
'forgotPassword': 'Forgot password',
|
||||||
'email': 'Email',
|
'email': 'Email',
|
||||||
'username': 'Username',
|
'username': 'Username',
|
||||||
@ -118,8 +125,12 @@ const i18nEnglish = {
|
|||||||
'postVisibleUsers': 'Visible users',
|
'postVisibleUsers': 'Visible users',
|
||||||
'postInvisibleUsers': 'Invisible users',
|
'postInvisibleUsers': 'Invisible users',
|
||||||
'postOverview': 'Overview',
|
'postOverview': 'Overview',
|
||||||
|
'postThumbnail': 'Thumbnail',
|
||||||
|
'postThumbnailAttachmentNew': 'Upload thumbnail',
|
||||||
|
'postThumbnailAttachment': 'Attachment serial number',
|
||||||
'postPinned': 'Pinned',
|
'postPinned': 'Pinned',
|
||||||
'postListNews': 'News',
|
'postListNews': 'News',
|
||||||
|
'postListFriends': 'Friends',
|
||||||
'postListShuffle': 'Random',
|
'postListShuffle': 'Random',
|
||||||
'postEditorModeStory': 'Post a post',
|
'postEditorModeStory': 'Post a post',
|
||||||
'postEditorModeArticle': 'Post an article',
|
'postEditorModeArticle': 'Post an article',
|
||||||
@ -168,7 +179,7 @@ const i18nEnglish = {
|
|||||||
'attachmentAttached': 'Exists Files',
|
'attachmentAttached': 'Exists Files',
|
||||||
'attachmentUploadBlocked':
|
'attachmentUploadBlocked':
|
||||||
'Upload blocked, there is currently a task in progress...',
|
'Upload blocked, there is currently a task in progress...',
|
||||||
'attachmentAdd': 'Attach attachments',
|
'attachmentAdd': 'Attach file',
|
||||||
'attachmentAddGalleryPhoto': 'Gallery photo',
|
'attachmentAddGalleryPhoto': 'Gallery photo',
|
||||||
'attachmentAddGalleryVideo': 'Gallery video',
|
'attachmentAddGalleryVideo': 'Gallery video',
|
||||||
'attachmentAddCameraPhoto': 'Capture photo',
|
'attachmentAddCameraPhoto': 'Capture photo',
|
||||||
@ -263,6 +274,7 @@ const i18nEnglish = {
|
|||||||
'callOngoing': 'A call is ongoing...',
|
'callOngoing': 'A call is ongoing...',
|
||||||
'callOngoingEmpty': 'A call is on hold...',
|
'callOngoingEmpty': 'A call is on hold...',
|
||||||
'callOngoingParticipants': '@count people are calling...',
|
'callOngoingParticipants': '@count people are calling...',
|
||||||
|
'callOngoingJoined': 'Call last @duration',
|
||||||
'callJoin': 'Join',
|
'callJoin': 'Join',
|
||||||
'callResume': 'Resume',
|
'callResume': 'Resume',
|
||||||
'callMicrophone': 'Microphone',
|
'callMicrophone': 'Microphone',
|
||||||
@ -333,6 +345,7 @@ const i18nEnglish = {
|
|||||||
'bsEstablishingConn': 'Establishing Connection',
|
'bsEstablishingConn': 'Establishing Connection',
|
||||||
'bsPreparingData': 'Preparing User Data',
|
'bsPreparingData': 'Preparing User Data',
|
||||||
'bsRegisteringPushNotify': 'Enabling Push Notifications',
|
'bsRegisteringPushNotify': 'Enabling Push Notifications',
|
||||||
|
'bsDismissibleErrorHint': 'Click anywhere to ignore this error',
|
||||||
'postShareContent':
|
'postShareContent':
|
||||||
'@content\n\n@username on the Solar Network\nCheck it out: @link',
|
'@content\n\n@username on the Solar Network\nCheck it out: @link',
|
||||||
'postShareSubject': '@username posted a post on the Solar Network',
|
'postShareSubject': '@username posted a post on the Solar Network',
|
||||||
@ -349,7 +362,7 @@ const i18nEnglish = {
|
|||||||
'attachmentSaved': 'Attachment saved to your system album.',
|
'attachmentSaved': 'Attachment saved to your system album.',
|
||||||
'cropImage': 'Crop Image',
|
'cropImage': 'Crop Image',
|
||||||
'stickerUploader': 'Upload sticker',
|
'stickerUploader': 'Upload sticker',
|
||||||
'stickerUploaderAttachmentNew': 'Upload new attachment',
|
'stickerUploaderAttachmentNew': 'Upload sticker',
|
||||||
'stickerUploaderAttachment': 'Attachment serial number',
|
'stickerUploaderAttachment': 'Attachment serial number',
|
||||||
'stickerUploaderPack': 'Sticker pack serial number',
|
'stickerUploaderPack': 'Sticker pack serial number',
|
||||||
'stickerUploaderPackHint':
|
'stickerUploaderPackHint':
|
||||||
@ -360,4 +373,20 @@ const i18nEnglish = {
|
|||||||
'stickerUploaderName': 'Name',
|
'stickerUploaderName': 'Name',
|
||||||
'stickerUploaderNameHint':
|
'stickerUploaderNameHint':
|
||||||
'A human-friendly name given to the user in the sticker selection interface.',
|
'A human-friendly name given to the user in the sticker selection interface.',
|
||||||
|
'readMore': 'Read more',
|
||||||
|
'attachmentUnload': 'Not Loaded',
|
||||||
|
'attachmentUnloadCaption':
|
||||||
|
'In order to save traffic, this attachment is not loaded automatically. Click it to start loading.',
|
||||||
|
'callStatusConnected': 'Connected',
|
||||||
|
'callStatusDisconnected': 'Disconnected',
|
||||||
|
'callStatusConnecting': 'Connecting',
|
||||||
|
'callStatusReconnected': 'Reconnecting',
|
||||||
|
'messageOutOfSync': 'May Out of Sync with Server',
|
||||||
|
'messageOutOfSyncCaption':
|
||||||
|
'Since the App has entered the background, there may be a time difference between the message list and the server. Click to Refresh.',
|
||||||
|
'messageHistoryWipe': 'Wipe local message history',
|
||||||
|
'unknown': 'Unknown',
|
||||||
|
'collapse': 'Collapse',
|
||||||
|
'expand': 'Expand',
|
||||||
|
'typingMessage': '@user are typing...',
|
||||||
};
|
};
|
||||||
|
@ -20,8 +20,12 @@ const i18nSimplifiedChinese = {
|
|||||||
'draftBox': '草稿箱',
|
'draftBox': '草稿箱',
|
||||||
'more': '更多',
|
'more': '更多',
|
||||||
'share': '分享',
|
'share': '分享',
|
||||||
|
'shareNoUri': '分享文字内容',
|
||||||
|
'alias': '别名',
|
||||||
'feed': '资讯',
|
'feed': '资讯',
|
||||||
'unlink': '移除链接',
|
'unlink': '移除链接',
|
||||||
|
'dashboard': '仪表盘',
|
||||||
|
'today': '今日',
|
||||||
'feedSearch': '搜索资讯',
|
'feedSearch': '搜索资讯',
|
||||||
'feedSearchWithTag': '检索带有 #@key 标签的资讯',
|
'feedSearchWithTag': '检索带有 #@key 标签的资讯',
|
||||||
'feedSearchWithCategory': '检索位于分类 @category 的资讯',
|
'feedSearchWithCategory': '检索位于分类 @category 的资讯',
|
||||||
@ -38,7 +42,14 @@ const i18nSimplifiedChinese = {
|
|||||||
'openInAlbum': '在相簿中打开',
|
'openInAlbum': '在相簿中打开',
|
||||||
'openInBrowser': '在浏览器中打开',
|
'openInBrowser': '在浏览器中打开',
|
||||||
'notification': '通知',
|
'notification': '通知',
|
||||||
|
'notificationUnreadCount': '@count 条未读通知',
|
||||||
'errorHappened': '发生错误了',
|
'errorHappened': '发生错误了',
|
||||||
|
'errorHappenedUnauthorized': '未经授权的请求,请登录或尝试重新登录。',
|
||||||
|
'errorHappenedRequestBad': '请求错误,服务器拒绝处理该请求,请检查您的请求数据。',
|
||||||
|
'errorHappenedRequestForbidden': '请求错误,权限不足。',
|
||||||
|
'errorHappenedRequestNotFound': '请求错误,请求的数据不存在。',
|
||||||
|
'errorHappenedRequestConnection': '网络请求失败,请检查连接状态与服务状态后再试。',
|
||||||
|
'errorHappenedRequestUnknown': '请求错误,类型未知,请将本提示完整截图提交反馈。',
|
||||||
'forgotPassword': '忘记密码',
|
'forgotPassword': '忘记密码',
|
||||||
'email': '邮件地址',
|
'email': '邮件地址',
|
||||||
'username': '用户名',
|
'username': '用户名',
|
||||||
@ -112,6 +123,9 @@ const i18nSimplifiedChinese = {
|
|||||||
'postVisibleUsers': '可见帖子者',
|
'postVisibleUsers': '可见帖子者',
|
||||||
'postInvisibleUsers': '隐藏帖子者',
|
'postInvisibleUsers': '隐藏帖子者',
|
||||||
'postOverview': '帖子概览',
|
'postOverview': '帖子概览',
|
||||||
|
'postThumbnail': '帖子缩略图',
|
||||||
|
'postThumbnailAttachmentNew': '上传附件作为缩略图',
|
||||||
|
'postThumbnailAttachment': '附件序列号',
|
||||||
'postPinned': '已置顶',
|
'postPinned': '已置顶',
|
||||||
'postEditorModeStory': '发个帖子',
|
'postEditorModeStory': '发个帖子',
|
||||||
'postEditorModeArticle': '撰写文章',
|
'postEditorModeArticle': '撰写文章',
|
||||||
@ -120,6 +134,7 @@ const i18nSimplifiedChinese = {
|
|||||||
'articleDetail': '文章详情',
|
'articleDetail': '文章详情',
|
||||||
'draftBoxOpen': '打开草稿箱',
|
'draftBoxOpen': '打开草稿箱',
|
||||||
'postListNews': '新鲜事',
|
'postListNews': '新鲜事',
|
||||||
|
'postListFriends': '好友圈',
|
||||||
'postListShuffle': '打乱看',
|
'postListShuffle': '打乱看',
|
||||||
'postNew': '创建新帖子',
|
'postNew': '创建新帖子',
|
||||||
'postNewInRealmHint': '在领域 @realm 里发表新帖子',
|
'postNewInRealmHint': '在领域 @realm 里发表新帖子',
|
||||||
@ -241,6 +256,7 @@ const i18nSimplifiedChinese = {
|
|||||||
'callOngoing': '一则通话正在进行中…',
|
'callOngoing': '一则通话正在进行中…',
|
||||||
'callOngoingEmpty': '一则通话待机中…',
|
'callOngoingEmpty': '一则通话待机中…',
|
||||||
'callOngoingParticipants': '@count 人正在进行通话…',
|
'callOngoingParticipants': '@count 人正在进行通话…',
|
||||||
|
'callOngoingJoined': '通话进行 @duration',
|
||||||
'callJoin': '加入',
|
'callJoin': '加入',
|
||||||
'callResume': '恢复',
|
'callResume': '恢复',
|
||||||
'callMicrophone': '麦克风',
|
'callMicrophone': '麦克风',
|
||||||
@ -306,6 +322,7 @@ const i18nSimplifiedChinese = {
|
|||||||
'bsEstablishingConn': '部署连接中',
|
'bsEstablishingConn': '部署连接中',
|
||||||
'bsPreparingData': '正在准备用户资料',
|
'bsPreparingData': '正在准备用户资料',
|
||||||
'bsRegisteringPushNotify': '正在启用推送通知',
|
'bsRegisteringPushNotify': '正在启用推送通知',
|
||||||
|
'bsDismissibleErrorHint': '点击任意地方忽略此错误',
|
||||||
'postShareContent': '@content\n\n@username 在 Solar Network\n原帖地址:@link',
|
'postShareContent': '@content\n\n@username 在 Solar Network\n原帖地址:@link',
|
||||||
'postShareSubject': '@username 在 Solar Network 上发布了一篇帖子',
|
'postShareSubject': '@username 在 Solar Network 上发布了一篇帖子',
|
||||||
'themeColor': '全局主题色',
|
'themeColor': '全局主题色',
|
||||||
@ -320,7 +337,7 @@ const i18nSimplifiedChinese = {
|
|||||||
'attachmentSaved': '附件已保存到系统相册',
|
'attachmentSaved': '附件已保存到系统相册',
|
||||||
'cropImage': '裁剪图片',
|
'cropImage': '裁剪图片',
|
||||||
'stickerUploader': '上传贴图',
|
'stickerUploader': '上传贴图',
|
||||||
'stickerUploaderAttachmentNew': '上传附件',
|
'stickerUploaderAttachmentNew': '上传附件作为贴图',
|
||||||
'stickerUploaderAttachment': '附件序列号',
|
'stickerUploaderAttachment': '附件序列号',
|
||||||
'stickerUploaderPack': '贴图包序号',
|
'stickerUploaderPack': '贴图包序号',
|
||||||
'stickerUploaderPackHint': '没有该序号?请转到我们的创作者平台创建一个贴图包。',
|
'stickerUploaderPackHint': '没有该序号?请转到我们的创作者平台创建一个贴图包。',
|
||||||
@ -328,4 +345,18 @@ const i18nSimplifiedChinese = {
|
|||||||
'stickerUploaderAliasHint': '将会在输入时使用和贴图包前缀组成占位符。',
|
'stickerUploaderAliasHint': '将会在输入时使用和贴图包前缀组成占位符。',
|
||||||
'stickerUploaderName': '贴图名称',
|
'stickerUploaderName': '贴图名称',
|
||||||
'stickerUploaderNameHint': '在贴图选择界面提供给用户的人类友好名称。',
|
'stickerUploaderNameHint': '在贴图选择界面提供给用户的人类友好名称。',
|
||||||
|
'readMore': '阅读更多',
|
||||||
|
'attachmentUnload': '附件未加载',
|
||||||
|
'attachmentUnloadCaption': '为了节省流量,本附件未自动加载,点一下来开始加载。',
|
||||||
|
'callStatusConnected': '已连接',
|
||||||
|
'callStatusDisconnected': '已断开',
|
||||||
|
'callStatusConnecting': '连接中',
|
||||||
|
'callStatusReconnected': '重连中',
|
||||||
|
'messageOutOfSync': '消息可能与服务器脱节',
|
||||||
|
'messageOutOfSyncCaption': '由于 App 进入后台,消息列表可能与服务器存在时差,点击刷新。',
|
||||||
|
'messageHistoryWipe': '清除消息记录',
|
||||||
|
'unknown': '未知',
|
||||||
|
'collapse': '折叠',
|
||||||
|
'expand': '展开',
|
||||||
|
'typingMessage': '@user 正在输入中…',
|
||||||
};
|
};
|
||||||
|
@ -24,7 +24,6 @@ class AccountAvatar extends StatelessWidget {
|
|||||||
if (content is String) {
|
if (content is String) {
|
||||||
direct = content.startsWith('http');
|
direct = content.startsWith('http');
|
||||||
if (!isEmpty) isEmpty = content.isEmpty;
|
if (!isEmpty) isEmpty = content.isEmpty;
|
||||||
if (!isEmpty) isEmpty = content.endsWith('/attachments/0');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final url = direct
|
final url = direct
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:solian/exts.dart';
|
|
||||||
import 'package:solian/models/account.dart';
|
import 'package:solian/models/account.dart';
|
||||||
import 'package:solian/providers/account_status.dart';
|
import 'package:solian/providers/account_status.dart';
|
||||||
import 'package:solian/router.dart';
|
import 'package:solian/router.dart';
|
||||||
@ -18,23 +17,38 @@ class AccountProfilePopup extends StatefulWidget {
|
|||||||
|
|
||||||
class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
||||||
bool _isBusy = true;
|
bool _isBusy = true;
|
||||||
|
dynamic _hasError;
|
||||||
|
|
||||||
Account? _userinfo;
|
Account? _userinfo;
|
||||||
|
|
||||||
void _getUserinfo() async {
|
void _getUserinfo() async {
|
||||||
setState(() => _isBusy = true);
|
setState(() => _isBusy = true);
|
||||||
|
|
||||||
final client = ServiceFinder.configureClient('auth');
|
try {
|
||||||
final resp = await client.get('/users/${widget.name}');
|
final client = ServiceFinder.configureClient('auth');
|
||||||
if (resp.statusCode == 200) {
|
final resp = await client.get('/users/${widget.name}');
|
||||||
_userinfo = Account.fromJson(resp.body);
|
if (resp.statusCode == 200) {
|
||||||
setState(() => _isBusy = false);
|
setState(() {
|
||||||
} else {
|
_userinfo = Account.fromJson(resp.body);
|
||||||
context.showErrorDialog(resp.bodyString);
|
_isBusy = false;
|
||||||
Navigator.pop(context);
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_hasError = resp.bodyString;
|
||||||
|
_isBusy = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setState(() {
|
||||||
|
_hasError = e;
|
||||||
|
_isBusy = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color get _unFocusColor =>
|
||||||
|
Theme.of(context).colorScheme.onSurface.withOpacity(0.75);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -43,13 +57,35 @@ class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_isBusy || _userinfo == null) {
|
if (_isBusy) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.75,
|
height: MediaQuery.of(context).size.height * 0.75,
|
||||||
child: const Center(child: CircularProgressIndicator()),
|
child: const Center(child: CircularProgressIndicator()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_hasError != null) {
|
||||||
|
return SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.75,
|
||||||
|
width: double.infinity,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.cancel, size: 24),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Text(
|
||||||
|
_hasError.toString(),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: _unFocusColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.75,
|
height: MediaQuery.of(context).size.height * 0.75,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -16,28 +16,29 @@ class AttachmentAttrEditorDialog extends StatefulWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AttachmentAttrEditorDialog> createState() => _AttachmentAttrEditorDialogState();
|
State<AttachmentAttrEditorDialog> createState() =>
|
||||||
|
_AttachmentAttrEditorDialogState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AttachmentAttrEditorDialogState extends State<AttachmentAttrEditorDialog> {
|
class _AttachmentAttrEditorDialogState
|
||||||
|
extends State<AttachmentAttrEditorDialog> {
|
||||||
final _altController = TextEditingController();
|
final _altController = TextEditingController();
|
||||||
|
|
||||||
bool _isBusy = false;
|
bool _isBusy = false;
|
||||||
bool _isMature = false;
|
bool _isMature = false;
|
||||||
|
|
||||||
Future<Attachment?> _updateAttachment() async {
|
Future<Attachment?> _updateAttachment() async {
|
||||||
final AttachmentProvider provider = Get.find();
|
final AttachmentProvider attach = Get.find();
|
||||||
|
|
||||||
setState(() => _isBusy = true);
|
setState(() => _isBusy = true);
|
||||||
try {
|
try {
|
||||||
final resp = await provider.updateAttachment(
|
final resp = await attach.updateAttachment(
|
||||||
widget.item.id,
|
widget.item.id,
|
||||||
_altController.value.text,
|
_altController.value.text,
|
||||||
widget.item.usage,
|
|
||||||
isMature: _isMature,
|
isMature: _isMature,
|
||||||
);
|
);
|
||||||
|
|
||||||
Get.find<AttachmentProvider>().clearCache(id: widget.item.id);
|
Get.find<AttachmentProvider>().clearCache(id: widget.item.rid);
|
||||||
|
|
||||||
setState(() => _isBusy = false);
|
setState(() => _isBusy = false);
|
||||||
return Attachment.fromJson(resp.body);
|
return Attachment.fromJson(resp.body);
|
||||||
@ -109,7 +110,7 @@ class _AttachmentAttrEditorDialogState extends State<AttachmentAttrEditorDialog>
|
|||||||
TextButton(
|
TextButton(
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
Theme.of(context).colorScheme.onSurfaceVariant),
|
Theme.of(context).colorScheme.onSurfaceVariant),
|
||||||
onPressed: () => Navigator.pop(context),
|
onPressed: () => Navigator.pop(context),
|
||||||
child: Text('cancel'.tr),
|
child: Text('cancel'.tr),
|
||||||
),
|
),
|
||||||
|
@ -22,19 +22,19 @@ import 'package:solian/widgets/attachments/attachment_attr_editor.dart';
|
|||||||
import 'package:solian/widgets/attachments/attachment_fullscreen.dart';
|
import 'package:solian/widgets/attachments/attachment_fullscreen.dart';
|
||||||
|
|
||||||
class AttachmentEditorPopup extends StatefulWidget {
|
class AttachmentEditorPopup extends StatefulWidget {
|
||||||
final String usage;
|
final String pool;
|
||||||
final bool singleMode;
|
final bool singleMode;
|
||||||
final bool imageOnly;
|
final bool imageOnly;
|
||||||
final bool autoUpload;
|
final bool autoUpload;
|
||||||
final double? imageMaxWidth;
|
final double? imageMaxWidth;
|
||||||
final double? imageMaxHeight;
|
final double? imageMaxHeight;
|
||||||
final List<int>? initialAttachments;
|
final List<String>? initialAttachments;
|
||||||
final void Function(int) onAdd;
|
final void Function(String) onAdd;
|
||||||
final void Function(int) onRemove;
|
final void Function(String) onRemove;
|
||||||
|
|
||||||
const AttachmentEditorPopup({
|
const AttachmentEditorPopup({
|
||||||
super.key,
|
super.key,
|
||||||
required this.usage,
|
required this.pool,
|
||||||
required this.onAdd,
|
required this.onAdd,
|
||||||
required this.onRemove,
|
required this.onRemove,
|
||||||
this.singleMode = false,
|
this.singleMode = false,
|
||||||
@ -64,7 +64,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) return;
|
if (auth.isAuthorized.isFalse) return;
|
||||||
|
|
||||||
if (widget.singleMode) {
|
if (!widget.singleMode) {
|
||||||
final medias = await _imagePicker.pickMultiImage(
|
final medias = await _imagePicker.pickMultiImage(
|
||||||
maxWidth: widget.imageMaxWidth,
|
maxWidth: widget.imageMaxWidth,
|
||||||
maxHeight: widget.imageMaxHeight,
|
maxHeight: widget.imageMaxHeight,
|
||||||
@ -72,8 +72,8 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
if (medias.isEmpty) return;
|
if (medias.isEmpty) return;
|
||||||
|
|
||||||
_enqueueTaskBatch(medias.map((x) {
|
_enqueueTaskBatch(medias.map((x) {
|
||||||
final file = File(x.path);
|
final file = XFile(x.path);
|
||||||
return AttachmentUploadTask(file: file, usage: widget.usage);
|
return AttachmentUploadTask(file: file, pool: widget.pool);
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
final media = await _imagePicker.pickMedia(
|
final media = await _imagePicker.pickMedia(
|
||||||
@ -83,7 +83,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
if (media == null) return;
|
if (media == null) return;
|
||||||
|
|
||||||
_enqueueTask(
|
_enqueueTask(
|
||||||
AttachmentUploadTask(file: File(media.path), usage: widget.usage),
|
AttachmentUploadTask(file: XFile(media.path), pool: widget.pool),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,9 +95,8 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
final media = await _imagePicker.pickVideo(source: ImageSource.gallery);
|
final media = await _imagePicker.pickVideo(source: ImageSource.gallery);
|
||||||
if (media == null) return;
|
if (media == null) return;
|
||||||
|
|
||||||
final file = File(media.path);
|
|
||||||
_enqueueTask(
|
_enqueueTask(
|
||||||
AttachmentUploadTask(file: file, usage: widget.usage),
|
AttachmentUploadTask(file: XFile(media.path), pool: widget.pool),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +112,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
List<File> files = result.paths.map((path) => File(path!)).toList();
|
List<File> files = result.paths.map((path) => File(path!)).toList();
|
||||||
|
|
||||||
_enqueueTaskBatch(files.map((x) {
|
_enqueueTaskBatch(files.map((x) {
|
||||||
return AttachmentUploadTask(file: x, usage: widget.usage);
|
return AttachmentUploadTask(file: XFile(x.path), pool: widget.pool);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,9 +128,8 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
}
|
}
|
||||||
if (media == null) return;
|
if (media == null) return;
|
||||||
|
|
||||||
final file = File(media.path);
|
|
||||||
_enqueueTask(
|
_enqueueTask(
|
||||||
AttachmentUploadTask(file: file, usage: widget.usage),
|
AttachmentUploadTask(file: XFile(media.path), pool: widget.pool),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,13 +179,11 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
WidgetsBinding.instance.addPostFrameCallback((_) => controller.dispose());
|
WidgetsBinding.instance.addPostFrameCallback((_) => controller.dispose());
|
||||||
|
|
||||||
if (input == null || input.isEmpty) return;
|
if (input == null || input.isEmpty) return;
|
||||||
final value = int.tryParse(input);
|
|
||||||
if (value == null) return;
|
|
||||||
|
|
||||||
final AttachmentProvider attach = Get.find();
|
final AttachmentProvider attach = Get.find();
|
||||||
final result = await attach.getMetadata(value);
|
final result = await attach.getMetadata(input);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
widget.onAdd(result.id);
|
widget.onAdd(result.rid);
|
||||||
setState(() => _attachments.add(result));
|
setState(() => _attachments.add(result));
|
||||||
if (widget.singleMode) Navigator.pop(context);
|
if (widget.singleMode) Navigator.pop(context);
|
||||||
}
|
}
|
||||||
@ -199,20 +195,16 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
|
|
||||||
if (_uploadController.isUploading.value) return;
|
if (_uploadController.isUploading.value) return;
|
||||||
|
|
||||||
_uploadController.uploadAttachmentWithCallback(
|
_uploadController
|
||||||
data,
|
.uploadAttachmentFromData(data, 'Pasted Image', widget.pool, null)
|
||||||
'Pasted Image',
|
.then((item) {
|
||||||
widget.usage,
|
if (item == null) return;
|
||||||
null,
|
widget.onAdd(item.rid);
|
||||||
(item) {
|
if (mounted) {
|
||||||
if (item == null) return;
|
setState(() => _attachments.add(item));
|
||||||
widget.onAdd(item.id);
|
if (widget.singleMode) Navigator.pop(context);
|
||||||
if (mounted) {
|
}
|
||||||
setState(() => _attachments.add(item));
|
});
|
||||||
if (widget.singleMode) Navigator.pop(context);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String _formatBytes(int bytes, {int decimals = 2}) {
|
String _formatBytes(int bytes, {int decimals = 2}) {
|
||||||
@ -254,7 +246,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
.listMetadata(widget.initialAttachments ?? List.empty())
|
.listMetadata(widget.initialAttachments ?? List.empty())
|
||||||
.then((result) {
|
.then((result) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_attachments = result;
|
_attachments = List.from(result, growable: true);
|
||||||
_isBusy = false;
|
_isBusy = false;
|
||||||
_isFirstTimeBusy = false;
|
_isFirstTimeBusy = false;
|
||||||
});
|
});
|
||||||
@ -306,7 +298,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
if (croppedFile == null) return;
|
if (croppedFile == null) return;
|
||||||
_uploadController.queueOfUpload[queueIndex].file = File(croppedFile.path);
|
_uploadController.queueOfUpload[queueIndex].file = XFile(croppedFile.path);
|
||||||
_uploadController.queueOfUpload.refresh();
|
_uploadController.queueOfUpload.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,9 +341,25 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
fontFamily: 'monospace',
|
fontFamily: 'monospace',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Row(
|
||||||
'In queue #${index + 1}',
|
children: [
|
||||||
style: const TextStyle(fontSize: 12),
|
FutureBuilder(
|
||||||
|
future: element.file.length(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (!snapshot.hasData) return const SizedBox();
|
||||||
|
return Text(
|
||||||
|
_formatBytes(snapshot.data!),
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
if (element.progress != null)
|
||||||
|
Text(
|
||||||
|
'${(element.progress! * 100).toStringAsFixed(2)}%',
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -385,7 +393,9 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
icon: const Icon(Icons.warning),
|
icon: const Icon(Icons.warning),
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
if (!element.isCompleted && element.error == null && canBeCrop)
|
if (!element.isCompleted &&
|
||||||
|
element.error == null &&
|
||||||
|
canBeCrop)
|
||||||
Obx(
|
Obx(
|
||||||
() => IconButton(
|
() => IconButton(
|
||||||
color: Colors.teal,
|
color: Colors.teal,
|
||||||
@ -398,7 +408,9 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!element.isCompleted && !element.isUploading && element.error == null)
|
if (!element.isCompleted &&
|
||||||
|
!element.isUploading &&
|
||||||
|
element.error == null)
|
||||||
Obx(
|
Obx(
|
||||||
() => IconButton(
|
() => IconButton(
|
||||||
color: Colors.green,
|
color: Colors.green,
|
||||||
@ -409,11 +421,11 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
: () {
|
: () {
|
||||||
_uploadController
|
_uploadController
|
||||||
.performSingleTask(index)
|
.performSingleTask(index)
|
||||||
.then((r) {
|
.then((out) {
|
||||||
if (r == null) return;
|
if (out == null) return;
|
||||||
widget.onAdd(r.id);
|
widget.onAdd(out.rid);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() => _attachments.add(r));
|
setState(() => _attachments.add(out));
|
||||||
if (widget.singleMode) {
|
if (widget.singleMode) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
@ -511,7 +523,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_deleteAttachment(element).then((_) {
|
_deleteAttachment(element).then((_) {
|
||||||
widget.onRemove(element.id);
|
widget.onRemove(element.rid);
|
||||||
setState(() => _attachments.removeAt(index));
|
setState(() => _attachments.removeAt(index));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -525,7 +537,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
widget.onRemove(element.id);
|
widget.onRemove(element.rid);
|
||||||
setState(() => _attachments.removeAt(index));
|
setState(() => _attachments.removeAt(index));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -556,7 +568,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
|
|
||||||
void _startUploading() {
|
void _startUploading() {
|
||||||
_uploadController.performUploadQueue(onData: (r) {
|
_uploadController.performUploadQueue(onData: (r) {
|
||||||
widget.onAdd(r.id);
|
widget.onAdd(r.rid);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() => _attachments.add(r));
|
setState(() => _attachments.add(r));
|
||||||
if (widget.singleMode) Navigator.pop(context);
|
if (widget.singleMode) Navigator.pop(context);
|
||||||
@ -579,8 +591,8 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
onDragDone: (detail) async {
|
onDragDone: (detail) async {
|
||||||
if (_uploadController.isUploading.value) return;
|
if (_uploadController.isUploading.value) return;
|
||||||
_enqueueTaskBatch(detail.files.map((x) {
|
_enqueueTaskBatch(detail.files.map((x) {
|
||||||
final file = File(x.path);
|
final file = XFile(x.path);
|
||||||
return AttachmentUploadTask(file: file, usage: widget.usage);
|
return AttachmentUploadTask(file: file, pool: widget.pool);
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -592,27 +604,38 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Expanded(
|
||||||
'attachmentAdd'.tr,
|
child: Row(
|
||||||
style: Theme.of(context).textTheme.headlineSmall,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
),
|
children: [
|
||||||
const SizedBox(width: 10),
|
Text(
|
||||||
Obx(() {
|
'attachmentAdd'.tr,
|
||||||
if (_uploadController.isUploading.value) {
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
return SizedBox(
|
maxLines: 1,
|
||||||
width: 18,
|
overflow: TextOverflow.ellipsis,
|
||||||
height: 18,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 2.5,
|
|
||||||
value: _uploadController.progressOfUpload.value,
|
|
||||||
),
|
),
|
||||||
);
|
const SizedBox(width: 10),
|
||||||
}
|
Obx(() {
|
||||||
return const SizedBox();
|
if (_uploadController.isUploading.value) {
|
||||||
}),
|
return SizedBox(
|
||||||
|
width: 18,
|
||||||
|
height: 18,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2.5,
|
||||||
|
value: _uploadController
|
||||||
|
.progressOfUpload.value,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return const SizedBox();
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 20),
|
||||||
Text('attachmentAutoUpload'.tr),
|
Text('attachmentAutoUpload'.tr),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Switch(
|
Switch(
|
||||||
|
@ -67,10 +67,10 @@ class _AttachmentFullScreenState extends State<AttachmentFullScreen> {
|
|||||||
Future<void> _saveToAlbum() async {
|
Future<void> _saveToAlbum() async {
|
||||||
final url = ServiceFinder.buildUrl(
|
final url = ServiceFinder.buildUrl(
|
||||||
'files',
|
'files',
|
||||||
'/attachments/${widget.item.id}',
|
'/attachments/${widget.item.rid}',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (PlatformInfo.isWeb) {
|
if (PlatformInfo.isWeb || PlatformInfo.isDesktop) {
|
||||||
await launchUrlString(url);
|
await launchUrlString(url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ class _AttachmentFullScreenState extends State<AttachmentFullScreen> {
|
|||||||
spacing: 6,
|
spacing: 6,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'#${widget.item.id}',
|
'#${widget.item.rid}',
|
||||||
style: metaTextStyle,
|
style: metaTextStyle,
|
||||||
),
|
),
|
||||||
if (widget.item.metadata?['width'] != null &&
|
if (widget.item.metadata?['width'] != null &&
|
||||||
|
@ -7,6 +7,7 @@ import 'package:media_kit_video/media_kit_video.dart';
|
|||||||
import 'package:solian/models/attachment.dart';
|
import 'package:solian/models/attachment.dart';
|
||||||
import 'package:solian/platform.dart';
|
import 'package:solian/platform.dart';
|
||||||
import 'package:solian/services.dart';
|
import 'package:solian/services.dart';
|
||||||
|
import 'package:solian/widgets/sized_container.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
class AttachmentItem extends StatefulWidget {
|
class AttachmentItem extends StatefulWidget {
|
||||||
@ -14,6 +15,7 @@ class AttachmentItem extends StatefulWidget {
|
|||||||
final Attachment item;
|
final Attachment item;
|
||||||
final bool showBadge;
|
final bool showBadge;
|
||||||
final bool showHideButton;
|
final bool showHideButton;
|
||||||
|
final bool autoload;
|
||||||
final BoxFit fit;
|
final BoxFit fit;
|
||||||
final String? badge;
|
final String? badge;
|
||||||
final Function? onHide;
|
final Function? onHide;
|
||||||
@ -26,6 +28,7 @@ class AttachmentItem extends StatefulWidget {
|
|||||||
this.fit = BoxFit.cover,
|
this.fit = BoxFit.cover,
|
||||||
this.showBadge = true,
|
this.showBadge = true,
|
||||||
this.showHideButton = true,
|
this.showHideButton = true,
|
||||||
|
this.autoload = false,
|
||||||
this.onHide,
|
this.onHide,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -48,7 +51,10 @@ class _AttachmentItemState extends State<AttachmentItem> {
|
|||||||
onHide: widget.onHide,
|
onHide: widget.onHide,
|
||||||
);
|
);
|
||||||
case 'video':
|
case 'video':
|
||||||
return _AttachmentItemVideo(item: widget.item);
|
return _AttachmentItemVideo(
|
||||||
|
item: widget.item,
|
||||||
|
autoload: widget.autoload,
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -85,7 +91,7 @@ class _AttachmentItemState extends State<AttachmentItem> {
|
|||||||
launchUrlString(
|
launchUrlString(
|
||||||
ServiceFinder.buildUrl(
|
ServiceFinder.buildUrl(
|
||||||
'files',
|
'files',
|
||||||
'/attachments/${widget.item.id}',
|
'/attachments/${widget.item.rid}',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -129,7 +135,7 @@ class _AttachmentItemImage extends StatelessWidget {
|
|||||||
fit: fit,
|
fit: fit,
|
||||||
imageUrl: ServiceFinder.buildUrl(
|
imageUrl: ServiceFinder.buildUrl(
|
||||||
'files',
|
'files',
|
||||||
'/attachments/${item.id}',
|
'/attachments/${item.rid}',
|
||||||
),
|
),
|
||||||
progressIndicatorBuilder: (context, url, downloadProgress) {
|
progressIndicatorBuilder: (context, url, downloadProgress) {
|
||||||
return Center(
|
return Center(
|
||||||
@ -141,17 +147,21 @@ class _AttachmentItemImage extends StatelessWidget {
|
|||||||
errorWidget: (context, url, error) {
|
errorWidget: (context, url, error) {
|
||||||
return Material(
|
return Material(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
child: Center(
|
child: Column(
|
||||||
child: const Icon(Icons.close, size: 32)
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
.animate(onPlay: (e) => e.repeat(reverse: true))
|
children: [
|
||||||
.fade(duration: 500.ms),
|
const Icon(Icons.close, size: 32)
|
||||||
|
.animate(onPlay: (e) => e.repeat(reverse: true))
|
||||||
|
.fade(duration: 500.ms),
|
||||||
|
Text(error.toString()),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Image.network(
|
Image.network(
|
||||||
ServiceFinder.buildUrl('files', '/attachments/${item.id}'),
|
ServiceFinder.buildUrl('files', '/attachments/${item.rid}'),
|
||||||
fit: fit,
|
fit: fit,
|
||||||
loadingBuilder: (BuildContext context, Widget child,
|
loadingBuilder: (BuildContext context, Widget child,
|
||||||
ImageChunkEvent? loadingProgress) {
|
ImageChunkEvent? loadingProgress) {
|
||||||
@ -168,10 +178,14 @@ class _AttachmentItemImage extends StatelessWidget {
|
|||||||
errorBuilder: (context, error, stackTrace) {
|
errorBuilder: (context, error, stackTrace) {
|
||||||
return Material(
|
return Material(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
child: Center(
|
child: Column(
|
||||||
child: const Icon(Icons.close, size: 32)
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
.animate(onPlay: (e) => e.repeat(reverse: true))
|
children: [
|
||||||
.fade(duration: 500.ms),
|
const Icon(Icons.close, size: 32)
|
||||||
|
.animate(onPlay: (e) => e.repeat(reverse: true))
|
||||||
|
.fade(duration: 500.ms),
|
||||||
|
Text(error.toString()),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -213,8 +227,12 @@ class _AttachmentItemImage extends StatelessWidget {
|
|||||||
|
|
||||||
class _AttachmentItemVideo extends StatefulWidget {
|
class _AttachmentItemVideo extends StatefulWidget {
|
||||||
final Attachment item;
|
final Attachment item;
|
||||||
|
final bool autoload;
|
||||||
|
|
||||||
const _AttachmentItemVideo({required this.item});
|
const _AttachmentItemVideo({
|
||||||
|
required this.item,
|
||||||
|
this.autoload = false,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<_AttachmentItemVideo> createState() => _AttachmentItemVideoState();
|
State<_AttachmentItemVideo> createState() => _AttachmentItemVideoState();
|
||||||
@ -222,25 +240,74 @@ class _AttachmentItemVideo extends StatefulWidget {
|
|||||||
|
|
||||||
class _AttachmentItemVideoState extends State<_AttachmentItemVideo> {
|
class _AttachmentItemVideoState extends State<_AttachmentItemVideo> {
|
||||||
late final _player = Player(
|
late final _player = Player(
|
||||||
configuration: const PlayerConfiguration(logLevel: MPVLogLevel.error),
|
configuration: const PlayerConfiguration(
|
||||||
|
logLevel: MPVLogLevel.error,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
late final _controller = VideoController(_player);
|
late final _controller = VideoController(_player);
|
||||||
|
|
||||||
|
bool _showContent = false;
|
||||||
|
|
||||||
|
Future<void> _startLoad() async {
|
||||||
|
await _player.open(
|
||||||
|
Media(ServiceFinder.buildUrl('files', '/attachments/${widget.item.rid}')),
|
||||||
|
play: false,
|
||||||
|
);
|
||||||
|
setState(() => _showContent = true);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_player.open(
|
if (widget.autoload) {
|
||||||
Media(
|
_startLoad();
|
||||||
ServiceFinder.buildUrl('files', '/attachments/${widget.item.id}'),
|
}
|
||||||
),
|
|
||||||
play: false,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final ratio = widget.item.metadata?['ratio'] ?? 16 / 9;
|
||||||
|
if (!_showContent) {
|
||||||
|
return GestureDetector(
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: ratio,
|
||||||
|
child: CenteredContainer(
|
||||||
|
maxWidth: 280,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.not_started,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 32,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'attachmentUnload'.tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'attachmentUnloadCaption'.tr,
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
_startLoad();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return Video(
|
return Video(
|
||||||
aspectRatio: widget.item.metadata?['ratio'] ?? 16 / 9,
|
aspectRatio: ratio,
|
||||||
controller: _controller,
|
controller: _controller,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,26 @@
|
|||||||
import 'dart:math' show min;
|
import 'dart:math' as math;
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:carousel_slider/carousel_slider.dart';
|
import 'package:carousel_slider/carousel_slider.dart';
|
||||||
import 'package:dismissible_page/dismissible_page.dart';
|
import 'package:dismissible_page/dismissible_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart' hide CarouselController;
|
||||||
import 'package:flutter_animate/flutter_animate.dart';
|
import 'package:flutter_animate/flutter_animate.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:solian/models/attachment.dart';
|
import 'package:solian/models/attachment.dart';
|
||||||
import 'package:solian/widgets/attachments/attachment_item.dart';
|
import 'package:solian/widgets/attachments/attachment_item.dart';
|
||||||
import 'package:solian/providers/content/attachment.dart';
|
import 'package:solian/providers/content/attachment.dart';
|
||||||
import 'package:solian/widgets/attachments/attachment_fullscreen.dart';
|
import 'package:solian/widgets/attachments/attachment_fullscreen.dart';
|
||||||
|
import 'package:solian/widgets/sized_container.dart';
|
||||||
|
|
||||||
class AttachmentList extends StatefulWidget {
|
class AttachmentList extends StatefulWidget {
|
||||||
final String parentId;
|
final String parentId;
|
||||||
final List<int> attachmentsId;
|
final List<String> attachmentsId;
|
||||||
final bool isGrid;
|
final bool isGrid;
|
||||||
|
final bool isColumn;
|
||||||
final bool isForceGrid;
|
final bool isForceGrid;
|
||||||
|
final bool autoload;
|
||||||
final double flatMaxHeight;
|
final double flatMaxHeight;
|
||||||
|
final double columnMaxWidth;
|
||||||
|
|
||||||
final double? width;
|
final double? width;
|
||||||
final double? viewport;
|
final double? viewport;
|
||||||
@ -26,8 +30,11 @@ class AttachmentList extends StatefulWidget {
|
|||||||
required this.parentId,
|
required this.parentId,
|
||||||
required this.attachmentsId,
|
required this.attachmentsId,
|
||||||
this.isGrid = false,
|
this.isGrid = false,
|
||||||
|
this.isColumn = false,
|
||||||
this.isForceGrid = false,
|
this.isForceGrid = false,
|
||||||
|
this.autoload = false,
|
||||||
this.flatMaxHeight = 720,
|
this.flatMaxHeight = 720,
|
||||||
|
this.columnMaxWidth = 480,
|
||||||
this.width,
|
this.width,
|
||||||
this.viewport,
|
this.viewport,
|
||||||
});
|
});
|
||||||
@ -54,10 +61,12 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
attach.listMetadata(widget.attachmentsId).then((result) {
|
attach.listMetadata(widget.attachmentsId).then((result) {
|
||||||
setState(() {
|
if (mounted) {
|
||||||
_attachmentsMeta = result;
|
setState(() {
|
||||||
_isLoading = false;
|
_attachmentsMeta = result;
|
||||||
});
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
_calculateAspectRatio();
|
_calculateAspectRatio();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -67,7 +76,8 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
double? consistentValue;
|
double? consistentValue;
|
||||||
int portrait = 0, square = 0, landscape = 0;
|
int portrait = 0, square = 0, landscape = 0;
|
||||||
for (var entry in _attachmentsMeta) {
|
for (var entry in _attachmentsMeta) {
|
||||||
if (entry!.metadata?['ratio'] != null) {
|
if (entry == null) continue;
|
||||||
|
if (entry.metadata?['ratio'] != null) {
|
||||||
if (entry.metadata?['ratio'] is int) {
|
if (entry.metadata?['ratio'] is int) {
|
||||||
consistentValue ??= entry.metadata?['ratio'].toDouble();
|
consistentValue ??= entry.metadata?['ratio'].toDouble();
|
||||||
} else {
|
} else {
|
||||||
@ -99,15 +109,17 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEntry(Attachment? element, int idx) {
|
Widget _buildEntry(Attachment? element, int idx, {double? width}) {
|
||||||
return AttachmentListEntry(
|
return AttachmentListEntry(
|
||||||
item: element,
|
item: element,
|
||||||
parentId: widget.parentId,
|
parentId: widget.parentId,
|
||||||
width: widget.width,
|
width: width ?? widget.width,
|
||||||
badgeContent: '${idx + 1}/${_attachmentsMeta.length}',
|
badgeContent: '${idx + 1}/${_attachmentsMeta.length}',
|
||||||
showBadge: _attachmentsMeta.length > 1 && !widget.isGrid,
|
showBadge:
|
||||||
|
_attachmentsMeta.length > 1 && !widget.isGrid && !widget.isColumn,
|
||||||
showBorder: widget.attachmentsId.length > 1,
|
showBorder: widget.attachmentsId.length > 1,
|
||||||
showMature: _showMature,
|
showMature: _showMature,
|
||||||
|
autoload: widget.autoload,
|
||||||
onReveal: (value) {
|
onReveal: (value) {
|
||||||
setState(() => _showMature = value);
|
setState(() => _showMature = value);
|
||||||
},
|
},
|
||||||
@ -120,6 +132,9 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
_getMetadataList();
|
_getMetadataList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color get _unFocusColor =>
|
||||||
|
Theme.of(context).colorScheme.onSurface.withOpacity(0.75);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (widget.attachmentsId.isEmpty) {
|
if (widget.attachmentsId.isEmpty) {
|
||||||
@ -127,16 +142,69 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_isLoading) {
|
if (_isLoading) {
|
||||||
return Container(
|
return Row(
|
||||||
decoration: BoxDecoration(
|
children: [
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
Icon(
|
||||||
),
|
Icons.file_copy,
|
||||||
child: const LinearProgressIndicator(),
|
size: 12,
|
||||||
|
color: _unFocusColor,
|
||||||
|
).paddingOnly(right: 5),
|
||||||
|
Text(
|
||||||
|
'attachmentHint'.trParams(
|
||||||
|
{'count': widget.attachmentsId.length.toString()},
|
||||||
|
),
|
||||||
|
style: TextStyle(color: _unFocusColor, fontSize: 12),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
.paddingSymmetric(horizontal: 8)
|
||||||
|
.animate(onPlay: (c) => c.repeat(reverse: true))
|
||||||
|
.fadeIn(duration: 1250.ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (widget.isColumn) {
|
||||||
|
var idx = 0;
|
||||||
|
const radius = BorderRadius.all(Radius.circular(8));
|
||||||
|
return Wrap(
|
||||||
|
spacing: 8,
|
||||||
|
runSpacing: 8,
|
||||||
|
children: widget.attachmentsId.map((x) {
|
||||||
|
final element = _attachmentsMeta[idx];
|
||||||
|
idx++;
|
||||||
|
if (element == null) return const SizedBox();
|
||||||
|
double ratio = element.metadata?['ratio']?.toDouble() ?? 16 / 9;
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
|
),
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxWidth: widget.columnMaxWidth,
|
||||||
|
maxHeight: 640,
|
||||||
|
),
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: ratio,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
borderRadius: radius,
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: radius,
|
||||||
|
child: _buildEntry(element, idx),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final isNotPureImage = _attachmentsMeta
|
final isNotPureImage = _attachmentsMeta.any(
|
||||||
.any((x) => x?.mimetype.split('/').firstOrNull != 'image');
|
(x) => x?.mimetype.split('/').firstOrNull != 'image',
|
||||||
|
);
|
||||||
if (widget.isGrid && (widget.isForceGrid || !isNotPureImage)) {
|
if (widget.isGrid && (widget.isForceGrid || !isNotPureImage)) {
|
||||||
const radius = BorderRadius.all(Radius.circular(8));
|
const radius = BorderRadius.all(Radius.circular(8));
|
||||||
return GridView.builder(
|
return GridView.builder(
|
||||||
@ -145,7 +213,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: min(3, widget.attachmentsId.length),
|
crossAxisCount: math.min(3, widget.attachmentsId.length),
|
||||||
mainAxisSpacing: 8.0,
|
mainAxisSpacing: 8.0,
|
||||||
crossAxisSpacing: 8.0,
|
crossAxisSpacing: 8.0,
|
||||||
),
|
),
|
||||||
@ -154,8 +222,11 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
final element = _attachmentsMeta[idx];
|
final element = _attachmentsMeta[idx];
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border:
|
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
Border.all(color: Theme.of(context).dividerColor, width: 1),
|
border: Border.all(
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
borderRadius: radius,
|
borderRadius: radius,
|
||||||
),
|
),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
@ -203,10 +274,12 @@ class AttachmentListEntry extends StatelessWidget {
|
|||||||
final Attachment? item;
|
final Attachment? item;
|
||||||
final String? badgeContent;
|
final String? badgeContent;
|
||||||
final double? width;
|
final double? width;
|
||||||
|
final double? height;
|
||||||
final bool showBorder;
|
final bool showBorder;
|
||||||
final bool showBadge;
|
final bool showBadge;
|
||||||
final bool showMature;
|
final bool showMature;
|
||||||
final bool isDense;
|
final bool isDense;
|
||||||
|
final bool autoload;
|
||||||
final Function(bool) onReveal;
|
final Function(bool) onReveal;
|
||||||
|
|
||||||
const AttachmentListEntry({
|
const AttachmentListEntry({
|
||||||
@ -216,10 +289,12 @@ class AttachmentListEntry extends StatelessWidget {
|
|||||||
this.item,
|
this.item,
|
||||||
this.badgeContent,
|
this.badgeContent,
|
||||||
this.width,
|
this.width,
|
||||||
|
this.height,
|
||||||
this.showBorder = false,
|
this.showBorder = false,
|
||||||
this.showBadge = false,
|
this.showBadge = false,
|
||||||
this.showMature = false,
|
this.showMature = false,
|
||||||
this.isDense = false,
|
this.isDense = false,
|
||||||
|
this.autoload = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -239,6 +314,7 @@ class AttachmentListEntry extends StatelessWidget {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: width ?? MediaQuery.of(context).size.width,
|
width: width ?? MediaQuery.of(context).size.width,
|
||||||
|
height: height,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: showBorder
|
border: showBorder
|
||||||
? Border.symmetric(
|
? Border.symmetric(
|
||||||
@ -258,6 +334,7 @@ class AttachmentListEntry extends StatelessWidget {
|
|||||||
item: item!,
|
item: item!,
|
||||||
badge: showBadge ? badgeContent : null,
|
badge: showBadge ? badgeContent : null,
|
||||||
showHideButton: !item!.isMature || showMature,
|
showHideButton: !item!.isMature || showMature,
|
||||||
|
autoload: autoload,
|
||||||
onHide: () {
|
onHide: () {
|
||||||
onReveal(false);
|
onReveal(false);
|
||||||
},
|
},
|
||||||
@ -272,35 +349,33 @@ class AttachmentListEntry extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (item!.isMature && !showMature)
|
if (item!.isMature && !showMature)
|
||||||
Center(
|
CenteredContainer(
|
||||||
child: Container(
|
maxWidth: 280,
|
||||||
constraints: const BoxConstraints(maxWidth: 280),
|
child: Column(
|
||||||
child: Column(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: [
|
||||||
children: [
|
const Icon(
|
||||||
const Icon(
|
Icons.visibility_off,
|
||||||
Icons.visibility_off,
|
color: Colors.white,
|
||||||
color: Colors.white,
|
size: 32,
|
||||||
size: 32,
|
),
|
||||||
|
if (!isDense) const SizedBox(height: 8),
|
||||||
|
if (!isDense)
|
||||||
|
Text(
|
||||||
|
'matureContent'.tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (!isDense) const SizedBox(height: 8),
|
if (!isDense)
|
||||||
if (!isDense)
|
Text(
|
||||||
Text(
|
'matureContentCaption'.tr,
|
||||||
'matureContent'.tr,
|
style: const TextStyle(color: Colors.white),
|
||||||
style: const TextStyle(
|
textAlign: TextAlign.center,
|
||||||
color: Colors.white,
|
),
|
||||||
fontWeight: FontWeight.bold,
|
],
|
||||||
fontSize: 16,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (!isDense)
|
|
||||||
Text(
|
|
||||||
'matureContentCaption'.tr,
|
|
||||||
style: const TextStyle(color: Colors.white),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -322,3 +397,51 @@ class AttachmentListEntry extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AttachmentSelfContainedEntry extends StatefulWidget {
|
||||||
|
final String rid;
|
||||||
|
final String parentId;
|
||||||
|
final bool isDense;
|
||||||
|
|
||||||
|
const AttachmentSelfContainedEntry({
|
||||||
|
super.key,
|
||||||
|
required this.rid,
|
||||||
|
required this.parentId,
|
||||||
|
this.isDense = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AttachmentSelfContainedEntry> createState() =>
|
||||||
|
_AttachmentSelfContainedEntryState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AttachmentSelfContainedEntryState
|
||||||
|
extends State<AttachmentSelfContainedEntry> {
|
||||||
|
bool _showMature = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final AttachmentProvider attachments = Get.find();
|
||||||
|
|
||||||
|
return FutureBuilder(
|
||||||
|
future: attachments.getMetadata(widget.rid),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (!snapshot.hasData) {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return AttachmentListEntry(
|
||||||
|
item: snapshot.data,
|
||||||
|
isDense: widget.isDense,
|
||||||
|
parentId: widget.parentId,
|
||||||
|
showMature: _showMature,
|
||||||
|
onReveal: (value) {
|
||||||
|
setState(() => _showMature = value);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -9,14 +9,20 @@ import 'package:solian/models/call.dart';
|
|||||||
import 'package:solian/models/channel.dart';
|
import 'package:solian/models/channel.dart';
|
||||||
import 'package:solian/platform.dart';
|
import 'package:solian/platform.dart';
|
||||||
import 'package:solian/providers/call.dart';
|
import 'package:solian/providers/call.dart';
|
||||||
|
import 'package:solian/theme.dart';
|
||||||
import 'package:solian/widgets/chat/call/call_prejoin.dart';
|
import 'package:solian/widgets/chat/call/call_prejoin.dart';
|
||||||
|
|
||||||
class ChannelCallIndicator extends StatelessWidget {
|
class ChannelCallIndicator extends StatelessWidget {
|
||||||
final Channel channel;
|
final Channel channel;
|
||||||
final Call ongoingCall;
|
final Call ongoingCall;
|
||||||
|
final Function onJoin;
|
||||||
|
|
||||||
const ChannelCallIndicator(
|
const ChannelCallIndicator({
|
||||||
{super.key, required this.channel, required this.ongoingCall});
|
super.key,
|
||||||
|
required this.channel,
|
||||||
|
required this.ongoingCall,
|
||||||
|
required this.onJoin,
|
||||||
|
});
|
||||||
|
|
||||||
void _showCallPrejoin(BuildContext context) {
|
void _showCallPrejoin(BuildContext context) {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
@ -25,6 +31,7 @@ class ChannelCallIndicator extends StatelessWidget {
|
|||||||
builder: (context) => ChatCallPrejoinPopup(
|
builder: (context) => ChatCallPrejoinPopup(
|
||||||
ongoingCall: ongoingCall,
|
ongoingCall: ongoingCall,
|
||||||
channel: channel,
|
channel: channel,
|
||||||
|
onJoin: onJoin,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -40,48 +47,72 @@ class ChannelCallIndicator extends StatelessWidget {
|
|||||||
dividerColor: Colors.transparent,
|
dividerColor: Colors.transparent,
|
||||||
content: Row(
|
content: Row(
|
||||||
children: [
|
children: [
|
||||||
if (ongoingCall.participants.isEmpty) Text('callOngoingEmpty'.tr),
|
Obx(() {
|
||||||
if (ongoingCall.participants.isNotEmpty)
|
if (call.isInitialized.value) {
|
||||||
Text('callOngoingParticipants'.trParams({
|
return Text('callOngoingJoined'.trParams({
|
||||||
'count': ongoingCall.participants.length.toString(),
|
'duration': call.lastDuration.value,
|
||||||
})),
|
}));
|
||||||
|
} else if (ongoingCall.participants.isEmpty) {
|
||||||
|
return Text('callOngoingEmpty'.tr);
|
||||||
|
} else {
|
||||||
|
return Text('callOngoingParticipants'.trParams({
|
||||||
|
'count': ongoingCall.participants.length.toString(),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
if (ongoingCall.participants.isNotEmpty)
|
Obx(() {
|
||||||
Container(
|
if (call.isInitialized.value) {
|
||||||
height: 28,
|
return const SizedBox();
|
||||||
constraints: const BoxConstraints(maxWidth: 120),
|
}
|
||||||
child: AvatarStack(
|
if (ongoingCall.participants.isNotEmpty) {
|
||||||
|
return Container(
|
||||||
height: 28,
|
height: 28,
|
||||||
borderWidth: 0,
|
constraints: const BoxConstraints(maxWidth: 120),
|
||||||
avatars: ongoingCall.participants.map((x) {
|
child: AvatarStack(
|
||||||
final userinfo = Account.fromJson(jsonDecode(x['metadata']));
|
height: 28,
|
||||||
return PlatformInfo.canCacheImage
|
borderWidth: 0,
|
||||||
? CachedNetworkImageProvider(userinfo.avatar)
|
avatars: ongoingCall.participants.map((x) {
|
||||||
as ImageProvider
|
final userinfo =
|
||||||
: NetworkImage(userinfo.avatar) as ImageProvider;
|
Account.fromJson(jsonDecode(x['metadata']));
|
||||||
}).toList(),
|
return PlatformInfo.canCacheImage
|
||||||
),
|
? CachedNetworkImageProvider(userinfo.avatar)
|
||||||
),
|
as ImageProvider
|
||||||
|
: NetworkImage(userinfo.avatar) as ImageProvider;
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return const SizedBox();
|
||||||
|
})
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
Obx(() {
|
Obx(() {
|
||||||
if (call.current.value == null) {
|
if (call.isBusy.value) {
|
||||||
|
return const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
width: 20,
|
||||||
|
child: CircularProgressIndicator(strokeWidth: 3),
|
||||||
|
).paddingAll(16);
|
||||||
|
} else if (call.current.value == null) {
|
||||||
return TextButton(
|
return TextButton(
|
||||||
onPressed: () => _showCallPrejoin(context),
|
onPressed: () => _showCallPrejoin(context),
|
||||||
child: Text('callJoin'.tr),
|
child: Text('callJoin'.tr),
|
||||||
);
|
);
|
||||||
} else if (call.channel.value?.id == channel.id) {
|
} else if (call.channel.value?.id == channel.id &&
|
||||||
|
!SolianTheme.isLargeScreen(context)) {
|
||||||
return TextButton(
|
return TextButton(
|
||||||
onPressed: () => call.gotoScreen(context),
|
onPressed: () => onJoin(),
|
||||||
child: Text('callResume'.tr),
|
child: Text('callResume'.tr),
|
||||||
);
|
);
|
||||||
} else {
|
} else if (!SolianTheme.isLargeScreen(context)) {
|
||||||
return TextButton(
|
return TextButton(
|
||||||
onPressed: null,
|
onPressed: null,
|
||||||
child: Text('callJoin'.tr),
|
child: Text('callJoin'.tr),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return const SizedBox();
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -88,10 +88,12 @@ class _ControlsWidgetState extends State<ControlsWidget> {
|
|||||||
void _disconnect() async {
|
void _disconnect() async {
|
||||||
if (await showDisconnectDialog() != true) return;
|
if (await showDisconnectDialog() != true) return;
|
||||||
|
|
||||||
final ChatCallProvider provider = Get.find();
|
final ChatCallProvider call = Get.find();
|
||||||
if (provider.current.value != null) {
|
if (call.current.value != null) {
|
||||||
provider.disposeRoom();
|
call.disposeRoom();
|
||||||
Navigator.pop(context);
|
if (Navigator.canPop(context)) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +161,9 @@ class _ControlsWidgetState extends State<ControlsWidget> {
|
|||||||
}
|
}
|
||||||
var track = await LocalVideoTrack.createScreenShareTrack(
|
var track = await LocalVideoTrack.createScreenShareTrack(
|
||||||
ScreenShareCaptureOptions(
|
ScreenShareCaptureOptions(
|
||||||
|
captureScreenAudio: true,
|
||||||
sourceId: source.id,
|
sourceId: source.id,
|
||||||
maxFrameRate: 15.0,
|
maxFrameRate: 30.0,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await _participant.publishVideoTrack(track);
|
await _participant.publishVideoTrack(track);
|
||||||
@ -174,6 +177,7 @@ class _ControlsWidgetState extends State<ControlsWidget> {
|
|||||||
var track = await LocalVideoTrack.createScreenShareTrack(
|
var track = await LocalVideoTrack.createScreenShareTrack(
|
||||||
const ScreenShareCaptureOptions(
|
const ScreenShareCaptureOptions(
|
||||||
useiOSBroadcastExtension: true,
|
useiOSBroadcastExtension: true,
|
||||||
|
captureScreenAudio: true,
|
||||||
maxFrameRate: 30.0,
|
maxFrameRate: 30.0,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -207,8 +211,7 @@ class _ControlsWidgetState extends State<ControlsWidget> {
|
|||||||
runSpacing: 5,
|
runSpacing: 5,
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Transform.flip(
|
icon: const Icon(Icons.exit_to_app),
|
||||||
flipX: true, child: const Icon(Icons.exit_to_app)),
|
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
onPressed: _disconnect,
|
onPressed: _disconnect,
|
||||||
),
|
),
|
||||||
|
@ -11,11 +11,13 @@ import 'package:solian/providers/call.dart';
|
|||||||
class ChatCallPrejoinPopup extends StatefulWidget {
|
class ChatCallPrejoinPopup extends StatefulWidget {
|
||||||
final Call ongoingCall;
|
final Call ongoingCall;
|
||||||
final Channel channel;
|
final Channel channel;
|
||||||
|
final Function onJoin;
|
||||||
|
|
||||||
const ChatCallPrejoinPopup({
|
const ChatCallPrejoinPopup({
|
||||||
super.key,
|
super.key,
|
||||||
required this.ongoingCall,
|
required this.ongoingCall,
|
||||||
required this.channel,
|
required this.channel,
|
||||||
|
required this.onJoin,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -25,22 +27,23 @@ class ChatCallPrejoinPopup extends StatefulWidget {
|
|||||||
class _ChatCallPrejoinPopupState extends State<ChatCallPrejoinPopup> {
|
class _ChatCallPrejoinPopupState extends State<ChatCallPrejoinPopup> {
|
||||||
bool _isBusy = false;
|
bool _isBusy = false;
|
||||||
|
|
||||||
void performJoin() async {
|
void _performJoin() async {
|
||||||
final AuthProvider auth = Get.find();
|
final AuthProvider auth = Get.find();
|
||||||
final ChatCallProvider provider = Get.find();
|
final ChatCallProvider call = Get.find();
|
||||||
if (auth.isAuthorized.isFalse) return;
|
if (auth.isAuthorized.isFalse) return;
|
||||||
|
|
||||||
setState(() => _isBusy = true);
|
setState(() => _isBusy = true);
|
||||||
|
|
||||||
provider.setCall(widget.ongoingCall, widget.channel);
|
call.setCall(widget.ongoingCall, widget.channel);
|
||||||
|
call.isBusy.value = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final resp = await provider.getRoomToken();
|
final resp = await call.getRoomToken();
|
||||||
final token = resp.$1;
|
final token = resp.$1;
|
||||||
final endpoint = resp.$2;
|
final endpoint = resp.$2;
|
||||||
|
|
||||||
provider.initRoom();
|
call.initRoom();
|
||||||
provider.setupRoomListeners(
|
call.setupRoomListeners(
|
||||||
onDisconnected: (reason) {
|
onDisconnected: (reason) {
|
||||||
context.showSnackbar(
|
context.showSnackbar(
|
||||||
'callDisconnected'.trParams({'reason': reason.toString()}),
|
'callDisconnected'.trParams({'reason': reason.toString()}),
|
||||||
@ -48,23 +51,22 @@ class _ChatCallPrejoinPopupState extends State<ChatCallPrejoinPopup> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
provider.joinRoom(endpoint, token);
|
call.joinRoom(endpoint, token);
|
||||||
|
|
||||||
provider.gotoScreen(context).then((_) {
|
Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
|
||||||
});
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
context.showErrorDialog(e);
|
context.showErrorDialog(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
widget.onJoin();
|
||||||
setState(() => _isBusy = false);
|
setState(() => _isBusy = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
final ChatCallProvider provider = Get.find();
|
final ChatCallProvider call = Get.find();
|
||||||
provider.checkPermissions().then((_) {
|
call.checkPermissions().then((_) {
|
||||||
provider.initHardware();
|
call.initHardware();
|
||||||
});
|
});
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -169,7 +171,7 @@ class _ChatCallPrejoinPopupState extends State<ChatCallPrejoinPopup> {
|
|||||||
backgroundColor:
|
backgroundColor:
|
||||||
Theme.of(context).colorScheme.primaryContainer,
|
Theme.of(context).colorScheme.primaryContainer,
|
||||||
),
|
),
|
||||||
onPressed: _isBusy ? null : performJoin,
|
onPressed: _isBusy ? null : _performJoin,
|
||||||
child: Text('callJoin'.tr),
|
child: Text('callJoin'.tr),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -7,10 +7,10 @@ class ChatCallCurrentIndicator extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ChatCallProvider provider = Get.find();
|
final ChatCallProvider call = Get.find();
|
||||||
|
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
if (provider.current.value == null || provider.channel.value == null) {
|
if (call.current.value == null || call.channel.value == null) {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,11 +18,8 @@ class ChatCallCurrentIndicator extends StatelessWidget {
|
|||||||
tileColor: Theme.of(context).colorScheme.surfaceContainerHigh,
|
tileColor: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 32),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 32),
|
||||||
leading: const Icon(Icons.call),
|
leading: const Icon(Icons.call),
|
||||||
title: Text(provider.channel.value!.name),
|
title: Text(call.channel.value!.name),
|
||||||
subtitle: Text('callAlreadyOngoing'.tr),
|
subtitle: Text('callAlreadyOngoing'.tr),
|
||||||
onTap: () {
|
|
||||||
provider.gotoScreen(context);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import 'package:solian/widgets/account/account_profile_popup.dart';
|
|||||||
import 'package:solian/widgets/attachments/attachment_list.dart';
|
import 'package:solian/widgets/attachments/attachment_list.dart';
|
||||||
import 'package:solian/widgets/chat/chat_event_action_log.dart';
|
import 'package:solian/widgets/chat/chat_event_action_log.dart';
|
||||||
import 'package:solian/widgets/chat/chat_event_message.dart';
|
import 'package:solian/widgets/chat/chat_event_message.dart';
|
||||||
|
import 'package:solian/widgets/link_expansion.dart';
|
||||||
import 'package:timeago/timeago.dart' show format;
|
import 'package:timeago/timeago.dart' show format;
|
||||||
|
|
||||||
class ChatEvent extends StatelessWidget {
|
class ChatEvent extends StatelessWidget {
|
||||||
@ -37,10 +38,15 @@ class ChatEvent extends StatelessWidget {
|
|||||||
return '$negativeSign${twoDigits(duration.inHours)}:$twoDigitMinutes:$twoDigitSeconds';
|
return '$negativeSign${twoDigits(duration.inHours)}:$twoDigitMinutes:$twoDigitSeconds';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildLinkExpansion() {
|
||||||
|
if (item.body['text'] == null) return const SizedBox();
|
||||||
|
return LinkExpansion(content: item.body['text']);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildAttachment(BuildContext context, {bool isMinimal = false}) {
|
Widget _buildAttachment(BuildContext context, {bool isMinimal = false}) {
|
||||||
final attachments = item.body['attachments'] != null
|
final attachments = item.body['attachments'] != null
|
||||||
? List<int>.from(item.body['attachments'].map((x) => x))
|
? List<String>.from(item.body['attachments']?.whereType<String>())
|
||||||
: List<int>.empty();
|
: List<String>.empty();
|
||||||
|
|
||||||
if (attachments.isEmpty) return const SizedBox();
|
if (attachments.isEmpty) return const SizedBox();
|
||||||
|
|
||||||
@ -50,10 +56,10 @@ class ChatEvent extends StatelessWidget {
|
|||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
Icons.attachment,
|
Icons.file_copy,
|
||||||
size: 18,
|
size: 15,
|
||||||
color: unFocusColor,
|
color: unFocusColor,
|
||||||
).paddingOnly(right: 6),
|
).paddingOnly(right: 5),
|
||||||
Text(
|
Text(
|
||||||
'attachmentHint'.trParams(
|
'attachmentHint'.trParams(
|
||||||
{'count': attachments.length.toString()},
|
{'count': attachments.length.toString()},
|
||||||
@ -67,7 +73,7 @@ class ChatEvent extends StatelessWidget {
|
|||||||
return Container(
|
return Container(
|
||||||
key: Key('m${item.uuid}attachments-box'),
|
key: Key('m${item.uuid}attachments-box'),
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
padding: EdgeInsets.only(top: isMerged ? 0 : 4),
|
padding: EdgeInsets.only(top: isMerged ? 0 : 4, bottom: 4),
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxHeight: 720,
|
maxHeight: 720,
|
||||||
),
|
),
|
||||||
@ -75,7 +81,7 @@ class ChatEvent extends StatelessWidget {
|
|||||||
key: Key('m${item.uuid}attachments'),
|
key: Key('m${item.uuid}attachments'),
|
||||||
parentId: item.uuid,
|
parentId: item.uuid,
|
||||||
attachmentsId: attachments,
|
attachmentsId: attachments,
|
||||||
viewport: 1,
|
isColumn: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -90,10 +96,13 @@ class ChatEvent extends StatelessWidget {
|
|||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ChatEvent(
|
return Container(
|
||||||
item: snapshot.data!.data,
|
constraints: const BoxConstraints(maxWidth: 480),
|
||||||
isMerged: false,
|
child: ChatEvent(
|
||||||
isQuote: true,
|
item: snapshot.data!.data,
|
||||||
|
isMerged: false,
|
||||||
|
isQuote: true,
|
||||||
|
),
|
||||||
).paddingOnly(left: isMerged ? 52 : 0);
|
).paddingOnly(left: isMerged ? 52 : 0);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -188,8 +197,12 @@ class ChatEvent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
).paddingOnly(right: 12),
|
).paddingOnly(right: 12),
|
||||||
_buildAttachment(context, isMinimal: isContentPreviewing)
|
if (!isContentPreviewing)
|
||||||
.paddingOnly(left: isContentPreviewing ? 12 : 0),
|
_buildLinkExpansion().paddingOnly(left: 52, right: 8),
|
||||||
|
_buildAttachment(context, isMinimal: isContentPreviewing).paddingOnly(
|
||||||
|
left: isContentPreviewing ? 12 : 56,
|
||||||
|
right: 8,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
} else if (isQuote) {
|
} else if (isQuote) {
|
||||||
@ -210,7 +223,9 @@ class ChatEvent extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
AccountAvatar(
|
AccountAvatar(
|
||||||
content: item.sender.account.avatar, radius: 9),
|
content: item.sender.account.avatar,
|
||||||
|
radius: 9,
|
||||||
|
),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 5),
|
||||||
Text(
|
Text(
|
||||||
item.sender.account.nick,
|
item.sender.account.nick,
|
||||||
@ -221,6 +236,7 @@ class ChatEvent extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
_buildContent().paddingOnly(left: 0.5),
|
_buildContent().paddingOnly(left: 0.5),
|
||||||
|
_buildAttachment(context, isMinimal: true),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -229,6 +245,7 @@ class ChatEvent extends StatelessWidget {
|
|||||||
).paddingOnly(left: isMerged ? 52 : 0, right: 4);
|
).paddingOnly(left: isMerged ? 52 : 0, right: 4);
|
||||||
} else {
|
} else {
|
||||||
return Column(
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
key: Key('m${item.uuid}'),
|
key: Key('m${item.uuid}'),
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
@ -282,7 +299,8 @@ class ChatEvent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
).paddingSymmetric(horizontal: 12),
|
).paddingSymmetric(horizontal: 12),
|
||||||
_buildAttachment(context),
|
_buildLinkExpansion().paddingOnly(left: 52, right: 8),
|
||||||
|
_buildAttachment(context).paddingOnly(left: 56, right: 8),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,11 @@ class ChatEventMessageActionLog extends StatelessWidget {
|
|||||||
).paddingOnly(
|
).paddingOnly(
|
||||||
left: isQuote ? 0 : (isMerged ? 64 : 12),
|
left: isQuote ? 0 : (isMerged ? 64 : 12),
|
||||||
top: 2,
|
top: 2,
|
||||||
bottom: isHasMerged ? 2 : 0,
|
bottom: isQuote
|
||||||
|
? 0
|
||||||
|
: isHasMerged
|
||||||
|
? 2
|
||||||
|
: 0,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|