add icon assets, fix name, use env vars

+1
.gitignore
··· 11 .svn/ 12 .swiftpm/ 13 migrate_working_dir/ 14 15 # IntelliJ related 16 *.iml
··· 11 .svn/ 12 .swiftpm/ 13 migrate_working_dir/ 14 + .env 15 16 # IntelliJ related 17 *.iml
+1 -1
README.md
··· 1 - # grain_flutter 2 3 A new Flutter project. 4
··· 1 + # grain 2 3 A new Flutter project. 4
+30 -4
ios/Runner.xcodeproj/project.pbxproj
··· 161 AA08BF815C647AB5DC8411F3 /* Pods-RunnerTests.release.xcconfig */, 162 1D6BE487C5E5B0B864003BB1 /* Pods-RunnerTests.profile.xcconfig */, 163 ); 164 - name = Pods; 165 path = Pods; 166 sourceTree = "<group>"; 167 }; ··· 469 baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 470 buildSettings = { 471 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 472 CLANG_ENABLE_MODULES = YES; 473 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 474 DEVELOPMENT_TEAM = YN68LN9T7Z; 475 ENABLE_BITCODE = NO; 476 INFOPLIST_FILE = Runner/Info.plist; 477 LD_RUNPATH_SEARCH_PATHS = ( 478 "$(inherited)", 479 "@executable_path/Frameworks", 480 ); 481 - PRODUCT_BUNDLE_IDENTIFIER = com.example.grainFlutter; 482 PRODUCT_NAME = "$(TARGET_NAME)"; 483 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 484 SWIFT_VERSION = 5.0; 485 VERSIONING_SYSTEM = "apple-generic"; 486 }; 487 name = Profile; ··· 652 baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 653 buildSettings = { 654 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 655 CLANG_ENABLE_MODULES = YES; 656 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 657 DEVELOPMENT_TEAM = YN68LN9T7Z; 658 ENABLE_BITCODE = NO; 659 INFOPLIST_FILE = Runner/Info.plist; 660 LD_RUNPATH_SEARCH_PATHS = ( 661 "$(inherited)", 662 "@executable_path/Frameworks", 663 ); 664 - PRODUCT_BUNDLE_IDENTIFIER = com.example.grainFlutter; 665 PRODUCT_NAME = "$(TARGET_NAME)"; 666 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 667 SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 668 SWIFT_VERSION = 5.0; 669 VERSIONING_SYSTEM = "apple-generic"; 670 }; 671 name = Debug; ··· 675 baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 676 buildSettings = { 677 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 678 CLANG_ENABLE_MODULES = YES; 679 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 680 DEVELOPMENT_TEAM = YN68LN9T7Z; 681 ENABLE_BITCODE = NO; 682 INFOPLIST_FILE = Runner/Info.plist; 683 LD_RUNPATH_SEARCH_PATHS = ( 684 "$(inherited)", 685 "@executable_path/Frameworks", 686 ); 687 - PRODUCT_BUNDLE_IDENTIFIER = com.example.grainFlutter; 688 PRODUCT_NAME = "$(TARGET_NAME)"; 689 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 690 SWIFT_VERSION = 5.0; 691 VERSIONING_SYSTEM = "apple-generic"; 692 }; 693 name = Release;
··· 161 AA08BF815C647AB5DC8411F3 /* Pods-RunnerTests.release.xcconfig */, 162 1D6BE487C5E5B0B864003BB1 /* Pods-RunnerTests.profile.xcconfig */, 163 ); 164 path = Pods; 165 sourceTree = "<group>"; 166 }; ··· 468 baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 469 buildSettings = { 470 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 + ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; 472 CLANG_ENABLE_MODULES = YES; 473 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 474 DEVELOPMENT_TEAM = YN68LN9T7Z; 475 ENABLE_BITCODE = NO; 476 INFOPLIST_FILE = Runner/Info.plist; 477 + INFOPLIST_KEY_CFBundleDisplayName = Grain; 478 + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking"; 479 LD_RUNPATH_SEARCH_PATHS = ( 480 "$(inherited)", 481 "@executable_path/Frameworks", 482 ); 483 + MARKETING_VERSION = "1.0.0+1"; 484 + PRODUCT_BUNDLE_IDENTIFIER = social.grain.grain; 485 PRODUCT_NAME = "$(TARGET_NAME)"; 486 + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; 487 + SUPPORTS_MACCATALYST = NO; 488 + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; 489 + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; 490 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 491 SWIFT_VERSION = 5.0; 492 + TARGETED_DEVICE_FAMILY = 1; 493 VERSIONING_SYSTEM = "apple-generic"; 494 }; 495 name = Profile; ··· 660 baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 661 buildSettings = { 662 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 663 + ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; 664 CLANG_ENABLE_MODULES = YES; 665 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 666 DEVELOPMENT_TEAM = YN68LN9T7Z; 667 ENABLE_BITCODE = NO; 668 INFOPLIST_FILE = Runner/Info.plist; 669 + INFOPLIST_KEY_CFBundleDisplayName = Grain; 670 + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking"; 671 LD_RUNPATH_SEARCH_PATHS = ( 672 "$(inherited)", 673 "@executable_path/Frameworks", 674 ); 675 + MARKETING_VERSION = "1.0.0+1"; 676 + PRODUCT_BUNDLE_IDENTIFIER = social.grain.grain; 677 PRODUCT_NAME = "$(TARGET_NAME)"; 678 + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; 679 + SUPPORTS_MACCATALYST = NO; 680 + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; 681 + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; 682 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 683 SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 684 SWIFT_VERSION = 5.0; 685 + TARGETED_DEVICE_FAMILY = 1; 686 VERSIONING_SYSTEM = "apple-generic"; 687 }; 688 name = Debug; ··· 692 baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 693 buildSettings = { 694 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 695 + ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; 696 CLANG_ENABLE_MODULES = YES; 697 CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 698 DEVELOPMENT_TEAM = YN68LN9T7Z; 699 ENABLE_BITCODE = NO; 700 INFOPLIST_FILE = Runner/Info.plist; 701 + INFOPLIST_KEY_CFBundleDisplayName = Grain; 702 + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking"; 703 LD_RUNPATH_SEARCH_PATHS = ( 704 "$(inherited)", 705 "@executable_path/Frameworks", 706 ); 707 + MARKETING_VERSION = "1.0.0+1"; 708 + PRODUCT_BUNDLE_IDENTIFIER = social.grain.grain; 709 PRODUCT_NAME = "$(TARGET_NAME)"; 710 + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; 711 + SUPPORTS_MACCATALYST = NO; 712 + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; 713 + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; 714 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 715 SWIFT_VERSION = 5.0; 716 + TARGETED_DEVICE_FAMILY = 1; 717 VERSIONING_SYSTEM = "apple-generic"; 718 }; 719 name = Release;
ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png

This is a binary file and will not be displayed.

+1 -122
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
··· 1 - { 2 - "images" : [ 3 - { 4 - "size" : "20x20", 5 - "idiom" : "iphone", 6 - "filename" : "Icon-App-20x20@2x.png", 7 - "scale" : "2x" 8 - }, 9 - { 10 - "size" : "20x20", 11 - "idiom" : "iphone", 12 - "filename" : "Icon-App-20x20@3x.png", 13 - "scale" : "3x" 14 - }, 15 - { 16 - "size" : "29x29", 17 - "idiom" : "iphone", 18 - "filename" : "Icon-App-29x29@1x.png", 19 - "scale" : "1x" 20 - }, 21 - { 22 - "size" : "29x29", 23 - "idiom" : "iphone", 24 - "filename" : "Icon-App-29x29@2x.png", 25 - "scale" : "2x" 26 - }, 27 - { 28 - "size" : "29x29", 29 - "idiom" : "iphone", 30 - "filename" : "Icon-App-29x29@3x.png", 31 - "scale" : "3x" 32 - }, 33 - { 34 - "size" : "40x40", 35 - "idiom" : "iphone", 36 - "filename" : "Icon-App-40x40@2x.png", 37 - "scale" : "2x" 38 - }, 39 - { 40 - "size" : "40x40", 41 - "idiom" : "iphone", 42 - "filename" : "Icon-App-40x40@3x.png", 43 - "scale" : "3x" 44 - }, 45 - { 46 - "size" : "60x60", 47 - "idiom" : "iphone", 48 - "filename" : "Icon-App-60x60@2x.png", 49 - "scale" : "2x" 50 - }, 51 - { 52 - "size" : "60x60", 53 - "idiom" : "iphone", 54 - "filename" : "Icon-App-60x60@3x.png", 55 - "scale" : "3x" 56 - }, 57 - { 58 - "size" : "20x20", 59 - "idiom" : "ipad", 60 - "filename" : "Icon-App-20x20@1x.png", 61 - "scale" : "1x" 62 - }, 63 - { 64 - "size" : "20x20", 65 - "idiom" : "ipad", 66 - "filename" : "Icon-App-20x20@2x.png", 67 - "scale" : "2x" 68 - }, 69 - { 70 - "size" : "29x29", 71 - "idiom" : "ipad", 72 - "filename" : "Icon-App-29x29@1x.png", 73 - "scale" : "1x" 74 - }, 75 - { 76 - "size" : "29x29", 77 - "idiom" : "ipad", 78 - "filename" : "Icon-App-29x29@2x.png", 79 - "scale" : "2x" 80 - }, 81 - { 82 - "size" : "40x40", 83 - "idiom" : "ipad", 84 - "filename" : "Icon-App-40x40@1x.png", 85 - "scale" : "1x" 86 - }, 87 - { 88 - "size" : "40x40", 89 - "idiom" : "ipad", 90 - "filename" : "Icon-App-40x40@2x.png", 91 - "scale" : "2x" 92 - }, 93 - { 94 - "size" : "76x76", 95 - "idiom" : "ipad", 96 - "filename" : "Icon-App-76x76@1x.png", 97 - "scale" : "1x" 98 - }, 99 - { 100 - "size" : "76x76", 101 - "idiom" : "ipad", 102 - "filename" : "Icon-App-76x76@2x.png", 103 - "scale" : "2x" 104 - }, 105 - { 106 - "size" : "83.5x83.5", 107 - "idiom" : "ipad", 108 - "filename" : "Icon-App-83.5x83.5@2x.png", 109 - "scale" : "2x" 110 - }, 111 - { 112 - "size" : "1024x1024", 113 - "idiom" : "ios-marketing", 114 - "filename" : "Icon-App-1024x1024@1x.png", 115 - "scale" : "1x" 116 - } 117 - ], 118 - "info" : { 119 - "version" : 1, 120 - "author" : "xcode" 121 - } 122 - }
··· 1 + {"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"}]}
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png

This is a binary file and will not be displayed.

ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png

This is a binary file and will not be displayed.

+15 -15
ios/Runner/Info.plist
··· 2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 <plist version="1.0"> 4 <dict> 5 <key>CFBundleDevelopmentRegion</key> 6 <string>$(DEVELOPMENT_LANGUAGE)</string> 7 <key>CFBundleDisplayName</key> 8 - <string>Grain Flutter</string> 9 <key>CFBundleExecutable</key> 10 <string>$(EXECUTABLE_NAME)</string> 11 <key>CFBundleIdentifier</key> ··· 13 <key>CFBundleInfoDictionaryVersion</key> 14 <string>6.0</string> 15 <key>CFBundleName</key> 16 - <string>grain_flutter</string> 17 <key>CFBundlePackageType</key> 18 <string>APPL</string> 19 <key>CFBundleShortVersionString</key> 20 <string>$(FLUTTER_BUILD_NAME)</string> 21 <key>CFBundleSignature</key> 22 <string>????</string> 23 <key>CFBundleVersion</key> 24 <string>$(FLUTTER_BUILD_NUMBER)</string> 25 <key>LSRequiresIPhoneOS</key> 26 <true/> 27 <key>UILaunchStoryboardName</key> 28 <string>LaunchScreen</string> 29 <key>UIMainStoryboardFile</key> ··· 40 <string>UIInterfaceOrientationPortraitUpsideDown</string> 41 <string>UIInterfaceOrientationLandscapeLeft</string> 42 <string>UIInterfaceOrientationLandscapeRight</string> 43 - </array> 44 - <key>CADisableMinimumFrameDurationOnPhone</key> 45 - <true/> 46 - <key>UIApplicationSupportsIndirectInputEvents</key> 47 - <true/> 48 - <key>CFBundleURLTypes</key> 49 - <array> 50 - <dict> 51 - <key>CFBundleURLSchemes</key> 52 - <array> 53 - <string>grainflutter</string> 54 - </array> 55 - </dict> 56 </array> 57 </dict> 58 </plist>
··· 2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 <plist version="1.0"> 4 <dict> 5 + <key>CADisableMinimumFrameDurationOnPhone</key> 6 + <true/> 7 <key>CFBundleDevelopmentRegion</key> 8 <string>$(DEVELOPMENT_LANGUAGE)</string> 9 <key>CFBundleDisplayName</key> 10 + <string>Grain</string> 11 <key>CFBundleExecutable</key> 12 <string>$(EXECUTABLE_NAME)</string> 13 <key>CFBundleIdentifier</key> ··· 15 <key>CFBundleInfoDictionaryVersion</key> 16 <string>6.0</string> 17 <key>CFBundleName</key> 18 + <string>grain</string> 19 <key>CFBundlePackageType</key> 20 <string>APPL</string> 21 <key>CFBundleShortVersionString</key> 22 <string>$(FLUTTER_BUILD_NAME)</string> 23 <key>CFBundleSignature</key> 24 <string>????</string> 25 + <key>CFBundleURLTypes</key> 26 + <array> 27 + <dict> 28 + <key>CFBundleURLSchemes</key> 29 + <array> 30 + <string>grainflutter</string> 31 + </array> 32 + </dict> 33 + </array> 34 <key>CFBundleVersion</key> 35 <string>$(FLUTTER_BUILD_NUMBER)</string> 36 <key>LSRequiresIPhoneOS</key> 37 <true/> 38 + <key>UIApplicationSupportsIndirectInputEvents</key> 39 + <true/> 40 <key>UILaunchStoryboardName</key> 41 <string>LaunchScreen</string> 42 <key>UIMainStoryboardFile</key> ··· 53 <string>UIInterfaceOrientationPortraitUpsideDown</string> 54 <string>UIInterfaceOrientationLandscapeLeft</string> 55 <string>UIInterfaceOrientationLandscapeRight</string> 56 </array> 57 </dict> 58 </plist>
+6 -5
lib/api.dart
··· 2 import 'dart:convert'; 3 import 'profile.dart'; 4 import 'gallery.dart'; 5 6 class ApiService { 7 String? _accessToken; 8 Profile? currentUser; 9 List<Gallery> galleries = []; 10 11 void setToken(String token) { 12 _accessToken = token; ··· 15 Future<void> fetchProfile() async { 16 if (_accessToken == null) return; 17 final response = await http.get( 18 - Uri.parse('http://localhost:8080/xrpc/social.grain.actor.getProfile'), 19 headers: {'Authorization': 'Bearer $_accessToken'}, 20 ); 21 if (response.statusCode == 200) { ··· 29 Future<List<Gallery>> fetchActorGalleries() async { 30 if (_accessToken == null) return []; 31 final response = await http.get( 32 - Uri.parse( 33 - 'http://localhost:8080/xrpc/social.grain.gallery.getActorGalleries', 34 - ), 35 headers: {'Authorization': 'Bearer $_accessToken'}, 36 ); 37 if (response.statusCode == 200) { ··· 44 } 45 return galleries; 46 } else { 47 - throw Exception('Failed to load galleries: \\${response.statusCode}'); 48 } 49 } 50 }
··· 2 import 'dart:convert'; 3 import 'profile.dart'; 4 import 'gallery.dart'; 5 + import 'package:flutter_dotenv/flutter_dotenv.dart'; 6 7 class ApiService { 8 String? _accessToken; 9 Profile? currentUser; 10 List<Gallery> galleries = []; 11 + 12 + String get _apiUrl => dotenv.env['API_URL'] ?? 'http://localhost:8080'; 13 14 void setToken(String token) { 15 _accessToken = token; ··· 18 Future<void> fetchProfile() async { 19 if (_accessToken == null) return; 20 final response = await http.get( 21 + Uri.parse('$_apiUrl/xrpc/social.grain.actor.getProfile'), 22 headers: {'Authorization': 'Bearer $_accessToken'}, 23 ); 24 if (response.statusCode == 200) { ··· 32 Future<List<Gallery>> fetchActorGalleries() async { 33 if (_accessToken == null) return []; 34 final response = await http.get( 35 + Uri.parse('$_apiUrl/xrpc/social.grain.gallery.getActorGalleries'), 36 headers: {'Authorization': 'Bearer $_accessToken'}, 37 ); 38 if (response.statusCode == 200) { ··· 45 } 46 return galleries; 47 } else { 48 + throw Exception('Failed to load galleries: ${response.statusCode}'); 49 } 50 } 51 }
+10 -5
lib/main.dart
··· 1 import 'package:flutter/material.dart'; 2 import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; 3 - import 'package:grain_flutter/api.dart'; 4 - import 'package:grain_flutter/gallery.dart'; 5 6 - void main() { 7 runApp(const MyApp()); 8 } 9 ··· 82 _signingIn = true; 83 }); 84 try { 85 final redirectedUrl = await FlutterWebAuth2.authenticate( 86 url: 87 - 'http://localhost:8080/oauth/login?client=native&handle=' + 88 - Uri.encodeComponent(handle), 89 callbackUrlScheme: 'grainflutter', 90 ); 91 final uri = Uri.parse(redirectedUrl);
··· 1 + import 'package:flutter/foundation.dart'; 2 import 'package:flutter/material.dart'; 3 import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; 4 + import 'package:grain/api.dart'; 5 + import 'package:grain/gallery.dart'; 6 + import 'package:flutter_dotenv/flutter_dotenv.dart'; 7 8 + Future<void> main() async { 9 + if (!kReleaseMode) { 10 + await dotenv.load(fileName: '.env'); 11 + } 12 runApp(const MyApp()); 13 } 14 ··· 87 _signingIn = true; 88 }); 89 try { 90 + final apiUrl = dotenv.env['API_URL'] ?? 'http://localhost:8080'; 91 final redirectedUrl = await FlutterWebAuth2.authenticate( 92 url: 93 + '$apiUrl/oauth/login?client=native&handle=${Uri.encodeComponent(handle)}', 94 callbackUrlScheme: 'grainflutter', 95 ); 96 final uri = Uri.parse(redirectedUrl);
+8
pubspec.lock
··· 169 description: flutter 170 source: sdk 171 version: "0.0.0" 172 flutter_lints: 173 dependency: "direct dev" 174 description:
··· 169 description: flutter 170 source: sdk 171 version: "0.0.0" 172 + flutter_dotenv: 173 + dependency: "direct main" 174 + description: 175 + name: flutter_dotenv 176 + sha256: b7c7be5cd9f6ef7a78429cabd2774d3c4af50e79cb2b7593e3d5d763ef95c61b 177 + url: "https://pub.dev" 178 + source: hosted 179 + version: "5.2.1" 180 flutter_lints: 181 dependency: "direct dev" 182 description:
+4 -2
pubspec.yaml
··· 1 - name: grain_flutter 2 description: "A new Flutter project." 3 # The following line prevents the package from being accidentally published to 4 # pub.dev using `flutter pub publish`. This is preferred for private packages. ··· 57 ref: main # or the branch/commit you want 58 path: packages/xrpc 59 http: ^1.4.0 60 - 61 62 dependency_overrides: 63 atproto_oauth: ··· 132 # 133 # For details regarding fonts from package dependencies, 134 # see https://flutter.dev/to/font-from-package
··· 1 + name: grain 2 description: "A new Flutter project." 3 # The following line prevents the package from being accidentally published to 4 # pub.dev using `flutter pub publish`. This is preferred for private packages. ··· 57 ref: main # or the branch/commit you want 58 path: packages/xrpc 59 http: ^1.4.0 60 + flutter_dotenv: ^5.2.1 61 62 dependency_overrides: 63 atproto_oauth: ··· 132 # 133 # For details regarding fonts from package dependencies, 134 # see https://flutter.dev/to/font-from-package 135 + assets: 136 + - .env
+1 -1
test/widget_test.dart
··· 8 import 'package:flutter/material.dart'; 9 import 'package:flutter_test/flutter_test.dart'; 10 11 - import 'package:grain_flutter/main.dart'; 12 13 void main() { 14 testWidgets('Counter increments smoke test', (WidgetTester tester) async {
··· 8 import 'package:flutter/material.dart'; 9 import 'package:flutter_test/flutter_test.dart'; 10 11 + import 'package:grain/main.dart'; 12 13 void main() { 14 testWidgets('Counter increments smoke test', (WidgetTester tester) async {