-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from NextFaze/feature/remote_config_manup
Support Firebase Remote Config as ManUp Source
- Loading branch information
Showing
18 changed files
with
1,581 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# 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 | ||
.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 | ||
|
||
ios/ | ||
android/ | ||
macos/ | ||
windows/ | ||
web/ | ||
linux/ | ||
firebase_options.dart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 and should not be manually edited. | ||
|
||
version: | ||
revision: "b0366e0a3f089e15fd89c97604ab402fe26b724c" | ||
channel: "stable" | ||
|
||
project_type: app | ||
|
||
# Tracks metadata for the flutter migrate command | ||
migration: | ||
platforms: | ||
- platform: root | ||
create_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
base_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
- platform: android | ||
create_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
base_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
- platform: ios | ||
create_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
base_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
- platform: linux | ||
create_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
base_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
- platform: macos | ||
create_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
base_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
- platform: web | ||
create_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
base_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
- platform: windows | ||
create_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
base_revision: b0366e0a3f089e15fd89c97604ab402fe26b724c | ||
|
||
# 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This file configures the analyzer, which statically analyzes Dart code to | ||
# check for errors, warnings, and lints. | ||
# | ||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled | ||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be | ||
# invoked from the command line by running `flutter analyze`. | ||
|
||
# The following line activates a set of recommended lints for Flutter apps, | ||
# packages, and plugins designed to encourage good coding practices. | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
linter: | ||
# The lint rules applied to this project can be customized in the | ||
# section below to disable rules from the `package:flutter_lints/flutter.yaml` | ||
# included above or to enable additional rules. A list of all available lints | ||
# and their documentation is published at https://dart.dev/lints. | ||
# | ||
# Instead of disabling a lint rule for the entire project in the | ||
# section below, it can also be suppressed for a single line of code | ||
# or a specific dart file by using the `// ignore: name_of_lint` and | ||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file | ||
# producing the lint. | ||
rules: | ||
# avoid_print: false # Uncomment to disable the `avoid_print` rule | ||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:firebase_core/firebase_core.dart'; | ||
import 'package:firebase_remote_config/firebase_remote_config.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:manup/manup.dart'; | ||
import 'package:manup/src/firebase_remote_config_man_up_service.dart'; | ||
|
||
// generated with flutterfire_cli | ||
import 'firebase_options.dart'; | ||
|
||
Future<void> main() async { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
await Firebase.initializeApp( | ||
options: DefaultFirebaseOptions.currentPlatform, | ||
); | ||
|
||
runApp(const MyApp()); | ||
} | ||
|
||
class MyApp extends StatefulWidget { | ||
const MyApp({super.key}); | ||
|
||
@override | ||
State<MyApp> createState() => _MyAppState(); | ||
} | ||
|
||
class _MyAppState extends State<MyApp> { | ||
late FireBaseRemoteConfigManUpService manUpService; | ||
|
||
String statusStr = 'unknown'; | ||
String latestVersion = '-'; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
manUpService = FireBaseRemoteConfigManUpService( | ||
remoteConfig: FirebaseRemoteConfig.instance, | ||
// Parameter name (key) in remote config | ||
paramName: 'configName', | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'App', | ||
home: Scaffold( | ||
body: ManUpWidget( | ||
service: manUpService, | ||
shouldShowAlert: () => true, | ||
onComplete: (bool isComplete) => debugPrint('Validate complete'), | ||
onError: (dynamic e) => debugPrint('Error: $e'), | ||
child: Center( | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Text('Status: $statusStr'), | ||
Text('Latest version: $latestVersion'), | ||
], | ||
)), | ||
), | ||
floatingActionButton: FloatingActionButton( | ||
child: const Text('Validate'), | ||
onPressed: () { | ||
manUpService.validate().then((status) { | ||
setState(() { | ||
statusStr = status.name; | ||
latestVersion = manUpService | ||
.setting( | ||
key: 'latest', | ||
orElse: '', | ||
os: 'ios', | ||
) | ||
.toString(); | ||
}); | ||
}).catchError((error) { | ||
debugPrint('error: $error'); | ||
}); | ||
}, | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.