Skip to content

Commit

Permalink
updates for version 0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
magnatronus committed May 19, 2022
1 parent 6f16623 commit f69a83a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.2 - 19 May 2022

* Merge PR to detect token rather than hard code

## 0.5.1 - 07 May 2022

* Merged PRs for Android and Linux updates
Expand Down
2 changes: 2 additions & 0 deletions example/linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Generated file. Do not edit.
//

// clang-format off

#include "generated_plugin_registrant.h"

#include <devicelocale/devicelocale_plugin.h>
Expand Down
2 changes: 2 additions & 0 deletions example/linux/flutter/generated_plugin_registrant.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Generated file. Do not edit.
//

// clang-format off

#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_

Expand Down
8 changes: 8 additions & 0 deletions example/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
devicelocale
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
)

set(PLUGIN_BUNDLED_LIBRARIES)

foreach(plugin ${FLUTTER_PLUGIN_LIST})
Expand All @@ -14,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
7 changes: 5 additions & 2 deletions lib/devicelocale.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import 'package:flutter/services.dart';

/// A Simple plug-in that can be used to query a device( iOS or Android) to obtain a list of current set up locales and languages
class Devicelocale {
static const MethodChannel _channel = const MethodChannel('uk.spiralarm.flutter/devicelocale');
static const MethodChannel _channel =
const MethodChannel('uk.spiralarm.flutter/devicelocale');

/// return a [Locale] based on the passed in String [info] or the [defaultLocale] and the platform
static Locale? _getAsLocale(String? info, String? defaultLocale) {
Expand All @@ -19,7 +20,9 @@ class Devicelocale {
List localeList = info.split(token);
if (localeList.length < 2) {
if (defaultLocale != null) {
List defaultList = defaultLocale.contains('-') ? defaultLocale.split('-') : defaultLocale.split('_');
List defaultList = defaultLocale.contains('-')
? defaultLocale.split('-')
: defaultLocale.split('_');
if (defaultList.length >= 2) {
return Locale(defaultList[0], defaultList[1]);
} else {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: devicelocale
description: A Flutter package that can be used to extract the locales that are currently defined on a device with the current locale set as the first in the list.
version: 0.5.1
version: 0.5.2
homepage: https://github.com/magnatronus/flutter-devicelocale

environment:
Expand Down

0 comments on commit f69a83a

Please sign in to comment.