Skip to content

chore: Removed NStack feature integration #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: ♨️ Setup Java
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: 🐦 Setup Flutter
Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ app.*.map.json
# Flutter code generation
*.freezed.dart
*.g.dart
nstack.dart
*.gr.dart
*.config.dart
lib/gen/**

# Dependencies
**.lock
# Pubspec.lock should be checked out to git
# to ensure everyone in the team is using the same version.
# Recommended by Flutter as well.
# We can git ignore Podfile.lock only.
Podfile.lock
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ This project serves as a template project for Flutter applications. You can gene
- [Confluence](https://TODO)
- [Slack Channel](https://TODO)
- [OpenAPI Specification](https://TODO)
- [NStack](https://TODO)
- [Figma Design](https://TODO)
2 changes: 0 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,5 @@ analyzer:
- "**/*.g.dart"
# Ignore warnings in files generated by Freezed specifically.
- "**/*.freezed.dart"
# Ignore warnings in files generated by NStack specifically.
- "**/*nstack.dart"
# Ignore bricks
- bricks/**
8 changes: 4 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def appName = "Monstarlab Flutter Template"

// TODO: Change the applicationId for production
// On staging it will add .staging and on development it will add .development as suffix.
def applicationId = "com.monstarlab.flutter"
def packageName = "com.monstarlab.flutter"

ext {
androidMinSdkVersion = 21
Expand All @@ -18,9 +18,9 @@ ext {


android {
namespace = "$applicationId"
namespace = "$packageName"
compileSdk = androidCompileAndTargetSdkVersion
ndkVersion = flutter.ndkVersion
ndkVersion = "27.0.12077973"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -32,7 +32,7 @@ android {
}

defaultConfig {
applicationId = "$applicationId"
applicationId = "$packageName"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = androidMinSdkVersion
Expand Down
6 changes: 6 additions & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-dontwarn com.google.errorprone.annotations.CanIgnoreReturnValue
-dontwarn com.google.errorprone.annotations.CheckReturnValue
-dontwarn com.google.errorprone.annotations.Immutable
-dontwarn com.google.errorprone.annotations.RestrictedApi
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.concurrent.GuardedBy
24 changes: 0 additions & 24 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,6 @@ allprojects {
}

rootProject.buildDir = "../build"
// [NStack] the namespace property is null within
// the android block of the build.gradle file for the nstack sdk.
// Additionally, the Kotlin Gradle plugin is using a very old version there.
subprojects {
afterEvaluate { project ->
if (project.name == 'nstack') {
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
project.buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
}
}
}
}
}
}
// End of NStack workaround


subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '7.4.2' apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "com.android.application" version '8.7.2' apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
}

include ":app"
23 changes: 11 additions & 12 deletions lib/data/response_objects/error_response.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'package:flutter_template/domain/common/response_error/response_error.dart';
import 'package:flutter_template/nstack/nstack.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'error_response.freezed.dart';
part 'error_response.g.dart';

///The BE should provide one unique code for each error, in this case the
///error is being provided through errorName so we create an Enum for each
///code we are aware of with a default value to unknown
/// The BE should provide one unique code for each error, in this case the
/// error is being provided through errorName so we create an Enum for each
/// code we are aware of with a default value to unknown
@freezed
class APIError with _$APIError {
const factory APIError({
Expand All @@ -27,9 +26,9 @@ class APIError with _$APIError {
@freezed
class ErrorResponse with _$ErrorResponse {
const factory ErrorResponse({
//TODO: name this according to the map key from the error response
//if no map key exists then just create this factory with the APIError values
//and remove APIError,
// TODO: name this according to the map key from the error response
// if no map key exists then just create this factory with the APIError values
// and remove APIError,
required APIError error,
}) = _ErrorResponse;

Expand All @@ -38,7 +37,7 @@ class ErrorResponse with _$ErrorResponse {
}

enum ErrorName {
//Add error enum and the BE value
// Add error enum and the BE value
@JsonValue('errorExample')
errorExample,
unknown,
Expand All @@ -53,13 +52,13 @@ extension ErrorResponseExtensions on ErrorResponse {
}

extension ErrorNameExtensions on ErrorName {
String getErrorMessage(Localization l10n) {
String getErrorMessage() {
switch (this) {
//Handle error enum and return mapped nstack value
// TODO: Handle error enum and return mapped localized value
case ErrorName.errorExample:
return l10n.error.authenticationError;
return 'Error Occurred';
default:
return '';
return 'Unexpected Error';
}
}
}
42 changes: 20 additions & 22 deletions lib/domain/common/response_error/response_error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_template/data/response_objects/error_response.dart';
import 'package:flutter_template/nstack/nstack.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'response_error.freezed.dart';
Expand Down Expand Up @@ -91,28 +90,27 @@ sealed class ResponseError<T> with _$ResponseError<T> implements Exception {
}

extension ResponseErrorExtensions on ResponseError {
String getErrorMessage(Localization l10n) {
//TODO: create error module for errors and set value accordingly
String getErrorMessage() {
return when<String>(
noInternetConnection: () => l10n.error.connectionError,
sendTimeout: () => l10n.error.authenticationError,
connectTimeout: () => l10n.error.authenticationError,
receiveTimeout: () => l10n.error.authenticationError,
badRequest: (message) => message.getErrorMessage(l10n),
notFound: () => l10n.error.authenticationError,
tooManyRequests: () => l10n.error.authenticationError,
unprocessableEntity: () => l10n.error.authenticationError,
internalServerError: () => l10n.error.authenticationError,
unexpectedError: () => l10n.error.authenticationError,
requestCancelled: () => l10n.error.authenticationError,
conflict: () => l10n.error.authenticationError,
unauthorized: () => l10n.error.authenticationError,
invalidPassword: () => l10n.error.authenticationError,
invalidEmail: () => l10n.error.authenticationError,
invalidSearchTerm: () => l10n.error.authenticationError,
invalidLoginCredentials: () => l10n.error.authenticationError,
badCertificate: () => l10n.error.authenticationError,
connectionError: () => l10n.error.connectionError,
noInternetConnection: () => 'No Internet Connection',
sendTimeout: () => 'Send Timeout Error',
connectTimeout: () => 'Connection Timeout Error',
receiveTimeout: () => 'Receive Timeout Error',
badRequest: (message) => message.getErrorMessage(),
notFound: () => 'Not Found Error',
tooManyRequests: () => 'Too Many Requests',
unprocessableEntity: () => 'Unprocessable Entity',
internalServerError: () => 'Internal Server Error',
unexpectedError: () => 'Unexpected Error',
requestCancelled: () => 'Request Cancelled',
conflict: () => 'Conflict Error',
unauthorized: () => 'Unauthorized Error',
invalidPassword: () => 'Invalid Password',
invalidEmail: () => 'Invalid Email',
invalidSearchTerm: () => 'Invalid Search Term',
invalidLoginCredentials: () => 'Invalid Login Credentials',
badCertificate: () => 'Bad Certificate',
connectionError: () => 'Connection Error',
);
}
}
5 changes: 0 additions & 5 deletions lib/nstack/nstack.json

This file was deleted.

10 changes: 0 additions & 10 deletions lib/presentation/app.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_template/injection/injector.dart';
import 'package:flutter_template/nstack/nstack.dart';
import 'package:flutter_template/presentation/resources/resources.dart';
import 'package:flutter_template/presentation/routes/router.dart';

Expand All @@ -20,15 +19,6 @@ class App extends StatelessWidget {
themeMode: ThemeMode.system,
// TODO: Change Project Name Here
title: 'Monstarlab Flutter Template',
builder: (c, widget) {
if (widget == null) {
return const SizedBox();
}

return NStackWidget(
child: widget,
);
},
routerDelegate: AutoRouterDelegate(
appRouter,
),
Expand Down
Loading