├── android ├── gradle.properties ├── app │ ├── src │ │ └── main │ │ │ ├── res │ │ │ └── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── java │ │ │ └── org │ │ │ │ └── ice1000 │ │ │ │ └── code_wars_android │ │ │ │ └── MainActivity.java │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── .gitignore ├── settings.gradle └── build.gradle ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── AppDelegate.h │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── main.m │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── .gitignore └── Podfile ├── api-reference ├── fail.json ├── user.json ├── authored.json ├── code-challenge.json └── completed.json ├── lib ├── main.dart ├── view │ ├── one_page_dialog.dart │ ├── completed.dart │ ├── settings.dart │ └── main.dart ├── code_wars │ ├── colors.dart │ └── code_wars.dart └── util │ ├── storage.dart │ └── util.dart ├── pubspec.yaml ├── .gitignore ├── README.md ├── .travis.yml └── LICENSE /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4096M 2 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /api-reference/fail.json: -------------------------------------------------------------------------------- 1 | { 2 | "success": false, 3 | "reason": "not found" 4 | } 5 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:code_wars_android/view/main.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | void main() => runApp(new Application()); 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ice1000/code_wars_android/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | GeneratedPluginRegistrant.java 10 | 11 | /gradle 12 | /gradlew 13 | /gradlew.bat 14 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: code_wars_android 2 | description: A mobile client for CodeWars. 3 | 4 | dependencies: 5 | path_provider: "^0.2.1+1" 6 | shared_preferences: "^0.2.0+1" 7 | url_launcher: "^0.4.2+1" 8 | flutter: 9 | sdk: flutter 10 | # 11 | 12 | flutter: 13 | uses-material-design: true 14 | # 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .atom/ 3 | .idea 4 | .vscode 5 | .packages 6 | .pub/ 7 | build/ 8 | ios/.generated/ 9 | packages 10 | pubspec.lock 11 | .flutter-plugins 12 | android.iml 13 | android/.gradle 14 | android/gen 15 | code_wars_android.iml 16 | out/ 17 | ios/Runner.xcodeproj/ 18 | ios/Runner.xcworkspace/ 19 | /.gradle 20 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withInputStream { stream -> plugins.load(stream) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot 13 | .resolve(path) 14 | .resolve('android') 15 | .toFile() 16 | include ":$name" 17 | project(":$name").projectDir = pluginDirectory 18 | } 19 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:2.2.3' 8 | } 9 | } 10 | 11 | allprojects { 12 | repositories { 13 | jcenter() 14 | } 15 | } 16 | 17 | rootProject.buildDir = '../build' 18 | subprojects { 19 | project.buildDir = "${rootProject.buildDir}/${project.name}" 20 | project.evaluationDependsOn(':app') 21 | } 22 | 23 | task clean(type: Delete) { 24 | delete rootProject.buildDir 25 | } 26 | 27 | task wrapper(type: Wrapper) { 28 | gradleVersion = '2.14.1' 29 | } 30 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | *.pbxuser 16 | *.mode1v3 17 | *.mode2v3 18 | *.perspectivev3 19 | 20 | !default.pbxuser 21 | !default.mode1v3 22 | !default.mode2v3 23 | !default.perspectivev3 24 | 25 | xcuserdata 26 | 27 | *.moved-aside 28 | 29 | *.pyc 30 | *sync/ 31 | Icon? 32 | .tags* 33 | 34 | /Flutter/app.flx 35 | /Flutter/app.zip 36 | /Flutter/App.framework 37 | /Flutter/Flutter.framework 38 | /Flutter/Generated.xcconfig 39 | /ServiceDefinitions.json 40 | 41 | Pods/ 42 | -------------------------------------------------------------------------------- /lib/view/one_page_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | /// 5 | /// Created by ice1000 on 2017/6/27 6 | /// 7 | /// @author ice1000 8 | /// 9 | 10 | class OnePageActivity extends MaterialPageRoute { 11 | OnePageActivity(Widget child) : super(builder: (BuildContext context) => new _OnePageView(child)); 12 | } 13 | 14 | class _OnePageView extends StatefulWidget { 15 | final Widget child; 16 | 17 | _OnePageView(this.child); 18 | 19 | @override 20 | State createState() => new _OnePageState(child); 21 | } 22 | 23 | class _OnePageState extends State<_OnePageView> { 24 | final Widget child; 25 | 26 | _OnePageState(this.child); 27 | 28 | @override 29 | Widget build(BuildContext context) => new Scaffold(body: child,); 30 | } 31 | -------------------------------------------------------------------------------- /api-reference/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "username": "ice1000", 3 | "name": "千里冰封", 4 | "honor": 1658, 5 | "clan": "Gensokyo", 6 | "leaderboardPosition": 1794, 7 | "skills": [ 8 | "haskell", 9 | "cross dress", 10 | "sell moe", 11 | "kotlin" 12 | ], 13 | "ranks": { 14 | "overall": { 15 | "rank": -3, 16 | "name": "3 kyu", 17 | "color": "blue", 18 | "score": 3077 19 | }, 20 | "languages": { 21 | "java": { 22 | "rank": -8, 23 | "name": "8 kyu", 24 | "color": "white", 25 | "score": 2 26 | }, 27 | "dart": { 28 | "rank": -8, 29 | "name": "8 kyu", 30 | "color": "white", 31 | "score": 5 32 | }, 33 | "haskell": { 34 | "rank": -3, 35 | "name": "3 kyu", 36 | "color": "blue", 37 | "score": 3072 38 | } 39 | } 40 | }, 41 | "codeChallenges": { 42 | "totalAuthored": 1, 43 | "totalCompleted": 114 44 | } 45 | } -------------------------------------------------------------------------------- /lib/code_wars/colors.dart: -------------------------------------------------------------------------------- 1 | /// 2 | /// Created by ice1000 on 2017/5/12 3 | /// 4 | /// @author ice1000 5 | /// 6 | 7 | import 'package:flutter/material.dart'; 8 | 9 | class CodeWarsColors { 10 | static const MaterialColor black = const MaterialColor( 11 | _codeWarsBlackPrimaryValue, 12 | const { 13 | 50: const Color(0xFFC2C2C2), 14 | 100: const Color(0xFFA2A2A2), 15 | 200: const Color(0xFF828282), 16 | 300: const Color(0xFF626262), 17 | 400: const Color(0xFF424242), 18 | 500: const Color(_codeWarsBlackPrimaryValue), 19 | 600: const Color(0xFF262729), 20 | 700: const Color(0xFF222222), 21 | 800: const Color(0xFF1D1D1f), 22 | 900: const Color(0xFF151515), 23 | }, 24 | ); 25 | static const _codeWarsBlackPrimaryValue = 0xFF303133; 26 | 27 | static const MaterialColor main = Colors.indigo; 28 | static const MaterialColor important = Colors.grey; 29 | static const MaterialColor notSoImportant = Colors.blueGrey; 30 | } 31 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | UIRequiredDeviceCapabilities 24 | 25 | arm64 26 | 27 | MinimumOSVersion 28 | 8.0 29 | 30 | 31 | -------------------------------------------------------------------------------- /android/app/src/main/java/org/ice1000/code_wars_android/MainActivity.java: -------------------------------------------------------------------------------- 1 | package org.ice1000.code_wars_android; 2 | 3 | import android.os.Bundle; 4 | 5 | import android.util.Log; 6 | import io.flutter.app.FlutterActivity; 7 | import io.flutter.plugins.GeneratedPluginRegistrant; 8 | 9 | /** 10 | * Android Main Activity 11 | * 12 | * @author ice1000 13 | */ 14 | public class MainActivity extends FlutterActivity { 15 | 16 | /** 17 | * To do some log jobs 18 | *

19 | * Here it's used to do some log 20 | * 21 | * @param savedInstanceState saved state 22 | */ 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | GeneratedPluginRegistrant.registerWith(this); 27 | Log.i(toString(), "app started (logged by ice1000)"); 28 | } 29 | 30 | /** 31 | * To do some log jobs 32 | *

33 | * Here it's used to do some log 34 | */ 35 | @Override 36 | protected void onDestroy() { 37 | super.onDestroy(); 38 | Log.i(toString(), "app exited (logged by ice1000)"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/util/storage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:path_provider/path_provider.dart'; 5 | 6 | class DatabaseKeys { 7 | static const USER = "user_data"; 8 | static const FRIENDS = "friends_data"; 9 | static const KATAS = "katas_data"; 10 | 11 | static const COMPLETED = "completed_kata"; 12 | 13 | static String friendData(String name) => "$FRIENDS$name"; 14 | } 15 | 16 | class Storage { 17 | static Future openOrCreate(File file) async { 18 | return !(await file.exists()) ? file.create() : file; 19 | } 20 | 21 | static Future getLocalFile(String fileName) async { 22 | String dir = (await getApplicationDocumentsDirectory()).path; 23 | return new File('$dir/$fileName'); 24 | } 25 | 26 | static Future readFile(String fileName) async => 27 | (await openOrCreate(await getLocalFile(fileName))).readAsString(); 28 | 29 | static writeFile(String fileName, String contents) async => 30 | (await openOrCreate(await getLocalFile(fileName))).writeAsString(contents); 31 | } 32 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withInputStream { stream -> 5 | localProperties.load(stream) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | apply plugin: 'com.android.application' 15 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 16 | 17 | android { 18 | compileSdkVersion 25 19 | buildToolsVersion '25.0.3' 20 | 21 | lintOptions { 22 | disable 'InvalidPackage' 23 | } 24 | 25 | defaultConfig { 26 | applicationId "org.ice1000.code_wars_android" 27 | } 28 | 29 | buildTypes { 30 | release { 31 | // Signing with the debug keys for now, so `flutter run --release` works. 32 | signingConfig signingConfigs.debug 33 | } 34 | } 35 | } 36 | 37 | flutter { 38 | source '../..' 39 | } 40 | 41 | dependencies { 42 | } 43 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | if ENV['FLUTTER_FRAMEWORK_DIR'] == nil 5 | abort('Please set FLUTTER_FRAMEWORK_DIR to the directory containing Flutter.framework') 6 | end 7 | 8 | target 'Runner' do 9 | use_frameworks! 10 | 11 | # Pods for Runner 12 | 13 | # Flutter Pods 14 | pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR'] 15 | 16 | if File.exists? '../.flutter-plugins' 17 | flutter_root = File.expand_path('..') 18 | File.foreach('../.flutter-plugins') { |line| 19 | plugin = line.split(pattern='=') 20 | if plugin.length == 2 21 | name = plugin[0].strip() 22 | path = plugin[1].strip() 23 | resolved_path = File.expand_path("#{path}/ios", flutter_root) 24 | pod name, :path => resolved_path 25 | else 26 | puts "Invalid plugin specification: #{line}" 27 | end 28 | } 29 | end 30 | end 31 | 32 | post_install do |installer| 33 | installer.pods_project.targets.each do |target| 34 | target.build_configurations.each do |config| 35 | config.build_settings['ENABLE_BITCODE'] = 'NO' 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # code_wars_android 2 | 3 | [![Build Status](https://travis-ci.org/ice1000/code_wars_android.svg?branch=master)](https://travis-ci.org/ice1000/code_wars_android) 4 | 5 | A Mobile client for [Code Wars](https://www.codewars.com). 6 | 7 | This app is entirely under development. 8 | 9 | You can view: 10 | 11 | 0. Information about yourself and someone else by giving the username. 12 | 0. Information about a specific kata 13 | 0. Information about your completed kata 14 | 0. Information about your authored kata 15 | 16 | ## Download 17 | 18 | Please go to the [release page](https://github.com/ice1000/code_wars_android/releases). 19 | 20 | The apk and flx are uploaded by Travis CI automatically. 21 | 22 | ## Progress 23 | 24 | - [X] Display user basic information 25 | - [X] Display user details 26 | - [X] Display user completed katas 27 | - [X] Paginate user completed katas 28 | - [ ] Display user authored katas 29 | - [X] Display a kata's information 30 | - [X] Display collections of other users 31 | - [X] View source 32 | - [X] Settings 33 | - [X] Change Username 34 | 35 | ## About 36 | 37 | I practise my Haskell skills on Code Wars: 38 | 39 | [![](https://www.codewars.com/users/ice1000/badges/large)](https://www.codewars.com/users/ice1000) 40 | 41 | So I made this to show my appreciation. 42 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 7 | [GeneratedPluginRegistrant registerWithRegistry:self]; 8 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 9 | } 10 | 11 | - (void)applicationWillResignActive:(UIApplication *)application { 12 | [super applicationWillResignActive:application]; 13 | } 14 | 15 | - (void)applicationDidEnterBackground:(UIApplication *)application { 16 | [super applicationDidEnterBackground:application]; 17 | } 18 | 19 | - (void)applicationWillEnterForeground:(UIApplication *)application { 20 | [super applicationWillEnterForeground:application]; 21 | } 22 | 23 | - (void)applicationDidBecomeActive:(UIApplication *)application { 24 | [super applicationDidBecomeActive:application]; 25 | } 26 | 27 | - (void)applicationWillTerminate:(UIApplication *)application { 28 | [super applicationWillTerminate:application]; 29 | } 30 | 31 | - (BOOL)application:(UIApplication *)application 32 | openURL:(NSURL *)url 33 | options:(NSDictionary *)options { 34 | return [super application:application openURL:url options:options]; 35 | } 36 | @end 37 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 20 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | code_wars_android 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | arm64 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | language: dart 3 | language: android 4 | os: 5 | - linux 6 | jdk: 7 | - oraclejdk8 8 | # 9 | 10 | script: 11 | - flutter build aot 12 | - flutter build apk 13 | - flutter build flx 14 | # 15 | 16 | before_install: 17 | - git clone -b alpha https://github.com/flutter/flutter.git 18 | - wget http://services.gradle.org/distributions/gradle-3.5-bin.zip 19 | - unzip gradle-3.5-bin.zip 20 | # 21 | 22 | install: 23 | - export GRADLE_HOME=$PWD/gradle-3.5 24 | - export PATH=$GRADLE_HOME/bin:$PATH 25 | - export PATH=./flutter/bin:$PATH 26 | # 27 | 28 | android: 29 | components: 30 | - tools 31 | - platform-tools 32 | - build-tools-25.0.3 33 | - android-25 34 | - extra-android-support 35 | - extra-google-google_play_services 36 | - extra-android-m2repository 37 | - extra-google-m2repository 38 | - addon-google_apis-google-21 39 | # 40 | 41 | #deploy: 42 | # provider: releases 43 | # skip_cleanup: true 44 | # api_key: 45 | # secure: KCBJBtuhB174ZtkLA2NGwG/CjGhj1OD1oznkZOpOlka4HYgxpMeUMrxM66W83ItOD9OfiID50CvZe42XZbH1ODmBcXkpJIlNgaoKd7uEuJykUnDW8OvPsbwjLTvrhXX+SdpnPnxnEddRiYsKwhL0CJUGC4BzT7mbIMDSsQMmJqBrb/f7DM5C0OYT3e/itQ8mvvzOjnU6pdLPI9a6NOKypeOReJXsITJQ5RncUv4Ov3qkzgzQqparPXDsKe25+H5c5s5uFjcEituDspQ1qmXghgn9aSnvpx2q6eyHoTAGbf/AzzGRQAz5WWg/OdeGpQrZvtM9x+BVNF9aFV8PeNHN1Eb4vE3Nftd0gqSEZm9gSnjCA8sbzG91Tj2q82lA8VOFomuVwB5f0VwjtIoybVfeRqysRc5XXJHcqed3gXDbqaX368SnBSDClnctc1BB3iorHTAkLwymxMdMOhEHZe3cgg1eshRixRPR5pxShSnnIoECmd1uzQjCJbitrqQIGTU9HPXrD6Su0aEgNcQtxV29W5yG/pL944YhwcS0dQSk5kt1tc4n9eC2pwoS/mE+0OmPkDA1FO77Esziv1haNxa8neBprT96HhPBrGDVGlG+Fxg34ONhNZ16Cnr4R45fryF0YqAjK//LVmww4duSgQkgFY0PEPNcQcX5XG7vJuzP7Lc= 46 | # file: 47 | # - build/app/outputs/apk/app-release.apk 48 | # - build/app.flx 49 | # on: 50 | # tags: true 51 | # repo: ice1000/code_wars_android 52 | # 53 | -------------------------------------------------------------------------------- /lib/util/util.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/foundation.dart'; 4 | 5 | /// 6 | /// Created by ice1000 on 2016/5/12 7 | /// 8 | /// @author ice1000 9 | /// 10 | 11 | import 'package:flutter/material.dart'; 12 | 13 | // ignore: must_be_immutable 14 | class RefreshProgressDialog extends StatelessWidget { 15 | RefreshProgressDialog(this.background, { 16 | Key key, 17 | this.width, 18 | this.height, 19 | }) : super(key: key) { 20 | child = new RefreshProgressIndicator(backgroundColor: background); 21 | } 22 | 23 | final Color background; 24 | final int width; 25 | final int height; 26 | Widget child; 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return new Center( 31 | child: new Container( 32 | color: new Color.fromARGB(0, 0, 0, 0), 33 | margin: const EdgeInsets.symmetric( 34 | horizontal: 40.0, vertical: 24.0), 35 | child: new ConstrainedBox( 36 | constraints: new BoxConstraints( 37 | minWidth: width.toDouble(), 38 | minHeight: height.toDouble(),), 39 | child: child 40 | ) 41 | ) 42 | ); 43 | } 44 | } 45 | 46 | //Future showDialogNamed({ 47 | // @required BuildContext context, 48 | // bool barrierDismissible: true, 49 | // @required Widget child,}) => 50 | // Navigator.push(context, new _DialogRoute( 51 | // child: child, 52 | // theme: Theme.of(context, shadowThemeOnly: true), 53 | // barrierDismissible: barrierDismissible, 54 | // )); 55 | 56 | 57 | const String GPLv3 = """ 58 | GNU GENERAL PUBLIC LICENSE 59 | Version 3, 29 June 2007 60 | 61 | Copyright (C) 2007 Free Software Foundation, Inc. 62 | Everyone is permitted to copy and distribute verbatim copies 63 | of this license document, but changing it is not allowed. 64 | """; -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "size": "20x20", 5 | "idiom": "iphone", 6 | "filename": "Icon-App-20x20@2x.png", 7 | "scale": "2x" 8 | }, 9 | { 10 | "size": "20x20", 11 | "idiom": "iphone", 12 | "filename": "Icon-App-20x20@3x.png", 13 | "scale": "3x" 14 | }, 15 | { 16 | "size": "29x29", 17 | "idiom": "iphone", 18 | "filename": "Icon-App-29x29@1x.png", 19 | "scale": "1x" 20 | }, 21 | { 22 | "size": "29x29", 23 | "idiom": "iphone", 24 | "filename": "Icon-App-29x29@2x.png", 25 | "scale": "2x" 26 | }, 27 | { 28 | "size": "29x29", 29 | "idiom": "iphone", 30 | "filename": "Icon-App-29x29@3x.png", 31 | "scale": "3x" 32 | }, 33 | { 34 | "size": "40x40", 35 | "idiom": "iphone", 36 | "filename": "Icon-App-40x40@2x.png", 37 | "scale": "2x" 38 | }, 39 | { 40 | "size": "40x40", 41 | "idiom": "iphone", 42 | "filename": "Icon-App-40x40@3x.png", 43 | "scale": "3x" 44 | }, 45 | { 46 | "size": "60x60", 47 | "idiom": "iphone", 48 | "filename": "Icon-App-40x40@3x.png", 49 | "scale": "2x" 50 | }, 51 | { 52 | "size": "60x60", 53 | "idiom": "iphone", 54 | "filename": "Icon-App-60x60@3x.png", 55 | "scale": "3x" 56 | }, 57 | { 58 | "size": "20x20", 59 | "idiom": "ipad", 60 | "filename": "Icon-App-20x20@1x.png", 61 | "scale": "1x" 62 | }, 63 | { 64 | "size": "20x20", 65 | "idiom": "ipad", 66 | "filename": "Icon-App-20x20@2x.png", 67 | "scale": "2x" 68 | }, 69 | { 70 | "size": "29x29", 71 | "idiom": "ipad", 72 | "filename": "Icon-App-29x29@1x.png", 73 | "scale": "1x" 74 | }, 75 | { 76 | "size": "29x29", 77 | "idiom": "ipad", 78 | "filename": "Icon-App-29x29@2x.png", 79 | "scale": "2x" 80 | }, 81 | { 82 | "size": "40x40", 83 | "idiom": "ipad", 84 | "filename": "Icon-App-20x20@2x.png", 85 | "scale": "1x" 86 | }, 87 | { 88 | "size": "40x40", 89 | "idiom": "ipad", 90 | "filename": "Icon-App-40x40@2x.png", 91 | "scale": "2x" 92 | }, 93 | { 94 | "size": "76x76", 95 | "idiom": "ipad", 96 | "filename": "Icon-App-76x76@1x.png", 97 | "scale": "1x" 98 | }, 99 | { 100 | "size": "76x76", 101 | "idiom": "ipad", 102 | "filename": "Icon-App-76x76@2x.png", 103 | "scale": "2x" 104 | }, 105 | { 106 | "size": "83.5x83.5", 107 | "idiom": "ipad", 108 | "filename": "Icon-App-83.5x83.5@2x.png", 109 | "scale": "2x" 110 | } 111 | ], 112 | "info": { 113 | "version": 1, 114 | "author": "ice1000" 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /lib/view/completed.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:code_wars_android/code_wars/code_wars.dart'; 4 | import 'package:code_wars_android/code_wars/colors.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/widgets.dart'; 7 | 8 | /// 9 | /// Created by ice1000 on 2017/6/2 10 | /// 11 | /// @author ice1000 12 | /// 13 | 14 | class CompletedActivity extends MaterialPageRoute { 15 | CompletedActivity(String data, int page) : super( 16 | builder: (BuildContext context) => new _CompletedView(data, page)); 17 | } 18 | 19 | class _CompletedView extends StatefulWidget { 20 | final String _data; 21 | final int _page; 22 | 23 | _CompletedView(this._data, this._page); 24 | 25 | @override 26 | State createState() => 27 | new _CompletedState("Completed Katas Page ${_page + 1}", _data, _page); 28 | } 29 | 30 | class _CompletedState extends State<_CompletedView> { 31 | final String _title; 32 | final String _data; 33 | final int _page; 34 | static final Color _titleColor = CodeWarsColors.notSoImportant.shade100; 35 | static final Color _textColor = CodeWarsColors.notSoImportant.shade600; 36 | static final Color _importantColor = CodeWarsColors.notSoImportant.shade800; 37 | List _completed; 38 | 39 | _CompletedState(this._title, this._data, this._page); 40 | 41 | @override 42 | void initState() { 43 | super.initState(); 44 | try { 45 | Map json = new JsonDecoder(null).convert(_data); 46 | var reason = json['reason']; 47 | _completed = null != reason ? null : KataCompleted.fromJson(json); 48 | } catch (e) { 49 | _completed = null; 50 | } 51 | } 52 | 53 | @override 54 | Widget build(BuildContext context) { 55 | Widget view; 56 | if (null != _completed) { 57 | var list = []; 58 | _completed.forEach((kata) { 59 | list.add(new ExpansionTile( 60 | title: new Text(kata.name, 61 | style: new TextStyle(fontSize: 20.0, color: _textColor)), 62 | children: [ 63 | new ListTile( 64 | dense: true, 65 | title: new Text(kata.fullName, 66 | style: new TextStyle( 67 | fontSize: 16.0, color: _importantColor))), 68 | // new ListTile( 69 | // dense: true, 70 | // title: new Text( 71 | // "Kata id: ${kata.id}", 72 | // style: new TextStyle( 73 | // fontSize: 16.0, 74 | // color: _importantColor))), 75 | new ListTile( 76 | isThreeLine: true, 77 | dense: true, 78 | subtitle: new Text("languages: ${kata.completedLanguages.join(", ")}", 79 | style: new TextStyle( 80 | fontSize: 14.0, color: _importantColor)), 81 | title: new Text("completed at: ${kata.completedAt}", 82 | style: new TextStyle( 83 | fontSize: 16.0, color: _importantColor))), 84 | ])); 85 | }); 86 | view = new Scrollbar( 87 | child: new ListView( 88 | primary: false, 89 | padding: new EdgeInsets.symmetric(vertical: 8.0), 90 | children: list, 91 | shrinkWrap: true, 92 | )); 93 | } 94 | return new Scaffold( 95 | appBar: new AppBar(title: new Text(_title, style: new TextStyle(color: _titleColor))), 96 | body: view ?? new Center(child: new Text("Error", style: new TextStyle(fontSize: 30.0, color: _titleColor)))); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /api-reference/authored.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "id": "56a2d27f8af7384815000037", 5 | "name": "Concatenate two list", 6 | "description": "Write a function append, that, given two list l and r, concatenate them into one list.\n\nFor example, append [1,2,3] [2,4,7] = [1,2,3,2,4,7]\n\nThe problem is really easy, basically the functional world equivalent of hello world.\n\nThere're at least four approach, including: \n\n1:calling one of the basic function\n\n2:pattern match explicitly and recurse\n\n3:use fix point combinator\n\n4:use foldl/foldr(yes, either of them can do the job)\n\n", 7 | "rank": -7, 8 | "rankName": "7 kyu", 9 | "tags": [ 10 | "Fundamentals", 11 | "Lists", 12 | "Data Structures" 13 | ], 14 | "languages": [ 15 | "haskell" 16 | ] 17 | }, 18 | { 19 | "id": "5922530af9c157651d0000aa", 20 | "name": "Peano and Church", 21 | "description": "Is Peano inside a church? Or is Church playing a piano?\n\nWe will go through 4 forumlations of Natural Numbers, including Peano Arithmetic and Church Numeral.\n", 22 | "rank": null, 23 | "rankName": null, 24 | "tags": [ 25 | "Fundamentals" 26 | ], 27 | "languages": [ 28 | "haskell" 29 | ] 30 | }, 31 | { 32 | "id": "5917a469c63c187e13000082", 33 | "name": "Typing Dynamic Typing", 34 | "description": "Haskell has static type, which is very great!\n\nHowever, sometimes we still want dynamic typing, if we do not know the type of a value beforehand. For example, we want dynamic typing if we serialize a Haskell value, or take a Haskell program and evaluate it.\n\nUsing Haskell, there are way to do dynamic typing without using features such as unsafeCoerce.\n\nFollowing the paper [Typing Dynamic Typing](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.193.1552), we will help you to add dynamic type in Haskell, without using unsafe features.\n\nYou do not need to, and should not read the paper to complete the exercise.\nThis might take you a lot of time. Have fun!", 35 | "rank": null, 36 | "rankName": null, 37 | "tags": [ 38 | "Fundamentals" 39 | ], 40 | "languages": [ 41 | "haskell" 42 | ] 43 | }, 44 | { 45 | "id": "5917f22dd2563a36a200009c", 46 | "name": "Algebraic Isomorphism", 47 | "description": "This is the continuation of [Isomorphism](https://www.codewars.com/kata/isomorphism). You need to finish it to do this kata.\n\nThis kata will explain why [Algebraic Data Type](https://en.wikipedia.org/wiki/Algebraic_data_type) get its name.", 48 | "rank": null, 49 | "rankName": null, 50 | "tags": [ 51 | "Fundamentals", 52 | "Functional Programming", 53 | "Declarative Programming", 54 | "Programming Paradigms" 55 | ], 56 | "languages": [ 57 | "haskell" 58 | ] 59 | }, 60 | { 61 | "id": "56a4270061589f48aa000012", 62 | "name": "Trash", 63 | "description": "In this short kata, we will walk you through what is isomorphism.\nIt is best to know algebraic data type, peano arithmetic before doing this.", 64 | "rank": null, 65 | "rankName": null, 66 | "tags": [ 67 | "Puzzles" 68 | ], 69 | "languages": [ 70 | "haskell" 71 | ] 72 | }, 73 | { 74 | "id": "5922543bf9c15705d0000020", 75 | "name": "Isomorphism", 76 | "description": "We will walk through what is isomorphism, and define some common isomorphism.\n\nThis kata possibly unlock [Algebraic Isomorphism](https://www.codewars.com/kata/algebraic-isomorphism/haskell)", 77 | "rank": null, 78 | "rankName": null, 79 | "tags": [ 80 | "Fundamentals", 81 | "Functional Programming", 82 | "Declarative Programming", 83 | "Programming Paradigms" 84 | ], 85 | "languages": [ 86 | "haskell" 87 | ] 88 | } 89 | ] 90 | } 91 | -------------------------------------------------------------------------------- /lib/code_wars/code_wars.dart: -------------------------------------------------------------------------------- 1 | /// 2 | /// Created by ice1000 on 2017/5/11 3 | /// 4 | /// @author ice1000 5 | /// 6 | 7 | class CodeWarsAPI { 8 | static getUser(String user) => "https://www.codewars.com/api/v1/users/$user"; 9 | 10 | static getCompletedKata(String user) => 11 | "http://www.codewars.com/api/v1/users/$user/code-challenges/completed"; 12 | 13 | static getCompletedKataPaginated(String user, int page) => 14 | "http://www.codewars.com/api/v1/users/$user/code-challenges/completed?page=$page"; 15 | 16 | static getKata(String kata) => 17 | "http://www.codewars.com/api/v1/code-challenges/$kata"; 18 | 19 | static getAuthoredChallenge(String user) => 20 | "http://www.codewars.com:3000/api/v1/users/$user/code-challenges/authored"; 21 | 22 | static getErrorWithReason(String reason) => 23 | "{\"success\":false,\"reason\":\"$reason\"}"; 24 | } 25 | 26 | /// 27 | /// represents a user of code wars 28 | /// containing data read from api 29 | /// 30 | class CodeWarsUser { 31 | String username = ""; 32 | String name = ""; 33 | String clan = ""; 34 | int honor = 0; 35 | int leaderboardPosition = -1; 36 | int totalAuthored; 37 | int totalCompleted; 38 | List skills = const[]; 39 | Rank overall; 40 | List langsRank; 41 | 42 | CodeWarsUser(); 43 | 44 | CodeWarsUser.fromJson(Map json) { 45 | username = json['username']; 46 | name = json['name']?.replaceAll(new RegExp("[\n\r]"), "") ?? 'Unknown'; 47 | clan = json['clan']?.replaceAll(new RegExp("[\n\r]"), "") ?? ''; 48 | honor = json['honor']; 49 | leaderboardPosition = json['leaderboardPosition']; 50 | skills = json['skills']; 51 | if (null == skills || skills.isEmpty) skills = const[" no skills found "]; 52 | totalAuthored = json['codeChallenges']['totalAuthored']; 53 | totalCompleted = json['codeChallenges']['totalCompleted']; 54 | var _overall = json['ranks']['overall']; 55 | overall = new Rank(_overall['rank'], _overall['name'], _overall['color'], 56 | _overall['score'], _overall['lang']); 57 | Map _ranks = json['ranks']['languages']; 58 | langsRank = _ranks.keys.map((key) => 59 | new Rank(_ranks[key]['rank'], _ranks[key]['name'], _ranks[key]['color'], 60 | _ranks[key]['score'], key)).toList(); 61 | } 62 | } 63 | 64 | /// 65 | /// represents rank of a single language 66 | /// 67 | class Rank { 68 | int rank; 69 | String name; 70 | String color; 71 | String lang; 72 | int score; 73 | 74 | Rank(this.rank, this.name, this.color, this.score, this.lang); 75 | } 76 | 77 | class KataCompleted { 78 | String id; 79 | String name; 80 | String fullName; 81 | String slug; 82 | String completedAt; 83 | List completedLanguages; 84 | 85 | KataCompleted(this.id, this.name, this.slug, this.completedLanguages, this.completedAt) { 86 | const maxLen = 25; 87 | if (null == id) { 88 | name = "[Deleted Kata]"; 89 | slug = "This kata had been deleted on Code Wars."; 90 | return; 91 | } 92 | if (null == slug) slug = ""; 93 | if (null == name) name = ""; 94 | fullName = name; 95 | if (name.length >= maxLen) name = name.substring(0, maxLen) + "..."; 96 | } 97 | 98 | @override 99 | String toString() => """{"id": "$id","name": "$name","slug": "$slug","completedLanguages": ${completedLanguages.map(( 100 | s) => "\"$s\"")})},"completedAt": "$completedAt"}"""; 101 | 102 | static List fromJson(Map json) { 103 | List ls = json['data']; 104 | return ls.map((m) => 105 | new KataCompleted(m['id'], m['name'], m['slug'], m['completedLanguages'], m['completedAt'])).toList(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /api-reference/code-challenge.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "54750ed320c64c64e20002e2", 3 | "name": "Singletons", 4 | "slug": "singletons", 5 | "category": "reference", 6 | "publishedAt": "2014-11-26T21:51:32Z", 7 | "approvedAt": "2015-07-03T15:21:32Z", 8 | "languages": [ 9 | "haskell" 10 | ], 11 | "url": "https://www.codewars.com/kata/singletons", 12 | "rank": { 13 | "id": -2, 14 | "name": "2 kyu", 15 | "color": "purple" 16 | }, 17 | "createdAt": "2014-11-25T23:20:51Z", 18 | "createdBy": { 19 | "username": "mpickering", 20 | "url": "https://www.codewars.com/users/mpickering" 21 | }, 22 | "approvedBy": { 23 | "username": "jhoffner", 24 | "url": "https://www.codewars.com/users/jhoffner" 25 | }, 26 | "description": "In this kata we will explore using singletons to mimic simple dependent typing\nin Haskell. The goal is to reimplement common list functions using vectors\nindexed by the natural numbers.\n\nUnlike languages such as Agda and Idris, Haskell differentiates between the\nterm and the type level. This distinction makes proper dependent types impossible but GHC language extensions can be used to partially mimic the effect.\n\nThe idea of singletons is to allow the programmer to infer something about the\ntype level from the term level. To do this, we construct a datatype (`SNat`)\nwhose type increments in lock-step with the data. For example:\n\n```\n*Singletons> :t SZero\nSZero :: SNat 'Zero\n*Singletons> :t SSucc SZero\nSSucc SZero :: SNat ('Succ 'Zero)\n```\n\nThis correspondence allows the programmer to specify more specific types than\nhe usually would. The example we will use is indexed vectors - that is, vectors\nwhich are annotated with their length at the type level. Their definition looks very similar to that of lists but with the extra index parameter `n`.\n\n```\ndata Vec a n where\n VNil :: Vec a Zero\n VCons :: a -> Vec a n -> Vec a (Succ n)\n```\n\nAgain inspecting the types - we see that applying the `VCons` constructor changes the type of the whole expression.\n\n```\n*Singletons> :t VNil\nVNil :: Vec a 'Zero\n*Singletons> :t VCons () VNil\nVCons () VNil :: Vec () ('Succ 'Zero)\n```\n\nThe final piece of the puzzle are type families. Simply put, type families are functions which act on types. As a result they are quite a bit more restricted than normal functions but we can use them to perform basic calculations at the type level.\n\nFor example the type family `:<` corresponds to the term level operator `<`. It is defined as follows.\n\n```\ntype family (a :: Nat) :< (b :: Nat) :: Bool\ntype instance m :< Zero = False\ntype instance Zero :< Succ n = True\ntype instance (Succ m) :< (Succ n) = m :< n\n```\n\nIt will be necessary to define two more type families to complete the kata.\n\nPutting this all together, this is how we might define a safe `index` function.\n\n```\nindex :: ((a :< b) ~ True) => SNat a -> Vec s b -> s\nindex SZero (VCons v _) = v\nindex (SSucc n) (VCons _ xs) = index n xs\n```\n\nYour task is to define some common functions which act on lists on an indexed vector. These functions are `map`, `zipWith`, `replicate`, `take`, `drop`, `head`, `tail`, `index` and `++`.\n\nThis description has been quite terse. Here are some more links which take a bit more time to explain the concept.\n\n- [Brent Yorgey's explanation](https://byorgey.wordpress.com/2010/07/06/typed-type-level-programming-in-haskell-part-ii-type-families/)\n- [Dependently Typed Programming with Singletons](http://www.cis.upenn.edu/~eir/papers/2012/singletons/paper.pdf)\n- [GHC wiki page](https://www.haskell.org/haskellwiki/GHC/Type_families)\n\nHINT: You may find defining a type family corresponding to subtraction useful.\nHINT: You may find definining a type family corresponding to `min` useful.\n\n", 27 | "totalAttempts": 1242, 28 | "totalCompleted": 117, 29 | "totalStars": 37, 30 | "voteScore": 39, 31 | "tags": [ 32 | "Fundamentals", 33 | "Dynamic Arrays", 34 | "Arrays", 35 | "Functional Programming", 36 | "Data Types", 37 | "Declarative Programming", 38 | "Programming Paradigms", 39 | "Vectors" 40 | ], 41 | "contributorsWanted": true, 42 | "unresolved": { 43 | "issues": 0, 44 | "suggestions": 1 45 | } 46 | } -------------------------------------------------------------------------------- /lib/view/settings.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:code_wars_android/code_wars/code_wars.dart'; 4 | import 'package:code_wars_android/code_wars/colors.dart'; 5 | import 'package:code_wars_android/util/storage.dart'; 6 | import 'package:url_launcher/url_launcher.dart'; 7 | import 'package:code_wars_android/util/util.dart'; 8 | import 'package:shared_preferences/shared_preferences.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:http/http.dart'; 11 | 12 | class SettingsActivity extends MaterialPageRoute { 13 | SettingsActivity(CodeWarsUser user) : 14 | super(builder: (BuildContext context) => new _SettingsView(user)); 15 | } 16 | 17 | class _SettingsView extends StatefulWidget { 18 | static const String _title = "Settings"; 19 | final CodeWarsUser _user; 20 | 21 | _SettingsView(this._user); 22 | 23 | @override 24 | State createState() => new _SettingsState(_title, _user); 25 | } 26 | 27 | // ignore: must_be_immutable 28 | class _SettingsState extends State<_SettingsView> { 29 | CodeWarsUser _user; 30 | String _title = "Settings"; 31 | static final Color _textColor = CodeWarsColors.notSoImportant.shade800; 32 | static final Color _titleColor = CodeWarsColors.notSoImportant.shade100; 33 | TextEditingController _usernameEditingController; 34 | 35 | _SettingsState(this._title, this._user); 36 | 37 | _performChangeUser(String _json) { 38 | try { 39 | Map json = new JsonDecoder(null).convert(_json); 40 | var reason = json['reason']; 41 | _user = null != reason ? null : new CodeWarsUser.fromJson(json); 42 | } catch (e) { 43 | _json = CodeWarsAPI.getErrorWithReason("invalid"); 44 | } 45 | } 46 | 47 | _pop() => Navigator.canPop(context) ? Navigator.pop(context) : null; 48 | 49 | _changeUserName() { 50 | var dialog = new SimpleDialog( 51 | contentPadding: new EdgeInsets.all(20.0), 52 | children: [ 53 | new TextFormField( 54 | decoration: const InputDecoration( 55 | hintText: "Click OK to submit", 56 | labelText: "New user name"), 57 | maxLines: 1, 58 | controller: _usernameEditingController), 59 | new FlatButton(onPressed: () { 60 | Navigator.pop(context); 61 | showDialog(context: context, child: new RefreshProgressDialog( 62 | CodeWarsColors.main.shade100, width: 100, height: 100), 63 | barrierDismissible: false); 64 | get(CodeWarsAPI.getUser(_usernameEditingController.text)) 65 | ..then((val) { 66 | setState(() => _performChangeUser(val.body)); 67 | SharedPreferences.getInstance().then((sp) { 68 | sp.setString(DatabaseKeys.USER, val.body); 69 | }); 70 | _pop(); 71 | }) 72 | ..timeout(new Duration(seconds: 10), onTimeout: () { 73 | SharedPreferences.getInstance().then((sp) { 74 | sp.setString(DatabaseKeys.USER, CodeWarsAPI 75 | .getErrorWithReason("time out")); 76 | }); 77 | setState(() { 78 | _user = null; 79 | _pop(); 80 | }); 81 | }); 82 | }, child: new Text("OK", 83 | style: new TextStyle(color: _textColor))), 84 | ], title: new Text("Reset your username", 85 | style: new TextStyle(color: _textColor)),); 86 | showDialog(context: context, child: dialog); 87 | } 88 | 89 | @override 90 | void dispose() { 91 | _usernameEditingController.dispose(); 92 | super.dispose(); 93 | } 94 | 95 | @override 96 | void initState() { 97 | super.initState(); 98 | _usernameEditingController = new TextEditingController(); 99 | } 100 | 101 | @override 102 | Widget build(BuildContext context) { 103 | List list = [ 104 | new ListTile( 105 | title: new Text("Change user name", 106 | style: new TextStyle( 107 | fontSize: 16.0, 108 | color: _textColor)), 109 | subtitle: new Text( 110 | _user?.username ?? "Unknown", 111 | style: new TextStyle( 112 | fontSize: 14.0, 113 | color: _textColor)), 114 | dense: true, 115 | trailing: new IconButton( 116 | icon: new Icon(Icons.edit), 117 | onPressed: _changeUserName)), 118 | new ExpansionTile( 119 | title: new Text("App info", 120 | style: new TextStyle( 121 | fontSize: 16.0, 122 | color: _textColor)), 123 | children: [ 124 | new ListTile( 125 | dense: true, 126 | title: new Text("Source on GitHub", 127 | style: new TextStyle( 128 | fontSize: 14.0, 129 | color: _textColor)), 130 | onTap: () => _viewWeb('https://github.com/ice1000/code_wars_android')), 131 | new ListTile( 132 | dense: true, 133 | title: new Text("License", 134 | style: new TextStyle( 135 | fontSize: 14.0, 136 | color: _textColor)), 137 | onTap: () { 138 | showDialog( 139 | context: context, 140 | child: new SimpleDialog( 141 | title: new Text( 142 | "License", 143 | style: new TextStyle(color: _textColor)), 144 | contentPadding: new EdgeInsets.all(12.0), 145 | children: [ 146 | new Text( 147 | GPLv3, 148 | style: new TextStyle(color: _textColor)) 149 | ])); 150 | }), 151 | new ListTile( 152 | dense: true, 153 | title: new Text("Open CodeWars", 154 | style: new TextStyle( 155 | fontSize: 14.0, 156 | color: _textColor)), 157 | onTap: () => _viewWeb('https://www.codewars.com/')), 158 | ]) 159 | ]; 160 | return new Scaffold( 161 | appBar: new AppBar( 162 | title: new Text( 163 | _title, 164 | style: new TextStyle( 165 | color: _titleColor))), 166 | backgroundColor: CodeWarsColors.main.shade50, 167 | body: new ListView( 168 | primary: false, 169 | children: list, 170 | shrinkWrap: true)); 171 | } 172 | 173 | _viewWeb(String url) async { 174 | if (await canLaunch(url)) await launch(url); 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /lib/view/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:code_wars_android/code_wars/code_wars.dart'; 4 | import 'package:code_wars_android/code_wars/colors.dart'; 5 | import 'package:code_wars_android/util/storage.dart'; 6 | import 'package:code_wars_android/util/util.dart'; 7 | import 'package:code_wars_android/view/completed.dart'; 8 | import 'package:code_wars_android/view/one_page_dialog.dart'; 9 | import 'package:code_wars_android/view/settings.dart'; 10 | import 'package:flutter/material.dart'; 11 | import 'package:http/http.dart'; 12 | import 'package:shared_preferences/shared_preferences.dart'; 13 | 14 | // ignore: must_be_immutable 15 | class Application extends StatelessWidget { 16 | var mainTitle = 'Code Wars'; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return new MaterialApp( 21 | title: mainTitle, 22 | theme: new ThemeData(primarySwatch: CodeWarsColors.main), 23 | home: new _MainView(mainTitle), 24 | ); 25 | } 26 | } 27 | 28 | class _Page { 29 | _Page({ 30 | this.displayWhenEmpty, 31 | this.icon, 32 | this.information, 33 | this.child, 34 | this.tabLabel, 35 | this.onClick 36 | }); 37 | 38 | String displayWhenEmpty; 39 | final String tabLabel; 40 | final MaterialColor colors = CodeWarsColors.important; 41 | final IconData icon; 42 | final String information; 43 | Widget child; 44 | VoidCallback onClick; 45 | 46 | Color get labelColor => colors.shade500; 47 | 48 | bool get fabHere => null != icon; 49 | 50 | Color get fabColor => colors.shade700; 51 | 52 | Icon get createIcon => new Icon(icon); 53 | 54 | Key get fabKey => new ValueKey(fabColor); 55 | 56 | Widget get childWight => 57 | child ?? new Card( 58 | color: CodeWarsColors.main.shade300, 59 | child: new Center(child: new Text(displayWhenEmpty, 60 | style: new TextStyle(color: labelColor, fontSize: 32.0), 61 | textAlign: TextAlign.center))); 62 | } 63 | 64 | class _MainView extends StatefulWidget { 65 | final String _title; 66 | 67 | _MainView(this._title); 68 | 69 | @override 70 | _MainActivity createState() => new _MainActivity(_title); 71 | } 72 | 73 | class _MainActivity extends State<_MainView> 74 | with SingleTickerProviderStateMixin { 75 | final _scaffoldKey = new GlobalKey(); 76 | static final Color _background = CodeWarsColors.main.shade50; 77 | static final Color _textColor = CodeWarsColors.notSoImportant.shade600; 78 | static final Color _importantColor = CodeWarsColors.notSoImportant.shade800; 79 | final String _title; 80 | List<_Page> _allPages; 81 | TextEditingController _friendNameController; 82 | bool _isRefreshingNewFriend = false; 83 | _Page _friends; 84 | _Page _kata; 85 | _Page _me; 86 | TabController _tabController; 87 | CodeWarsUser _user; 88 | CodeWarsUser _refreshingFriend; 89 | List _friendUsers = []; 90 | List _completedCache; 91 | _Page _selectedPage; 92 | 93 | _MainActivity(this._title); 94 | 95 | _changeTheBossOfThisGym() { 96 | SharedPreferences.getInstance().then((sp) { 97 | _performChangeUser(sp.getString(DatabaseKeys.USER) ?? 98 | CodeWarsAPI.getErrorWithReason("not set")); 99 | List us = sp.getStringList(DatabaseKeys.FRIENDS) ?? []; 100 | _performChangeFriends(us.map((s) => sp.getString(DatabaseKeys.friendData(s))).toList()); 101 | }); 102 | } 103 | 104 | _pop() => Navigator.canPop(context) ? Navigator.pop(context) : null; 105 | 106 | @override 107 | void initState() { 108 | super.initState(); 109 | _changeTheBossOfThisGym(); 110 | _friendNameController = new TextEditingController(); 111 | _friends = new _Page( 112 | displayWhenEmpty: 'Friends', 113 | // 还有这种friend? 114 | tabLabel: 'Friends', 115 | information: "Add friend",); 116 | _kata = new _Page( 117 | displayWhenEmpty: 'Kata', 118 | tabLabel: 'Kata', 119 | information: "Refresh",); 120 | _me = new _Page( 121 | displayWhenEmpty: 'Go there ↗ to specify a user.', 122 | tabLabel: 'Me', 123 | icon: Icons.refresh, 124 | onClick: () { 125 | if (null != _user) { 126 | showDialog(context: context, child: new RefreshProgressDialog( 127 | CodeWarsColors.main.shade100, width: 100, height: 100), 128 | barrierDismissible: false); 129 | get(CodeWarsAPI.getUser(_user.username)) 130 | ..then((val) { 131 | _performChangeUser(val.body); 132 | SharedPreferences.getInstance().then((sp) { 133 | sp.setString(DatabaseKeys.USER, val.body); 134 | }); 135 | _pop(); 136 | }) 137 | ..timeout(new Duration(seconds: 10)) 138 | ..catchError(() { 139 | SharedPreferences.getInstance().then((sp) { 140 | sp.setString(DatabaseKeys.USER, CodeWarsAPI 141 | .getErrorWithReason("time out")); 142 | }); 143 | setState(() => _user = null); 144 | _pop(); 145 | }); 146 | } 147 | }, 148 | information: "Refresh",); 149 | _allPages = <_Page>[_friends, _kata, _me]; 150 | _tabController = new TabController(vsync: this, length: _allPages.length); 151 | _tabController.addListener(_handleTabSelection); 152 | _selectedPage = _allPages.first; 153 | } 154 | 155 | @override 156 | void dispose() { 157 | _tabController.dispose(); 158 | _friendNameController.dispose(); 159 | super.dispose(); 160 | } 161 | 162 | _handleTabSelection() => setState(() => _selectedPage = _allPages[_tabController.index]); 163 | 164 | Widget buildTabView(_Page page) => 165 | new Container( 166 | key: new ValueKey(page.tabLabel), color: _background, 167 | padding: const EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 32.0), 168 | child: page.childWight); 169 | 170 | /// errors handled. 171 | /// please use [onError] to custom your error handle code 172 | CodeWarsUser _json2user(String _json, {onError: Function}) { 173 | try { 174 | Map json = new JsonDecoder(null).convert(_json); 175 | var reason = json['reason']; 176 | if (null != reason) { 177 | setState(() => onError(reason)); 178 | return null; 179 | } else 180 | return new CodeWarsUser.fromJson(json); 181 | } catch (e) { 182 | if (onError != null) setState(() => onError(e)); 183 | return null; 184 | } 185 | } 186 | 187 | _performChangeUser(String _json) { 188 | CodeWarsUser user = _json2user(_json, onError: (msg) => _me.displayWhenEmpty = msg); 189 | setState(() => _user = user); 190 | } 191 | 192 | _performChangeFriends(List _allJson) { 193 | var all = _allJson 194 | .map(_json2user) 195 | .where((o) => null != o); 196 | setState(() => all.forEach(_friendUsers.add)); 197 | } 198 | 199 | bool _addFriend(String _json) { 200 | print(_json); 201 | CodeWarsUser friend = _json2user(_json); 202 | if (null != friend) { 203 | _friendUsers.add(friend); 204 | SharedPreferences.getInstance().then((sp) { 205 | sp.setStringList(DatabaseKeys.FRIENDS, _friendUsers.map((obj) => obj.username).toList()); 206 | sp.setString(DatabaseKeys.friendData(friend.username), _json); 207 | sp.commit(); 208 | }); 209 | return true; 210 | } 211 | return false; 212 | } 213 | 214 | List _getUserInfoView(CodeWarsUser _user) { 215 | return [ 216 | new ListTile( 217 | title: new Text( 218 | _user.name, 219 | style: new TextStyle( 220 | color: _textColor, 221 | fontSize: 32.0)), 222 | trailing: new Text( 223 | "\n${_user.username}", 224 | style: new TextStyle( 225 | color: _textColor, 226 | fontSize: 16.0))), 227 | new ListTile( 228 | title: new Text( 229 | "\n${_user.clan}", 230 | style: new TextStyle( 231 | color: _textColor, 232 | fontSize: 16.0))), 233 | const ListTile(), 234 | new ListTile( 235 | trailing: new Text( 236 | "${_user.honor}", 237 | style: new TextStyle( 238 | color: _importantColor, 239 | fontSize: 22.0)), 240 | title: new Text( 241 | "Honor", 242 | style: new TextStyle( 243 | color: _importantColor, 244 | fontSize: 20.0))), 245 | new ListTile( 246 | trailing: new Text( 247 | "${_user.leaderboardPosition}", 248 | style: new TextStyle( 249 | color: _importantColor, 250 | fontSize: 22.0)), 251 | title: new Text( 252 | "LeaderBoard Rank", 253 | style: new TextStyle( 254 | color: _importantColor, 255 | fontSize: 20.0))), 256 | const ListTile(), 257 | new ListTile( 258 | title: new Text("Overall", 259 | style: new TextStyle( 260 | color: _textColor, 261 | fontSize: 24.0))), 262 | new ListTile( 263 | title: new Text( 264 | "Score: ${_user.overall.score}", 265 | style: new TextStyle( 266 | color: _importantColor, 267 | fontSize: 20.0)), 268 | trailing: new Text( 269 | "<${_user.overall.name}>", 270 | style: new TextStyle( 271 | color: _importantColor, 272 | fontSize: 20.0)), 273 | dense: true), 274 | const ListTile(), 275 | new ListTile( 276 | title: new Text( 277 | "Skills:", 278 | style: new TextStyle( 279 | color: _textColor, 280 | fontSize: 24.0))), 281 | new ListTile( 282 | title: new ListView( 283 | scrollDirection: Axis.horizontal, 284 | children: _user.skills.map((f) => 285 | new Card( 286 | elevation: 1.5, 287 | color: _textColor, 288 | child: new Text( 289 | " $f ", 290 | style: new TextStyle( 291 | color: _background, 292 | fontSize: 16.0)))).toList())), 293 | const ListTile(), 294 | new ListTile( 295 | title: new Text( 296 | "Challenges", 297 | style: new TextStyle( 298 | color: _textColor, 299 | fontSize: 24.0))), 300 | new ListTile( 301 | trailing: new Text( 302 | "${_user.totalAuthored}", 303 | style: new TextStyle( 304 | color: _importantColor, 305 | fontSize: 20.0)), 306 | title: new Text( 307 | "Authored", 308 | style: new TextStyle( 309 | color: _importantColor, 310 | fontSize: 18.0))), 311 | new ListTile( 312 | trailing: new Text( 313 | "${_user.totalCompleted}", 314 | style: new TextStyle( 315 | color: _importantColor, 316 | fontSize: 20.0)), 317 | title: new Text( 318 | "Completed", 319 | style: new TextStyle( 320 | color: _importantColor, 321 | fontSize: 18.0))), 322 | const ListTile(), 323 | new ListTile( 324 | title: new Text( 325 | "Languages", 326 | style: new TextStyle( 327 | color: _textColor, 328 | fontSize: 24.0))), 329 | ]; 330 | } 331 | 332 | List _fullUserInfoView(CodeWarsUser _user) { 333 | List list = _getUserInfoView(_user); 334 | list.add(new ListTile( 335 | dense: true, 336 | title: new Text("total count", 337 | style: new TextStyle( 338 | color: _importantColor, 339 | fontSize: 20.0)), 340 | trailing: new Text("${_user.langsRank.length}", 341 | style: new TextStyle( 342 | color: _importantColor, 343 | fontSize: 20.0)), 344 | )); 345 | _user.langsRank.forEach((rank) { 346 | list.add(new ListTile( 347 | dense: true, 348 | title: new Text( 349 | "${rank.lang}\n", 350 | style: new TextStyle( 351 | color: _importantColor, 352 | fontSize: 18.0)), 353 | trailing: new Text( 354 | "${rank.score} <${rank.name}>", 355 | style: new TextStyle( 356 | color: _importantColor, 357 | fontSize: 14.0)))); 358 | }); 359 | list.add(const ListTile()); 360 | list.add(const ListTile()); 361 | return list; 362 | } 363 | 364 | @override 365 | Widget build(BuildContext context) { 366 | if (null != _user) { 367 | _completedCache = new List(_user.totalCompleted ~/ 200 + 1); 368 | _me.child = new ListView( 369 | padding: new EdgeInsets.symmetric(vertical: 0.0), 370 | primary: false, 371 | itemExtent: 30.0, 372 | children: _fullUserInfoView(_user)); 373 | _kata.child = new Scrollbar(child: new ListView( 374 | primary: false, 375 | padding: new EdgeInsets.symmetric(vertical: 8.0), 376 | children: new List.generate(_completedCache.length, (page) => 377 | new ListTile(onTap: () { 378 | if (null != _user) { 379 | showDialog(context: context, child: new RefreshProgressDialog( 380 | CodeWarsColors.main.shade100, width: 100, height: 100), 381 | barrierDismissible: false); 382 | if (null == _completedCache[page]) 383 | get(CodeWarsAPI.getCompletedKataPaginated(_user.username, page)) 384 | ..then((val) { 385 | _pop(); 386 | _completedCache[page] = val.body; 387 | Navigator.of(context).push(new CompletedActivity(val.body, page)); 388 | }) 389 | ..timeout(new Duration(seconds: 10)) 390 | ..catchError(_pop); 391 | else 392 | Navigator.of(context).push(new CompletedActivity(_completedCache[page], page)); 393 | } 394 | }, title: new Text("Completed ${page * 200 + 1} ~ ${(page + 1) * 200}"))), 395 | shrinkWrap: true, 396 | )); 397 | } 398 | List _friendsView = _friendUsers.map((user) => 399 | new ExpansionTile( 400 | leading: new IconButton( 401 | icon: new Icon(_refreshingFriend == user ? Icons.adjust : Icons.refresh), 402 | onPressed: () { 403 | setState(() => _refreshingFriend = user); 404 | get(CodeWarsAPI.getUser(user.username)) 405 | ..then((val) { 406 | int index = _friendUsers.indexOf(user); 407 | CodeWarsUser u = _json2user(val.body); 408 | setState(() { 409 | _friendUsers.removeAt(index); 410 | _friendUsers.insert(index, u); 411 | _refreshingFriend = null; 412 | }); 413 | SharedPreferences.getInstance().then((sp) { 414 | sp.setString(DatabaseKeys.friendData(user.username), val.body); 415 | sp.commit(); 416 | }); 417 | }) 418 | ..timeout(new Duration(seconds: 10)) 419 | ..catchError(() { 420 | _pop(); 421 | setState(() => _refreshingFriend = null); 422 | }); 423 | },), 424 | title: new ListTile( 425 | title: new Text( 426 | user.name, 427 | style: new TextStyle( 428 | color: _importantColor, 429 | fontSize: 20.0),), 430 | trailing: new Text("<${user.overall.name}>"),), 431 | children: [ 432 | new ListTile( 433 | title: new Text("Honor: ${user.honor}"), 434 | trailing: new Text("Rank: ${user.leaderboardPosition}"),), 435 | new ListTile(title: new FlatButton( 436 | child: new Text( 437 | "Delete", 438 | style: new TextStyle(color: Colors.red),), 439 | onPressed: () { 440 | setState(() => _friendUsers.remove(user)); 441 | SharedPreferences.getInstance().then((sp) { 442 | sp.setStringList(DatabaseKeys.FRIENDS, _friendUsers.map((u) => u.username)); 443 | sp.commit(); 444 | }); 445 | }),), 446 | new ListTile(title: new FlatButton( 447 | child: new Text( 448 | "Details", 449 | style: new TextStyle(color: Colors.blue.shade400),), 450 | onPressed: () { 451 | Navigator.of(context).push(new OnePageActivity(new ListView( 452 | padding: new EdgeInsets.symmetric(vertical: 16.0), 453 | primary: false, 454 | itemExtent: 30.0, 455 | children: _fullUserInfoView(user)))); 456 | }),), 457 | ],)).toList(); 458 | _friendsView.add(new ListTile( 459 | isThreeLine: true, 460 | dense: true, 461 | subtitle: const ListTile(), 462 | title: new TextFormField( 463 | maxLines: 1, 464 | controller: _friendNameController, 465 | decoration: const InputDecoration( 466 | hintText: "Friend's username", 467 | isDense: true, 468 | labelText: "Add new..."),), 469 | trailing: new IconButton( 470 | tooltip: "Add friend", 471 | icon: new Icon(_isRefreshingNewFriend ? Icons.adjust : Icons.done), 472 | onPressed: () { 473 | setState(() => _isRefreshingNewFriend = true); 474 | get(CodeWarsAPI.getUser(_friendNameController.text)) 475 | ..then((val) { 476 | setState(() => _isRefreshingNewFriend = false); 477 | if (!_addFriend(val.body)) 478 | showDialog(context: context, child: new SimpleDialog( 479 | title: new Text("Error"), 480 | children: [ 481 | new Text("Sorry, user not found") 482 | ],)); 483 | }) 484 | ..timeout(new Duration(seconds: 10)) 485 | ..catchError(() { 486 | _pop(); 487 | setState(() => _isRefreshingNewFriend = false); 488 | }); 489 | },),)); 490 | _friendsView.add(const ListTile()); 491 | _friends.child = new ListView( 492 | primary: false, 493 | padding: new EdgeInsets.symmetric(vertical: 16.0), 494 | shrinkWrap: true, 495 | children: _friendsView, 496 | ); 497 | return new Scaffold( 498 | key: _scaffoldKey, 499 | appBar: new AppBar( 500 | title: new Text(_title), 501 | actions: [ 502 | new IconButton( 503 | icon: new Icon(Icons.settings), 504 | onPressed: () => 505 | Navigator.of(context).push(new SettingsActivity(_user)).then((_) => 506 | setState(_changeTheBossOfThisGym))), 507 | // new IconButton(icon: new Icon(Icons.bug_report), onPressed: () { 508 | // SharedPreferences.getInstance().then((v) { 509 | // print(v.getStringList(DatabaseKeys.FRIENDS).join(",")); 510 | // print(v.getString(DatabaseKeys.friendData("lolisa"))); 511 | // }); 512 | // }), 513 | ], 514 | bottom: new TabBar( 515 | controller: _tabController, 516 | tabs: _allPages.map((_Page page) => new Tab(text: page.tabLabel)).toList(),)), 517 | floatingActionButton: !_selectedPage.fabHere ? null 518 | : new FloatingActionButton( 519 | key: _selectedPage.fabKey, 520 | tooltip: _selectedPage.information, 521 | backgroundColor: _selectedPage.fabColor, 522 | child: _selectedPage.createIcon, 523 | onPressed: _selectedPage.onClick), 524 | body: new TabBarView( 525 | controller: _tabController, 526 | children: _allPages.map(buildTabView).toList()),); 527 | } 528 | } 529 | -------------------------------------------------------------------------------- /api-reference/completed.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "id": "54750ed320c64c64e20002e2", 5 | "name": "Singletons", 6 | "slug": "singletons", 7 | "completedLanguages": [ 8 | "haskell" 9 | ], 10 | "completedAt": "2017-05-25T15:24:45Z" 11 | }, 12 | { 13 | "id": "580a094553bd9ec5d800007d", 14 | "name": "Alan Partridge II - Apple Turnover", 15 | "slug": "alan-partridge-ii-apple-turnover", 16 | "completedLanguages": [ 17 | "haskell" 18 | ], 19 | "completedAt": "2017-05-25T10:21:33Z" 20 | }, 21 | { 22 | "id": "5808c8eff0ed4210de000008", 23 | "name": "Alan Partridge I - Partridge Watch", 24 | "slug": "alan-partridge-i-partridge-watch", 25 | "completedLanguages": [ 26 | "haskell" 27 | ], 28 | "completedAt": "2017-05-25T10:18:35Z" 29 | }, 30 | { 31 | "id": "580a41b6d6df740d6100030c", 32 | "name": "Alan Partridge III - London", 33 | "slug": "alan-partridge-iii-london", 34 | "completedLanguages": [ 35 | "haskell" 36 | ], 37 | "completedAt": "2017-05-25T10:10:44Z" 38 | }, 39 | { 40 | "id": "56a1c074f87bc2201200002e", 41 | "name": "How many are smaller than me?", 42 | "slug": "how-many-are-smaller-than-me", 43 | "completedLanguages": [ 44 | "haskell" 45 | ], 46 | "completedAt": "2017-05-25T10:05:12Z" 47 | }, 48 | { 49 | "id": "5326ef17b7320ee2e00001df", 50 | "name": "Escape the Mines !", 51 | "slug": "escape-the-mines", 52 | "completedLanguages": [ 53 | "haskell" 54 | ], 55 | "completedAt": "2017-05-25T04:39:32Z" 56 | }, 57 | { 58 | "id": "55d1d6d5955ec6365400006d", 59 | "name": "Round to the next 5.", 60 | "slug": "round-to-the-next-5", 61 | "completedLanguages": [ 62 | "haskell" 63 | ], 64 | "completedAt": "2017-05-25T00:33:29Z" 65 | }, 66 | { 67 | "id": "58702c0ca44cfc50dc000245", 68 | "name": "Pig Atinlay", 69 | "slug": "pig-atinlay", 70 | "completedLanguages": [ 71 | "haskell" 72 | ], 73 | "completedAt": "2017-05-25T00:28:30Z" 74 | }, 75 | { 76 | "id": "525f50e3b73515a6db000b83", 77 | "name": "Create Phone Number", 78 | "slug": "create-phone-number", 79 | "completedLanguages": [ 80 | "haskell" 81 | ], 82 | "completedAt": "2017-05-25T00:25:38Z" 83 | }, 84 | { 85 | "id": "57a049e253ba33ac5e000212", 86 | "name": "Factorial", 87 | "slug": "factorial-1", 88 | "completedLanguages": [ 89 | "haskell" 90 | ], 91 | "completedAt": "2017-05-24T15:51:43Z" 92 | }, 93 | { 94 | "id": "521c2db8ddc89b9b7a0000c1", 95 | "name": "Snail", 96 | "slug": "snail", 97 | "completedLanguages": [ 98 | "haskell" 99 | ], 100 | "completedAt": "2017-05-24T15:41:16Z" 101 | }, 102 | { 103 | "id": "55da6c52a94744b379000036", 104 | "name": "Sum up the random string", 105 | "slug": "sum-up-the-random-string", 106 | "completedLanguages": [ 107 | "haskell" 108 | ], 109 | "completedAt": "2017-05-24T15:24:56Z" 110 | }, 111 | { 112 | "id": "525f277c7103571f47000147", 113 | "name": "Finding an appointment", 114 | "slug": "finding-an-appointment", 115 | "completedLanguages": [ 116 | "haskell" 117 | ], 118 | "completedAt": "2017-05-24T14:31:19Z" 119 | }, 120 | { 121 | "id": "55c28f7304e3eaebef0000da", 122 | "name": "Unfinished Loop - Bug Fixing #1", 123 | "slug": "unfinished-loop-bug-fixing-number-1", 124 | "completedLanguages": [ 125 | "haskell" 126 | ], 127 | "completedAt": "2017-05-24T13:41:56Z" 128 | }, 129 | { 130 | "id": "5917f22dd2563a36a200009c", 131 | "name": "Algebraic Isomorphism", 132 | "slug": "algebraic-isomorphism", 133 | "completedLanguages": [ 134 | "haskell" 135 | ], 136 | "completedAt": "2017-05-22T16:39:14Z" 137 | }, 138 | { 139 | "id": "5922543bf9c15705d0000020", 140 | "name": "Isomorphism", 141 | "slug": "isomorphism", 142 | "completedLanguages": [ 143 | "haskell" 144 | ], 145 | "completedAt": "2017-05-22T14:17:38Z" 146 | }, 147 | { 148 | "id": "554e4a2f232cdd87d9000038", 149 | "name": "Complementary DNA", 150 | "slug": "complementary-dna", 151 | "completedLanguages": [ 152 | "haskell" 153 | ], 154 | "completedAt": "2017-05-21T09:34:07Z" 155 | }, 156 | { 157 | "id": "57a19defbb994481c40001bd", 158 | "name": "Number factors", 159 | "slug": "number-factors-1", 160 | "completedLanguages": [ 161 | "haskell" 162 | ], 163 | "completedAt": "2017-05-21T09:30:17Z" 164 | }, 165 | { 166 | "id": "57a34e2b53ba33994d000668", 167 | "name": "Correct movie title", 168 | "slug": "correct-movie-title", 169 | "completedLanguages": [ 170 | "haskell" 171 | ], 172 | "completedAt": "2017-05-21T09:28:31Z" 173 | }, 174 | { 175 | "id": "58424c2e5692f50715000080", 176 | "name": "Perimeter of a Rectangle", 177 | "slug": "perimeter-of-a-rectangle", 178 | "completedLanguages": [ 179 | "haskell" 180 | ], 181 | "completedAt": "2017-05-21T09:21:52Z" 182 | }, 183 | { 184 | "id": "57e8e9df2aee49c0280009ab", 185 | "name": "Holiday I - Temperature in Bali", 186 | "slug": "holiday-i-temperature-in-bali", 187 | "completedLanguages": [ 188 | "haskell" 189 | ], 190 | "completedAt": "2017-05-21T09:16:10Z" 191 | }, 192 | { 193 | "id": "546274b0eaa31f79c9000d5d", 194 | "name": "Anagram or not", 195 | "slug": "anagram-or-not", 196 | "completedLanguages": [ 197 | "haskell" 198 | ], 199 | "completedAt": "2017-05-21T07:10:35Z" 200 | }, 201 | { 202 | "id": "545a4c5a61aa4c6916000755", 203 | "name": "Find the middle element", 204 | "slug": "find-the-middle-element", 205 | "completedLanguages": [ 206 | "haskell" 207 | ], 208 | "completedAt": "2017-05-21T07:02:01Z" 209 | }, 210 | { 211 | "id": "54474afb46324f45190000a5", 212 | "name": "Flattening Lists", 213 | "slug": "flattening-lists", 214 | "completedLanguages": [ 215 | "haskell" 216 | ], 217 | "completedAt": "2017-05-21T06:56:10Z" 218 | }, 219 | { 220 | "id": "55f81f9aa51f9b72a200002f", 221 | "name": "Find the unique number", 222 | "slug": "find-the-unique-number", 223 | "completedLanguages": [ 224 | "haskell" 225 | ], 226 | "completedAt": "2017-05-21T06:54:39Z" 227 | }, 228 | { 229 | "id": "56d0a591c6c8b466ca00118b", 230 | "name": "Beginner Series #5 Triangular Numbers", 231 | "slug": "beginner-series-number-5-triangular-numbers", 232 | "completedLanguages": [ 233 | "haskell" 234 | ], 235 | "completedAt": "2017-05-21T06:51:20Z" 236 | }, 237 | { 238 | "id": "57a1a89fcf1fa56b8600154a", 239 | "name": "Get n first prime numbers", 240 | "slug": "get-n-first-prime-numbers", 241 | "completedLanguages": [ 242 | "haskell" 243 | ], 244 | "completedAt": "2017-05-21T06:18:49Z" 245 | }, 246 | { 247 | "id": "537529f42993de0e0b00181f", 248 | "name": "Calculate number of inversions in array", 249 | "slug": "calculate-number-of-inversions-in-array", 250 | "completedLanguages": [ 251 | "haskell" 252 | ], 253 | "completedAt": "2017-05-21T06:12:59Z" 254 | }, 255 | { 256 | "id": "56662e268c0797cece0000bb", 257 | "name": "SumFibs", 258 | "slug": "sumfibs", 259 | "completedLanguages": [ 260 | "haskell" 261 | ], 262 | "completedAt": "2017-05-21T04:44:44Z" 263 | }, 264 | { 265 | "id": "5546180ca783b6d2d5000062", 266 | "name": "Squares sequence", 267 | "slug": "squares-sequence", 268 | "completedLanguages": [ 269 | "haskell" 270 | ], 271 | "completedAt": "2017-05-21T04:40:07Z" 272 | }, 273 | { 274 | "id": "5637b03c6be7e01d99000046", 275 | "name": "Password maker", 276 | "slug": "password-maker", 277 | "completedLanguages": [ 278 | "haskell" 279 | ], 280 | "completedAt": "2017-05-21T04:36:25Z" 281 | }, 282 | { 283 | "id": "57da675dfa96908b16000040", 284 | "name": "Maybe - concat 2 maybe's", 285 | "slug": "maybe-concat-2-maybes", 286 | "completedLanguages": [ 287 | "haskell" 288 | ], 289 | "completedAt": "2017-05-21T04:28:20Z" 290 | }, 291 | { 292 | "id": "56b1eb19247c01493a000065", 293 | "name": "Unique Sum", 294 | "slug": "unique-sum", 295 | "completedLanguages": [ 296 | "haskell" 297 | ], 298 | "completedAt": "2017-05-21T04:20:03Z" 299 | }, 300 | { 301 | "id": "57a1e23853ba339caf001000", 302 | "name": "Uppercase all vowels", 303 | "slug": "uppercase-all-vowels", 304 | "completedLanguages": [ 305 | "haskell" 306 | ], 307 | "completedAt": "2017-05-21T04:18:56Z" 308 | }, 309 | { 310 | "id": "57da7f901b5ff148ad00030d", 311 | "name": "Sum of list of Integer Just's and Nothing's", 312 | "slug": "sum-of-list-of-integer-justs-and-nothings", 313 | "completedLanguages": [ 314 | "haskell" 315 | ], 316 | "completedAt": "2017-05-21T04:08:19Z" 317 | }, 318 | { 319 | "id": "57da7ca63150b02e6400026b", 320 | "name": "Sum of list of Integer Just's", 321 | "slug": "sum-of-list-of-integer-justs", 322 | "completedLanguages": [ 323 | "haskell" 324 | ], 325 | "completedAt": "2017-05-21T04:03:53Z" 326 | }, 327 | { 328 | "id": "57a1a3f153ba3315140013d5", 329 | "name": "Is prime number?", 330 | "slug": "is-prime-number", 331 | "completedLanguages": [ 332 | "haskell" 333 | ], 334 | "completedAt": "2017-05-21T03:57:41Z" 335 | }, 336 | { 337 | "id": "57a8873cbb99449e300000ba", 338 | "name": "Find max recursively", 339 | "slug": "find-max-recursively", 340 | "completedLanguages": [ 341 | "haskell" 342 | ], 343 | "completedAt": "2017-05-21T03:54:37Z" 344 | }, 345 | { 346 | "id": "57cc981a58da9e302a000214", 347 | "name": "Small enough? - Beginner", 348 | "slug": "small-enough-beginner", 349 | "completedLanguages": [ 350 | "haskell" 351 | ], 352 | "completedAt": "2017-05-21T03:53:14Z" 353 | }, 354 | { 355 | "id": "583872e3c233416868000162", 356 | "name": "How low do you go?", 357 | "slug": "how-low-do-you-go", 358 | "completedLanguages": [ 359 | "haskell" 360 | ], 361 | "completedAt": "2017-05-21T03:52:08Z" 362 | }, 363 | { 364 | "id": "57a0515f53ba33ac5e000245", 365 | "name": "Sum of list values", 366 | "slug": "sum-of-list-values", 367 | "completedLanguages": [ 368 | "haskell" 369 | ], 370 | "completedAt": "2017-05-21T03:50:44Z" 371 | }, 372 | { 373 | "id": "5893f03c779ce5faab0000f6", 374 | "name": "Simple Fun #66: Obtain Max Number", 375 | "slug": "simple-fun-number-66-obtain-max-number", 376 | "completedLanguages": [ 377 | "haskell" 378 | ], 379 | "completedAt": "2017-05-21T03:40:36Z" 380 | }, 381 | { 382 | "id": "5715eaedb436cf5606000381", 383 | "name": "Sum of positive", 384 | "slug": "sum-of-positive", 385 | "completedLanguages": [ 386 | "haskell" 387 | ], 388 | "completedAt": "2017-05-20T19:41:25Z" 389 | }, 390 | { 391 | "id": "54147087d5c2ebe4f1000805", 392 | "name": "The 'if' function", 393 | "slug": "the-if-function", 394 | "completedLanguages": [ 395 | "haskell" 396 | ], 397 | "completedAt": "2017-05-20T19:40:31Z" 398 | }, 399 | { 400 | "id": "5556282156230d0e5e000089", 401 | "name": "DNA to RNA Conversion", 402 | "slug": "dna-to-rna-conversion", 403 | "completedLanguages": [ 404 | "haskell" 405 | ], 406 | "completedAt": "2017-05-20T19:38:27Z" 407 | }, 408 | { 409 | "id": "57a386117cb1f31890000039", 410 | "name": "Parse float", 411 | "slug": "parse-float", 412 | "completedLanguages": [ 413 | "haskell" 414 | ], 415 | "completedAt": "2017-05-20T19:36:52Z" 416 | }, 417 | { 418 | "id": "57eae65a4321032ce000002d", 419 | "name": "Fake Binary", 420 | "slug": "fake-binary", 421 | "completedLanguages": [ 422 | "haskell" 423 | ], 424 | "completedAt": "2017-05-20T19:30:28Z" 425 | }, 426 | { 427 | "id": "56bc28ad5bdaeb48760009b0", 428 | "name": "Remove First and Last Character", 429 | "slug": "remove-first-and-last-character", 430 | "completedLanguages": [ 431 | "haskell" 432 | ], 433 | "completedAt": "2017-05-20T19:28:16Z" 434 | }, 435 | { 436 | "id": "5583090cbe83f4fd8c000051", 437 | "name": "Convert number to reversed array of digits", 438 | "slug": "convert-number-to-reversed-array-of-digits", 439 | "completedLanguages": [ 440 | "haskell" 441 | ], 442 | "completedAt": "2017-05-20T19:27:45Z" 443 | }, 444 | { 445 | "id": "5899dc03bc95b1bf1b0000ad", 446 | "name": "Invert values", 447 | "slug": "invert-values", 448 | "completedLanguages": [ 449 | "haskell" 450 | ], 451 | "completedAt": "2017-05-20T19:25:58Z" 452 | }, 453 | { 454 | "id": "515e271a311df0350d00000f", 455 | "name": "Square(n) Sum", 456 | "slug": "square-n-sum", 457 | "completedLanguages": [ 458 | "haskell" 459 | ], 460 | "completedAt": "2017-05-20T19:24:30Z" 461 | }, 462 | { 463 | "id": "53da3dbb4a5168369a0000fe", 464 | "name": "Even or Odd", 465 | "slug": "even-or-odd", 466 | "completedLanguages": [ 467 | "haskell" 468 | ], 469 | "completedAt": "2017-05-20T19:22:32Z" 470 | }, 471 | { 472 | "id": "561e9c843a2ef5a40c0000a4", 473 | "name": "Gap in Primes", 474 | "slug": "gap-in-primes", 475 | "completedLanguages": [ 476 | "haskell" 477 | ], 478 | "completedAt": "2017-05-20T18:59:29Z" 479 | }, 480 | { 481 | "id": "544675c6f971f7399a000e79", 482 | "name": "Convert a String to a Number!", 483 | "slug": "convert-a-string-to-a-number", 484 | "completedLanguages": [ 485 | "haskell" 486 | ], 487 | "completedAt": "2017-05-20T18:37:14Z" 488 | }, 489 | { 490 | "id": "55f0b69fe3ef582c4100008a", 491 | "name": "Sieve of Eratosthenes", 492 | "slug": "sieve-of-eratosthenes", 493 | "completedLanguages": [ 494 | "haskell" 495 | ], 496 | "completedAt": "2017-05-20T17:56:56Z" 497 | }, 498 | { 499 | "id": "57eae20f5500ad98e50002c5", 500 | "name": "Remove String Spaces", 501 | "slug": "remove-string-spaces", 502 | "completedLanguages": [ 503 | "haskell" 504 | ], 505 | "completedAt": "2017-05-20T17:39:44Z" 506 | }, 507 | { 508 | "id": "55fd2d567d94ac3bc9000064", 509 | "name": "Sum of odd numbers", 510 | "slug": "sum-of-odd-numbers", 511 | "completedLanguages": [ 512 | "haskell" 513 | ], 514 | "completedAt": "2017-05-20T17:38:03Z" 515 | }, 516 | { 517 | "id": "5416356b1b28a5e297000bc7", 518 | "name": "Find the K'th Element of a List", 519 | "slug": "find-the-kth-element-of-a-list", 520 | "completedLanguages": [ 521 | "haskell" 522 | ], 523 | "completedAt": "2017-05-20T17:31:17Z" 524 | }, 525 | { 526 | "id": "5426d7a2c2c7784365000783", 527 | "name": "All Balanced Parentheses", 528 | "slug": "all-balanced-parentheses", 529 | "completedLanguages": [ 530 | "haskell" 531 | ], 532 | "completedAt": "2017-05-20T17:18:22Z" 533 | }, 534 | { 535 | "id": "54da5a58ea159efa38000836", 536 | "name": "Find the odd int", 537 | "slug": "find-the-odd-int", 538 | "completedLanguages": [ 539 | "haskell" 540 | ], 541 | "completedAt": "2017-05-20T16:33:03Z" 542 | }, 543 | { 544 | "id": "556deca17c58da83c00002db", 545 | "name": "Tribonacci Sequence", 546 | "slug": "tribonacci-sequence", 547 | "completedLanguages": [ 548 | "haskell" 549 | ], 550 | "completedAt": "2017-05-20T10:33:11Z" 551 | }, 552 | { 553 | "id": "515de9ae9dcfc28eb6000001", 554 | "name": "Split Strings", 555 | "slug": "split-strings", 556 | "completedLanguages": [ 557 | "haskell" 558 | ], 559 | "completedAt": "2017-05-20T10:18:35Z" 560 | }, 561 | { 562 | "id": "51b62bf6a9c58071c600001b", 563 | "name": "Roman Numerals Encoder", 564 | "slug": "roman-numerals-encoder", 565 | "completedLanguages": [ 566 | "haskell" 567 | ], 568 | "completedAt": "2017-05-20T10:06:52Z" 569 | }, 570 | { 571 | "id": "543d218022e0f307fb000173", 572 | "name": "foldMap all the things!", 573 | "slug": "foldmap-all-the-things", 574 | "completedLanguages": [ 575 | "haskell" 576 | ], 577 | "completedAt": "2017-05-20T09:45:34Z" 578 | }, 579 | { 580 | "id": "5226eb40316b56c8d500030f", 581 | "name": "Pascal's Triangle", 582 | "slug": "pascals-triangle", 583 | "completedLanguages": [ 584 | "haskell" 585 | ], 586 | "completedAt": "2017-05-20T09:24:33Z" 587 | }, 588 | { 589 | "id": "54d496788776e49e6b00052f", 590 | "name": "Sum by Factors", 591 | "slug": "sum-by-factors", 592 | "completedLanguages": [ 593 | "haskell" 594 | ], 595 | "completedAt": "2017-05-19T19:50:39Z" 596 | }, 597 | { 598 | "id": "550756a881b8bdba99000348", 599 | "name": "Recurrence relations", 600 | "slug": "recurrence-relations", 601 | "completedLanguages": [ 602 | "haskell" 603 | ], 604 | "completedAt": "2017-05-18T08:00:13Z" 605 | }, 606 | { 607 | "id": "52a89c2ea8ddc5547a000863", 608 | "name": "Can you get the loop ?", 609 | "slug": "can-you-get-the-loop", 610 | "completedLanguages": [ 611 | "haskell" 612 | ], 613 | "completedAt": "2017-05-16T17:43:06Z" 614 | }, 615 | { 616 | "id": "52f831fa9d332c6591000511", 617 | "name": "Molecule to atoms", 618 | "slug": "molecule-to-atoms", 619 | "completedLanguages": [ 620 | "haskell" 621 | ], 622 | "completedAt": "2017-05-16T17:08:18Z" 623 | }, 624 | { 625 | "id": "547202bdf7587835d9000c46", 626 | "name": "Five Fundamental Monads", 627 | "slug": "five-fundamental-monads", 628 | "completedLanguages": [ 629 | "haskell" 630 | ], 631 | "completedAt": "2017-05-15T18:50:03Z" 632 | }, 633 | { 634 | "id": "51ba717bb08c1cd60f00002f", 635 | "name": "Range Extraction", 636 | "slug": "range-extraction", 637 | "completedLanguages": [ 638 | "haskell" 639 | ], 640 | "completedAt": "2017-05-15T16:15:47Z" 641 | }, 642 | { 643 | "id": "56a2d27f8af7384815000037", 644 | "name": "Concatenate two list", 645 | "slug": "concatenate-two-list", 646 | "completedLanguages": [ 647 | "haskell" 648 | ], 649 | "completedAt": "2017-05-14T09:33:21Z" 650 | }, 651 | { 652 | "id": "52756e5ad454534f220001ef", 653 | "name": "Longest Common Subsequence", 654 | "slug": "longest-common-subsequence", 655 | "completedLanguages": [ 656 | "haskell" 657 | ], 658 | "completedAt": "2017-05-07T09:40:12Z" 659 | }, 660 | { 661 | "id": "5887a6fe0cfe64850800161c", 662 | "name": "Largest Square Inside A Circle", 663 | "slug": "largest-square-inside-a-circle", 664 | "completedLanguages": [ 665 | "haskell" 666 | ], 667 | "completedAt": "2017-05-07T09:12:14Z" 668 | }, 669 | { 670 | "id": "5541f58a944b85ce6d00006a", 671 | "name": "Product of consecutive Fib numbers", 672 | "slug": "product-of-consecutive-fib-numbers", 673 | "completedLanguages": [ 674 | "haskell" 675 | ], 676 | "completedAt": "2017-05-07T09:08:03Z" 677 | }, 678 | { 679 | "id": "57a1d5ef7cb1f3db590002af", 680 | "name": "Fibonacci", 681 | "slug": "fibonacci", 682 | "completedLanguages": [ 683 | "haskell" 684 | ], 685 | "completedAt": "2017-05-07T08:51:52Z" 686 | }, 687 | { 688 | "id": "5886e082a836a691340000c3", 689 | "name": "Simple Fun #27: Rectangle Rotation", 690 | "slug": "simple-fun-number-27-rectangle-rotation", 691 | "completedLanguages": [ 692 | "haskell" 693 | ], 694 | "completedAt": "2017-05-07T07:52:42Z" 695 | }, 696 | { 697 | "id": "5511b2f550906349a70004e1", 698 | "name": "Last digit of a large number", 699 | "slug": "last-digit-of-a-large-number", 700 | "completedLanguages": [ 701 | "haskell" 702 | ], 703 | "completedAt": "2017-05-06T16:03:29Z" 704 | }, 705 | { 706 | "id": "5277c8a221e209d3f6000b56", 707 | "name": "Valid Braces", 708 | "slug": "valid-braces", 709 | "completedLanguages": [ 710 | "haskell" 711 | ], 712 | "completedAt": "2017-05-06T15:44:58Z" 713 | }, 714 | { 715 | "id": "52c4dd683bfd3b434c000292", 716 | "name": "Catching Car Mileage Numbers", 717 | "slug": "catching-car-mileage-numbers", 718 | "completedLanguages": [ 719 | "haskell" 720 | ], 721 | "completedAt": "2017-05-06T15:25:27Z" 722 | }, 723 | { 724 | "id": "52685f7382004e774f0001f7", 725 | "name": "Human Readable Time", 726 | "slug": "human-readable-time", 727 | "completedLanguages": [ 728 | "haskell" 729 | ], 730 | "completedAt": "2017-05-06T07:34:08Z" 731 | }, 732 | { 733 | "id": "5626b561280a42ecc50000d1", 734 | "name": "Take a Number And Sum Its Digits Raised To The Consecutive Powers And ....¡Eureka!!", 735 | "slug": "take-a-number-and-sum-its-digits-raised-to-the-consecutive-powers-and-dot-dot-dot-eureka", 736 | "completedLanguages": [ 737 | "haskell" 738 | ], 739 | "completedAt": "2017-05-06T07:00:58Z" 740 | }, 741 | { 742 | "id": "54bf1c2cd5b56cc47f0007a1", 743 | "name": "Counting Duplicates", 744 | "slug": "counting-duplicates", 745 | "completedLanguages": [ 746 | "haskell" 747 | ], 748 | "completedAt": "2017-05-06T00:57:58Z" 749 | }, 750 | { 751 | "id": "546e2562b03326a88e000020", 752 | "name": "Square Every Digit", 753 | "slug": "square-every-digit", 754 | "completedLanguages": [ 755 | "haskell" 756 | ], 757 | "completedAt": "2017-05-06T00:43:55Z" 758 | }, 759 | { 760 | "id": "57339a5226196a7f90001bcf", 761 | "name": "N-Point Crossover", 762 | "slug": "n-point-crossover", 763 | "completedLanguages": [ 764 | "haskell" 765 | ], 766 | "completedAt": "2017-05-05T15:07:20Z" 767 | }, 768 | { 769 | "id": "554b4ac871d6813a03000035", 770 | "name": "Highest and Lowest", 771 | "slug": "highest-and-lowest", 772 | "completedLanguages": [ 773 | "haskell" 774 | ], 775 | "completedAt": "2017-05-05T12:40:10Z" 776 | }, 777 | { 778 | "id": "54ff3102c1bad923760001f3", 779 | "name": "Vowel Count", 780 | "slug": "vowel-count", 781 | "completedLanguages": [ 782 | "haskell" 783 | ], 784 | "completedAt": "2017-05-04T18:25:01Z" 785 | }, 786 | { 787 | "id": "55908aad6620c066bc00002a", 788 | "name": "Exes and Ohs", 789 | "slug": "exes-and-ohs", 790 | "completedLanguages": [ 791 | "haskell" 792 | ], 793 | "completedAt": "2017-05-04T18:21:00Z" 794 | }, 795 | { 796 | "id": "55225023e1be1ec8bc000390", 797 | "name": "Jenny's secret message", 798 | "slug": "jennys-secret-message", 799 | "completedLanguages": [ 800 | "haskell" 801 | ], 802 | "completedAt": "2017-05-04T18:08:57Z" 803 | }, 804 | { 805 | "id": "51f9d93b4095e0a7200001b8", 806 | "name": "How many lightsabers do you own?", 807 | "slug": "how-many-lightsabers-do-you-own", 808 | "completedLanguages": [ 809 | "haskell" 810 | ], 811 | "completedAt": "2017-05-04T18:06:52Z" 812 | }, 813 | { 814 | "id": "541629460b198da04e000bb9", 815 | "name": "Last", 816 | "slug": "last", 817 | "completedLanguages": [ 818 | "haskell" 819 | ], 820 | "completedAt": "2017-05-04T18:02:50Z" 821 | }, 822 | { 823 | "id": "57a0556c7cb1f31ab3000ad7", 824 | "name": "MakeUpperCase", 825 | "slug": "makeuppercase", 826 | "completedLanguages": [ 827 | "haskell" 828 | ], 829 | "completedAt": "2017-05-04T17:55:57Z" 830 | }, 831 | { 832 | "id": "576bb71bbbcf0951d5000044", 833 | "name": "Count of positives / sum of negatives", 834 | "slug": "count-of-positives-slash-sum-of-negatives", 835 | "completedLanguages": [ 836 | "haskell" 837 | ], 838 | "completedAt": "2017-05-04T17:54:43Z" 839 | }, 840 | { 841 | "id": "57a883cfbb9944a97c000088", 842 | "name": "Reverse list recursively", 843 | "slug": "reverse-list-recursively", 844 | "completedLanguages": [ 845 | "haskell" 846 | ], 847 | "completedAt": "2017-05-04T17:54:29Z" 848 | }, 849 | { 850 | "id": "53369039d7ab3ac506000467", 851 | "name": "Convert boolean values to strings 'Yes' or 'No'.", 852 | "slug": "convert-boolean-values-to-strings-yes-or-no", 853 | "completedLanguages": [ 854 | "haskell" 855 | ], 856 | "completedAt": "2017-05-04T17:50:03Z" 857 | }, 858 | { 859 | "id": "57a2013acf1fa5bfc4000921", 860 | "name": "Calculate average ", 861 | "slug": "calculate-average", 862 | "completedLanguages": [ 863 | "haskell" 864 | ], 865 | "completedAt": "2017-05-04T17:48:32Z" 866 | }, 867 | { 868 | "id": "576b93db1129fcf2200001e6", 869 | "name": "Sum without highest and lowest number", 870 | "slug": "sum-without-highest-and-lowest-number", 871 | "completedLanguages": [ 872 | "haskell" 873 | ], 874 | "completedAt": "2017-05-04T17:37:05Z" 875 | }, 876 | { 877 | "id": "56efc695740d30f963000557", 878 | "name": "altERnaTIng cAsE <=> ALTerNAtiNG CaSe", 879 | "slug": "alternating-case-<-equals->-alternating-case", 880 | "completedLanguages": [ 881 | "haskell" 882 | ], 883 | "completedAt": "2017-05-04T17:23:28Z" 884 | }, 885 | { 886 | "id": "56dec885c54a926dcd001095", 887 | "name": "Opposite number", 888 | "slug": "opposite-number", 889 | "completedLanguages": [ 890 | "haskell" 891 | ], 892 | "completedAt": "2017-05-04T17:20:11Z" 893 | }, 894 | { 895 | "id": "58b57ae2724e3c63df000006", 896 | "name": "Parse HTML/CSS Colors", 897 | "slug": "parse-html-slash-css-colors", 898 | "completedLanguages": [ 899 | "haskell" 900 | ], 901 | "completedAt": "2017-05-04T17:04:40Z" 902 | }, 903 | { 904 | "id": "57a1fd2ce298a731b20006a4", 905 | "name": "Is it a palindrome?", 906 | "slug": "is-it-a-palindrome", 907 | "completedLanguages": [ 908 | "haskell" 909 | ], 910 | "completedAt": "2017-05-04T15:42:20Z" 911 | }, 912 | { 913 | "id": "57cebe1dc6fdc20c57000ac9", 914 | "name": "Shortest Word", 915 | "slug": "shortest-word", 916 | "completedLanguages": [ 917 | "haskell" 918 | ], 919 | "completedAt": "2017-05-04T15:15:00Z" 920 | }, 921 | { 922 | "id": "57a0e5c372292dd76d000d7e", 923 | "name": "String repeat", 924 | "slug": "string-repeat", 925 | "completedLanguages": [ 926 | "haskell" 927 | ], 928 | "completedAt": "2017-05-03T20:14:49Z" 929 | }, 930 | { 931 | "id": "56e9e4f516bcaa8d4f001763", 932 | "name": "Sum of numbers from 0 to N", 933 | "slug": "sum-of-numbers-from-0-to-n", 934 | "completedLanguages": [ 935 | "dart" 936 | ], 937 | "completedAt": "2017-05-03T20:07:17Z" 938 | }, 939 | { 940 | "id": "50654ddff44f800200000004", 941 | "name": "Multiply", 942 | "slug": "multiply", 943 | "completedLanguages": [ 944 | "java", 945 | "dart" 946 | ], 947 | "completedAt": "2017-05-03T19:51:33Z" 948 | } 949 | ] 950 | } 951 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | --------------------------------------------------------------------------------