diff --git a/example/.metadata b/example/.metadata deleted file mode 100644 index 8ba2206..0000000 --- a/example/.metadata +++ /dev/null @@ -1,30 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled. - -version: - revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66 - channel: stable - -project_type: app - -# Tracks metadata for the flutter migrate command -migration: - platforms: - - platform: root - create_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66 - base_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66 - - platform: android - create_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66 - base_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66 - - # User provided section - - # List of Local paths (relative to this file) that should be - # ignored by the migrate tool. - # - # Files that are not part of the templates will be ignored by default. - unmanaged_files: - - 'lib/main.dart' - - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/README.md b/example/demo_app/README.md similarity index 100% rename from example/README.md rename to example/demo_app/README.md diff --git a/example/analysis_options.yaml b/example/demo_app/analysis_options.yaml similarity index 100% rename from example/analysis_options.yaml rename to example/demo_app/analysis_options.yaml diff --git a/example/android/.gitignore b/example/demo_app/android/.gitignore similarity index 100% rename from example/android/.gitignore rename to example/demo_app/android/.gitignore diff --git a/example/android/app/build.gradle b/example/demo_app/android/app/build.gradle similarity index 100% rename from example/android/app/build.gradle rename to example/demo_app/android/app/build.gradle diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/demo_app/android/app/src/debug/AndroidManifest.xml similarity index 100% rename from example/android/app/src/debug/AndroidManifest.xml rename to example/demo_app/android/app/src/debug/AndroidManifest.xml diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/demo_app/android/app/src/main/AndroidManifest.xml similarity index 100% rename from example/android/app/src/main/AndroidManifest.xml rename to example/demo_app/android/app/src/main/AndroidManifest.xml diff --git a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/example/demo_app/android/app/src/main/kotlin/com/example/example/MainActivity.kt similarity index 100% rename from example/android/app/src/main/kotlin/com/example/example/MainActivity.kt rename to example/demo_app/android/app/src/main/kotlin/com/example/example/MainActivity.kt diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/demo_app/android/app/src/main/res/drawable-v21/launch_background.xml similarity index 100% rename from example/android/app/src/main/res/drawable-v21/launch_background.xml rename to example/demo_app/android/app/src/main/res/drawable-v21/launch_background.xml diff --git a/example/android/app/src/main/res/drawable/launch_background.xml b/example/demo_app/android/app/src/main/res/drawable/launch_background.xml similarity index 100% rename from example/android/app/src/main/res/drawable/launch_background.xml rename to example/demo_app/android/app/src/main/res/drawable/launch_background.xml diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/demo_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to example/demo_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/example/demo_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png similarity index 100% rename from example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png rename to example/demo_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/example/demo_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png rename to example/demo_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/demo_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to example/demo_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/example/demo_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png similarity index 100% rename from example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png rename to example/demo_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/example/demo_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png rename to example/demo_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/demo_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to example/demo_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/example/demo_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png rename to example/demo_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/example/demo_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png rename to example/demo_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/demo_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to example/demo_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/example/demo_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png rename to example/demo_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/example/demo_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png rename to example/demo_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/demo_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to example/demo_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/example/demo_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png rename to example/demo_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/example/demo_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png rename to example/demo_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/example/android/app/src/main/res/playstore-icon.png b/example/demo_app/android/app/src/main/res/playstore-icon.png similarity index 100% rename from example/android/app/src/main/res/playstore-icon.png rename to example/demo_app/android/app/src/main/res/playstore-icon.png diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/demo_app/android/app/src/main/res/values-night/styles.xml similarity index 100% rename from example/android/app/src/main/res/values-night/styles.xml rename to example/demo_app/android/app/src/main/res/values-night/styles.xml diff --git a/example/android/app/src/main/res/values/styles.xml b/example/demo_app/android/app/src/main/res/values/styles.xml similarity index 100% rename from example/android/app/src/main/res/values/styles.xml rename to example/demo_app/android/app/src/main/res/values/styles.xml diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/demo_app/android/app/src/profile/AndroidManifest.xml similarity index 100% rename from example/android/app/src/profile/AndroidManifest.xml rename to example/demo_app/android/app/src/profile/AndroidManifest.xml diff --git a/example/android/build.gradle b/example/demo_app/android/build.gradle similarity index 100% rename from example/android/build.gradle rename to example/demo_app/android/build.gradle diff --git a/example/android/gradle.properties b/example/demo_app/android/gradle.properties similarity index 100% rename from example/android/gradle.properties rename to example/demo_app/android/gradle.properties diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/demo_app/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from example/android/gradle/wrapper/gradle-wrapper.properties rename to example/demo_app/android/gradle/wrapper/gradle-wrapper.properties diff --git a/example/android/settings.gradle b/example/demo_app/android/settings.gradle similarity index 100% rename from example/android/settings.gradle rename to example/demo_app/android/settings.gradle diff --git a/example/assets/dark.svg b/example/demo_app/assets/dark.svg similarity index 100% rename from example/assets/dark.svg rename to example/demo_app/assets/dark.svg diff --git a/example/assets/epnsLogo.png b/example/demo_app/assets/epnsLogo.png similarity index 100% rename from example/assets/epnsLogo.png rename to example/demo_app/assets/epnsLogo.png diff --git a/example/assets/light.svg b/example/demo_app/assets/light.svg similarity index 100% rename from example/assets/light.svg rename to example/demo_app/assets/light.svg diff --git a/example/assets/loading_state.svg b/example/demo_app/assets/loading_state.svg similarity index 100% rename from example/assets/loading_state.svg rename to example/demo_app/assets/loading_state.svg diff --git a/example/assets/pushLogo.svg b/example/demo_app/assets/pushLogo.svg similarity index 100% rename from example/assets/pushLogo.svg rename to example/demo_app/assets/pushLogo.svg diff --git a/example/assets/space.svg b/example/demo_app/assets/space.svg similarity index 100% rename from example/assets/space.svg rename to example/demo_app/assets/space.svg diff --git a/example/assets/talk.png b/example/demo_app/assets/talk.png similarity index 100% rename from example/assets/talk.png rename to example/demo_app/assets/talk.png diff --git a/example/ios/.gitignore b/example/demo_app/ios/.gitignore similarity index 100% rename from example/ios/.gitignore rename to example/demo_app/ios/.gitignore diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/demo_app/ios/Flutter/AppFrameworkInfo.plist similarity index 100% rename from example/ios/Flutter/AppFrameworkInfo.plist rename to example/demo_app/ios/Flutter/AppFrameworkInfo.plist diff --git a/example/ios/Flutter/Debug.xcconfig b/example/demo_app/ios/Flutter/Debug.xcconfig similarity index 100% rename from example/ios/Flutter/Debug.xcconfig rename to example/demo_app/ios/Flutter/Debug.xcconfig diff --git a/example/ios/Flutter/Release.xcconfig b/example/demo_app/ios/Flutter/Release.xcconfig similarity index 100% rename from example/ios/Flutter/Release.xcconfig rename to example/demo_app/ios/Flutter/Release.xcconfig diff --git a/example/ios/Podfile b/example/demo_app/ios/Podfile similarity index 100% rename from example/ios/Podfile rename to example/demo_app/ios/Podfile diff --git a/example/ios/Podfile.lock b/example/demo_app/ios/Podfile.lock similarity index 100% rename from example/ios/Podfile.lock rename to example/demo_app/ios/Podfile.lock diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/demo_app/ios/Runner.xcodeproj/project.pbxproj similarity index 100% rename from example/ios/Runner.xcodeproj/project.pbxproj rename to example/demo_app/ios/Runner.xcodeproj/project.pbxproj diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/demo_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to example/demo_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/demo_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to example/demo_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/demo_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings similarity index 100% rename from example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename to example/demo_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/demo_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme similarity index 100% rename from example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to example/demo_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/demo_app/ios/Runner.xcworkspace/contents.xcworkspacedata similarity index 100% rename from example/ios/Runner.xcworkspace/contents.xcworkspacedata rename to example/demo_app/ios/Runner.xcworkspace/contents.xcworkspacedata diff --git a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/demo_app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to example/demo_app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/demo_app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings similarity index 100% rename from example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename to example/demo_app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/example/ios/Runner/AppDelegate.swift b/example/demo_app/ios/Runner/AppDelegate.swift similarity index 100% rename from example/ios/Runner/AppDelegate.swift rename to example/demo_app/ios/Runner/AppDelegate.swift diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png b/example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png rename to example/demo_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/example/demo_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json rename to example/demo_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/example/demo_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png rename to example/demo_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/demo_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png rename to example/demo_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/demo_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png rename to example/demo_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/example/demo_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md rename to example/demo_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md diff --git a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/demo_app/ios/Runner/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from example/ios/Runner/Base.lproj/LaunchScreen.storyboard rename to example/demo_app/ios/Runner/Base.lproj/LaunchScreen.storyboard diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/example/demo_app/ios/Runner/Base.lproj/Main.storyboard similarity index 100% rename from example/ios/Runner/Base.lproj/Main.storyboard rename to example/demo_app/ios/Runner/Base.lproj/Main.storyboard diff --git a/example/ios/Runner/Info.plist b/example/demo_app/ios/Runner/Info.plist similarity index 100% rename from example/ios/Runner/Info.plist rename to example/demo_app/ios/Runner/Info.plist diff --git a/example/ios/Runner/Runner-Bridging-Header.h b/example/demo_app/ios/Runner/Runner-Bridging-Header.h similarity index 100% rename from example/ios/Runner/Runner-Bridging-Header.h rename to example/demo_app/ios/Runner/Runner-Bridging-Header.h diff --git a/example/ios/RunnerTests/RunnerTests.swift b/example/demo_app/ios/RunnerTests/RunnerTests.swift similarity index 100% rename from example/ios/RunnerTests/RunnerTests.swift rename to example/demo_app/ios/RunnerTests/RunnerTests.swift diff --git a/example/lib/__lib.dart b/example/demo_app/lib/__lib.dart similarity index 100% rename from example/lib/__lib.dart rename to example/demo_app/lib/__lib.dart diff --git a/example/lib/main.dart b/example/demo_app/lib/main.dart similarity index 100% rename from example/lib/main.dart rename to example/demo_app/lib/main.dart diff --git a/example/lib/models/__models.dart b/example/demo_app/lib/models/__models.dart similarity index 100% rename from example/lib/models/__models.dart rename to example/demo_app/lib/models/__models.dart diff --git a/example/lib/models/signer.dart b/example/demo_app/lib/models/signer.dart similarity index 100% rename from example/lib/models/signer.dart rename to example/demo_app/lib/models/signer.dart diff --git a/example/lib/test_functions/__test_functions.dart b/example/demo_app/lib/test_functions/__test_functions.dart similarity index 78% rename from example/lib/test_functions/__test_functions.dart rename to example/demo_app/lib/test_functions/__test_functions.dart index e8c7fc0..1cf8f1d 100644 --- a/example/lib/test_functions/__test_functions.dart +++ b/example/demo_app/lib/test_functions/__test_functions.dart @@ -2,3 +2,4 @@ export 'chat/__chats.dart'; export 'user/__user.dart'; export 'payload/__payloads.dart'; export 'space/__spaces.dart'; +export 'pushapi/_pushapi.dart'; diff --git a/example/lib/test_functions/chat/__chats.dart b/example/demo_app/lib/test_functions/chat/__chats.dart similarity index 100% rename from example/lib/test_functions/chat/__chats.dart rename to example/demo_app/lib/test_functions/chat/__chats.dart diff --git a/example/lib/test_functions/chat/approve_intent.dart b/example/demo_app/lib/test_functions/chat/approve_intent.dart similarity index 100% rename from example/lib/test_functions/chat/approve_intent.dart rename to example/demo_app/lib/test_functions/chat/approve_intent.dart diff --git a/example/lib/test_functions/chat/create_group_private.dart b/example/demo_app/lib/test_functions/chat/create_group_private.dart similarity index 100% rename from example/lib/test_functions/chat/create_group_private.dart rename to example/demo_app/lib/test_functions/chat/create_group_private.dart diff --git a/example/lib/test_functions/chat/create_group_public.dart b/example/demo_app/lib/test_functions/chat/create_group_public.dart similarity index 100% rename from example/lib/test_functions/chat/create_group_public.dart rename to example/demo_app/lib/test_functions/chat/create_group_public.dart diff --git a/example/lib/test_functions/chat/create_profile.dart b/example/demo_app/lib/test_functions/chat/create_profile.dart similarity index 100% rename from example/lib/test_functions/chat/create_profile.dart rename to example/demo_app/lib/test_functions/chat/create_profile.dart diff --git a/example/lib/test_functions/chat/fetch_chat.dart b/example/demo_app/lib/test_functions/chat/fetch_chat.dart similarity index 100% rename from example/lib/test_functions/chat/fetch_chat.dart rename to example/demo_app/lib/test_functions/chat/fetch_chat.dart diff --git a/example/lib/test_functions/chat/fetch_chats.dart b/example/demo_app/lib/test_functions/chat/fetch_chats.dart similarity index 100% rename from example/lib/test_functions/chat/fetch_chats.dart rename to example/demo_app/lib/test_functions/chat/fetch_chats.dart diff --git a/example/lib/test_functions/chat/fetch_group_by_chat_id.dart b/example/demo_app/lib/test_functions/chat/fetch_group_by_chat_id.dart similarity index 100% rename from example/lib/test_functions/chat/fetch_group_by_chat_id.dart rename to example/demo_app/lib/test_functions/chat/fetch_group_by_chat_id.dart diff --git a/example/lib/test_functions/chat/fetch_group_by_name.dart b/example/demo_app/lib/test_functions/chat/fetch_group_by_name.dart similarity index 100% rename from example/lib/test_functions/chat/fetch_group_by_name.dart rename to example/demo_app/lib/test_functions/chat/fetch_group_by_name.dart diff --git a/example/lib/test_functions/chat/fetch_latest_chat.dart b/example/demo_app/lib/test_functions/chat/fetch_latest_chat.dart similarity index 100% rename from example/lib/test_functions/chat/fetch_latest_chat.dart rename to example/demo_app/lib/test_functions/chat/fetch_latest_chat.dart diff --git a/example/lib/test_functions/chat/fetch_requests.dart b/example/demo_app/lib/test_functions/chat/fetch_requests.dart similarity index 100% rename from example/lib/test_functions/chat/fetch_requests.dart rename to example/demo_app/lib/test_functions/chat/fetch_requests.dart diff --git a/example/lib/test_functions/chat/get_all_group_members.dart b/example/demo_app/lib/test_functions/chat/get_all_group_members.dart similarity index 100% rename from example/lib/test_functions/chat/get_all_group_members.dart rename to example/demo_app/lib/test_functions/chat/get_all_group_members.dart diff --git a/example/lib/test_functions/chat/get_all_group_members_public_keys.dart b/example/demo_app/lib/test_functions/chat/get_all_group_members_public_keys.dart similarity index 100% rename from example/lib/test_functions/chat/get_all_group_members_public_keys.dart rename to example/demo_app/lib/test_functions/chat/get_all_group_members_public_keys.dart diff --git a/example/lib/test_functions/chat/get_group_info.dart b/example/demo_app/lib/test_functions/chat/get_group_info.dart similarity index 100% rename from example/lib/test_functions/chat/get_group_info.dart rename to example/demo_app/lib/test_functions/chat/get_group_info.dart diff --git a/example/lib/test_functions/chat/get_group_member_count.dart b/example/demo_app/lib/test_functions/chat/get_group_member_count.dart similarity index 100% rename from example/lib/test_functions/chat/get_group_member_count.dart rename to example/demo_app/lib/test_functions/chat/get_group_member_count.dart diff --git a/example/lib/test_functions/chat/get_group_member_status.dart b/example/demo_app/lib/test_functions/chat/get_group_member_status.dart similarity index 100% rename from example/lib/test_functions/chat/get_group_member_status.dart rename to example/demo_app/lib/test_functions/chat/get_group_member_status.dart diff --git a/example/lib/test_functions/chat/get_group_members.dart b/example/demo_app/lib/test_functions/chat/get_group_members.dart similarity index 57% rename from example/lib/test_functions/chat/get_group_members.dart rename to example/demo_app/lib/test_functions/chat/get_group_members.dart index b6f6320..b9ebbf2 100644 --- a/example/lib/test_functions/chat/get_group_members.dart +++ b/example/demo_app/lib/test_functions/chat/get_group_members.dart @@ -2,8 +2,9 @@ import 'package:push_restapi_dart/push_restapi_dart.dart'; Future testGetGroupMembers() async { final result = await getGroupMembers( - chatId: - '5ed6ac1c59384fc447986141e5ff593b8fd446d63bd3a9a0f16e06e012bc86d3'); + options: FetchChatGroupInfoType( + chatId: + '5ed6ac1c59384fc447986141e5ff593b8fd446d63bd3a9a0f16e06e012bc86d3')); print('testGetGroupMembers result: $result'); } diff --git a/example/lib/test_functions/chat/get_group_members_public_keys.dart b/example/demo_app/lib/test_functions/chat/get_group_members_public_keys.dart similarity index 100% rename from example/lib/test_functions/chat/get_group_members_public_keys.dart rename to example/demo_app/lib/test_functions/chat/get_group_members_public_keys.dart diff --git a/example/lib/test_functions/chat/ipfs.dart b/example/demo_app/lib/test_functions/chat/ipfs.dart similarity index 100% rename from example/lib/test_functions/chat/ipfs.dart rename to example/demo_app/lib/test_functions/chat/ipfs.dart diff --git a/example/lib/test_functions/chat/send.dart b/example/demo_app/lib/test_functions/chat/send.dart similarity index 100% rename from example/lib/test_functions/chat/send.dart rename to example/demo_app/lib/test_functions/chat/send.dart diff --git a/example/lib/test_functions/chat/send_composite.dart b/example/demo_app/lib/test_functions/chat/send_composite.dart similarity index 100% rename from example/lib/test_functions/chat/send_composite.dart rename to example/demo_app/lib/test_functions/chat/send_composite.dart diff --git a/example/lib/test_functions/chat/send_file.dart b/example/demo_app/lib/test_functions/chat/send_file.dart similarity index 100% rename from example/lib/test_functions/chat/send_file.dart rename to example/demo_app/lib/test_functions/chat/send_file.dart diff --git a/example/lib/test_functions/chat/send_group.dart b/example/demo_app/lib/test_functions/chat/send_group.dart similarity index 100% rename from example/lib/test_functions/chat/send_group.dart rename to example/demo_app/lib/test_functions/chat/send_group.dart diff --git a/example/lib/test_functions/chat/send_group_meta.dart b/example/demo_app/lib/test_functions/chat/send_group_meta.dart similarity index 100% rename from example/lib/test_functions/chat/send_group_meta.dart rename to example/demo_app/lib/test_functions/chat/send_group_meta.dart diff --git a/example/lib/test_functions/chat/send_image.dart b/example/demo_app/lib/test_functions/chat/send_image.dart similarity index 100% rename from example/lib/test_functions/chat/send_image.dart rename to example/demo_app/lib/test_functions/chat/send_image.dart diff --git a/example/lib/test_functions/chat/send_intent.dart b/example/demo_app/lib/test_functions/chat/send_intent.dart similarity index 100% rename from example/lib/test_functions/chat/send_intent.dart rename to example/demo_app/lib/test_functions/chat/send_intent.dart diff --git a/example/lib/test_functions/chat/send_media_embed.dart b/example/demo_app/lib/test_functions/chat/send_media_embed.dart similarity index 100% rename from example/lib/test_functions/chat/send_media_embed.dart rename to example/demo_app/lib/test_functions/chat/send_media_embed.dart diff --git a/example/lib/test_functions/chat/send_reaction.dart b/example/demo_app/lib/test_functions/chat/send_reaction.dart similarity index 100% rename from example/lib/test_functions/chat/send_reaction.dart rename to example/demo_app/lib/test_functions/chat/send_reaction.dart diff --git a/example/lib/test_functions/chat/send_reply.dart b/example/demo_app/lib/test_functions/chat/send_reply.dart similarity index 100% rename from example/lib/test_functions/chat/send_reply.dart rename to example/demo_app/lib/test_functions/chat/send_reply.dart diff --git a/example/demo_app/lib/test_functions/chat/update_group_config.dart b/example/demo_app/lib/test_functions/chat/update_group_config.dart new file mode 100644 index 0000000..def453f --- /dev/null +++ b/example/demo_app/lib/test_functions/chat/update_group_config.dart @@ -0,0 +1,11 @@ +import 'package:push_restapi_dart/push_restapi_dart.dart'; + +void testUpdateGroupConfig() async { + final result = await updateGroupConfig( + options: ChatUpdateConfigProfileType( + scheduleAt: DateTime.now().add(Duration(hours: 3)), + chatId: '64434400c9a61256451f025f1f8c7b34d9651af4a03ca063126e137572fb85ca', + )); + + print(result); +} diff --git a/example/lib/test_functions/chat/update_group_members.dart b/example/demo_app/lib/test_functions/chat/update_group_members.dart similarity index 100% rename from example/lib/test_functions/chat/update_group_members.dart rename to example/demo_app/lib/test_functions/chat/update_group_members.dart diff --git a/example/demo_app/lib/test_functions/chat/update_group_profile.dart b/example/demo_app/lib/test_functions/chat/update_group_profile.dart new file mode 100644 index 0000000..d8b3131 --- /dev/null +++ b/example/demo_app/lib/test_functions/chat/update_group_profile.dart @@ -0,0 +1,13 @@ +import 'package:push_restapi_dart/push_restapi_dart.dart'; + +void testUpdateGroupProfile() async { + final result = await updateGroupProfile( + options: ChatUpdateGroupProfileType( + groupImage: + 'https://tmpfiles.org/dl/3250024/screenshot2023-11-26at8.51.05pm.png', + chatId: + '64434400c9a61256451f025f1f8c7b34d9651af4a03ca063126e137572fb85ca', + groupName: 'Group New name')); + + print(result); +} diff --git a/example/lib/test_functions/payload/__payloads.dart b/example/demo_app/lib/test_functions/payload/__payloads.dart similarity index 100% rename from example/lib/test_functions/payload/__payloads.dart rename to example/demo_app/lib/test_functions/payload/__payloads.dart diff --git a/example/lib/test_functions/payload/send_notification.dart b/example/demo_app/lib/test_functions/payload/send_notification.dart similarity index 100% rename from example/lib/test_functions/payload/send_notification.dart rename to example/demo_app/lib/test_functions/payload/send_notification.dart diff --git a/example/demo_app/lib/test_functions/pushapi/_pushapi.dart b/example/demo_app/lib/test_functions/pushapi/_pushapi.dart new file mode 100644 index 0000000..fade94b --- /dev/null +++ b/example/demo_app/lib/test_functions/pushapi/_pushapi.dart @@ -0,0 +1 @@ +export 'pushapi.dart'; diff --git a/example/demo_app/lib/test_functions/pushapi/pushapi.dart b/example/demo_app/lib/test_functions/pushapi/pushapi.dart new file mode 100644 index 0000000..f31c1dd --- /dev/null +++ b/example/demo_app/lib/test_functions/pushapi/pushapi.dart @@ -0,0 +1,22 @@ +import 'dart:math'; + +import 'package:push_restapi_dart/push_restapi_dart.dart'; +import 'package:web3dart/web3dart.dart' as web3; + +import '../../__lib.dart'; + +testPushApi() async { + final web3.Credentials randomCredentials = + web3.EthPrivateKey.createRandom(Random.secure()); + final signer = Web3Signer(randomCredentials); + final web3.Credentials randomCredentials2 = + web3.EthPrivateKey.createRandom(Random.secure()); + final signer2 = Web3Signer(randomCredentials2); + + final alice = await PushAPI.initialize(signer: signer); + final bob = await PushAPI.initialize(signer: signer2); + + print('Push api : ${alice.pgpPublicKey}'); + + print('Push api bob: ${bob.pgpPublicKey}'); +} diff --git a/example/lib/test_functions/sockets/test_sockets.dart b/example/demo_app/lib/test_functions/sockets/test_sockets.dart similarity index 100% rename from example/lib/test_functions/sockets/test_sockets.dart rename to example/demo_app/lib/test_functions/sockets/test_sockets.dart diff --git a/example/lib/test_functions/space/__spaces.dart b/example/demo_app/lib/test_functions/space/__spaces.dart similarity index 100% rename from example/lib/test_functions/space/__spaces.dart rename to example/demo_app/lib/test_functions/space/__spaces.dart diff --git a/example/lib/test_functions/space/create_space.dart b/example/demo_app/lib/test_functions/space/create_space.dart similarity index 100% rename from example/lib/test_functions/space/create_space.dart rename to example/demo_app/lib/test_functions/space/create_space.dart diff --git a/example/lib/test_functions/space/get_latest_live_space_data.dart b/example/demo_app/lib/test_functions/space/get_latest_live_space_data.dart similarity index 100% rename from example/lib/test_functions/space/get_latest_live_space_data.dart rename to example/demo_app/lib/test_functions/space/get_latest_live_space_data.dart diff --git a/example/lib/test_functions/space/get_space.dart b/example/demo_app/lib/test_functions/space/get_space.dart similarity index 100% rename from example/lib/test_functions/space/get_space.dart rename to example/demo_app/lib/test_functions/space/get_space.dart diff --git a/example/lib/test_functions/space/send_live_space_data_meta.dart b/example/demo_app/lib/test_functions/space/send_live_space_data_meta.dart similarity index 100% rename from example/lib/test_functions/space/send_live_space_data_meta.dart rename to example/demo_app/lib/test_functions/space/send_live_space_data_meta.dart diff --git a/example/lib/test_functions/space/send_live_space_data_ua.dart b/example/demo_app/lib/test_functions/space/send_live_space_data_ua.dart similarity index 100% rename from example/lib/test_functions/space/send_live_space_data_ua.dart rename to example/demo_app/lib/test_functions/space/send_live_space_data_ua.dart diff --git a/example/lib/test_functions/space/send_space_reaction.dart b/example/demo_app/lib/test_functions/space/send_space_reaction.dart similarity index 100% rename from example/lib/test_functions/space/send_space_reaction.dart rename to example/demo_app/lib/test_functions/space/send_space_reaction.dart diff --git a/example/lib/test_functions/space/trending_spaces.dart b/example/demo_app/lib/test_functions/space/trending_spaces.dart similarity index 100% rename from example/lib/test_functions/space/trending_spaces.dart rename to example/demo_app/lib/test_functions/space/trending_spaces.dart diff --git a/example/lib/test_functions/space/update_space.dart b/example/demo_app/lib/test_functions/space/update_space.dart similarity index 100% rename from example/lib/test_functions/space/update_space.dart rename to example/demo_app/lib/test_functions/space/update_space.dart diff --git a/example/lib/test_functions/user/__user.dart b/example/demo_app/lib/test_functions/user/__user.dart similarity index 100% rename from example/lib/test_functions/user/__user.dart rename to example/demo_app/lib/test_functions/user/__user.dart diff --git a/example/lib/test_functions/user/fetch_feeds.dart b/example/demo_app/lib/test_functions/user/fetch_feeds.dart similarity index 100% rename from example/lib/test_functions/user/fetch_feeds.dart rename to example/demo_app/lib/test_functions/user/fetch_feeds.dart diff --git a/example/lib/test_functions/user/get_user.dart b/example/demo_app/lib/test_functions/user/get_user.dart similarity index 100% rename from example/lib/test_functions/user/get_user.dart rename to example/demo_app/lib/test_functions/user/get_user.dart diff --git a/example/lib/test_functions/user/test_create_user.dart b/example/demo_app/lib/test_functions/user/test_create_user.dart similarity index 100% rename from example/lib/test_functions/user/test_create_user.dart rename to example/demo_app/lib/test_functions/user/test_create_user.dart diff --git a/example/lib/test_functions/user/test_decrpt_pgp_key.dart b/example/demo_app/lib/test_functions/user/test_decrpt_pgp_key.dart similarity index 100% rename from example/lib/test_functions/user/test_decrpt_pgp_key.dart rename to example/demo_app/lib/test_functions/user/test_decrpt_pgp_key.dart diff --git a/example/lib/test_functions/user/update_user.dart b/example/demo_app/lib/test_functions/user/update_user.dart similarity index 100% rename from example/lib/test_functions/user/update_user.dart rename to example/demo_app/lib/test_functions/user/update_user.dart diff --git a/example/lib/test_functions/video/__video.dart b/example/demo_app/lib/test_functions/video/__video.dart similarity index 100% rename from example/lib/test_functions/video/__video.dart rename to example/demo_app/lib/test_functions/video/__video.dart diff --git a/example/lib/test_functions/video/test_initialise.dart b/example/demo_app/lib/test_functions/video/test_initialise.dart similarity index 100% rename from example/lib/test_functions/video/test_initialise.dart rename to example/demo_app/lib/test_functions/video/test_initialise.dart diff --git a/example/lib/util/__util.dart b/example/demo_app/lib/util/__util.dart similarity index 100% rename from example/lib/util/__util.dart rename to example/demo_app/lib/util/__util.dart diff --git a/example/lib/util/app_file_picker.dart b/example/demo_app/lib/util/app_file_picker.dart similarity index 100% rename from example/lib/util/app_file_picker.dart rename to example/demo_app/lib/util/app_file_picker.dart diff --git a/example/lib/util/toast.dart b/example/demo_app/lib/util/toast.dart similarity index 100% rename from example/lib/util/toast.dart rename to example/demo_app/lib/util/toast.dart diff --git a/example/lib/values/__values.dart b/example/demo_app/lib/values/__values.dart similarity index 100% rename from example/lib/values/__values.dart rename to example/demo_app/lib/values/__values.dart diff --git a/example/lib/values/assets.dart b/example/demo_app/lib/values/assets.dart similarity index 100% rename from example/lib/values/assets.dart rename to example/demo_app/lib/values/assets.dart diff --git a/example/lib/views/__views.dart b/example/demo_app/lib/views/__views.dart similarity index 100% rename from example/lib/views/__views.dart rename to example/demo_app/lib/views/__views.dart diff --git a/example/lib/views/account_provider.dart b/example/demo_app/lib/views/account_provider.dart similarity index 100% rename from example/lib/views/account_provider.dart rename to example/demo_app/lib/views/account_provider.dart diff --git a/example/lib/views/chats_tab.dart b/example/demo_app/lib/views/chats_tab.dart similarity index 100% rename from example/lib/views/chats_tab.dart rename to example/demo_app/lib/views/chats_tab.dart diff --git a/example/lib/views/connect_screen.dart b/example/demo_app/lib/views/connect_screen.dart similarity index 100% rename from example/lib/views/connect_screen.dart rename to example/demo_app/lib/views/connect_screen.dart diff --git a/example/lib/views/group/__group.dart b/example/demo_app/lib/views/group/__group.dart similarity index 100% rename from example/lib/views/group/__group.dart rename to example/demo_app/lib/views/group/__group.dart diff --git a/example/lib/views/group/add_group_member.dart b/example/demo_app/lib/views/group/add_group_member.dart similarity index 100% rename from example/lib/views/group/add_group_member.dart rename to example/demo_app/lib/views/group/add_group_member.dart diff --git a/example/lib/views/group/chat_room/chat_room_provider.dart b/example/demo_app/lib/views/group/chat_room/chat_room_provider.dart similarity index 98% rename from example/lib/views/group/chat_room/chat_room_provider.dart rename to example/demo_app/lib/views/group/chat_room/chat_room_provider.dart index 70fc1c1..4f119ec 100644 --- a/example/lib/views/group/chat_room/chat_room_provider.dart +++ b/example/demo_app/lib/views/group/chat_room/chat_room_provider.dart @@ -231,7 +231,8 @@ class ChatRoomProvider extends ChangeNotifier { } Future getLatestGroupMembers() async { - _members = await getGroupMembers(chatId: _currentChatid); + _members = await getGroupMembers( + options: FetchChatGroupInfoType(chatId: _currentChatid)); notifyListeners(); } diff --git a/example/lib/views/group/chat_room/chat_room_screen.dart b/example/demo_app/lib/views/group/chat_room/chat_room_screen.dart similarity index 100% rename from example/lib/views/group/chat_room/chat_room_screen.dart rename to example/demo_app/lib/views/group/chat_room/chat_room_screen.dart diff --git a/example/lib/views/group/conversations/conversations_provider.dart b/example/demo_app/lib/views/group/conversations/conversations_provider.dart similarity index 100% rename from example/lib/views/group/conversations/conversations_provider.dart rename to example/demo_app/lib/views/group/conversations/conversations_provider.dart diff --git a/example/lib/views/group/conversations/conversations_screen.dart b/example/demo_app/lib/views/group/conversations/conversations_screen.dart similarity index 100% rename from example/lib/views/group/conversations/conversations_screen.dart rename to example/demo_app/lib/views/group/conversations/conversations_screen.dart diff --git a/example/lib/views/group/create_group_screen.dart b/example/demo_app/lib/views/group/create_group_screen.dart similarity index 100% rename from example/lib/views/group/create_group_screen.dart rename to example/demo_app/lib/views/group/create_group_screen.dart diff --git a/example/lib/views/group/edit_group_info.screen.dart b/example/demo_app/lib/views/group/edit_group_info.screen.dart similarity index 98% rename from example/lib/views/group/edit_group_info.screen.dart rename to example/demo_app/lib/views/group/edit_group_info.screen.dart index b6abe77..29887c3 100644 --- a/example/lib/views/group/edit_group_info.screen.dart +++ b/example/demo_app/lib/views/group/edit_group_info.screen.dart @@ -107,12 +107,13 @@ class _EditGroupInfoScreenState extends ConsumerState { try { showLoadingDialog(); await push.updateGroupProfile( + options: ChatUpdateGroupProfileType( chatId: groupInfo!.chatId, groupName: nameController.text.trim(), groupImage: - selectedFile != null ? composeImage() : groupInfo!.groupImage, + selectedFile != null ? composeImage() : groupInfo!.groupImage!, groupDescription: descriptionController.text.trim(), - ); + )); await ref.read(chatRoomProvider).getLatestGroupInfo(); pop(); diff --git a/example/lib/views/group/group_members_dialog.dart b/example/demo_app/lib/views/group/group_members_dialog.dart similarity index 100% rename from example/lib/views/group/group_members_dialog.dart rename to example/demo_app/lib/views/group/group_members_dialog.dart diff --git a/example/lib/views/group/requests/request_provider.dart b/example/demo_app/lib/views/group/requests/request_provider.dart similarity index 100% rename from example/lib/views/group/requests/request_provider.dart rename to example/demo_app/lib/views/group/requests/request_provider.dart diff --git a/example/lib/views/group/requests/requests_screen.dart b/example/demo_app/lib/views/group/requests/requests_screen.dart similarity index 100% rename from example/lib/views/group/requests/requests_screen.dart rename to example/demo_app/lib/views/group/requests/requests_screen.dart diff --git a/example/lib/views/group/start_p2p_chat.dart b/example/demo_app/lib/views/group/start_p2p_chat.dart similarity index 100% rename from example/lib/views/group/start_p2p_chat.dart rename to example/demo_app/lib/views/group/start_p2p_chat.dart diff --git a/example/lib/views/home_screen.dart b/example/demo_app/lib/views/home_screen.dart similarity index 100% rename from example/lib/views/home_screen.dart rename to example/demo_app/lib/views/home_screen.dart diff --git a/example/lib/views/loading.dart b/example/demo_app/lib/views/loading.dart similarity index 100% rename from example/lib/views/loading.dart rename to example/demo_app/lib/views/loading.dart diff --git a/example/lib/views/spaces/__spaces.dart b/example/demo_app/lib/views/spaces/__spaces.dart similarity index 100% rename from example/lib/views/spaces/__spaces.dart rename to example/demo_app/lib/views/spaces/__spaces.dart diff --git a/example/lib/views/spaces/create_space_screen.dart b/example/demo_app/lib/views/spaces/create_space_screen.dart similarity index 100% rename from example/lib/views/spaces/create_space_screen.dart rename to example/demo_app/lib/views/spaces/create_space_screen.dart diff --git a/example/lib/views/spaces/live_space/live_space_provider.dart b/example/demo_app/lib/views/spaces/live_space/live_space_provider.dart similarity index 100% rename from example/lib/views/spaces/live_space/live_space_provider.dart rename to example/demo_app/lib/views/spaces/live_space/live_space_provider.dart diff --git a/example/lib/views/spaces/live_space/live_space_screen.dart b/example/demo_app/lib/views/spaces/live_space/live_space_screen.dart similarity index 100% rename from example/lib/views/spaces/live_space/live_space_screen.dart rename to example/demo_app/lib/views/spaces/live_space/live_space_screen.dart diff --git a/example/lib/views/spaces/live_space/send_space_invite_dialog.dart b/example/demo_app/lib/views/spaces/live_space/send_space_invite_dialog.dart similarity index 100% rename from example/lib/views/spaces/live_space/send_space_invite_dialog.dart rename to example/demo_app/lib/views/spaces/live_space/send_space_invite_dialog.dart diff --git a/example/lib/views/spaces/live_space/space_moderation_dialog.dart b/example/demo_app/lib/views/spaces/live_space/space_moderation_dialog.dart similarity index 100% rename from example/lib/views/spaces/live_space/space_moderation_dialog.dart rename to example/demo_app/lib/views/spaces/live_space/space_moderation_dialog.dart diff --git a/example/lib/views/spaces/live_space/tiles.dart b/example/demo_app/lib/views/spaces/live_space/tiles.dart similarity index 100% rename from example/lib/views/spaces/live_space/tiles.dart rename to example/demo_app/lib/views/spaces/live_space/tiles.dart diff --git a/example/lib/views/spaces/popular/popular_space_provider.dart b/example/demo_app/lib/views/spaces/popular/popular_space_provider.dart similarity index 100% rename from example/lib/views/spaces/popular/popular_space_provider.dart rename to example/demo_app/lib/views/spaces/popular/popular_space_provider.dart diff --git a/example/lib/views/spaces/popular/popular_tab.dart b/example/demo_app/lib/views/spaces/popular/popular_tab.dart similarity index 100% rename from example/lib/views/spaces/popular/popular_tab.dart rename to example/demo_app/lib/views/spaces/popular/popular_tab.dart diff --git a/example/lib/views/spaces/search_spaces.screen.dart b/example/demo_app/lib/views/spaces/search_spaces.screen.dart similarity index 100% rename from example/lib/views/spaces/search_spaces.screen.dart rename to example/demo_app/lib/views/spaces/search_spaces.screen.dart diff --git a/example/lib/views/spaces/space_requests/space_invites_screen.dart b/example/demo_app/lib/views/spaces/space_requests/space_invites_screen.dart similarity index 100% rename from example/lib/views/spaces/space_requests/space_invites_screen.dart rename to example/demo_app/lib/views/spaces/space_requests/space_invites_screen.dart diff --git a/example/lib/views/spaces/space_requests/space_request_provider.dart b/example/demo_app/lib/views/spaces/space_requests/space_request_provider.dart similarity index 100% rename from example/lib/views/spaces/space_requests/space_request_provider.dart rename to example/demo_app/lib/views/spaces/space_requests/space_request_provider.dart diff --git a/example/lib/views/spaces/space_tile.dart b/example/demo_app/lib/views/spaces/space_tile.dart similarity index 100% rename from example/lib/views/spaces/space_tile.dart rename to example/demo_app/lib/views/spaces/space_tile.dart diff --git a/example/lib/views/spaces/your_spaces/for_you_tab.dart b/example/demo_app/lib/views/spaces/your_spaces/for_you_tab.dart similarity index 100% rename from example/lib/views/spaces/your_spaces/for_you_tab.dart rename to example/demo_app/lib/views/spaces/your_spaces/for_you_tab.dart diff --git a/example/lib/views/spaces/your_spaces/hosted_by_you_tab.dart b/example/demo_app/lib/views/spaces/your_spaces/hosted_by_you_tab.dart similarity index 100% rename from example/lib/views/spaces/your_spaces/hosted_by_you_tab.dart rename to example/demo_app/lib/views/spaces/your_spaces/hosted_by_you_tab.dart diff --git a/example/lib/views/spaces/your_spaces/your_spaces_provider.dart b/example/demo_app/lib/views/spaces/your_spaces/your_spaces_provider.dart similarity index 100% rename from example/lib/views/spaces/your_spaces/your_spaces_provider.dart rename to example/demo_app/lib/views/spaces/your_spaces/your_spaces_provider.dart diff --git a/example/lib/views/spaces_tab.dart b/example/demo_app/lib/views/spaces_tab.dart similarity index 100% rename from example/lib/views/spaces_tab.dart rename to example/demo_app/lib/views/spaces_tab.dart diff --git a/example/pubspec.yaml b/example/demo_app/pubspec.yaml similarity index 98% rename from example/pubspec.yaml rename to example/demo_app/pubspec.yaml index ea5a534..181f648 100644 --- a/example/pubspec.yaml +++ b/example/demo_app/pubspec.yaml @@ -48,7 +48,7 @@ dependencies: push_restapi_dart: - path: '../' + path: '../../' diff --git a/example/test/widget_test.dart b/example/demo_app/test/widget_test.dart similarity index 100% rename from example/test/widget_test.dart rename to example/demo_app/test/widget_test.dart diff --git a/example/web/favicon.png b/example/demo_app/web/favicon.png similarity index 100% rename from example/web/favicon.png rename to example/demo_app/web/favicon.png diff --git a/example/web/icons/Icon-192.png b/example/demo_app/web/icons/Icon-192.png similarity index 100% rename from example/web/icons/Icon-192.png rename to example/demo_app/web/icons/Icon-192.png diff --git a/example/web/icons/Icon-512.png b/example/demo_app/web/icons/Icon-512.png similarity index 100% rename from example/web/icons/Icon-512.png rename to example/demo_app/web/icons/Icon-512.png diff --git a/example/web/icons/Icon-maskable-192.png b/example/demo_app/web/icons/Icon-maskable-192.png similarity index 100% rename from example/web/icons/Icon-maskable-192.png rename to example/demo_app/web/icons/Icon-maskable-192.png diff --git a/example/web/icons/Icon-maskable-512.png b/example/demo_app/web/icons/Icon-maskable-512.png similarity index 100% rename from example/web/icons/Icon-maskable-512.png rename to example/demo_app/web/icons/Icon-maskable-512.png diff --git a/example/web/index.html b/example/demo_app/web/index.html similarity index 100% rename from example/web/index.html rename to example/demo_app/web/index.html diff --git a/example/web/manifest.json b/example/demo_app/web/manifest.json similarity index 100% rename from example/web/manifest.json rename to example/demo_app/web/manifest.json diff --git a/example/lib/test_functions/chat/update_group_config.dart b/example/lib/test_functions/chat/update_group_config.dart deleted file mode 100644 index a395c9f..0000000 --- a/example/lib/test_functions/chat/update_group_config.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:push_restapi_dart/push_restapi_dart.dart'; - -void testUpdateGroupConfig() async { - final result = await updateGroupConfig( - scheduleAt: DateTime.now().add(Duration(hours: 3)), - chatId: - '64434400c9a61256451f025f1f8c7b34d9651af4a03ca063126e137572fb85ca'); - - print(result); -} diff --git a/example/lib/test_functions/chat/update_group_profile.dart b/example/lib/test_functions/chat/update_group_profile.dart deleted file mode 100644 index 60b7e83..0000000 --- a/example/lib/test_functions/chat/update_group_profile.dart +++ /dev/null @@ -1,12 +0,0 @@ -import 'package:push_restapi_dart/push_restapi_dart.dart'; - -void testUpdateGroupProfile() async { - final result = await updateGroupProfile( - groupImage: - 'https://tmpfiles.org/dl/3250024/screenshot2023-11-26at8.51.05pm.png', - chatId: - '64434400c9a61256451f025f1f8c7b34d9651af4a03ca063126e137572fb85ca', - groupName: 'Ayo New name'); - - print(result); -} diff --git a/example/use_cases/.gitignore b/example/use_cases/.gitignore new file mode 100644 index 0000000..24476c5 --- /dev/null +++ b/example/use_cases/.gitignore @@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/example/use_cases/.metadata b/example/use_cases/.metadata new file mode 100644 index 0000000..de745e4 --- /dev/null +++ b/example/use_cases/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + channel: stable + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: android + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: ios + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: linux + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: macos + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: web + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + - platform: windows + create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/use_cases/README.md b/example/use_cases/README.md new file mode 100644 index 0000000..a599054 --- /dev/null +++ b/example/use_cases/README.md @@ -0,0 +1,3 @@ +# use_cases + +A new Flutter project. diff --git a/example/use_cases/analysis_options.yaml b/example/use_cases/analysis_options.yaml new file mode 100644 index 0000000..f9b3034 --- /dev/null +++ b/example/use_cases/analysis_options.yaml @@ -0,0 +1 @@ +include: package:flutter_lints/flutter.yaml diff --git a/example/use_cases/android/.gitignore b/example/use_cases/android/.gitignore new file mode 100644 index 0000000..6f56801 --- /dev/null +++ b/example/use_cases/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/example/use_cases/android/app/build.gradle b/example/use_cases/android/app/build.gradle new file mode 100644 index 0000000..3004d8e --- /dev/null +++ b/example/use_cases/android/app/build.gradle @@ -0,0 +1,72 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + namespace "com.example.use_cases" + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.use_cases" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/example/use_cases/android/app/src/debug/AndroidManifest.xml b/example/use_cases/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/example/use_cases/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/use_cases/android/app/src/main/AndroidManifest.xml b/example/use_cases/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..5fb68d3 --- /dev/null +++ b/example/use_cases/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/example/use_cases/android/app/src/main/kotlin/com/example/use_cases/MainActivity.kt b/example/use_cases/android/app/src/main/kotlin/com/example/use_cases/MainActivity.kt new file mode 100644 index 0000000..1a3720b --- /dev/null +++ b/example/use_cases/android/app/src/main/kotlin/com/example/use_cases/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.use_cases + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/example/use_cases/android/app/src/main/res/drawable-v21/launch_background.xml b/example/use_cases/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/example/use_cases/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/use_cases/android/app/src/main/res/drawable/launch_background.xml b/example/use_cases/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/example/use_cases/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/use_cases/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/use_cases/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/example/use_cases/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/example/use_cases/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/use_cases/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/example/use_cases/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/example/use_cases/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/use_cases/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/example/use_cases/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/example/use_cases/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/use_cases/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/example/use_cases/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/example/use_cases/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/use_cases/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/example/use_cases/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/example/use_cases/android/app/src/main/res/values-night/styles.xml b/example/use_cases/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/example/use_cases/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/use_cases/android/app/src/main/res/values/styles.xml b/example/use_cases/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/example/use_cases/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/use_cases/android/app/src/profile/AndroidManifest.xml b/example/use_cases/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/example/use_cases/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/use_cases/android/build.gradle b/example/use_cases/android/build.gradle new file mode 100644 index 0000000..f7eb7f6 --- /dev/null +++ b/example/use_cases/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.7.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.3.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/example/use_cases/android/gradle.properties b/example/use_cases/android/gradle.properties new file mode 100644 index 0000000..94adc3a --- /dev/null +++ b/example/use_cases/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/example/use_cases/android/gradle/wrapper/gradle-wrapper.properties b/example/use_cases/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..3c472b9 --- /dev/null +++ b/example/use_cases/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/example/use_cases/android/settings.gradle b/example/use_cases/android/settings.gradle new file mode 100644 index 0000000..44e62bc --- /dev/null +++ b/example/use_cases/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/example/use_cases/ios/.gitignore b/example/use_cases/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/example/use_cases/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/example/use_cases/ios/Flutter/AppFrameworkInfo.plist b/example/use_cases/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..9625e10 --- /dev/null +++ b/example/use_cases/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 11.0 + + diff --git a/example/use_cases/ios/Flutter/Debug.xcconfig b/example/use_cases/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..ec97fc6 --- /dev/null +++ b/example/use_cases/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/example/use_cases/ios/Flutter/Release.xcconfig b/example/use_cases/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..c4855bf --- /dev/null +++ b/example/use_cases/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/example/use_cases/ios/Podfile b/example/use_cases/ios/Podfile new file mode 100644 index 0000000..7f35b81 --- /dev/null +++ b/example/use_cases/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +platform :ios, '12.1' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/example/use_cases/ios/Podfile.lock b/example/use_cases/ios/Podfile.lock new file mode 100644 index 0000000..2fe90bf --- /dev/null +++ b/example/use_cases/ios/Podfile.lock @@ -0,0 +1,65 @@ +PODS: + - connectivity_plus (0.0.1): + - Flutter + - ReachabilitySwift + - device_info_plus (0.0.1): + - Flutter + - Flutter (1.0.0) + - flutter_webrtc (0.9.36): + - Flutter + - WebRTC-SDK (= 114.5735.08) + - livekit_client (1.5.6): + - Flutter + - WebRTC-SDK (= 114.5735.08) + - openpgp (0.6.0): + - Flutter + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - ReachabilitySwift (5.0.0) + - WebRTC-SDK (114.5735.08) + +DEPENDENCIES: + - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) + - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) + - Flutter (from `Flutter`) + - flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`) + - livekit_client (from `.symlinks/plugins/livekit_client/ios`) + - openpgp (from `.symlinks/plugins/openpgp/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + +SPEC REPOS: + trunk: + - ReachabilitySwift + - WebRTC-SDK + +EXTERNAL SOURCES: + connectivity_plus: + :path: ".symlinks/plugins/connectivity_plus/ios" + device_info_plus: + :path: ".symlinks/plugins/device_info_plus/ios" + Flutter: + :path: Flutter + flutter_webrtc: + :path: ".symlinks/plugins/flutter_webrtc/ios" + livekit_client: + :path: ".symlinks/plugins/livekit_client/ios" + openpgp: + :path: ".symlinks/plugins/openpgp/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" + +SPEC CHECKSUMS: + connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d + device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + flutter_webrtc: 55df3aaa802114dad390191a46c2c8d535751268 + livekit_client: 381ed3cad6ba0b6ffbfffcf1b5db95ad1e61ffa2 + openpgp: 5acfbf58958e99c451509150274c4aa3f3a5980b + path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 + ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 + WebRTC-SDK: c24d2a6c9f571f2ed42297cb8ffba9557093142b + +PODFILE CHECKSUM: f9420bd595da8fbce156b547dcd3368afc5226ff + +COCOAPODS: 1.14.2 diff --git a/example/use_cases/ios/Runner.xcodeproj/project.pbxproj b/example/use_cases/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..166e9cb --- /dev/null +++ b/example/use_cases/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,721 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 23C77B2E4F09AC45EA9E995F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0362E6133ACD9A948B4E5C2E /* Pods_Runner.framework */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 6BD66EE6949939BE7478374B /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3B1D87F2990E5E24F1526A6 /* Pods_RunnerTests.framework */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0362E6133ACD9A948B4E5C2E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 1E184FEAE6560CD7D7008D96 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 41E829895B2E03063B8C07C0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7EDAF38E61BE0F0E0244081C /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A3B1D87F2990E5E24F1526A6 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C07DCF3AEDF27FC1BB4915DF /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + F5D183F01DCEDF213FD6B72B /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + FF3A90A74275D652F85F18EA /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 47E1AE47FB863AFCAF878055 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6BD66EE6949939BE7478374B /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 23C77B2E4F09AC45EA9E995F /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 78D37C4758A4E009565B58B7 /* Pods */ = { + isa = PBXGroup; + children = ( + F5D183F01DCEDF213FD6B72B /* Pods-Runner.debug.xcconfig */, + 1E184FEAE6560CD7D7008D96 /* Pods-Runner.release.xcconfig */, + 41E829895B2E03063B8C07C0 /* Pods-Runner.profile.xcconfig */, + FF3A90A74275D652F85F18EA /* Pods-RunnerTests.debug.xcconfig */, + C07DCF3AEDF27FC1BB4915DF /* Pods-RunnerTests.release.xcconfig */, + 7EDAF38E61BE0F0E0244081C /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + 78D37C4758A4E009565B58B7 /* Pods */, + C10241542CA665772C76B8A7 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + C10241542CA665772C76B8A7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 0362E6133ACD9A948B4E5C2E /* Pods_Runner.framework */, + A3B1D87F2990E5E24F1526A6 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + CD90030A329B2DB025E4683D /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + 47E1AE47FB863AFCAF878055 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 033D820F3B8A11FD232DB877 /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 948DC839691427D512864BB3 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1300; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 033D820F3B8A11FD232DB877 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 948DC839691427D512864BB3 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + CD90030A329B2DB025E4683D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.useCases; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FF3A90A74275D652F85F18EA /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.useCases.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C07DCF3AEDF27FC1BB4915DF /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.useCases.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7EDAF38E61BE0F0E0244081C /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.useCases.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.useCases; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.useCases; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/example/use_cases/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/use_cases/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/example/use_cases/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/use_cases/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/use_cases/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/use_cases/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/use_cases/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/use_cases/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/use_cases/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/use_cases/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/use_cases/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..e42adcb --- /dev/null +++ b/example/use_cases/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/use_cases/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/use_cases/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/example/use_cases/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/example/use_cases/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/use_cases/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/use_cases/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/use_cases/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/use_cases/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/use_cases/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/use_cases/ios/Runner/AppDelegate.swift b/example/use_cases/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..70693e4 --- /dev/null +++ b/example/use_cases/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/example/use_cases/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/example/use_cases/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/use_cases/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/example/use_cases/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/use_cases/ios/Runner/Base.lproj/Main.storyboard b/example/use_cases/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/example/use_cases/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/use_cases/ios/Runner/Info.plist b/example/use_cases/ios/Runner/Info.plist new file mode 100644 index 0000000..6963525 --- /dev/null +++ b/example/use_cases/ios/Runner/Info.plist @@ -0,0 +1,51 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Use Cases + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + use_cases + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/example/use_cases/ios/Runner/Runner-Bridging-Header.h b/example/use_cases/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/example/use_cases/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/example/use_cases/ios/RunnerTests/RunnerTests.swift b/example/use_cases/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/example/use_cases/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/example/use_cases/lib/chats/chat.dart b/example/use_cases/lib/chats/chat.dart new file mode 100644 index 0000000..9e78492 --- /dev/null +++ b/example/use_cases/lib/chats/chat.dart @@ -0,0 +1,234 @@ +import 'dart:math'; + +import 'package:push_restapi_dart/push_restapi_dart.dart'; +import 'package:unique_names_generator/unique_names_generator.dart'; +import 'package:web3dart/web3dart.dart' as web3; + +import '../models/signer.dart'; + +void log(Object? object) { + // ignore: avoid_print + print(object); +} + +Future delay(int miliseconds) async { + await Future.delayed(Duration(milliseconds: miliseconds)); +} + +// Dummy Wallet Addresses and signers +var random = Random.secure(); + +final randomWallet1 = web3.EthPrivateKey.createRandom(random); +final randomWallet2 = web3.EthPrivateKey.createRandom(random); +final randomWallet3 = web3.EthPrivateKey.createRandom(random); + +final wallet1Signer = Web3Signer(randomWallet1); +final wallet2Signer = Web3Signer(randomWallet2); +final wallet3Signer = Web3Signer(randomWallet3); + +/// *************** SAMPLE GROUP DATA *************************** +const groupImage = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; + +String groupName() { + final generator = UniqueNamesGenerator( + config: Config(dictionaries: [names, animals, colors]), + ); + return generator.generate().replaceAll('_', ' '); +} + +String groupDescription() { + final generator = UniqueNamesGenerator( + config: Config(dictionaries: [names, animals, colors]), + ); + return generator.generate().replaceAll('_', ' '); +} + +/// *************** SAMPLE GROUP DATA *************************** + +Future runChatClassUseCases() async { + final userAlice = await PushAPI.initialize( + signer: wallet1Signer, + options: PushAPIInitializeOptions(showHttpLog: true), + ); + final userBob = await PushAPI.initialize( + signer: wallet2Signer, + options: PushAPIInitializeOptions(showHttpLog: true), + ); + final userKate = await PushAPI.initialize( + signer: wallet3Signer, + options: PushAPIInitializeOptions(showHttpLog: true), + ); + + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.chat.list'); + final aliceChats = await userAlice.chat.list(type: ChatListType.CHATS); + log('PushAPI.chat.list: $aliceChats | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.chat.latest'); + final aliceLatestChatWithBob = + await userAlice.chat.latest(target: wallet2Signer.getAddress()); + log(aliceLatestChatWithBob); + log('PushAPI.chat.latest | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.chat.history'); + final aliceChatHistoryWithBob = + await userAlice.chat.history(target: wallet2Signer.getAddress()); + + log(aliceChatHistoryWithBob); + log('PushAPI.chat.history | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.chat.send'); + final aliceMessagesBob = await userAlice.chat.send( + recipient: wallet2Signer.getAddress(), + options: SendMessage( + content: 'Hello Bob!', + type: MessageType.TEXT, + )); + log(aliceMessagesBob); + await delay(2000); // Delay added to log the events in order + log('PushAPI.chat.send | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.chat.accept'); + final bobAcceptsRequest = + await userBob.chat.accept(target: wallet1Signer.getAddress()); + log(bobAcceptsRequest); + await delay(2000); // Delay added to log the events in order + log('PushAPI.chat.accept | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.chat.reject'); + await userKate.chat.send( + recipient: wallet1Signer.getAddress(), + options: SendMessage( + content: 'Sending malicious message', + type: MessageType.TEXT, + ), + ); + final aliceRejectsRequest = + await userAlice.chat.reject(target: wallet3Signer.getAddress()); + log(aliceRejectsRequest); + await delay(2000); // Delay added to log the events in order + log('PushAPI.chat.reject | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.chat.block'); + final aliceBlocksBob = + await userAlice.chat.block(users: [wallet2Signer.getAddress()]); + + log(aliceBlocksBob); + log('PushAPI.chat.block | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.chat.unblock'); + final aliceUnblocksBob = + await userAlice.chat.unblock(users: [wallet2Signer.getAddress()]); + + log(aliceUnblocksBob); + log('PushAPI.chat.unblock | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.group.create'); + final createdGroup = await userAlice.chat.group.create( + name: groupName(), + options: GroupCreationOptions( + description: groupDescription(), + image: groupImage, + members: [ + wallet2Signer.getAddress(), + wallet3Signer.getAddress(), + ], + admins: [], + private: false, + )); + final groupChatId = createdGroup?.chatId; // to be used in other examples + + log(createdGroup); + await delay(2000); // Delay added to log the events in order + log('PushAPI.group.create | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.group.permissions'); + final grouppermissions = + await userAlice.chat.group.permissions(chatId: groupChatId!); + + log(grouppermissions); + log('PushAPI.group.permissions | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.group.info'); + final groupInfo = await userAlice.chat.group.info(chatId: groupChatId); + + log(groupInfo); + log('PushAPI.group.info | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.group.update'); + final updatedGroup = await userAlice.chat.group.update( + chatId: groupChatId, + options: GroupUpdateOptions( + description: 'Updated Description', + ), + ); + log(updatedGroup); + await delay(2000); // Delay added to log the events in order + log('PushAPI.group.update | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.group.add'); + final addMember = await userAlice.chat.group.add( + chatId: groupChatId, + role: 'MEMBER', + accounts: [wallet3Signer.getAddress()], + ); + log(addMember); + await delay(2000); // Delay added to log the events in order + log('PushAPI.group.add | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.group.remove'); + final removeMember = await userAlice.chat.group.remove( + chatId: groupChatId, + role: 'MEMBER', + accounts: [wallet3Signer.getAddress()], + ); + log(removeMember); + await delay(2000); // Delay added to log the events in order + log('PushAPI.group.remove | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.group.join'); + final joinGrp = await userBob.chat.group.join(target: groupChatId); + + log(joinGrp); + await delay(2000); // Delay added to log the events in order + log('PushAPI.group.join | Response - 200 OK\n\n'); + //------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.group.leave'); + final leaveGrp = await userBob.chat.group.leave(target: groupChatId); + + log(leaveGrp); + await delay(2000); // Delay added to log the events in order + log('PushAPI.group.leave | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + log('PushAPI.group.reject'); + final sampleGrp = await userAlice.chat.group.create( + name: 'Sample Grp', + options: GroupCreationOptions( + description: groupDescription(), + image: groupImage, + members: [wallet2Signer.getAddress()], // invite bob + admins: [], + private: true, + )); + await userBob.chat.group.reject(target: sampleGrp!.chatId); + await delay(2000); // Delay added to log the events in order + log('PushAPI.group.reject | Response - 200 OK\n\n'); +} diff --git a/example/use_cases/lib/main.dart b/example/use_cases/lib/main.dart new file mode 100644 index 0000000..cc821ed --- /dev/null +++ b/example/use_cases/lib/main.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import 'package:use_cases/chats/chat.dart'; + +void main() async { + runApp(const MainApp()); + + log(r''' + + ░█████╗░██╗░░██╗░█████╗░████████╗ + ██╔══██╗██║░░██║██╔══██╗╚══██╔══╝ + ██║░░╚═╝███████║███████║░░░██║░░░ + ██║░░██╗██╔══██║██╔══██║░░░██║░░░ + ╚█████╔╝██║░░██║██║░░██║░░░██║░░░ + ░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝░░░╚═╝░░░ + '''); + + await runChatClassUseCases(); +} + +class MainApp extends StatelessWidget { + const MainApp({super.key}); + + @override + Widget build(BuildContext context) { + return const MaterialApp( + home: Scaffold( + body: Center( + child: Text('Push'), + ), + ), + ); + } +} diff --git a/example/use_cases/lib/models/signer.dart b/example/use_cases/lib/models/signer.dart new file mode 100644 index 0000000..5c6b01c --- /dev/null +++ b/example/use_cases/lib/models/signer.dart @@ -0,0 +1,84 @@ +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:ethers/signers/wallet.dart' as ethers; +import 'package:push_restapi_dart/push_restapi_dart.dart' as push; +import 'package:eth_sig_util/eth_sig_util.dart' as eth_sig; +import 'package:web3dart/web3dart.dart' as web3; + +class EthersSigner extends push.Signer { + final ethers.Wallet ethersWallet; + + final String address; + + EthersSigner({required this.ethersWallet, required this.address}); + + @override + String getAddress() { + return address; + } + + @override + Future getEip191Signature(String message) async { + try { + var m = utf8.encode(message); + + String signature = eth_sig.EthSigUtil.signPersonalMessage( + privateKey: ethersWallet.privateKey, message: Uint8List.fromList(m)); + return signature; + } catch (e) { + print('override: getEip191Signature: error$e'); + return message; + } + } + + @override + Future getEip712Signature(String message) async { + throw UnimplementedError(); + } + + @override + Future signMessage(String message) async { + try { + var m = utf8.encode(message); + + String signature = eth_sig.EthSigUtil.signMessage( + privateKey: ethersWallet.privateKey, message: Uint8List.fromList(m)); + return signature; + } catch (e) { + return message; + } + } +} + +class Web3Signer extends push.Signer { + final web3.Credentials credentials; + + Web3Signer(this.credentials); + + @override + String getAddress() { + return credentials.address.hex; + } + + @override + Future getEip191Signature(String message) async { + var m = utf8.encode(message); + final sig = credentials.signToEcSignature(Uint8List.fromList(m)); + + return sig.toString(); + } + + @override + Future getEip712Signature(String message) { + throw UnimplementedError(); + } + + @override + Future signMessage(String message) async { + var m = utf8.encode(message); + final sig = + credentials.signPersonalMessageToUint8List(Uint8List.fromList(m)); + return utf8.decode(sig); + } +} diff --git a/example/use_cases/pubspec.yaml b/example/use_cases/pubspec.yaml new file mode 100644 index 0000000..d37cd37 --- /dev/null +++ b/example/use_cases/pubspec.yaml @@ -0,0 +1,31 @@ +name: use_cases +description: A new Flutter project. +publish_to: 'none' +version: 0.1.0 + +environment: + sdk: '>=3.0.6 <4.0.0' + +dependencies: + flutter: + sdk: flutter + + web3dart: ^2.6.1 + eth_sig_util: ^0.0.9 + ethers: + git: + url: https://github.com/gbogboadePush/ethers.git + ref: main + + push_restapi_dart: + path: '../../' + unique_names_generator: ^1.0.0 + logger: ^2.0.2+1 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + +flutter: + uses-material-design: true diff --git a/lib/push_restapi_dart.dart b/lib/push_restapi_dart.dart index a08cd7d..4c0ddf1 100644 --- a/lib/push_restapi_dart.dart +++ b/lib/push_restapi_dart.dart @@ -14,4 +14,6 @@ export 'src/payloads/payloads.dart'; export 'src/video/video.dart'; export 'src/sockets/sockets.dart'; +export 'src/pushapi/__pushapi.dart'; + export 'src/main.dart'; diff --git a/lib/src/chat/chat.dart b/lib/src/chat/chat.dart index 8da606d..8b08d1c 100644 --- a/lib/src/chat/chat.dart +++ b/lib/src/chat/chat.dart @@ -15,6 +15,7 @@ export 'src/models/group_member_status.dart'; export 'src/models/group_member_public_key.dart'; export 'src/models/update_group_members.dart'; export 'src/models/send_models.dart'; +export 'src/models/group_access.dart'; export 'src/chat.dart'; export 'src/chats.dart'; @@ -43,3 +44,7 @@ export 'src/get_all_group_members_public_keys.dart'; export 'src/update_group_config.dart'; export 'src/update_group_profile.dart'; export 'src/update_group_members.dart'; +export 'src/reject_request.dart'; +export 'src/create_group_v2.dart'; +export 'src/get_group_access.dart'; +export 'src/modify_roles.dart'; diff --git a/lib/src/chat/src/create_group_v2.dart b/lib/src/chat/src/create_group_v2.dart new file mode 100644 index 0000000..aadf0f0 --- /dev/null +++ b/lib/src/chat/src/create_group_v2.dart @@ -0,0 +1,200 @@ +import '../../../push_restapi_dart.dart'; + +class ChatCreateGroupTypeV2 extends EnvOptionsType { + String? account; + Signer? signer; + String? pgpPrivateKey; + + // Profile + late String groupName; + late String groupDescription; + String? groupImage; + dynamic rules; + late bool isPublic; + late String groupType; + late GroupConfig config; + late List members; + late List admins; + + ChatCreateGroupTypeV2({ + this.account, + this.signer, + this.pgpPrivateKey, + required this.groupName, + required this.groupDescription, + this.groupImage, + this.rules, + required this.isPublic, + this.groupType = 'default', + required this.config, + this.members = const [], + this.admins = const [], + }); +} + +class GroupConfig { + String? meta; + DateTime? scheduleAt; + DateTime? scheduleEnd; + String? status; + + GroupConfig({ + this.meta, + this.scheduleAt, + this.scheduleEnd, + this.status, + }); +} + +Future createGroupV2( + {required ChatCreateGroupTypeV2 options}) async { + return createGroupCoreV2(options: options); +} + +Future createGroupCoreV2( + {required ChatCreateGroupTypeV2 options}) async { + try { + options.account ??= getCachedWallet()?.address; + options.signer ??= getCachedWallet()?.signer; + options.pgpPrivateKey ??= getCachedWallet()?.pgpPrivateKey; + + if (options.account == null && options.signer == null) { + throw Exception('At least one from account or signer is necessary!'); + } + final wallet = getWallet(address: options.account, signer: options.signer); + final connectedUser = await getConnectedUserV2( + wallet: wallet, + privateKey: options.pgpPrivateKey, + ); + + /** + * VALIDATIONS + */ + createGroupV2OptionsValidator(options: options); + + final convertedMembers = await Future.wait( + options.members.map((item) => getUserDID(address: item))); + final convertedAdmins = await Future.wait( + options.admins.map((item) => getUserDID(address: item))); + + /** + * PROFILE VERIFICATION PROOF + */ + final profileVerificationBody = { + 'groupName': options.groupName, + 'groupDescription': options.groupDescription, + 'groupImage': options.groupImage, + 'rules': options.rules ?? {}, + 'isPublic': options.isPublic, + 'groupType': options.groupType, + }; + + final profileHash = generateHash(profileVerificationBody); + final profileSignature = await sign( + message: profileHash, + privateKey: connectedUser.privateKey!, + ); + + final profileVerificationProof = + 'pgpv2:$profileSignature:${connectedUser.did}'; + + /** + * CONFIG VERIFICATION PROOF + */ + + final configVerificationBody = { + 'meta': options.config.meta, + 'scheduleAt': options.config.scheduleAt, + 'scheduleEnd': options.config.scheduleEnd, + 'status': options.config.status, + }; + + final configHash = generateHash(configVerificationBody); + final configSignature = await sign( + message: configHash, + privateKey: connectedUser.privateKey!, + ); + + final configVerificationProof = + 'pgpv2:$configSignature:${connectedUser.did}'; + + /** + * IDEMPOTENT VERIFICATION PROOF + */ + final idempotentVerificationBody = { + 'members': convertedMembers, + 'admins': convertedAdmins, + }; + + final idempotentHash = generateHash(idempotentVerificationBody); + final idempotentSignature = await sign( + message: idempotentHash, + privateKey: connectedUser.privateKey!, + ); + final String idempotentVerificationProof = + 'pgpv2:$idempotentSignature:${connectedUser.did}'; + + final body = { + 'groupName': options.groupName, + 'groupDescription': options.groupDescription, + 'groupImage': options.groupImage, + 'rules': options.rules ?? {}, + 'isPublic': options.isPublic, + 'groupType': options.groupType, + 'profileVerificationProof': profileVerificationProof, + 'config': { + 'meta': options.config.meta, + 'scheduleAt': options.config.scheduleAt, + 'scheduleEnd': options.config.scheduleEnd, + 'status': options.config.status, + 'configVerificationProof': configVerificationProof, + }, + 'members': convertedMembers, + 'admins': convertedAdmins, + 'idempotentVerificationProof': idempotentVerificationProof, + }; + + final result = await http.post( + path: '/v2/chat/groups', + data: body, + ); + + if (result == null || result is String) { + throw Exception(result); + } + return GroupInfoDTO.fromJson(result); + } catch (e) { + log("[Push SDK] - API - Error - API createGroup -: $e "); + rethrow; + } +} + +void createGroupV2OptionsValidator({required ChatCreateGroupTypeV2 options}) { + if (options.groupName.isEmpty) { + throw Exception('groupName cannot be null or empty'); + } + + if (options.groupName.length > 50) { + throw Exception('groupName cannot be more than 50 characters'); + } + + if (options.groupDescription.length > 150) { + throw Exception('groupDescription cannot be more than 150 characters'); + } + + for (int i = 0; i < options.members.length; i++) { + if (!isValidETHAddress(options.members[i])) { + throw Exception('Invalid member address!'); + } + } + + for (int i = 0; i < options.admins.length; i++) { + if (!isValidETHAddress(options.admins[i])) { + throw Exception('Invalid admin address!'); + } + } + + validateScheduleDates( + scheduleAt: options.config.scheduleAt, + scheduleEnd: options.config.scheduleEnd); +} diff --git a/lib/src/chat/src/get_all_group_members.dart b/lib/src/chat/src/get_all_group_members.dart index e03f8f0..475f3b9 100644 --- a/lib/src/chat/src/get_all_group_members.dart +++ b/lib/src/chat/src/get_all_group_members.dart @@ -15,9 +15,10 @@ Future> getAllGroupMembers({ final pagesResult = await Future.wait( List.generate( - totalPages, - (index) => getGroupMembers(chatId: chatId, page: index + 1, limit: limit), - ), + totalPages, + (index) => getGroupMembers( + options: FetchChatGroupInfoType( + chatId: chatId, page: index + 1, limit: limit))), ); var members = []; diff --git a/lib/src/chat/src/get_group_access.dart b/lib/src/chat/src/get_group_access.dart new file mode 100644 index 0000000..439c812 --- /dev/null +++ b/lib/src/chat/src/get_group_access.dart @@ -0,0 +1,23 @@ +import 'package:push_restapi_dart/push_restapi_dart.dart'; + +Future getGroupAccess({ + required String chatId, + required String did, // Decentralized Identifier +}) async { + if (chatId.isEmpty) { + throw Exception('chatId cannot be null or empty'); + } + if (did.isEmpty) { + throw Exception('did cannot be null or empty'); + } + + final user = await getUserDID(address: did); + + final result = await http.get(path: '/v1/chat/groups/$chatId/access/$user'); + + if (result == null || result is String) { + throw Exception(result ?? 'Cannot get group access for $user in $chatId'); + } + + return GroupAccess.fromJson(result); +} diff --git a/lib/src/chat/src/get_group_members.dart b/lib/src/chat/src/get_group_members.dart index 00018de..642aa4d 100644 --- a/lib/src/chat/src/get_group_members.dart +++ b/lib/src/chat/src/get_group_members.dart @@ -1,18 +1,42 @@ import 'package:push_restapi_dart/push_restapi_dart.dart'; +class FetchChatGroupInfoType { + late String chatId; + int page; + int limit; + bool? pending; + String? role; + + FetchChatGroupInfoType({ + required this.chatId, + this.page = 1, + this.limit = 20, + this.pending, + this.role, + }); +} + Future> getGroupMembers( - {required String chatId, int page = 1, int limit = 20}) async { - if (chatId.isEmpty) { + {required FetchChatGroupInfoType options}) async { + if (options.chatId.isEmpty) { throw Exception('chatId cannot be null or empty'); } + var requestUrl = + '/v1/chat/groups/${options.chatId}/members?pageNumber=${options.page}&pageSize=${options.limit}'; + if (options.pending != null) { + requestUrl += '&pending=${options.pending}'; + } + if (options.role != null) { + requestUrl += '&role=${options.role}'; + } final result = await http.get( - path: '/v1/chat/groups/$chatId/members?pageNumber=$page&pageSize=$limit', + path: requestUrl, ); if (result == null || result is String) { - throw Exception( - result ?? 'Failed to retrieve group members. ChatId: $chatId'); + throw Exception(result ?? + 'Failed to retrieve group members. ChatId: ${options.chatId}'); } return (result['members'] as List) diff --git a/lib/src/chat/src/helper/crypto.dart b/lib/src/chat/src/helper/crypto.dart index 7a02e96..794a571 100644 --- a/lib/src/chat/src/helper/crypto.dart +++ b/lib/src/chat/src/helper/crypto.dart @@ -124,6 +124,7 @@ Future getEncryptedRequestCore({ user: receiverAddress, publicKey: '', encryptedPrivateKey: '', + wallet: getWallet(address: receiverAddress), ); // If the user is being created here, that means that user don't have a PGP keys. So this intent will be in plaintext diff --git a/lib/src/chat/src/helper/service.dart b/lib/src/chat/src/helper/service.dart index b73d2a9..dbd291a 100644 --- a/lib/src/chat/src/helper/service.dart +++ b/lib/src/chat/src/helper/service.dart @@ -8,9 +8,9 @@ Future createUserService({ }) async { wallet ??= getCachedWallet(); - if (wallet == null || wallet.signer == null) { - throw Exception('Provide signer'); - } + // if (wallet == null || wallet.signer == null) { + // throw Exception('Provide signer'); + // } final requestPath = '/v2/users/'; @@ -30,7 +30,7 @@ Future createUserService({ final hash = generateHash(data); - final signatureObj = await getEip191Signature(wallet, hash, version: 'v2'); + final signatureObj = await getEip191Signature(wallet!, hash, version: 'v2'); final body = { ...data, diff --git a/lib/src/chat/src/helper/validators.dart b/lib/src/chat/src/helper/validators.dart index 4d9063b..895d9f9 100644 --- a/lib/src/chat/src/helper/validators.dart +++ b/lib/src/chat/src/helper/validators.dart @@ -164,3 +164,26 @@ Future validateSendOptions(ComputedOptions options) async { //TODO implement validateMessageObj } + +void validateScheduleDates({ + DateTime? scheduleAt, + DateTime? scheduleEnd, +}) { + if (scheduleAt != null) { + final now = DateTime.now(); + + if (scheduleAt.isBefore(now)) { + throw Exception('Schedule start time must be in the future.'); + } + + if (scheduleEnd != null) { + if (scheduleEnd.isBefore(now)) { + throw Exception('Schedule end time must be in the future.'); + } + + if (scheduleAt.isAfter(scheduleEnd)) { + throw Exception('Schedule start time must be earlier than end time.'); + } + } + } +} diff --git a/lib/src/chat/src/models/group_access.dart b/lib/src/chat/src/models/group_access.dart new file mode 100644 index 0000000..89cab0a --- /dev/null +++ b/lib/src/chat/src/models/group_access.dart @@ -0,0 +1,27 @@ +class GroupAccess { + bool entry; + bool chat; + dynamic rules; + + GroupAccess({ + required this.entry, + required this.chat, + this.rules, + }); + + factory GroupAccess.fromJson(Map json) { + return GroupAccess( + entry: json['entry'] ?? false, + chat: json['chat'] ?? false, + rules: json['rules']); + } + + Map toJson() { + final Map data = { + 'entry': entry, + 'chat': chat, + 'rules': rules, + }; + return data; + } +} diff --git a/lib/src/chat/src/modify_roles.dart b/lib/src/chat/src/modify_roles.dart new file mode 100644 index 0000000..f2cda8e --- /dev/null +++ b/lib/src/chat/src/modify_roles.dart @@ -0,0 +1,44 @@ +import '../../../push_restapi_dart.dart'; + +class ModifyRolesType { + String chatId; + String newRole; + List members; + String? account; + Signer? signer; + String? pgpPrivateKey; + bool? overrideSecretKeyGeneration; + + ModifyRolesType({ + required this.chatId, + required this.newRole, + this.members = const [], + this.account, + this.signer, + this.pgpPrivateKey, + this.overrideSecretKeyGeneration, + }); +} + +Future modifyRoles({required ModifyRolesType options}) async { + if (options.account == null && options.signer == null) { + throw Exception('At least one from account or signer is necessary!'); + } + + if (options.members.isEmpty) { + throw Exception('Members array cannot be empty!'); + } + + final upsertPayload = UpsertDTO( + members: options.newRole == 'MEMBER' ? options.members : [], + admins: options.newRole == 'ADMIN' ? options.members : [], + ); + + return updateGroupMembers( + chatId: options.chatId, + account: options.account, + pgpPrivateKey: options.pgpPrivateKey, + upsert: upsertPayload, + signer: options.signer, + ); +} diff --git a/lib/src/chat/src/reject_request.dart b/lib/src/chat/src/reject_request.dart new file mode 100644 index 0000000..558b39c --- /dev/null +++ b/lib/src/chat/src/reject_request.dart @@ -0,0 +1,90 @@ +import 'package:push_restapi_dart/push_restapi_dart.dart'; + +/// Reject Chat Request +Future reject({ + required String senderAddress, + String? account, + Signer? signer, + String? pgpPrivateKey, +}) async { + try { + account ??= getCachedWallet()?.address; + signer ??= getCachedWallet()?.signer; + if (account == null && signer == null) { + throw Exception('At least one from account or signer is necessary!'); + } + + final wallet = getWallet(address: account, signer: signer); + final address = getAccountAddress(wallet); + + pgpPrivateKey ??= getCachedWallet()?.pgpPrivateKey; + if (pgpPrivateKey == null) { + throw Exception('Private Key is required.'); + } + + final isGroup = !isValidETHAddress(senderAddress); + + final connectedUser = await getConnectedUserV2( + wallet: wallet, + privateKey: pgpPrivateKey, + ); + + late String fromDID, toDID; + + if (isGroup) { + fromDID = await getUserDID(address: address); + toDID = await getUserDID(address: senderAddress); + } else { + fromDID = await getUserDID(address: senderAddress); + toDID = await getUserDID(address: address); + } + + /** + * GENERATE VERIFICATION PROOF + */ + + // pgp is used for public grps & w2w + // pgpv2 is used for private grps + var sigType = 'pgp'; + + final bodyToBeHashed = { + "fromDID": fromDID, + "toDID": toDID, + }; + + final hash = generateHash(bodyToBeHashed); + + final signature = await sign( + message: hash, + privateKey: connectedUser.privateKey!, + ); + + final body = { + "fromDID": fromDID, + "toDID": toDID, + "verificationProof": '$sigType:$signature', + }; + + final result = await http.put( + path: '/v1/chat/request/reject', + data: body, + skipJsonDecode: true, + ); + + if (result == null) { + throw Exception(isGroup + ? 'Unanable to reject $senderAddress group invite' + : 'Unable to reject request from $senderAddress'); + } + + //if chat address was returned + if (result is String) { + return result; + } + + return result['data']; + } catch (e) { + log(e); + throw Exception('[Push SDK] - API chats: $e'); + } +} diff --git a/lib/src/chat/src/update_group_config.dart b/lib/src/chat/src/update_group_config.dart index 858584f..1b9ac17 100644 --- a/lib/src/chat/src/update_group_config.dart +++ b/lib/src/chat/src/update_group_config.dart @@ -1,40 +1,55 @@ import '../../../push_restapi_dart.dart'; +class ChatUpdateConfigProfileType { + String? account; + Signer? signer; + String chatId; + String? meta; + DateTime? scheduleAt; + DateTime? scheduleEnd; + ChatStatus? status; + String? pgpPrivateKey; + + ChatUpdateConfigProfileType({ + this.account, + this.signer, + required this.chatId, + this.meta, + this.scheduleAt, + this.scheduleEnd, + this.status, + this.pgpPrivateKey, + }); +} + Future updateGroupConfig({ - String? account, - Signer? signer, - required String chatId, - String? meta, - DateTime? scheduleAt, - DateTime? scheduleEnd, - ChatStatus? status, - String? pgpPrivateKey, + required ChatUpdateConfigProfileType options, }) async { - account ??= getCachedWallet()?.address; - signer ??= getCachedWallet()?.signer; - pgpPrivateKey ??= getCachedWallet()?.pgpPrivateKey; + options.account ??= getCachedWallet()?.address; + options.signer ??= getCachedWallet()?.signer; + options.pgpPrivateKey ??= getCachedWallet()?.pgpPrivateKey; /** * VALIDATIONS */ - if (account == null && signer == null) { + if (options.account == null && options.signer == null) { throw Exception('At least one from account or signer is necessary!'); } - final wallet = getWallet(address: account, signer: signer); + final wallet = getWallet(address: options.account, signer: options.signer); String userDID = getAccountAddress(wallet); final connectedUser = await getConnectedUserV2( wallet: wallet, - privateKey: pgpPrivateKey, + privateKey: options.pgpPrivateKey, ); /** * CREATE PROFILE VERIFICATION PROOF */ final bodyToBeHashed = { - 'meta': meta, - 'scheduleAt': scheduleAt?.toIso8601String(), - 'scheduleEnd': scheduleEnd?.toIso8601String(), - 'status': status, + 'meta': options.meta, + 'scheduleAt': options.scheduleAt?.toIso8601String(), + 'scheduleEnd': options.scheduleEnd?.toIso8601String(), + 'status': options.status, }; final hash = generateHash(bodyToBeHashed); @@ -53,7 +68,7 @@ Future updateGroupConfig({ }; final result = await http.put( - path: '/v1/chat/groups/$chatId/config', + path: '/v1/chat/groups/${options.chatId}/config', data: body, ); diff --git a/lib/src/chat/src/update_group_profile.dart b/lib/src/chat/src/update_group_profile.dart index 68699e1..b8a305c 100644 --- a/lib/src/chat/src/update_group_profile.dart +++ b/lib/src/chat/src/update_group_profile.dart @@ -1,53 +1,69 @@ import '../../../push_restapi_dart.dart'; +class ChatUpdateGroupProfileType { + String? account; + Signer? signer; + String chatId; + late String groupName; + String? groupDescription; + String? groupImage; + dynamic rules; + String? pgpPrivateKey; + + ChatUpdateGroupProfileType({ + this.account, + this.signer, + required this.chatId, + required this.groupName, + this.groupDescription, + this.groupImage, + this.rules, + this.pgpPrivateKey, + }); +} + Future updateGroupProfile({ - String? account, - Signer? signer, - required String chatId, - required String groupName, - String? groupDescription, - String? groupImage, - dynamic rules, - String? pgpPrivateKey, + required ChatUpdateGroupProfileType options, }) async { - account ??= getCachedWallet()?.address; - signer ??= getCachedWallet()?.signer; - pgpPrivateKey ??= getCachedWallet()?.pgpPrivateKey; + options.account ??= getCachedWallet()?.address; + options.signer ??= getCachedWallet()?.signer; + options.pgpPrivateKey ??= getCachedWallet()?.pgpPrivateKey; /** * VALIDATIONS */ - if (account == null && signer == null) { + if (options.account == null && options.signer == null) { throw Exception('At least one from account or signer is necessary!'); } - final wallet = getWallet(address: walletToPCAIP10(account!), signer: signer); + final wallet = getWallet( + address: walletToPCAIP10(options.account!), signer: options.signer); String userDID = getAccountAddress(wallet); final connectedUser = await getConnectedUserV2( wallet: wallet, - privateKey: pgpPrivateKey, + privateKey: options.pgpPrivateKey, ); updateGroupRequestValidator( - chatId, - groupName, - groupDescription ?? '', - groupImage, + options.chatId, + options.groupName, + options.groupDescription ?? '', + options.groupImage, [], [], userDID, ); - final group = await getGroupInfo(chatId: chatId); + final group = await getGroupInfo(chatId: options.chatId); /** * CREATE PROFILE VERIFICATION PROOF */ final bodyToBeHashed = { - 'groupName': groupName, - 'groupDescription': groupDescription ?? group.groupDescription, - 'groupImage': groupImage, - 'rules': rules ?? {}, + 'groupName': options.groupName, + 'groupDescription': options.groupDescription ?? group.groupDescription, + 'groupImage': options.groupImage, + 'rules': options.rules ?? {}, "isPublic": group.isPublic, "groupType": group.groupType, }; @@ -63,15 +79,15 @@ Future updateGroupProfile({ '$sigType:$signature:${walletToPCAIP10(userDID)}'; final body = { - 'groupName': groupName, - 'groupDescription': groupDescription ?? group.groupDescription, - 'groupImage': groupImage, - 'rules': rules ?? {}, + 'groupName': options.groupName, + 'groupDescription': options.groupDescription ?? group.groupDescription, + 'groupImage': options.groupImage, + 'rules': options.rules ?? {}, 'profileVerificationProof': profileVerificationProof, }; final result = await http.put( - path: '/v1/chat/groups/$chatId/profile', + path: '/v1/chat/groups/${options.chatId}/profile', data: body, ); diff --git a/lib/src/helpers/src/crypto.dart b/lib/src/helpers/src/crypto.dart index a482691..f9bc0be 100644 --- a/lib/src/helpers/src/crypto.dart +++ b/lib/src/helpers/src/crypto.dart @@ -496,8 +496,13 @@ Future decryptPGPKey({ } } -verifyPGPPublicKey({ +//TODO: Implement verifyProfileKeys + verifyProfileKeys({ required String encryptedPrivateKey, required String publicKey, required String did, -}) async {} + required String caip10, + required String verificationProof, +}) async { + return ''; +} diff --git a/lib/src/main.dart b/lib/src/main.dart index 6514d3b..99192ea 100644 --- a/lib/src/main.dart +++ b/lib/src/main.dart @@ -1,7 +1,12 @@ import '../push_restapi_dart.dart'; -Future initPush({ENV env = ENV.staging, Wallet? wallet}) async { +Future initPush({ + ENV env = ENV.staging, + Wallet? wallet, + bool showHttpLog = false, +}) async { providerContainer.read(envProvider.notifier).setEnv(env); + providerContainer.read(showHttpLogProvider.notifier).setEnv(showHttpLog); if (wallet != null) { await providerContainer diff --git a/lib/src/models/src/all.dart b/lib/src/models/src/all.dart index 05259bb..cb2f02d 100644 --- a/lib/src/models/src/all.dart +++ b/lib/src/models/src/all.dart @@ -223,7 +223,7 @@ class GroupDTO { List members; List pendingMembers; String? contractAddressERC20; - int numberOfERC20; + int? numberOfERC20; String? contractAddressNFT; int? numberOfNFTTokens; String? verificationProof; diff --git a/lib/src/models/src/user_model.dart b/lib/src/models/src/user_model.dart index 09fe35c..a8f6b08 100644 --- a/lib/src/models/src/user_model.dart +++ b/lib/src/models/src/user_model.dart @@ -50,6 +50,30 @@ class ConnectedUser extends User { } } +class CreateUser extends User { + final String? decryptedPrivateKey; + + CreateUser({ + required this.decryptedPrivateKey, + }); + + static CreateUser fromUser( + {required User user, String? decryptedPrivateKey}) { + var createdUser = CreateUser(decryptedPrivateKey: decryptedPrivateKey); + createdUser.did = user.did; + createdUser.profile = user.profile; + createdUser.name = user.name; + createdUser.about = user.about; + createdUser.verificationProof = user.verificationProof; + createdUser.publicKey = user.publicKey; + createdUser.msgSent = user.msgSent; + createdUser.maxMsgPersisted = user.maxMsgPersisted; + createdUser.wallets = user.wallets; + createdUser.encryptedPrivateKey = user.encryptedPrivateKey; + return createdUser; + } +} + class User { int? msgSent; int? maxMsgPersisted; diff --git a/lib/src/providers/src/environment_provider.dart b/lib/src/providers/src/environment_provider.dart index 2da2364..eb0dfe7 100644 --- a/lib/src/providers/src/environment_provider.dart +++ b/lib/src/providers/src/environment_provider.dart @@ -23,3 +23,14 @@ class EnvProvider extends StateNotifier { ENV getCachedENV() { return providerContainer.read(envProvider); } + +final showHttpLogProvider = StateNotifierProvider( + (ref) => ShowHttpLogProvider(false)); + +class ShowHttpLogProvider extends StateNotifier { + ShowHttpLogProvider(super.state); + + setEnv(bool showHttpLog) { + state = showHttpLog; + } +} diff --git a/lib/src/pushapi/__pushapi.dart b/lib/src/pushapi/__pushapi.dart new file mode 100644 index 0000000..af5402b --- /dev/null +++ b/lib/src/pushapi/__pushapi.dart @@ -0,0 +1,4 @@ +export 'models.dart'; +export 'pushapi.dart'; +export 'chat.dart' hide GroupAPI, GroupParticipantsAPI; +export 'user.dart'; diff --git a/lib/src/pushapi/chat.dart b/lib/src/pushapi/chat.dart new file mode 100644 index 0000000..10049bd --- /dev/null +++ b/lib/src/pushapi/chat.dart @@ -0,0 +1,586 @@ +// ignore_for_file: library_prefixes + +import '../../push_restapi_dart.dart'; +import '../chat/chat.dart' as PUSH_CHAT; +import '../user/user.dart' as PUSH_USER; + +class Chat { + late final Signer? _signer; + + late final String _account; + late final String? _decryptedPgpPvtKey; + void Function(ProgressHookType)? progressHook; + + Chat({ + Signer? signer, + required String account, + String? decryptedPgpPvtKey, + String? pgpPublicKey, + required this.progressHook, + }) { + _signer = signer; + _account = account; + _decryptedPgpPvtKey = decryptedPgpPvtKey; + + _userAPI = UserAPI(account: account); + group = GroupAPI( + account: account, + progressHook: progressHook, + decryptedPgpPvtKey: _decryptedPgpPvtKey, + pgpPublicKey: pgpPublicKey, + signer: _signer); + } + + late final UserAPI _userAPI; + bool get _hasSigner => _signer != null; + + late final GroupAPI group; + + Future?> list({ + required ChatListType type, + int page = 1, + int limit = 10, + String? overrideAccount, + }) async { + switch (type) { + case ChatListType.CHATS: + return PUSH_CHAT.chats( + accountAddress: overrideAccount ?? _account, + limit: limit, + page: page, + pgpPrivateKey: _decryptedPgpPvtKey, + toDecrypt: _hasSigner, + ); + case ChatListType.REQUESTS: + return PUSH_CHAT.requests( + accountAddress: overrideAccount ?? _account, + limit: limit, + page: page, + pgpPrivateKey: _decryptedPgpPvtKey, + toDecrypt: _hasSigner, + ); + } + } + + Future latest({required String target}) async { + final threadHash = await PUSH_CHAT.conversationHash( + conversationId: target, + accountAddress: _account, + ); + if (threadHash == null) { + return null; + } + + return PUSH_CHAT.latest( + threadhash: threadHash, + accountAddress: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + toDecrypt: _hasSigner, + ); + } + + Future?> history({ + required String target, + String? reference, + int limit = FetchLimit.DEFAULT, + }) async { + if (reference == null) { + final threadHash = await PUSH_CHAT.conversationHash( + conversationId: target, + accountAddress: _account, + ); + reference = threadHash; + } + + if (reference == null) { + return []; + } + + return PUSH_CHAT.history( + threadhash: reference, + limit: limit, + accountAddress: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + toDecrypt: _hasSigner, + ); + } + + Future send( + {required String recipient, required SendMessage options}) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + final chatOptions = ChatSendOptions( + to: recipient, + message: options, + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + ); + + return PUSH_CHAT.send(chatOptions); + } + + Future> decrypt( + {required List messagePayloads}) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + return PUSH_CHAT.decryptConversation( + messages: messagePayloads, + connectedUser: await _userAPI.info(), + pgpPrivateKey: _decryptedPgpPvtKey!, + ); + } + + Future accept({required String target}) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + return PUSH_CHAT.approve( + senderAddress: target, + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } + + Future reject({required String target}) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + return PUSH_CHAT.reject( + senderAddress: target, + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } + + Future block({required List users}) async { + if (!_hasSigner || _decryptedPgpPvtKey == null) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + final user = await PUSH_USER.getUser(address: _account); + + for (var element in users) { + if (!isValidETHAddress(element)) { + throw Exception('Invalid address in the users: $element'); + } + } + + if (user!.profile!.blockedUsersList == null) { + user.profile?.blockedUsersList = []; + } + + user.profile?.blockedUsersList = + {...user.profile!.blockedUsersList!, ...users}.toList(); + + if (_decryptedPgpPvtKey == null) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + return PUSH_USER.profileUpdate( + pgpPrivateKey: _decryptedPgpPvtKey!, + account: _account, + profile: Profile( + name: user.profile!.name, + desc: user.profile!.desc, + picture: user.profile!.picture, + blockedUsersList: user.profile?.blockedUsersList), + ); + } + + Future unblock({required List users}) async { + if (!_hasSigner || _decryptedPgpPvtKey == null) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + final user = await PUSH_USER.getUser(address: _account); + + for (var element in users) { + if (!isValidETHAddress(element)) { + throw Exception('Invalid address in the users: $element'); + } + } + + if (user!.profile!.blockedUsersList == null) { + return user; + } + + final userDIDs = + await Future.wait(users.map((e) async => await getUserDID(address: e))); + + user.profile!.blockedUsersList = user.profile!.blockedUsersList! + .where((element) => !userDIDs.contains(element)) + .toList(); + + return PUSH_USER.profileUpdate( + pgpPrivateKey: _decryptedPgpPvtKey!, + account: _account, + profile: Profile( + name: user.profile!.name, + desc: user.profile!.desc, + picture: user.profile!.picture, + blockedUsersList: user.profile?.blockedUsersList), + ); + } +} + +class GroupAPI { + late final Signer? _signer; + + late final String _account; + late final String? _decryptedPgpPvtKey; + void Function(ProgressHookType)? progressHook; + + GroupAPI({ + Signer? signer, + required String account, + String? decryptedPgpPvtKey, + String? pgpPublicKey, + required this.progressHook, + }) { + _signer = signer; + _account = account; + _decryptedPgpPvtKey = decryptedPgpPvtKey; + + participants = GroupParticipantsAPI(); + } + + bool get _hasSigner => _signer != null; + + late final GroupParticipantsAPI participants; + + Future create({ + required String name, + required GroupCreationOptions options, + }) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + final groupParam = ChatCreateGroupTypeV2( + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + groupName: name, + groupDescription: options.description, + groupImage: options.image, + rules: options.rules, + isPublic: !options.private, + groupType: 'default', + config: GroupConfig(), + admins: options.admins, + members: options.members, + ); + + return PUSH_CHAT.createGroupV2(options: groupParam); + } + + Future permissions({required String chatId}) async { + return PUSH_CHAT.getGroupAccess(chatId: chatId, did: _account); + } + + Future info({required String chatId}) async { + return PUSH_CHAT.getGroupInfo(chatId: chatId); + } + + Future update({ + required String chatId, + required GroupUpdateOptions options, + }) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + final group = await PUSH_CHAT.getGroupInfo(chatId: chatId); + + final updateGroupProfileOptions = ChatUpdateGroupProfileType( + chatId: chatId, + groupName: options.name ?? group.groupName, + groupDescription: options.description ?? group.groupDescription, + groupImage: options.image ?? group.groupImage, + pgpPrivateKey: _decryptedPgpPvtKey, + rules: options.rules ?? group.rules, + signer: _signer, + account: _account, + ); + + final updateGroupConfigOptions = ChatUpdateConfigProfileType( + chatId: chatId, + account: _account, + meta: options.meta, + pgpPrivateKey: _decryptedPgpPvtKey, + scheduleAt: options.scheduleAt, + scheduleEnd: options.scheduleEnd, + signer: _signer, + status: options.status, + ); + + await updateGroupProfile(options: updateGroupProfileOptions); + return await updateGroupConfig( + options: updateGroupConfigOptions, + ); + } + + ///role: 'ADMIN' | 'MEMBER'; + Future add({ + required String chatId, + required String role, + required List accounts, + }) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + final validRoles = ['ADMIN', 'MEMBER']; + if (!validRoles.contains(role)) { + throw Exception('Invalid role provided.'); + } + + if (accounts.isEmpty) { + throw Exception('accounts array cannot be empty!'); + } + + for (var account in accounts) { + if (!isValidETHAddress(account)) { + throw Exception('Invalid account address: $account'); + } + } + + if (role == 'ADMIN') { + return PUSH_CHAT.addAdmins( + chatId: chatId, + admins: accounts, + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } else { + return PUSH_CHAT.addMembers( + chatId: chatId, + members: accounts, + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } + } + + ///role: 'ADMIN' | 'MEMBER'; + Future remove({ + required String chatId, + required String role, + required List accounts, + }) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + final validRoles = ['ADMIN', 'MEMBER']; + if (!validRoles.contains(role)) { + throw Exception('Invalid role provided.'); + } + + if (accounts.isEmpty) { + throw Exception('accounts array cannot be empty!'); + } + + for (var account in accounts) { + if (!isValidETHAddress(account)) { + throw Exception('Invalid account address: $account'); + } + } + + var adminsToRemove = []; + var membersToRemove = []; + + for (var account in accounts) { + final status = + await PUSH_CHAT.getGroupMemberStatus(chatId: chatId, did: account); + if (status.isAdmin) { + adminsToRemove.add(account); + } else { + membersToRemove.add(account); + } + } + + if (adminsToRemove.isNotEmpty) { + await PUSH_CHAT.removeAdmins( + chatId: chatId, + admins: adminsToRemove, + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } + + if (membersToRemove.isNotEmpty) { + await PUSH_CHAT.removeMembers( + chatId: chatId, + members: membersToRemove, + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } + + return info(chatId: chatId); + } + + ///role: 'ADMIN' | 'MEMBER'; + Future modify({ + required String chatId, + required String role, + required List accounts, + }) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + final validRoles = ['ADMIN', 'MEMBER']; + if (!validRoles.contains(role)) { + throw Exception('Invalid role provided.'); + } + + if (accounts.isEmpty) { + throw Exception('accounts array cannot be empty!'); + } + + for (var account in accounts) { + if (!isValidETHAddress(account)) { + throw Exception('Invalid account address: $account'); + } + } + + return PUSH_CHAT.modifyRoles( + options: ModifyRolesType( + chatId: chatId, + newRole: role, + account: _account, + members: accounts, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ), + ); + } + + Future join({required String target}) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + final status = await PUSH_CHAT.getGroupMemberStatus( + chatId: target, + did: _account, + ); + + if (status.isPending) { + await PUSH_CHAT.approve( + senderAddress: target, + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } else if (!status.isMember) { + await PUSH_CHAT.addMembers( + chatId: target, + members: [_account], + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } + + return await info(chatId: target); + } + + Future leave({required String target}) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + final status = await PUSH_CHAT.getGroupMemberStatus( + chatId: target, + did: _account, + ); + + if (status.isAdmin) { + await PUSH_CHAT.removeAdmins( + chatId: target, + admins: [_account], + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } else if (!status.isMember) { + await PUSH_CHAT.removeMembers( + chatId: target, + members: [_account], + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } + + return await info(chatId: target); + } + + Future reject({required String target}) async { + if (!_hasSigner) { + throw Exception(PushAPI.ensureSignerMessage()); + } + + await PUSH_CHAT.reject( + senderAddress: target, + account: _account, + pgpPrivateKey: _decryptedPgpPvtKey, + signer: _signer, + ); + } +} + +class GroupParticipantsAPI { + void Function(ProgressHookType)? progressHook; + + GroupParticipantsAPI(); + + Future> list({ + required String chatId, + required GetGroupParticipantsOptions options, + }) async { + return PUSH_CHAT.getGroupMembers( + options: FetchChatGroupInfoType( + chatId: chatId, + limit: options.limit, + page: options.limit, + pending: options.filter?.pending, + role: options.filter?.role, + ), + ); + } + + Future count({required String chatId}) async { + final count = await PUSH_CHAT.getGroupMemberCount(chatId: chatId); + + return GroupCountInfo( + participants: count.overallCount - count.pendingCount, + pending: count.pendingCount, + ); + } + + Future status({ + required String chatId, + required String accountId, + }) async { + final status = + await PUSH_CHAT.getGroupMemberStatus(chatId: chatId, did: accountId); + return ParticipantStatus( + pending: status.isPending, + role: status.isAdmin ? 'ADMIN' : 'MEMBER', + participant: status.isMember, + ); + } +} diff --git a/lib/src/pushapi/models.dart b/lib/src/pushapi/models.dart new file mode 100644 index 0000000..5c84c32 --- /dev/null +++ b/lib/src/pushapi/models.dart @@ -0,0 +1,108 @@ +// ignore_for_file: constant_identifier_names + +import '../../push_restapi_dart.dart'; + +class PushAPIInitializeOptions { + void Function(ProgressHookType)? progressHook; + String? account; + String? version; + Map>? versionMeta; + bool autoUpgrade; + String? origin; + bool showHttpLog; + + PushAPIInitializeOptions( + {this.progressHook, + this.account, + this.version = Constants.ENC_TYPE_V3, + this.versionMeta, + this.autoUpgrade = true, + this.origin, + this.showHttpLog = false}); +} + +enum ChatListType { CHATS, REQUESTS } + +class GroupCreationOptions { + String description; + String? image; + List members; + List admins; + bool private; + dynamic rules; + + GroupCreationOptions({ + required this.description, + this.image, + this.members = const [], + this.admins = const [], + this.private = false, + this.rules, + }); +} + +class GetGroupParticipantsOptions { + int page; + int limit; + FilterOptions? filter; + + GetGroupParticipantsOptions({ + this.page = 1, + this.limit = 20, + this.filter, + }); +} + +class FilterOptions { + bool? pending; + String? role; + + FilterOptions({ + this.pending, + this.role, + }); +} + +class GroupCountInfo { + int participants; + int pending; + + GroupCountInfo({ + required this.participants, + required this.pending, + }); +} + +class ParticipantStatus { + bool pending; + String role; + bool participant; + + ParticipantStatus({ + required this.pending, + required this.role, + required this.participant, + }); +} + +class GroupUpdateOptions { + String? name; + String? description; + String? image; + DateTime? scheduleAt; + DateTime? scheduleEnd; + ChatStatus? status; + String? meta; + dynamic rules; + + GroupUpdateOptions({ + this.name, + this.description, + this.image, + this.scheduleAt, + this.scheduleEnd, + this.status, + this.meta, + this.rules, + }); +} diff --git a/lib/src/pushapi/pushapi.dart b/lib/src/pushapi/pushapi.dart new file mode 100644 index 0000000..d446d55 --- /dev/null +++ b/lib/src/pushapi/pushapi.dart @@ -0,0 +1,117 @@ +import '../../push_restapi_dart.dart'; + +class PushAPI { + late final Signer? _signer; + late final String _account; + late final String? _decryptedPgpPvtKey; + final String? pgpPublicKey; + final bool readMode; + + void Function(ProgressHookType)? progressHook; + + late Chat chat; + PushAPI({ + Signer? signer, + required String account, + String? decryptedPgpPvtKey, + this.pgpPublicKey, + this.progressHook, + this.readMode = false, + ENV env = ENV.staging, + bool showHttpLog = false, + }) { + _signer = signer; + _account = account; + _decryptedPgpPvtKey = decryptedPgpPvtKey; + + initPush( + env: env, + showHttpLog: showHttpLog, + ); + + chat = Chat( + signer: _signer, + account: _account, + decryptedPgpPvtKey: _decryptedPgpPvtKey, + pgpPublicKey: pgpPublicKey, + progressHook: progressHook, + ); + } + + static Future initialize( + {Signer? signer, PushAPIInitializeOptions? options}) async { + if (signer == null && options?.account == null) { + throw Exception("Either 'signer' or 'account' must be provided."); + } + + final readMode = signer != null; + + // Get account + // Derives account from signer if not provided + String? derivedAccount; + + if (signer != null) { + derivedAccount = getAccountAddress( + getWallet(address: options?.account, signer: signer)); + } else { + derivedAccount = options?.account; + } + + if (derivedAccount == null) { + throw Exception('Account could not be derived.'); + } + + String? decryptedPGPPrivateKey; + String? pgpPublicKey; + + /** + * Decrypt PGP private key + * If user exists, decrypts the PGP private key + * If user does not exist, creates a new user and returns the decrypted PGP private key + */ + final user = await getUser(address: derivedAccount); + + if (readMode) { + if (user != null && user.encryptedPrivateKey != null) { + decryptedPGPPrivateKey = await decryptPGPKey( + toUpgrade: options?.autoUpgrade, + progressHook: options?.progressHook, + additionalMeta: options?.versionMeta, + encryptedPGPPrivateKey: user.encryptedPrivateKey!, + wallet: getWallet(address: options?.account, signer: signer), + ); + pgpPublicKey = user.publicKey; + } else { + final newUser = await createUser( + signer: signer, + progressHook: options?.progressHook ?? (_) {}, + version: options?.version ?? ENCRYPTION_TYPE.PGP_V3, + ); + decryptedPGPPrivateKey = newUser.decryptedPrivateKey; + pgpPublicKey = newUser.publicKey; + } + } + + final api = PushAPI( + account: derivedAccount, + signer: signer, + decryptedPgpPvtKey: decryptedPGPPrivateKey, + pgpPublicKey: pgpPublicKey, + readMode: readMode, + showHttpLog: options?.showHttpLog ?? false, + ); + + return api; + } + +//TODO initStream + Future initStream() async {} + + Future info({String? overrideAccount}) async { + return getUser(address: overrideAccount ?? _account); + } + + static String ensureSignerMessage() { + return 'Operation not allowed in read-only mode. Signer is required.'; + } +} diff --git a/lib/src/pushapi/user.dart b/lib/src/pushapi/user.dart new file mode 100644 index 0000000..97ee399 --- /dev/null +++ b/lib/src/pushapi/user.dart @@ -0,0 +1,14 @@ +import '../../push_restapi_dart.dart'; + +class UserAPI { + late final String _account; + UserAPI({ + required String account, + }) { + _account = account; + } + + Future info({String? overrideAccount}) async { + return getUser(address: overrideAccount ?? _account); + } +} diff --git a/lib/src/services/src/http_service.dart b/lib/src/services/src/http_service.dart index 9b9eca8..181bbf1 100755 --- a/lib/src/services/src/http_service.dart +++ b/lib/src/services/src/http_service.dart @@ -15,6 +15,13 @@ log(Object? data) { } class HttpService { + log(Object? data) { + final showHtttpLog = providerContainer.read(showHttpLogProvider); + if (showHtttpLog) { + print(data); + } + } + static const timeOutSeconds = 30; Map? header(String? authorization) { diff --git a/lib/src/user/src/create_user.dart b/lib/src/user/src/create_user.dart index fd846e8..6f63718 100644 --- a/lib/src/user/src/create_user.dart +++ b/lib/src/user/src/create_user.dart @@ -2,7 +2,19 @@ import 'dart:convert'; import '../../../push_restapi_dart.dart'; -Future createUser({ +Future createUser({ + required Signer signer, + String version = ENCRYPTION_TYPE.PGP_V3, + required Function(ProgressHookType) progressHook, +}) async { + return createUserCore( + signer: signer, + progressHook: progressHook, + version: version, + ); +} + +Future createUserCore({ required Signer signer, String version = ENCRYPTION_TYPE.PGP_V3, required Function(ProgressHookType) progressHook, @@ -51,7 +63,8 @@ Future createUser({ if (result == null || result is String) { throw Exception(result ?? 'Unable to create account for $address'); } else { - return User.fromJson(result); + return CreateUser.fromUser( + user: User.fromJson(result), decryptedPrivateKey: keyPairs.privateKey); } } diff --git a/lib/src/user/src/get_user.dart b/lib/src/user/src/get_user.dart index 3ba22c7..ad8c6ce 100644 --- a/lib/src/user/src/get_user.dart +++ b/lib/src/user/src/get_user.dart @@ -11,8 +11,12 @@ Future getUser({ final requestUrl = '/v2/users/?caip10=$caip10'; final result = await http.get(path: requestUrl); - if (result == null || result is String) { - throw Exception(result ?? "Unable to get user with address $address"); + if (result == null || result.isEmpty) { + return null; + } + + if (result is String) { + throw Exception(result); } return User.fromJson(result); diff --git a/lib/src/user/src/get_users_batch.dart b/lib/src/user/src/get_users_batch.dart index 960c4e3..69bab2b 100644 --- a/lib/src/user/src/get_users_batch.dart +++ b/lib/src/user/src/get_users_batch.dart @@ -30,10 +30,12 @@ getBatch({ final output = []; for (var item in result['users']) { var user = User.fromJson(item); - user.publicKey = verifyPGPPublicKey( + user.publicKey = verifyProfileKeys( encryptedPrivateKey: user.encryptedPrivateKey!, publicKey: user.publicKey!, did: user.did!, + caip10: user.wallets!, + verificationProof: user.verificationProof!, ); user = await populateDeprecatedUser(user: user); diff --git a/lib/src/user/src/profile.update_user.dart b/lib/src/user/src/profile.update_user.dart index 3cdab6c..9936b14 100644 --- a/lib/src/user/src/profile.update_user.dart +++ b/lib/src/user/src/profile.update_user.dart @@ -4,11 +4,13 @@ class Profile { String? name; String? desc; String? picture; + List? blockedUsersList; Profile({ this.name, this.desc, this.picture, + this.blockedUsersList, }); } @@ -27,10 +29,25 @@ Future profileUpdate({ throw Exception('User not Found!'); } + List? blockedUsersList; + + if (profile.blockedUsersList != null) { + for (var element in profile.blockedUsersList!) { + // Check if the element is a valid CAIP-10 address + if (!isValidETHAddress(element)) { + throw Exception('Invalid address in the users: $element'); + } + } + blockedUsersList = await Future.wait(profile.blockedUsersList! + .map((e) async => await getUserDID(address: e))); + } + final updatedProfile = { 'name': profile.name ?? user.profile?.name, 'desc': profile.desc ?? user.profile?.desc, 'picture': profile.picture ?? user.profile?.picture, + 'blockedUsersList': + profile.blockedUsersList != null ? blockedUsersList : [], }; final hash = generateHash(updatedProfile); @@ -40,7 +57,7 @@ Future profileUpdate({ privateKey: pgpPrivateKey, ); - final sigType = 'pgp'; + final sigType = 'pgpv2'; final verificationProof = '$sigType:$signature'; final body = { @@ -58,11 +75,14 @@ Future profileUpdate({ } var updatedUser = User.fromJson(result); - updatedUser.publicKey = verifyPGPPublicKey( - encryptedPrivateKey: updatedUser.encryptedPrivateKey!, - publicKey: updatedUser.publicKey!, - did: updatedUser.did!, - ); + + // updatedUser.publicKey = verifyProfileKeys( + // encryptedPrivateKey: updatedUser.encryptedPrivateKey!, + // publicKey: updatedUser.publicKey!, + // did: updatedUser.did!, + // caip10: updatedUser.wallets!, + // verificationProof: updatedUser.verificationProof!, + // ); return populateDeprecatedUser(user: updatedUser); } catch (err) {