generated from nimblehq/git-template
-
Notifications
You must be signed in to change notification settings - Fork 4
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 #208 from nimblehq/release/1.9.0
- Loading branch information
Showing
16 changed files
with
357 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# permission_handler | ||
|
||
[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason) | ||
|
||
A new brick created with the Mason CLI. | ||
|
||
## Description 🚀 | ||
|
||
This brick has the simple implementation of [permission_handler](https://pub.dev/packages/permission_handler) package. |
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
52 changes: 52 additions & 0 deletions
52
bricks/permission_handler/__brick__/{{~ _Podfile_build_configurations }}
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,52 @@ | ||
# TODO You can enable the permissions needed here. | ||
# permission, just remove the `#` character in front so it looks like this: | ||
# | ||
# ## dart: PermissionGroup.camera | ||
#'PERMISSION_CAMERA=1' | ||
# | ||
# Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h | ||
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ | ||
'$(inherited)', | ||
|
||
## dart: PermissionGroup.calendar | ||
# 'PERMISSION_EVENTS=1', | ||
|
||
## dart: PermissionGroup.reminders | ||
# 'PERMISSION_REMINDERS=1', | ||
|
||
## dart: PermissionGroup.contacts | ||
# 'PERMISSION_CONTACTS=1', | ||
|
||
## dart: PermissionGroup.camera | ||
# 'PERMISSION_CAMERA=1', | ||
|
||
## dart: PermissionGroup.microphone | ||
# 'PERMISSION_MICROPHONE=1', | ||
|
||
## dart: PermissionGroup.speech | ||
# 'PERMISSION_SPEECH_RECOGNIZER=1', | ||
|
||
## dart: PermissionGroup.photos | ||
# 'PERMISSION_PHOTOS=1', | ||
|
||
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse] | ||
# 'PERMISSION_LOCATION=1', | ||
|
||
## dart: PermissionGroup.notification | ||
# 'PERMISSION_NOTIFICATIONS=1', | ||
|
||
## dart: PermissionGroup.mediaLibrary | ||
# 'PERMISSION_MEDIA_LIBRARY=1', | ||
|
||
## dart: PermissionGroup.sensors | ||
# 'PERMISSION_SENSORS=1', | ||
|
||
## dart: PermissionGroup.bluetooth | ||
# 'PERMISSION_BLUETOOTH=1', | ||
|
||
## dart: PermissionGroup.appTrackingTransparency | ||
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1', | ||
|
||
## dart: PermissionGroup.criticalAlerts | ||
# 'PERMISSION_CRITICAL_ALERTS=1' | ||
] |
1 change: 1 addition & 0 deletions
1
bricks/permission_handler/__brick__/{{~ _pubspec_dependency.yaml }}
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 @@ | ||
permission_handler: ^8.3.0 |
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,26 @@ | ||
name: permission_handler | ||
description: A new brick created with the Mason CLI. | ||
|
||
# The following defines the version and build number for your brick. | ||
# A version number is three numbers separated by dots, like 1.2.34 | ||
# followed by an optional build number (separated by a +). | ||
version: 0.1.0+1 | ||
|
||
# The following defines the environment for the current brick. | ||
# It includes the version of mason that the brick requires. | ||
environment: | ||
mason: ">=0.1.0-dev.41 <0.1.0" | ||
|
||
# Variables specify dynamic values that your brick depends on. | ||
# Zero or more variables can be specified for a given brick. | ||
# Each variable has: | ||
# * a type (string, number, boolean, enum, or array) | ||
# * an optional short description | ||
# * an optional default value | ||
# * an optional list of default values (array only) | ||
# * an optional prompt phrase used when asking for the variable | ||
# * a list of values (enums only) | ||
vars: | ||
# Injected from the root brick by post_gen hook | ||
project_name: | ||
type: string |
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,2 @@ | ||
.dart_tool | ||
build |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,25 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:mason/mason.dart'; | ||
|
||
import 'bundles/permission_handler_bundle.dart'; | ||
|
||
Future<void> run(HookContext context) async { | ||
try { | ||
await generateBricks(context); | ||
} catch (e) { | ||
context.logger.err(e.toString()); | ||
} | ||
} | ||
|
||
Future<void> generateBricks(HookContext context) async { | ||
if (context.vars['add_permission_handler'] == true) { | ||
await generatePermissionHandlerBrick(context.vars['project_name']); | ||
} | ||
} | ||
|
||
Future<void> generatePermissionHandlerBrick(String projectName) async { | ||
final generator = await MasonGenerator.fromBundle(permissionHandlerBundle); | ||
await generator.generate(DirectoryGeneratorTarget(Directory.current), | ||
vars: {'project_name': projectName}); | ||
} |
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,33 @@ | ||
import 'package:mason/mason.dart'; | ||
|
||
import 'bundles/permission_handler_bundle.dart'; | ||
|
||
Future<void> run(HookContext context) async { | ||
try { | ||
final additionalVars = {}; | ||
if (context.vars['add_permission_handler'] == true) { | ||
additionalVars.addAll(await addPermissionHandlerVariables()); | ||
} | ||
context.vars = {...context.vars, ...additionalVars}; | ||
} catch (e) { | ||
context.logger.err(e.toString()); | ||
} | ||
} | ||
|
||
Future<Map<String, dynamic>> addPermissionHandlerVariables() async { | ||
Map<String, dynamic> vars = {}; | ||
final generator = await MasonGenerator.fromBundle(permissionHandlerBundle); | ||
generator.partials.forEach((filePath, content) { | ||
if (filePath.startsWith('{{~ _')) { | ||
// Remove the special characters from the partial files | ||
final formattedName = filePath | ||
.replaceAll('{', '') | ||
.replaceAll('}', '') | ||
.replaceAll('~ ', '') | ||
.replaceAll('.', '') | ||
.trim(); | ||
vars.putIfAbsent(formattedName, () => String.fromCharCodes(content)); | ||
} | ||
}); | ||
return vars; | ||
} |
Oops, something went wrong.