-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from p2devs/ps/add-force-update
feat: add Force Update feature and Firebase In-App Messaging support
- Loading branch information
Showing
15 changed files
with
223 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { | ||
View, | ||
Text, | ||
StyleSheet, | ||
TouchableOpacity, | ||
Image, | ||
Modal, | ||
Linking | ||
} from 'react-native'; | ||
import { checkUpdate } from './Func'; | ||
|
||
const ForceUpdate = () => { | ||
const [isForceUpdate, setIsForceUpdate] = useState(false); | ||
useEffect(() => { | ||
checkUpdate(setIsForceUpdate, handleUpdate) | ||
}, []); | ||
|
||
const handleUpdate = () => { | ||
Linking.openURL('https://p2devs.github.io/InkNest/'); | ||
} | ||
|
||
return ( | ||
<Modal visible={isForceUpdate} animationType="slide" transparent> | ||
<View style={styles.container}> | ||
<Image | ||
source={{ uri: 'https://github.com/p2devs/InkNest/blob/main/.github/readme-images/icon.png?raw=true' }} | ||
style={styles.image} | ||
/> | ||
<Text style={styles.title}>Update Required</Text> | ||
<Text style={styles.message}> | ||
A newer version of the app is available. Please update to continue using the app. | ||
</Text> | ||
<TouchableOpacity style={styles.updateButton} onPress={handleUpdate}> | ||
<Text style={styles.updateButtonText}>Update Now</Text> | ||
</TouchableOpacity> | ||
</View> | ||
</Modal> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
padding: 30, | ||
backgroundColor: 'rgba(0, 0, 0, 0.8)', | ||
}, | ||
image: { | ||
width: 200, | ||
height: 200, | ||
marginBottom: 20, | ||
borderRadius: 20, | ||
resizeMode: 'contain', | ||
}, | ||
title: { | ||
fontSize: 24, | ||
fontWeight: 'bold', | ||
color: '#FFFFFF', | ||
marginBottom: 10, | ||
}, | ||
message: { | ||
fontSize: 16, | ||
color: '#FFFFFF', | ||
textAlign: 'center', | ||
marginBottom: 20, | ||
lineHeight: 24, | ||
}, | ||
updateButton: { | ||
backgroundColor: '#007BFF', | ||
paddingVertical: 12, | ||
paddingHorizontal: 24, | ||
borderRadius: 8, | ||
shadowColor: '#000', | ||
shadowOffset: { width: 0, height: 2 }, | ||
shadowOpacity: 0.2, | ||
shadowRadius: 3, | ||
elevation: 3, | ||
}, | ||
updateButtonText: { | ||
color: '#FFFFFF', | ||
fontSize: 16, | ||
fontWeight: 'bold', | ||
}, | ||
}); | ||
|
||
export default ForceUpdate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import axios from "axios"; | ||
import APICaller from "../../Redux/Controller/Interceptor"; | ||
import { Alert, Linking, Modal, View } from "react-native"; | ||
import DeviceInfo from "react-native-device-info"; | ||
|
||
export const getReleases = async (setLogs = null, navigation = null) => { | ||
try { | ||
let response = await APICaller.get('https://api.github.com/repos/p2devs/InkNest/releases') | ||
|
||
if (setLogs) { | ||
setLogs(response?.data); | ||
} | ||
|
||
return response?.data | ||
} catch (error) { | ||
|
||
if (navigation) { | ||
navigation.goBack(); | ||
} | ||
|
||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.