forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flutter_tool] Update analytics policy, send event on disable (flutte…
- Loading branch information
Showing
16 changed files
with
323 additions
and
37 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
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,41 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'base/config.dart'; | ||
import 'base/context.dart'; | ||
import 'base/file_system.dart'; | ||
|
||
PersistentToolState get persistentToolState => PersistentToolState.instance; | ||
|
||
/// A class that represents global (non-project-specific) internal state that | ||
/// must persist across tool invocations. | ||
abstract class PersistentToolState { | ||
factory PersistentToolState([File configFile]) => | ||
_DefaultPersistentToolState(configFile); | ||
|
||
static PersistentToolState get instance => context.get<PersistentToolState>(); | ||
|
||
/// Whether the welcome message should be redisplayed. | ||
/// | ||
/// May give null if the value has not been set. | ||
bool redisplayWelcomeMessage; | ||
} | ||
|
||
class _DefaultPersistentToolState implements PersistentToolState { | ||
_DefaultPersistentToolState([File configFile]) : | ||
_config = Config(configFile ?? fs.file(fs.path.join(userHomePath(), _kFileName))); | ||
|
||
static const String _kFileName = '.flutter_tool_state'; | ||
static const String _kRedisplayWelcomeMessage = 'redisplay-welcome-message'; | ||
|
||
final Config _config; | ||
|
||
@override | ||
bool get redisplayWelcomeMessage => _config.getValue(_kRedisplayWelcomeMessage); | ||
|
||
@override | ||
set redisplayWelcomeMessage(bool value) { | ||
_config.setValue(_kRedisplayWelcomeMessage, value); | ||
} | ||
} |
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
Oops, something went wrong.