Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sai Srinivas
Pulse Application
Commits
ed162f90
Commit
ed162f90
authored
Oct 16, 2025
by
Sai Srinivas
Browse files
permissions and info.plist
parent
416a5204
Changes
5
Show whitespace changes
Inline
Side-by-side
ios/Runner.xcodeproj/project.pbxproj
View file @
ed162f90
...
@@ -497,8 +497,8 @@
...
@@ -497,8 +497,8 @@
CURRENT_PROJECT_VERSION
=
"$(FLUTTER_BUILD_NUMBER)"
;
CURRENT_PROJECT_VERSION
=
"$(FLUTTER_BUILD_NUMBER)"
;
DEVELOPMENT_TEAM
=
72BV93K9AR
;
DEVELOPMENT_TEAM
=
72BV93K9AR
;
ENABLE_BITCODE
=
NO
;
ENABLE_BITCODE
=
NO
;
FLUTTER_BUILD_NAME
=
1.0.
1
;
FLUTTER_BUILD_NAME
=
1.0.
2
;
FLUTTER_BUILD_NUMBER
=
2
;
FLUTTER_BUILD_NUMBER
=
3
;
INFOPLIST_FILE
=
Runner/Info.plist
;
INFOPLIST_FILE
=
Runner/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
(
LD_RUNPATH_SEARCH_PATHS
=
(
"$(inherited)"
,
"$(inherited)"
,
...
@@ -683,8 +683,8 @@
...
@@ -683,8 +683,8 @@
CURRENT_PROJECT_VERSION
=
"$(FLUTTER_BUILD_NUMBER)"
;
CURRENT_PROJECT_VERSION
=
"$(FLUTTER_BUILD_NUMBER)"
;
DEVELOPMENT_TEAM
=
72BV93K9AR
;
DEVELOPMENT_TEAM
=
72BV93K9AR
;
ENABLE_BITCODE
=
NO
;
ENABLE_BITCODE
=
NO
;
FLUTTER_BUILD_NAME
=
1.0.
1
;
FLUTTER_BUILD_NAME
=
1.0.
2
;
FLUTTER_BUILD_NUMBER
=
2
;
FLUTTER_BUILD_NUMBER
=
3
;
INFOPLIST_FILE
=
Runner/Info.plist
;
INFOPLIST_FILE
=
Runner/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
(
LD_RUNPATH_SEARCH_PATHS
=
(
"$(inherited)"
,
"$(inherited)"
,
...
@@ -709,8 +709,8 @@
...
@@ -709,8 +709,8 @@
CURRENT_PROJECT_VERSION
=
"$(FLUTTER_BUILD_NUMBER)"
;
CURRENT_PROJECT_VERSION
=
"$(FLUTTER_BUILD_NUMBER)"
;
DEVELOPMENT_TEAM
=
72BV93K9AR
;
DEVELOPMENT_TEAM
=
72BV93K9AR
;
ENABLE_BITCODE
=
NO
;
ENABLE_BITCODE
=
NO
;
FLUTTER_BUILD_NAME
=
1.0.
1
;
FLUTTER_BUILD_NAME
=
1.0.
2
;
FLUTTER_BUILD_NUMBER
=
2
;
FLUTTER_BUILD_NUMBER
=
3
;
INFOPLIST_FILE
=
Runner/Info.plist
;
INFOPLIST_FILE
=
Runner/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
(
LD_RUNPATH_SEARCH_PATHS
=
(
"$(inherited)"
,
"$(inherited)"
,
...
...
ios/Runner/Info.plist
View file @
ed162f90
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
<string>
LaunchScreen
</string>
<string>
LaunchScreen
</string>
<key>
UIMainStoryboardFile
</key>
<key>
UIMainStoryboardFile
</key>
<string>
Main
</string>
<string>
Main
</string>
<key>
UISupportedInterfaceOrientations
</key>
<key>
UISupportedInterfaceOrientations
</key>
<array>
<array>
<string>
UIInterfaceOrientationPortrait
</string>
<string>
UIInterfaceOrientationPortrait
</string>
...
...
lib/Screens/home_screen.dart
View file @
ed162f90
...
@@ -4,6 +4,7 @@ import 'dart:io';
...
@@ -4,6 +4,7 @@ import 'dart:io';
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
import
'package:provider/provider.dart'
;
import
'package:provider/provider.dart'
;
import
'package:cached_network_image/cached_network_image.dart'
;
import
'package:cached_network_image/cached_network_image.dart'
;
import
'package:pulse/Notifier/ProfileProvider.dart'
;
import
'package:pulse/Notifier/ProfileProvider.dart'
;
...
@@ -65,7 +66,7 @@ class _HomeScreenState extends State<HomeScreen> {
...
@@ -65,7 +66,7 @@ class _HomeScreenState extends State<HomeScreen> {
_initializePullToRefresh
();
_initializePullToRefresh
();
final
sessionId
=
_prefs
.
getString
(
"sessionId"
);
final
sessionId
=
_prefs
.
getString
(
"sessionId"
);
final
staffId
=
_prefs
.
getString
(
"staffId"
);
final
staffId
=
_prefs
.
getString
(
"staffId"
);
requestPermissions
();
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
final
provider
=
Provider
.
of
<
ProfileProvider
>(
context
,
listen:
false
);
final
provider
=
Provider
.
of
<
ProfileProvider
>(
context
,
listen:
false
);
if
(
provider
.
sessionExists
!=
0
)
{
if
(
provider
.
sessionExists
!=
0
)
{
...
@@ -82,7 +83,6 @@ class _HomeScreenState extends State<HomeScreen> {
...
@@ -82,7 +83,6 @@ class _HomeScreenState extends State<HomeScreen> {
);
);
}
}
});
});
}
}
void
_initializePullToRefresh
()
{
void
_initializePullToRefresh
()
{
...
@@ -332,6 +332,44 @@ class _HomeScreenState extends State<HomeScreen> {
...
@@ -332,6 +332,44 @@ class _HomeScreenState extends State<HomeScreen> {
}
}
}
}
void
requestPermissions
()
async
{
var
cam
=
requestCameraPermissions
();
if
(!
cam
)
{
requestCameraPermissions
();
}
var
photos
=
requestPhotosPermission
();
if
(!
photos
)
{
requestPhotosPermission
();
}
var
npt
=
getNotificationsPermissions
();
if
(!
npt
)
{
getNotificationsPermissions
();
}
}
requestCameraPermissions
()
async
{
var
glypermission
=
await
Permission
.
camera
.
request
();
return
glypermission
.
isGranted
;
}
requestPhotosPermission
()
async
{
var
glypermission
=
await
Permission
.
photos
.
request
();
return
glypermission
.
isGranted
;
}
getNotificationsPermissions
()
async
{
try
{
if
(
await
Permission
.
notification
.
request
().
isGranted
)
{
return
true
;
}
else
if
(
await
Permission
.
notification
.
request
().
isPermanentlyDenied
)
{
await
openAppSettings
();
return
false
;
}
else
if
(
await
Permission
.
notification
.
request
().
isDenied
)
{
return
false
;
}
}
catch
(
e
,
s
)
{}
}
@override
@override
void
dispose
()
{
void
dispose
()
{
_connectivityTimer
?.
cancel
();
_connectivityTimer
?.
cancel
();
...
...
lib/SplashScreen.dart
View file @
ed162f90
...
@@ -4,6 +4,7 @@ import 'package:connectivity_plus/connectivity_plus.dart';
...
@@ -4,6 +4,7 @@ import 'package:connectivity_plus/connectivity_plus.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
import
'package:package_info_plus/package_info_plus.dart'
;
import
'package:package_info_plus/package_info_plus.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
import
'package:provider/provider.dart'
;
import
'package:provider/provider.dart'
;
import
'package:pulse/Notifier/auth_provider.dart'
;
import
'package:pulse/Notifier/auth_provider.dart'
;
import
'package:pulse/Screens/authScreen/LoginScreen.dart'
;
import
'package:pulse/Screens/authScreen/LoginScreen.dart'
;
...
@@ -19,7 +20,8 @@ class SplashScreen extends StatefulWidget {
...
@@ -19,7 +20,8 @@ class SplashScreen extends StatefulWidget {
State
<
SplashScreen
>
createState
()
=>
_SplashScreenState
();
State
<
SplashScreen
>
createState
()
=>
_SplashScreenState
();
}
}
class
_SplashScreenState
extends
State
<
SplashScreen
>
with
SingleTickerProviderStateMixin
{
class
_SplashScreenState
extends
State
<
SplashScreen
>
with
SingleTickerProviderStateMixin
{
final
_prefs
=
SharedPreferencesService
.
instance
;
final
_prefs
=
SharedPreferencesService
.
instance
;
String
_appVersion
=
""
;
String
_appVersion
=
""
;
double
_opacity
=
0.0
;
double
_opacity
=
0.0
;
...
@@ -35,6 +37,7 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
...
@@ -35,6 +37,7 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
_loadAppVersion
();
_loadAppVersion
();
requestPermissions
();
// Initialize connectivity check
// Initialize connectivity check
_initConnectivity
();
_initConnectivity
();
...
@@ -44,9 +47,10 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
...
@@ -44,9 +47,10 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
vsync:
this
,
vsync:
this
,
)..
repeat
(
reverse:
true
);
)..
repeat
(
reverse:
true
);
_animation
=
Tween
<
double
>(
begin:
0.95
,
end:
1.05
).
animate
(
_animation
=
Tween
<
double
>(
CurvedAnimation
(
parent:
_controller
,
curve:
Curves
.
easeInOut
),
begin:
0.95
,
);
end:
1.05
,
).
animate
(
CurvedAnimation
(
parent:
_controller
,
curve:
Curves
.
easeInOut
));
// Start fade-in and scale animation
// Start fade-in and scale animation
Future
.
delayed
(
const
Duration
(
milliseconds:
200
),
()
{
Future
.
delayed
(
const
Duration
(
milliseconds:
200
),
()
{
...
@@ -87,13 +91,16 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
...
@@ -87,13 +91,16 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
// Method 1: Using connectivity_plus
// Method 1: Using connectivity_plus
final
connectivity
=
Connectivity
();
final
connectivity
=
Connectivity
();
final
results
=
await
connectivity
.
checkConnectivity
();
final
results
=
await
connectivity
.
checkConnectivity
();
final
hasInternet
=
results
.
any
((
result
)
=>
result
!=
ConnectivityResult
.
none
);
final
hasInternet
=
results
.
any
(
(
result
)
=>
result
!=
ConnectivityResult
.
none
,
);
// Method 2: Fallback with socket test
// Method 2: Fallback with socket test
if
(
hasInternet
)
{
if
(
hasInternet
)
{
try
{
try
{
final
result
=
await
InternetAddress
.
lookup
(
'google.com'
);
final
result
=
await
InternetAddress
.
lookup
(
'google.com'
);
final
socketCheck
=
result
.
isNotEmpty
&&
result
[
0
].
rawAddress
.
isNotEmpty
;
final
socketCheck
=
result
.
isNotEmpty
&&
result
[
0
].
rawAddress
.
isNotEmpty
;
_updateConnectionStatus
(
socketCheck
);
_updateConnectionStatus
(
socketCheck
);
}
catch
(
e
)
{
}
catch
(
e
)
{
_updateConnectionStatus
(
false
);
_updateConnectionStatus
(
false
);
...
@@ -107,6 +114,49 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
...
@@ -107,6 +114,49 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
}
}
}
}
void
requestPermissions
()
async
{
requestCameraPermissions
();
requestPhotosPermission
();
getNotificationsPermissions
();
}
void
requestCameraPermissions
()
async
{
Map
<
Permission
,
PermissionStatus
>
statuses
=
await
[
Permission
.
camera
,
// Add more permissions as needed
].
request
();
statuses
.
forEach
((
permission
,
status
)
{
if
(!
status
.
isGranted
)
{
// Handle denied permissions
}
});
}
void
requestPhotosPermission
()
async
{
try
{
var
glypermission
=
await
Permission
.
photos
.
request
();
if
(!
glypermission
.
isGranted
)
{
await
Permission
.
photos
.
request
();
}
else
{
// print("granted");
}
}
catch
(
e
,
s
)
{}
}
Future
<
void
>
getNotificationsPermissions
()
async
{
try
{
var
notif
=
await
Permission
.
notification
.
request
();
if
(
notif
.
isGranted
)
{
}
else
if
(
notif
.
isPermanentlyDenied
)
{
await
Permission
.
notification
.
request
();
}
else
if
(
notif
.
isDenied
)
{
await
Permission
.
notification
.
request
();
}
}
catch
(
e
,
s
)
{}
}
void
_updateConnectionStatus
(
bool
hasInternet
)
{
void
_updateConnectionStatus
(
bool
hasInternet
)
{
if
(
mounted
)
{
if
(
mounted
)
{
setState
(()
{
setState
(()
{
...
@@ -132,7 +182,6 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
...
@@ -132,7 +182,6 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
// Hide any existing snackbar
// Hide any existing snackbar
ScaffoldMessenger
.
of
(
context
).
hideCurrentSnackBar
();
ScaffoldMessenger
.
of
(
context
).
hideCurrentSnackBar
();
// Show custom snackbar with all required params
// Show custom snackbar with all required params
CustomSnackBar
.
show
(
CustomSnackBar
.
show
(
context:
context
,
context:
context
,
...
@@ -145,10 +194,6 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
...
@@ -145,10 +194,6 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
}
}
}
}
void
_simulateProgress
()
{
void
_simulateProgress
()
{
Timer
.
periodic
(
const
Duration
(
milliseconds:
30
),
(
timer
)
{
Timer
.
periodic
(
const
Duration
(
milliseconds:
30
),
(
timer
)
{
if
(
_progressValue
<
1.0
)
{
if
(
_progressValue
<
1.0
)
{
...
@@ -171,7 +216,6 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
...
@@ -171,7 +216,6 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
_checkLoginStatus
();
_checkLoginStatus
();
}
}
Future
<
void
>
_checkLoginStatus
()
async
{
Future
<
void
>
_checkLoginStatus
()
async
{
await
Future
.
delayed
(
const
Duration
(
seconds:
3
));
await
Future
.
delayed
(
const
Duration
(
seconds:
3
));
...
@@ -185,10 +229,7 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
...
@@ -185,10 +229,7 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
Navigator
.
pushReplacement
(
Navigator
.
pushReplacement
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
builder:
(
_
)
=>
HomeScreen
(
builder:
(
_
)
=>
HomeScreen
(
sessionId:
sessionId
,
staffId:
staffId
),
sessionId:
sessionId
,
staffId:
staffId
,
),
),
),
);
);
return
;
return
;
...
@@ -211,7 +252,8 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
...
@@ -211,7 +252,8 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
Navigator
.
pushReplacement
(
Navigator
.
pushReplacement
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
builder:
(
_
)
=>
HomeScreen
(
builder:
(
_
)
=>
HomeScreen
(
sessionId:
loginProvider
.
sessionId
!,
sessionId:
loginProvider
.
sessionId
!,
staffId:
loginProvider
.
staffId
.
toString
(),
staffId:
loginProvider
.
staffId
.
toString
(),
),
),
...
@@ -334,10 +376,7 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
...
@@ -334,10 +376,7 @@ class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderSt
ShaderMask
(
ShaderMask
(
shaderCallback:
(
bounds
)
{
shaderCallback:
(
bounds
)
{
return
LinearGradient
(
return
LinearGradient
(
colors:
[
colors:
[
Colors
.
white
,
Colors
.
white
.
withOpacity
(
0.8
)],
Colors
.
white
,
Colors
.
white
.
withOpacity
(
0.8
),
],
).
createShader
(
bounds
);
).
createShader
(
bounds
);
},
},
child:
Text
(
child:
Text
(
...
...
pubspec.yaml
View file @
ed162f90
...
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
...
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
# of the product and file versions while build-number is used as the build suffix.
version
:
1.0.
1+2
version
:
1.0.
2+3
environment
:
environment
:
sdk
:
^3.7.2
sdk
:
^3.7.2
...
@@ -37,7 +37,7 @@ dependencies:
...
@@ -37,7 +37,7 @@ dependencies:
provider
:
^6.1.5
provider
:
^6.1.5
http
:
^1.3.0
http
:
^1.3.0
package_info_plus
:
^8.3.0
package_info_plus
:
^8.3.0
permission_handler
:
^12.0.
0+
1
permission_handler
:
^12.0.1
shared_preferences
:
^2.5.3
shared_preferences
:
^2.5.3
webview_flutter
:
^4.7.0
webview_flutter
:
^4.7.0
flutter_svg
:
^2.1.0
flutter_svg
:
^2.1.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment