Skip to content

Commit

Permalink
refactor: Rename remote_parameter_fetcher to configurator
Browse files Browse the repository at this point in the history
  • Loading branch information
naipaka committed Nov 12, 2023
1 parent c784440 commit 30d881f
Show file tree
Hide file tree
Showing 122 changed files with 177 additions and 176 deletions.
1 change: 1 addition & 0 deletions .cspell/app-words.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# App Specific Words
configurator
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"version": "0.2.0",
"configurations": [
{
"name": "flutterfire_remote_parameter_fetcher/example",
"cwd": "packages/flutterfire_remote_parameter_fetcher/example",
"name": "flutterfire_configurator/example",
"cwd": "packages/flutterfire_configurator/example",
"request": "launch",
"type": "dart",
"flutterMode": "debug"
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions packages/flutterfire_configurator/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# FlutterFire Configurator example

A new Flutter project.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (flutterVersionName == null) {
}

android {
namespace "jp.co.altive.flutterfireremoteparameterfetcher.example"
namespace "jp.co.altive.flutterfireconfigurator.example"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

Expand All @@ -42,7 +42,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "jp.co.altive.flutterfireremoteparameterfetcher.example"
applicationId "jp.co.altive.flutterfireconfigurator.example"
// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"client_info": {
"mobilesdk_app_id": "1:282061201204:android:86708a3c3a298e18b04f61",
"android_client_info": {
"package_name": "jp.co.altive.flutterfireremoteparameterfetcher.example"
"package_name": "jp.co.altive.flutterfireconfigurator.example"
}
},
"oauth_client": [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jp.co.altive.flutterfireremoteparameterfetcher.example
package jp.co.altive.flutterfireconfigurator.example

import io.flutter.embedding.android.FlutterActivity

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireremoteparameterfetcher.example;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireconfigurator.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand All @@ -496,7 +496,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireremoteparameterfetcher.example.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireconfigurator.example.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -514,7 +514,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireremoteparameterfetcher.example.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireconfigurator.example.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
Expand All @@ -530,7 +530,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireremoteparameterfetcher.example.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireconfigurator.example.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
Expand Down Expand Up @@ -658,7 +658,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireremoteparameterfetcher.example;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireconfigurator.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -681,7 +681,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireremoteparameterfetcher.example;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireconfigurator.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string>AIzaSyDW2cbXfGjFB4EdKJTFojoAt_7wM-P10lg</string>
<key>GCM_SENDER_ID</key>
<string>282061201204</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>jp.co.altive.flutterfireconfigurator.example</string>
<key>PROJECT_ID</key>
<string>flutterfire-adapter</string>
<key>STORAGE_BUCKET</key>
<string>flutterfire-adapter.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:282061201204:ios:0971ee1979644c5eb04f61</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class DefaultFirebaseOptions {
messagingSenderId: '282061201204',
projectId: 'flutterfire-adapter',
storageBucket: 'flutterfire-adapter.appspot.com',
iosBundleId: 'jp.co.altive.flutterfireremoteparameterfetcher.example',
iosBundleId: 'jp.co.altive.flutterfireconfigurator.example',
);

static const FirebaseOptions macos = FirebaseOptions(
Expand All @@ -75,6 +75,6 @@ class DefaultFirebaseOptions {
messagingSenderId: '282061201204',
projectId: 'flutterfire-adapter',
storageBucket: 'flutterfire-adapter.appspot.com',
iosBundleId: 'jp.co.altive.flutterfireremoteparameterfetcher.example.RunnerTests',
iosBundleId: 'jp.co.altive.flutterfireconfigurator.example.RunnerTests',
);
}
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutterfire_remote_parameter_fetcher/remote_parameter_fetcher.dart';
import 'package:flutterfire_configurator/configurator.dart';

import 'firebase_options.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
final rpf = RemoteParameterFetcher();
await rpf.setDefaults({
final configurator = Configurator();
await configurator.setDefaults({
'int_parameter': 123,
});

runApp(MainApp(rpf: rpf));
runApp(MainApp(configurator: configurator));
}

class MainApp extends StatefulWidget {
const MainApp({super.key, required this.rpf});
const MainApp({super.key, required this.configurator});

final RemoteParameterFetcher rpf;
final Configurator configurator;

@override
State<MainApp> createState() => _MainAppState();
}

class _MainAppState extends State<MainApp> {
late final rpf = widget.rpf;
late final configurator = widget.configurator;

late RemoteParameter<int> _intRemoteParameter;
late Config<int> _intConfig;

late int _intParameterValue;
late int _intConfigValue;

@override
void initState() {
super.initState();
_intRemoteParameter = rpf.getIntParameter(
_intConfig = configurator.getIntParameter(
'int_parameter',
onConfigUpdated: (value) {
debugPrint('remoteParameter value changed: $value');
debugPrint('Config value changed: $value');
setState(() {
_intParameterValue = value;
_intConfigValue = value;
});
},
);
_intParameterValue = _intRemoteParameter.value;
_intConfigValue = _intConfig.value;
}

@override
Future<void> dispose() async {
await _intRemoteParameter.dispose();
await _intConfig.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('FlutterFireRemoteParameterFetcher')),
appBar: AppBar(title: const Text('FlutterFireConfigurator')),
body: Padding(
padding: const EdgeInsets.all(32),
child: Center(
child: Text('RemoteParameter value: $_intParameterValue'),
child: Text('Config value: $_intConfigValue'),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireremoteparameterfetcher.example.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireconfigurator.example.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example";
Expand All @@ -497,7 +497,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireremoteparameterfetcher.example.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireconfigurator.example.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example";
Expand All @@ -512,7 +512,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireremoteparameterfetcher.example.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireconfigurator.example.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
PRODUCT_NAME = example

// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireremoteparameterfetcher.example
PRODUCT_BUNDLE_IDENTIFIER = jp.co.altive.flutterfireconfigurator.example

// The copyright displayed in application information
PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string>AIzaSyDW2cbXfGjFB4EdKJTFojoAt_7wM-P10lg</string>
<key>GCM_SENDER_ID</key>
<string>282061201204</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>jp.co.altive.flutterfireconfigurator.example.RunnerTests</string>
<key>PROJECT_ID</key>
<string>flutterfire-adapter</string>
<key>STORAGE_BUCKET</key>
<string>flutterfire-adapter.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:282061201204:ios:160f3e4560ec8c4db04f61</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutterfire_remote_parameter_fetcher:
flutterfire_configurator:
dependency: "direct main"
description:
path: ".."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: flutterfire_remote_parameter_fetcher_example
description: Demonstrates how to use the flutterfire_remote_parameter_fetcher package.
name: flutterfire_configurator_example
description: Demonstrates how to use the flutterfire_configurator package.
publish_to: "none"
version: 0.1.0

Expand All @@ -11,7 +11,7 @@ dependencies:
firebase_core: ^2.21.0
flutter:
sdk: flutter
flutterfire_remote_parameter_fetcher:
flutterfire_configurator:
path: ../

dev_dependencies:
Expand Down
5 changes: 5 additions & 0 deletions packages/flutterfire_configurator/lib/configurator.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// Configurator
library configurator;

export 'src/config.dart';
export 'src/configurator.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'dart:async';

/// A class that holds the value of a parameter fetched from a remote.
/// It also provides a Stream of updated parameter information.
class RemoteParameter<T> {
RemoteParameter({
class Config<T> {
Config({
required T value,
required StreamSubscription<void> subscription,
}) : _value = value,
Expand All @@ -16,7 +16,7 @@ class RemoteParameter<T> {
T get value => _value;
final T _value;

/// Closes the [RemoteParameter].
/// Closes the [Config].
Future<void> dispose() async {
await _subscription.cancel();
}
Expand Down
Loading

0 comments on commit 30d881f

Please sign in to comment.