Merge pull request #73 from jaicis/Chatroom

fixed android image path issue and fixed APK creation issue
This commit is contained in:
navjotcis 2020-06-12 21:33:28 +05:30 committed by GitHub
commit 225c213f6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 94 deletions

View File

@ -1226,7 +1226,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
initialHash = hashlib.sha512(encryptedPayload).digest() initialHash = hashlib.sha512(encryptedPayload).digest()
trialValue, nonce = proofofwork.run(target, initialHash) trialValue, nonce = proofofwork.run(target, initialHash)
with threads.printLock: with threads.printLock:
print '(For msg message via API) Found proof of work', trialValue, 'Nonce:', nonce print('(For msg message via API) Found proof of work', trialValue, 'Nonce:', nonce)
try: try:
print( print(
'POW took', int(time.time() - powStartTime), 'POW took', int(time.time() - powStartTime),
@ -1245,7 +1245,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
int(time.time()) + TTL, '' int(time.time()) + TTL, ''
) )
with threads.printLock: with threads.printLock:
print 'Broadcasting inv for msg(API disseminatePreEncryptedMsg command):', hexlify(inventoryHash) print('Broadcasting inv for msg(API disseminatePreEncryptedMsg command):', hexlify(inventoryHash))
queues.invQueue.put((toStreamNumber, inventoryHash)) queues.invQueue.put((toStreamNumber, inventoryHash))
def HandleTrashSentMessageByAckDAta(self, params): def HandleTrashSentMessageByAckDAta(self, params):
@ -1299,7 +1299,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
objectType, pubkeyStreamNumber, payload, int(time.time()) + TTL, '' objectType, pubkeyStreamNumber, payload, int(time.time()) + TTL, ''
) )
with threads.printLock: with threads.printLock:
print 'broadcasting inv within API command disseminatePubkey with hash:', hexlify(inventoryHash) print('broadcasting inv within API command disseminatePubkey with hash:', hexlify(inventoryHash))
queues.invQueue.put((pubkeyStreamNumber, inventoryHash)) queues.invQueue.put((pubkeyStreamNumber, inventoryHash))
def HandleGetMessageDataByDestinationHash(self, params): def HandleGetMessageDataByDestinationHash(self, params):

View File

@ -84,43 +84,6 @@
on_press: on_press:
app.root.ids.sc7.reset_address_label(app) app.root.ids.sc7.reset_address_label(app)
Screen:
name: "label_screen"
BoxLayout:
orientation: "vertical"
padding: 0, dp(5), 0, dp(5)
spacing: dp(5)
#label area
AnchorLayout:
size_hint_y: None
height: dp(50)
MDLabel:
text: "Enter a label to generate address for:"
bold: True
halign: "center"
theme_text_color: "Custom"
text_color: .4,.4,.4,1
AnchorLayout:
size_hint_y: None
height: dp(40)
MDTextField:
hint_text: "Label"
required: True
size_hint_x: None
width: dp(190)
AnchorLayout:
MDFillRoundFlatIconButton:
icon: "chevron-double-right"
text: "Proceed Next"
Widget:
#info-area-outer #info-area-outer
BoxLayout: BoxLayout:
size_hint_y: .47 size_hint_y: .47
@ -179,6 +142,9 @@
id:add_random_bx id:add_random_bx
#buttons-area-outer #buttons-area-outer
BoxLayout: BoxLayout:
orientation: "vertical"
# padding: 0, dp(5), 0, dp(5)
# spacing: dp(5)
size_hint_y: .53 size_hint_y: .53
canvas: canvas:
Color: Color:
@ -186,48 +152,37 @@
Rectangle: Rectangle:
pos: self.pos pos: self.pos
size: self.size size: self.size
ScreenManager:
id: check_screenmgr
Screen:
name: "label_screen"
BoxLayout:
orientation: "vertical"
padding: 0, dp(5), 0, dp(5)
spacing: dp(5)
#label area #label area
AnchorLayout: AnchorLayout:
size_hint_y: None size_hint_y: None
height: dp(50) height: dp(50)
MDLabel: MDLabel:
text: "Enter a label to generate address for:" text: "Enter a label to generate address for:"
bold: True bold: True
halign: "center" halign: "center"
theme_text_color: "Custom" theme_text_color: "Custom"
text_color: .4,.4,.4,1 text_color: .4,.4,.4,1
AnchorLayout:
size_hint_y: None
height: dp(40)
MDTextField:
id:lab
hint_text: "Label"
required: True
size_hint_x: None
width: dp(190)
helper_text_mode: "on_error"
helper_text: "Please enter your label name"
AnchorLayout:
MDFillRoundFlatIconButton:
icon: "chevron-double-right"
text: "Proceed Next"
on_release: app.root.ids.sc7.generateaddress(app)
Widget:
AnchorLayout:
size_hint_y: None
height: dp(40)
MDTextField:
id:lab
hint_text: "Label"
required: True
size_hint_x: None
width: dp(190)
helper_text_mode: "on_error"
helper_text: "Please enter your label name"
AnchorLayout:
MDFillRoundFlatIconButton:
icon: "chevron-double-right"
text: "Proceed Next"
on_release: app.root.ids.sc7.generateaddress(app)
Widget:
#info-area-outer #info-area-outer
BoxLayout: BoxLayout:

View File

@ -16,7 +16,7 @@
#:import MDScrollViewRefreshLayout kivymd.uix.refreshlayout.MDScrollViewRefreshLayout #:import MDScrollViewRefreshLayout kivymd.uix.refreshlayout.MDScrollViewRefreshLayout
#:import MDSpinner kivymd.uix.spinner.MDSpinner #:import MDSpinner kivymd.uix.spinner.MDSpinner
#:import MDTabsBase kivymd.uix.tab.MDTabsBase #:import MDTabsBase kivymd.uix.tab.MDTabsBase
#:import ZBarSymbol pyzbar.pyzbar.ZBarSymbol ##:import ZBarSymbol pyzbar.pyzbar.ZBarSymbol
<Tab@BoxLayout+MDTabsBase> <Tab@BoxLayout+MDTabsBase>
#:set color_button (0.784, 0.443, 0.216, 1) # brown #:set color_button (0.784, 0.443, 0.216, 1) # brown

View File

@ -5,7 +5,6 @@ Bitmessage android(mobile) interface
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation # pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation
# pylint: disable=protected-access # pylint: disable=protected-access
from sys import platform as _sys_platform from sys import platform as _sys_platform
from os import environ from os import environ
@ -139,10 +138,10 @@ from datetime import datetime
from kivymd.uix.behaviors.elevation import RectangularElevationBehavior from kivymd.uix.behaviors.elevation import RectangularElevationBehavior
from kivymd.uix.bottomsheet import MDCustomBottomSheet from kivymd.uix.bottomsheet import MDCustomBottomSheet
from kivy.effects.dampedscroll import DampedScrollEffect from kivy.effects.dampedscroll import DampedScrollEffect
from kivy_garden.zbarcam import ZBarCam
from pyzbar.pyzbar import ZBarSymbol
if platform != 'android': if platform != 'android':
from pyzbar.pyzbar import ZBarSymbol
from kivy_garden.zbarcam import ZBarCam
from kivy.config import Config from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand') Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
# pylint: disable=too-few-public-methods,too-many-arguments,attribute-defined-outside-init # pylint: disable=too-few-public-methods,too-many-arguments,attribute-defined-outside-init
@ -1148,9 +1147,8 @@ class Random(Screen):
entered_label = str(self.ids.lab.text).strip() entered_label = str(self.ids.lab.text).strip()
if not entered_label: if not entered_label:
self.ids.lab.focus = True self.ids.lab.focus = True
# self.ids.add_random_bx.children[0].ids.label.focus = True #self.ids.lab.error = True
# self.ids.label.error = True #self.ids.lab.helper_text = 'This field is required'
# self.ids.label.helper_text = 'This field is required'
streamNumberForAddress = 1 streamNumberForAddress = 1
eighteenByteRipe = False eighteenByteRipe = False
nonceTrialsPerByte = 1000 nonceTrialsPerByte = 1000
@ -1766,7 +1764,7 @@ class NavigateApp(MDApp):
BMConfigParser().addresses()[0])): BMConfigParser().addresses()[0])):
android_path = os.path.join( android_path = os.path.join(
os.environ['ANDROID_PRIVATE'] + '/app/') os.environ['ANDROID_PRIVATE'] + '/app/')
img.texture.save('{1}/kivy/default_identicon/{0}.png'.format( img.texture.save('{1}/images/kivy/default_identicon/{0}.png'.format(
BMConfigParser().addresses()[0], android_path)) BMConfigParser().addresses()[0], android_path))
else: else:
if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format( if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(
@ -2220,7 +2218,7 @@ class NavigateApp(MDApp):
if platform == 'android': if platform == 'android':
android_path = os.path.join( android_path = os.path.join(
os.environ['ANDROID_PRIVATE'] + '/app/') os.environ['ANDROID_PRIVATE'] + '/app/')
newImg.save('{1}/kivy/default_identicon/{0}.png'.format( newImg.save('{1}/images/kivy/default_identicon/{0}.png'.format(
state.association, android_path)) state.association, android_path))
else: else:
if not os.path.exists(state.imageDir + '/default_identicon/'): if not os.path.exists(state.imageDir + '/default_identicon/'):

View File

@ -1,13 +1,13 @@
[app] [app]
# (str) Title of your application # (str) Title of your application
title = tor title = py3
# (str) Package name # (str) Package name
package.name = tor package.name = py3
# (str) Package domain (needed for android/ios packaging) # (str) Package domain (needed for android/ios packaging)
package.domain = org.kel package.domain = org.test
# (str) Source code where the main.py live # (str) Source code where the main.py live
source.dir = . source.dir = .
@ -239,7 +239,7 @@ android.sdk = 20
#android.copy_libs = 1 #android.copy_libs = 1
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64 # (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
android.arch = arm64-v8a android.arch = armeabi-v7a
# #
# Python for android (p4a) specific # Python for android (p4a) specific

View File

@ -1,8 +1,8 @@
"""This module is for thread start.""" """This module is for thread start."""
import state import state
from bitmessagemain import main
if __name__ == '__main__': if __name__ == '__main__':
state.kivy = True state.kivy = True
print("Kivy Loading......") print("Kivy Loading......")
from bitmessagemain import main
main() main()